Fix: Headers are now installed.
[libsex.git] / configure.ac
blobba139638e5daad493eed5d6ba0cb0f3cf4414337
1 AC_INIT([libsex], [1.0.0], [<arandes@programmers.at>])
2 AC_PREREQ(2.50)
3 AM_INIT_AUTOMAKE([-Wall -Werror])
4 AC_DEFINE_UNQUOTED(
5     COPYRIGHT,
6     ["2010 Andreas Waidler"],
7     [Copyright information.])
9 #AC_CONFIG_SRCDIR([src/Option])
10 AC_CONFIG_SRCDIR([src])
11 AM_CONFIG_HEADER([src/config.hxx])
13 EXTRA_DIST=m4
15 # cxxflags
16 AC_MSG_CHECKING([whether configure should try to set CXXFLAGS])
17 if test "x${CXXFLAGS+set}" = xset; then
18     enable_cxxflags_setting=no
19 else
20     enable_cxxflags_setting=yes
22 AC_MSG_RESULT($enable_cxxflags_setting)
25 # Optional Features
26 # debug
27 AC_ARG_ENABLE(
28     [debug],
29     AC_HELP_STRING(
30         [--enable-debug],
31         [enable debugging output to stderr @<:@default=no@>:@]),
32     [debug=${enableval}],
33     [debug=no])
35 if test "x${debug}" = xyes; then
36     AC_DEFINE(
37         DEBUG,
38         [1],
39         [Define to 1 to enable debugging output to stderr])
40     if test "x${enable_cxxflags_setting}" = xyes; then
41         CXXFLAGS="-g -O0" # Debugging information for gdb.
42     fi
43 else
44     if test "x${enable_cxxflags_setting}" = xyes; then
45         CXXFLAGS="-O2"
46     fi
49 # dot-multi-targets
50 AC_ARG_ENABLE(
51     [dot-multi-targets],
52     AC_HELP_STRING(
53         [--disable-dot-multi-targets],
54         [disable dot's output to multiple files in one run (make doxygen)
55          @<:@default=use@:>@]),
56     [dot_multi_targets=${withval}],
57     [dot_multi_targets=yes])
60 # Optional Packages
61 # dot
62 AC_ARG_WITH(
63     [dot],
64     AC_HELP_STRING(
65         [--without-dot],
66         [do not use dot for graph generation (make doxygen)
67          @<:@default=use@:>@]),
68     [with_dot=${withval}],
69     [with_dot=yes])
71 # htags
72 AC_ARG_WITH(
73     [htags],
74     AC_HELP_STRING(
75         [--with-htags],
76         [enable the htags (GNU GLOBAL) source browser (make doxygen)
77          @<:@default=no@:>@]),
78     [with_htags=${withval}],
79     [with_htags=no])
82 # Checks for programs.
83 # AC_PROG_*
84 AC_PROG_CXX
85 AC_PROG_CC
86 AC_PROG_CPP
87 AC_PROG_INSTALL
88 AC_PROG_LN_S
89 AC_PROG_MAKE_SET
90 AC_PROG_LIBTOOL
91 AC_PROG_AWK
92 AC_PROG_SED
94 # doxygen
95 AC_CHECK_PROG([have_doxygen], [doxygen], [yes], [no])
96 if test "x${have_doxygen}" = xno; then
97     echo \
98 "-------------------------------------------------
99  Unable to find Doxygen.
100  \"make doxygen\" will not work.
101 -------------------------------------------------"
104 # perl
105 AC_PATH_PROG([perl_path], [perl], [no])
106 if test "x${perl_path}" = xno; then
107     echo \
108 "-------------------------------------------------
109  Unable to find Perl.
110  \"make doxygen\" will not work.
111 -------------------------------------------------"
114 if test "x${have_doxygen}" = xyes -a "x${perl_path}" != xno; then
115     # dot
116     if test "x${with_dot}" = xyes; then
117         AC_CHECK_PROG([with_dot], [dot], [yes], [no])
118         if test "x${with_dot}" = xno; then
119             echo \
120 "-------------------------------------------------
121  Unable to find dot.
122  \"make doxygen\" will not build powerful graphs.
123 -------------------------------------------------"
124         else
125             if test "x${dot_multi_targets}" = xyes; then
126                 dot_version=`dot -V 2>&1 | \
127                     sed -e 's/.*version //' | sed -e 's/ .*//'`
128                 # Requires AX_COMPARE_VERSION from the Autoconf Macro Archive
129                 AX_COMPARE_VERSION(
130                     [$dot_version],
131                     [gt],
132                     [1.8.10],
133                     [],
134                     [dot_multi_targets=no])
135                 AC_MSG_CHECKING([for dot > 1.8.10])
136                 AC_MSG_RESULT([$dot_multi_targets])
137                 if test "x${dot_multi_targets}" = xno; then
138                     echo \
139 "-------------------------------------------------
140  Unable to find dot > 1.8.10.
141  \"make doxygen\" will not enable dot to output
142  multiple files in one run. Therefore it will run
143  slower.
144 -------------------------------------------------"
145                 fi
146             fi
147         fi
148     else
149         dot_multi_targets=no
150     fi
152     # htags
153     if test "x${with_htags}" = xyes; then
154         AC_MSG_CHECKING([for htags >= 4.8.6])
155         htags_version=`htags --version |
156             sed -ne 1p | sed -e 's/.* //'`
157         # Requires AX_COMPARE_VERSION from the Autoconf Macro Archive
158         AX_COMPARE_VERSION(
159             [$htags_version],
160             [ge],
161             [4.8.6],
162             [],
163             [with_htags=no])
164         AC_MSG_RESULT([$with_htags])
165         if test "x${with_htags}" = xno; then
166             echo \
167 "-------------------------------------------------
168  Unable to find htags (GNU GLOBAL) >= 4.8.6.
169  \"make doxygen\" will not use htags as the
170  source browser.
171 -------------------------------------------------"
172         fi
173     fi
175 else
176     with_dot=no
177     dot_multi_targets=no
178     with_htags=no
181 # Checks for language.
182 AC_LANG([C++])
184 # Checks for header files.
185 AC_HEADER_STDC
187 # Checks for libraries.
188 # cppunit
189 PKG_CHECK_MODULES(
190     [CPPUNIT],
191     [cppunit >= 1.12.0],
192     [have_cppunit=yes],
193     [have_cppunit=no])
194 if test "x${have_cppunit}" = xno; then
195     echo \
196 "-------------------------------------------------
197  Unable to find CppUnit >= 1.12.0.
198  \"make check\" will not work.
199 -------------------------------------------------"
203 # Checks for typedefs, structures, and compiler characteristics.
204 AC_HEADER_STDBOOL
205 AC_C_CONST
206 AC_C_INLINE
208 # Checks for library functions.
210 # Substs
211 AC_SUBST(debug)
212 AC_SUBST(dot_multi_targets)
214 AC_SUBST(perl_path)
215 AC_SUBST(with_dot)
216 AC_SUBST(with_htags)
218 AC_SUBST(CPPUNIT_CFLAGS)
219 AC_SUBST(CPPUNIT_LIBS)
221 # Conditionals
222 AM_CONDITIONAL(can_run_tests, test "x${have_cppunit}" = xyes)
225 AC_CONFIG_FILES([
226     Makefile
227     include/Makefile
228     include/libsex/Makefile
229     src/Makefile
230     tests/Makefile
231     tests/framework/Makefile
232     tests/src/Makefile
233     ${PACKAGE}.pc
234     Doxyfile
238 AC_OUTPUT
240 echo \
241 "-------------------------------------------------
243  ${PACKAGE_NAME} ${PACKAGE_VERSION}
245  Prefix: '${prefix}'.
246  Compiler: '${CXX} ${CXXFLAGS} ${CPPFLAGS}'
248  Package features:
249   debug              : ${debug}
250   make doxygen:
251    doxygen (needed)  : ${have_doxygen}
252    Perl (needed)     : ${perl_path}
253    dot               : ${with_dot}
254    dot multi targets : ${dot_multi_targets}
255    htags             : ${with_htags}
256   make check:
257    cppunit (needed)  : ${have_cppunit}
258    pthreads (needed) : ${have_pthreads}
260  Now type 'make @<:@<target>@:>@'
261  where the optional <target> is:
262   all                - build all binaries
263   check              - run unittests
264   doxygen            - build the documentation
265   install            - install everything
266   uninstall          - uninstall everything
268 -------------------------------------------------"