Jeongik Cha | 1199caa | 2021-07-20 12:32:58 +0900 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script. |
| 2 | |
| 3 | AC_INIT(libconfig, 1.7.3, hyperrealm@gmail.com, libconfig, |
| 4 | [https://hyperrealm.github.io/libconfig/]) |
| 5 | AC_CONFIG_AUX_DIR([aux-build]) |
| 6 | AC_CONFIG_MACRO_DIR([m4]) |
| 7 | AC_CANONICAL_TARGET |
| 8 | AM_INIT_AUTOMAKE |
| 9 | AC_CONFIG_HEADERS(ac_config.h) |
| 10 | |
| 11 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 12 | |
| 13 | AC_MSG_NOTICE([libconfig - made with pride in Colorado]) |
| 14 | sleep 3 |
| 15 | |
| 16 | AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.]) |
| 17 | |
| 18 | # Enable GNU extensions. |
| 19 | AC_GNU_SOURCE |
| 20 | |
| 21 | LT_INIT() |
| 22 | |
| 23 | dnl Checks for programs. |
| 24 | AC_PROG_CC |
| 25 | AM_PROG_CC_C_O |
| 26 | AC_PROG_CXX |
| 27 | AC_LIBTOOL_WIN32_DLL |
| 28 | AC_PROG_LIBTOOL |
| 29 | |
| 30 | AM_PROG_LEX |
| 31 | if test Z"$LEX" != Zflex; then |
| 32 | cat <<EOF |
| 33 | ******************************************************************* |
| 34 | You do not seem to have flex. While flex is not required to build |
| 35 | libconfig, you may need it to regenerate the lexer if you change |
| 36 | the scanner.l file. |
| 37 | ******************************************************************* |
| 38 | EOF |
| 39 | fi |
| 40 | |
| 41 | AC_PROG_YACC |
| 42 | if test Z"$YACC" != "Zbison -y"; then |
| 43 | cat <<EOF |
| 44 | ******************************************************************* |
| 45 | You do not seem to have bison. While bison is not required to build |
| 46 | libconfig, you may need it to regenerate the parser if you change |
| 47 | the grammar.y file. |
| 48 | ******************************************************************* |
| 49 | EOF |
| 50 | fi |
| 51 | |
| 52 | AC_MSG_CHECKING([for compiler switch to enable full C/C++ warnings]); |
| 53 | |
| 54 | dnl Checks for libraries |
| 55 | |
| 56 | dnl Enable warnings, if we can determine an appropriate switch... |
| 57 | case "${CC}" in |
| 58 | |
| 59 | gcc) |
| 60 | warn_c_sw="-Wall -Wshadow -Wextra -Wdeclaration-after-statement -Wno-unused-parameter" |
| 61 | warn_cxx_sw="-Wall -Wshadow -Wextra -Wno-unused-parameter";; |
| 62 | *) |
| 63 | warn_cxx_sw="" |
| 64 | warn_c_sw="";; |
| 65 | esac |
| 66 | |
| 67 | if test -n "${warn_c_sw}"; |
| 68 | then |
| 69 | CFLAGS="${CFLAGS} ${warn_c_sw}"; |
| 70 | CXXFLAGS="${CXXFLAGS} ${warn_cxx_sw}"; |
| 71 | AC_MSG_RESULT([${warn_c_sw}, ${warn_cxx_sw}]) |
| 72 | else |
| 73 | AC_MSG_RESULT([(cannot determine)]) |
| 74 | fi; |
| 75 | |
| 76 | |
| 77 | dnl Checks for header files. |
| 78 | AC_HEADER_STDC |
| 79 | AC_CHECK_HEADERS(unistd.h stdint.h xlocale.h) |
| 80 | |
| 81 | dnl Checks for typedefs, structures, and compiler characteristics. |
| 82 | AC_C_CONST |
| 83 | |
| 84 | dnl Checks for functions |
| 85 | |
| 86 | AC_CHECK_FUNCS([newlocale uselocale freelocale]) |
| 87 | |
| 88 | dnl Package options |
| 89 | |
| 90 | docxx=yes |
| 91 | |
| 92 | AC_ARG_ENABLE(cxx, |
| 93 | AS_HELP_STRING([--disable-cxx], [Disable building of the C++ library]), |
| 94 | [if test "$enableval" = "no"; then docxx="no"; fi], |
| 95 | [ |
| 96 | docxx=yes |
| 97 | ] |
| 98 | ) |
| 99 | |
| 100 | AM_CONDITIONAL(BUILDCXX, test x$docxx = xyes) |
| 101 | |
| 102 | dodoc=yes |
| 103 | |
| 104 | AC_ARG_ENABLE(doc, |
| 105 | AS_HELP_STRING([--disable-doc], [Disable building of the documentation]), |
| 106 | [if test "$enableval" = "no"; then dodoc="no"; fi], |
| 107 | [ |
| 108 | dodoc=yes |
| 109 | ] |
| 110 | ) |
| 111 | |
| 112 | AM_CONDITIONAL(BUILDDOC, test x$dodoc = xyes) |
| 113 | |
| 114 | doexamples=yes |
| 115 | |
| 116 | AC_ARG_ENABLE(examples, |
| 117 | AS_HELP_STRING([--disable-examples], [Disable building of the example programs]), |
| 118 | [if test "$enableval" = "no"; then doexamples="no"; fi], |
| 119 | [ |
| 120 | doexamples=yes |
| 121 | ] |
| 122 | ) |
| 123 | |
| 124 | AM_CONDITIONAL(BUILDEXAMPLES, test x$doexamples = xyes) |
| 125 | |
| 126 | dotests=yes |
| 127 | |
| 128 | AC_ARG_ENABLE(tests, |
| 129 | AS_HELP_STRING([--disable-tests], [Disable building of the tests]), |
| 130 | [if test "$enableval" = "no"; then dotests="no"; fi], |
| 131 | [ |
| 132 | dotests=yes |
| 133 | ] |
| 134 | ) |
| 135 | |
| 136 | AM_CONDITIONAL(BUILDTESTS, test x$dotests = xyes) |
| 137 | |
| 138 | dnl Check for MinGW. Workaround for libtool's DLL_EXPORT stupidity. |
| 139 | |
| 140 | case "$target" in |
| 141 | *-*-cygwin* | *-*-mingw*) |
| 142 | gnuwin=yes;; |
| 143 | esac |
| 144 | |
| 145 | AM_CONDITIONAL(GNU_WIN, test x$gnuwin = xyes) |
| 146 | |
| 147 | dnl Checks for library functions. |
| 148 | |
| 149 | AC_OUTPUT( |
| 150 | Makefile |
| 151 | lib/Makefile |
| 152 | lib/libconfig.pc |
| 153 | lib/libconfig++.pc |
| 154 | lib/libconfigConfig.cmake |
| 155 | lib/libconfig++Config.cmake |
| 156 | doc/Makefile |
| 157 | examples/Makefile |
| 158 | examples/c/Makefile |
| 159 | examples/c++/Makefile |
| 160 | tinytest/Makefile |
| 161 | tests/Makefile |
| 162 | libconfig.spec |
| 163 | ) |