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