1 | dnl Process this file with autoconf to produce a configure script. |
---|
2 | AC_INIT(libconfig, 1.4b4, hyperrealm@gmail.com) |
---|
3 | AC_CONFIG_AUX_DIR([aux-build]) |
---|
4 | AC_CANONICAL_TARGET |
---|
5 | AM_INIT_AUTOMAKE |
---|
6 | AM_CONFIG_HEADER(ac_config.h) |
---|
7 | |
---|
8 | AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.]) |
---|
9 | |
---|
10 | # Enable GNU extensions. |
---|
11 | AC_GNU_SOURCE |
---|
12 | |
---|
13 | LT_INIT() |
---|
14 | |
---|
15 | dnl Checks for programs. |
---|
16 | AC_PROG_CC |
---|
17 | AC_LIBTOOL_WIN32_DLL |
---|
18 | AC_PROG_LIBTOOL |
---|
19 | |
---|
20 | AM_PROG_LEX |
---|
21 | if test Z"$LEX" != Zflex; then |
---|
22 | cat <<EOF |
---|
23 | ******************************************************************* |
---|
24 | You do not seem to have flex. While flex is not required to build |
---|
25 | libconfig, you may need it to regenerate the lexer if you change |
---|
26 | the scanner.l file. Flex 2.5.33 or newer is recommended. |
---|
27 | ******************************************************************* |
---|
28 | EOF |
---|
29 | fi |
---|
30 | |
---|
31 | AC_PROG_YACC |
---|
32 | if test Z"$YACC" != "Zbison -y"; then |
---|
33 | cat <<EOF |
---|
34 | ******************************************************************* |
---|
35 | You do not seem to have bison. While bison is not required to build |
---|
36 | libconfig, you may need it to regenerate the parser if you change |
---|
37 | the grammar.y file. |
---|
38 | ******************************************************************* |
---|
39 | EOF |
---|
40 | fi |
---|
41 | |
---|
42 | AC_MSG_CHECKING([for compiler switch to enable full C/C++ warnings]); |
---|
43 | |
---|
44 | dnl Checks for libraries |
---|
45 | |
---|
46 | dnl Enable warnings, if we can determine an appropriate switch... |
---|
47 | case "${CC}" in |
---|
48 | |
---|
49 | gcc) |
---|
50 | warn_c_sw="-Wall -Wshadow -Wdeclaration-after-statement" |
---|
51 | warn_cxx_sw="-Wall -Wshadow";; |
---|
52 | *) |
---|
53 | warn_cxx_sw="" |
---|
54 | warn_c_sw="";; |
---|
55 | esac |
---|
56 | |
---|
57 | if test -n "${warn_c_sw}"; |
---|
58 | then |
---|
59 | CFLAGS="${CFLAGS} ${warn_c_sw}"; |
---|
60 | CXXFLAGS="${CXXFLAGS} ${warn_cxx_sw}"; |
---|
61 | AC_MSG_RESULT([${warn_c_sw}, ${warn_cxx_sw}]) |
---|
62 | else |
---|
63 | AC_MSG_RESULT([(cannot determine)]) |
---|
64 | fi; |
---|
65 | |
---|
66 | |
---|
67 | dnl Checks for header files. |
---|
68 | AC_HEADER_STDC |
---|
69 | AC_CHECK_HEADERS(unistd.h stdint.h xlocale.h) |
---|
70 | |
---|
71 | dnl Checks for typedefs, structures, and compiler characteristics. |
---|
72 | AC_C_CONST |
---|
73 | |
---|
74 | dnl Checks for functions |
---|
75 | |
---|
76 | AC_CHECK_FUNCS([newlocale uselocale freelocale]) |
---|
77 | |
---|
78 | dnl Package options |
---|
79 | |
---|
80 | docxx=yes |
---|
81 | |
---|
82 | AC_ARG_ENABLE(cxx, |
---|
83 | AS_HELP_STRING([--disable-cxx], [Disable building of the C++ library]), |
---|
84 | [if test "$enableval" = "no"; then docxx="no"; fi], |
---|
85 | [ |
---|
86 | AC_PROG_CXX |
---|
87 | docxx=yes |
---|
88 | ] |
---|
89 | ) |
---|
90 | |
---|
91 | AM_CONDITIONAL(BUILDCXX, test x$docxx = xyes) |
---|
92 | |
---|
93 | dnl Check for MinGW. Workaround for libtool's DLL_EXPORT stupidity. |
---|
94 | |
---|
95 | case "$target" in |
---|
96 | *-*-cygwin* | *-*-mingw*) |
---|
97 | gnuwin=yes;; |
---|
98 | esac |
---|
99 | |
---|
100 | AM_CONDITIONAL(GNU_WIN, test x$gnuwin = xyes) |
---|
101 | |
---|
102 | dnl Checks for library functions. |
---|
103 | |
---|
104 | AC_OUTPUT( |
---|
105 | Makefile |
---|
106 | lib/Makefile |
---|
107 | lib/libconfig.pc |
---|
108 | lib/libconfig++.pc |
---|
109 | doc/Makefile |
---|
110 | examples/Makefile |
---|
111 | examples/c/Makefile |
---|
112 | examples/c++/Makefile |
---|
113 | libconfig.spec |
---|
114 | ) |
---|