Skip to content

Commit

Permalink
Use matching naming scheme, add ini to configure.ac
Browse files Browse the repository at this point in the history
  • Loading branch information
Antidote committed Jan 7, 2025
1 parent 6964f71 commit 671e855
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,15 @@ set(LCF_HEADERS
src/lcf/third_party/string_view.h
)

set(LCF_SUPPORT_INIH 0)
if(LIBLCF_WITH_INIH)
set(LCF_SUPPORT_INI 0)
if(LIBLCF_WITH_INI)
list(APPEND LCF_SOURCES
src/inireader.cpp
)
list(APPEND LCF_HEADERS
src/lcf/inireader.h
)
set(LCF_SUPPORT_INIH 1)
set(LCF_SUPPORT_INI 1)
endif()

add_library(lcf ${LCF_SOURCES} ${LCF_HEADERS})
Expand Down
2 changes: 1 addition & 1 deletion builds/cmake/liblcf-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include(CMakeFindDependencyMacro)
# Required to find our installed Findinih.cmake
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

if(@LCF_SUPPORT_INIH@)
if(@LCF_SUPPORT_INI@)
find_dependency(inih REQUIRED)
endif()

Expand Down
2 changes: 1 addition & 1 deletion builds/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
#define LCF_SUPPORT_XML @LCF_SUPPORT_XML@

/* Enable INI reading support (INIH ) */
#define LCF_SUPPORT_INIH @LCF_SUPPORT_INIH@
#define LCF_SUPPORT_INI @LCF_SUPPORT_INI@
7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ AS_IF([test "x$enable_xml" != "xno"],[
])
AM_CONDITIONAL(SUPPORT_XML,[test $LCF_SUPPORT_XML == 1])

AC_SUBST([LCF_SUPPORT_INI],[0])
AC_ARG_ENABLE([ini],[AS_HELP_STRING([--disable-ini],[Disable INI reading support (inih) [default=no]])])
AS_IF([test "x$enable_ini" != "xno"],[
AX_PKG_CHECK_MODULES([EXPAT],[],[ini >= 2.1],[LCF_SUPPORT_INI=1])
])
AM_CONDITIONAL(SUPPORT_INI,[test $LCF_SUPPORT_INI == 1])

# Tools
AC_ARG_ENABLE([tools],[AS_HELP_STRING([--disable-tools],[Do not build and install the tools [default=no]])])
AM_CONDITIONAL(ENABLE_TOOLS,[test "x$enable_tools" != "xno"])
Expand Down
2 changes: 1 addition & 1 deletion src/lcf/reader_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace ReaderUtil {
* @return list of encodings or empty if not detected
*/
std::vector<std::string> DetectEncodings(StringView string);
#if LCF_SUPPORT_INIH
#if LCF_SUPPORT_INI
/**
* Returns the encoding set in the ini file.
*
Expand Down
2 changes: 1 addition & 1 deletion src/reader_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ std::vector<std::string> ReaderUtil::DetectEncodings(StringView string) {
return encodings;
}

#if LCF_SUPPORT_INIH
#if LCF_SUPPORT_INI
std::string ReaderUtil::GetEncoding(StringView ini_file) {
INIReader ini(ToString(ini_file));
if (ini.ParseError() != -1) {
Expand Down

0 comments on commit 671e855

Please sign in to comment.