]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/configure.in
Initial revision
[thirdparty/pdns.git] / pdns / configure.in
1 dnl intro
2 AC_INIT(receiver.cc)
3 AC_CANONICAL_SYSTEM
4 AM_INIT_AUTOMAKE(pdns, 2.9)
5 AM_CONFIG_HEADER(config.h)
6 CXXFLAGS="-Wall -pthread -O2"
7
8 AC_PREFIX_DEFAULT(/opt/pdns)
9 AC_PROG_CC
10 AC_PROG_CXX
11 AC_PROG_YACC
12 AM_PROG_LEX
13 AC_PROG_INSTALL
14 AC_PROG_MAKE_SET
15 AM_PROG_LIBTOOL
16 AC_LANG_CPLUSPLUS
17
18
19 #dnl Replace `main' with a function in -ldl:
20 #AC_CHECK_LIB(dl, main)
21 #dnl Replace `main' with a function in -lpthread:
22 #AC_CHECK_LIB(pthread, main)
23
24 #CPPFLAGS="$CPPFLAGS -I/usr/include/postgresql"
25 #LDFLAGS="$LDFLAGS -L/usr/local/lib"
26
27 AC_CHECK_LIB(gnugetopt,getopt_long,LIBS="$LIBS -lgnugetopt")
28
29 dnl Checks for header files.
30 AC_HEADER_STDC
31 AC_CHECK_HEADERS(fcntl.h getopt.h limits.h strings.h sys/time.h syslog.h unistd.h)
32
33 dnl Checks for typedefs, structures, and compiler characteristics.
34 AC_TYPE_SIZE_T
35 AC_HEADER_TIME
36 AC_STRUCT_TM
37
38 dnl Checks for library functions.
39 AC_FUNC_SETVBUF_REVERSED
40 AC_TYPE_SIGNAL
41 AC_FUNC_STRFTIME
42 AC_CHECK_FUNCS(gethostname gettimeofday mkdir mktime select socket strerror)
43
44
45
46 # #
47 # # Check if we have libresolv. XXX If we do not have libresolv then we
48 # # cannot build the 'resolver'. Is it possible to remove that target
49 # # conditionally?
50 # #
51 #
52 # AC_CHECK_LIB(resolv, res_mkquery, RESOLV_LIBS="-l resolv")
53 # AC_MSG_CHECKING("for resolver library")
54 # if test -f /usr/lib/libresolv.so -o -f /lib/libresolv.o
55 # then
56 # AC_MSG_RESULT("yes")
57 # LIBS="$LIBS -lresolv"
58 # else
59 # AC_MSG_RESULT("no")
60 # fi
61
62 #
63 # Check for libresolv
64 #
65
66 my_save_LIBS="$LIBS"
67 LIBS=""
68 AC_CHECK_LIB(resolv,res_mkquery)
69 LIBRESOLV=$LIBS
70 LIBS="$my_save_LIBS"
71 AC_SUBST(LIBRESOLV)
72
73 #
74 # Check for libdl
75 #
76
77 my_save_LIBS="$LIBS"
78 LIBS=""
79 AC_CHECK_LIB(dl,dlopen)
80 LIBDL=$LIBS
81 LIBS="$my_save_LIBS"
82 AC_SUBST(LIBDL)
83
84
85 #
86 # The following code checks for the right pthreads library and linker
87 # flags. It was taken from MySQL, so we should have the same platform
88 # support as they have.
89 #
90 # XXX Dit is nog niet correct. Als dit matched dan moet de rest van de
91 # XXX thread checks niet. Fixen als we solaris hebben.
92 #
93
94 #AC_MSG_CHECKING("for Solaris threads")
95 #if test -f /usr/lib/libpthread.so -a -f /usr/lib/libthread.so
96 #then
97 # with_named_thread="-lpthread -lthread"
98 # AC_MSG_RESULT("yes")
99 #else
100 # AC_MSG_RESULT("no")
101 #fi
102
103 # pthread_create is in standard libraries (As in BSDI 3.0)
104 AC_MSG_CHECKING("for pthread_create in -libc");
105 AC_TRY_LINK(
106 [#include <pthread.h>],
107 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
108 with_posix_threads=yes, with_posix_threads=no)
109 AC_MSG_RESULT("$with_posix_threads")
110 if test "$with_posix_threads" = "no"
111 then
112 AC_MSG_CHECKING("for pthread_create in -lpthread");
113 ac_save_LIBS="$LIBS"
114 LIBS="$LIBS -lpthread"
115 AC_TRY_LINK(
116 [#include <pthread.h>],
117 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
118 with_posix_threads=yes, with_posix_threads=no)
119 AC_MSG_RESULT("$with_posix_threads")
120 if test "$with_posix_threads" = "no"
121 then
122 LIBS=" $ac_save_LIBS -lpthreads"
123 AC_MSG_CHECKING("for pthread_create in -lpthreads");
124 AC_TRY_LINK(
125 [#include <pthread.h>],
126 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
127 with_posix_threads=yes, with_posix_threads=no)
128 AC_MSG_RESULT("$with_posix_threads")
129 if test "$with_posix_threads" = "no"
130 then
131 # This is for FreeBSD
132 LIBS="$ac_save_LIBS -pthread"
133 AC_MSG_CHECKING("for pthread_create in -pthread");
134 AC_TRY_LINK(
135 [#include <pthread.h>],
136 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
137 with_posix_threads=yes, with_posix_threads=no)
138 AC_MSG_RESULT("$with_posix_threads")
139 if test "$with_posix_threads" = "no"
140 then
141 with_mit_threads="yes"
142 LIBS="$ac_save_LIBS"
143 fi
144 fi
145 fi
146 fi
147
148 case "$host_os" in
149 solaris2*) AC_DEFINE(NEED_POSIX_TYPEDEF)
150 ;;
151 *)
152 ;;
153 esac
154
155 AC_CHECK_HEADER(sstream,dontneedstl=1)
156
157 if test "$dontneedstl" != "1"
158 then
159
160 AC_ARG_WITH(stl-includes, [ --with-stl-includes=PATH Specify location of STL headers],
161 [ if test x"$withval" = x"no"; then
162 search_stl=0
163 else
164 #if test x"$withval" != x"yes"; then
165 if test -d "$withval"; then
166 STL_INCLUDES="-I$withval"
167 search_stl=0
168 has_stl=1
169 fi
170 fi
171 ])
172
173
174 AC_ARG_WITH(stl-libs, [ --with-stl-libs=PATH Specify location of STL libs],
175 [ if test x"$withval" = x"no"; then
176 search_stl=0
177 else
178 #if test x"$withval" != x"yes"; then
179 if test -d "$withval"; then
180 STL_LIBS="$LIBS -L$withval -lstlport_gcc"
181 search_stl=0
182 has_stl=1
183 fi
184 fi
185 ])
186
187 AC_DEFUN(AC_CHECK_STL,
188 [ if test x"$search_stl" != x"0"; then
189 if test -f "$1/$2"; then
190 AC_MSG_RESULT($5)
191 STL_LIBS="$3"
192 STL_INCLUDES="$4"
193 search_stl=0
194 has_stl=1
195 fi
196 fi
197 ])
198
199 AC_DEFUN(AC_SEARCH_STL,
200 [ AC_MSG_CHECKING("location of sstream")
201 AC_CHECK_STL(/usr/include, sstream, -lstlport_gcc,, "found in /usr/include")
202 AC_CHECK_STL(/usr/include/stlport, sstream, -lstlport_gcc, -I/usr/include/stlport, "found in /usr/include/stlport")
203 AC_CHECK_STL(/usr/local/include, sstream, -L/usr/local/lib -lstlport_gcc, -I/usr/local/include, "found in /usr/local")
204 AC_CHECK_STL(/usr/local/include/stl, sstream, -L/usr/local/lib -L/usr/local/lib/stl -lstlport_gcc, -I/usr/local/include/stl, "found in /usr/local/include/stl")
205 AC_CHECK_STL(/home/ahu/download/STLport-4.0/stlport, sstream,-L/home/ahu/download/STLport-4.0/lib/ -lstlport_gcc, -I/home/ahu/download/STLport-4.0/stlport/, "found in /home/ahu/download/STLport-4.0/stlport")
206 AC_CHECK_STL($HOME/STLport-4.0/stlport, sstream,-L$HOME/STLport-4.0/lib/ -lstlport_gcc, -I$HOME/STLport-4.0/stlport/, "found in $HOME/STLport-4.0/stlport")
207 ])
208
209 if test x"$search_stl" != x"0"; then
210 AC_SEARCH_STL()
211 fi
212
213 if test x"$has_stl" = x"1"; then
214 echo Found sstream include file, assuming working and compliant STL
215 else
216 echo
217 echo Did not find sstream include file, this probably means that your STL is not
218 echo compliant - the default gcc libstdc++ isn\'t. Download STLport-4.0 from
219 echo http://www.stlport.org, or use --with-stl-includes and --with-stl-libs
220 echo to specify the location of your STL.
221 echo
222 exit 1
223 fi
224
225 CPPFLAGS="$CPPFLAGS $STL_INCLUDES"
226 LIBS="$LIBS $STL_LIBS"
227 fi
228
229 AC_MSG_CHECKING(whether we will be doing verbose logging)
230 AC_ARG_ENABLE(verbose-logging,
231 [ --enable-verbose-logging Do verbose logging],enable_verbose_logging=yes ,enable_verbose_logging=no)
232
233 if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1)
234 fi
235 AC_MSG_RESULT($enable_verbose_logging)
236
237 AC_MSG_CHECKING(whether we should build static binaries)
238 AC_ARG_ENABLE(static-binaries,
239 [ --enable-static-binaries Build static binaries],enable_static_binaries=yes ,enable_static_binaries=no)
240
241 if test $enable_static_binaries = yes;
242 then
243 LDFLAGS="-all-static $LD_FLAGS"
244 fi
245 AC_MSG_RESULT($enable_static_binaries)
246
247
248
249 AC_OUTPUT(Makefile codedocs/Makefile backends/bind/Makefile \
250 backends/Makefile \
251 pdns.conf-dist buildroot.sh \
252 showvar pdns mkbindist)