root/configure.in

Revision dcfe53958da3654f243cdc2bf9c92df43de25893, 11.4 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 6 years ago)

remove the inclusion of server headers path in the CFLAGS, closes #33

  • Property mode set to 100755
Line 
1 AC_INIT(src/noitd.c)
2
3 node=`hostname | cut -f1 -d '.' | tr '[A-Z]' '[a-z]'`
4 if test -f ".configure.$node"; then
5         echo "***********************************************************"
6         echo "* Loading node specific configure settings for $node."
7         echo "***********************************************************"
8         . ./.configure.$node
9 fi
10
11 AC_CANONICAL_HOST
12 AC_CONFIG_HEADER(src/noit_config.h)
13 AC_CONFIG_HEADER(src/jlog/jlog_config.h)
14
15 AC_PROG_CC
16 AC_C_INLINE
17 AC_C_BIGENDIAN
18 AC_PROG_CPP
19 AC_PROG_RANLIB
20 AC_PROG_INSTALL
21 AC_PROG_LN_S
22 AC_PATH_PROG(AR, ar)
23 AC_PATH_PROGS(PERL, perl)
24 AC_SUBST(PERL)
25
26 if test "x$CC" = "xgcc" ; then
27   CFLAGS="$CFLAGS -g -Wall"
28 fi
29
30 CPPFLAGS="$CPPFLAGS "'-I$(top_srcdir)/src'
31
32 case $host in
33 *-*-darwin*)
34         PICFLAGS="-fPIC"
35         MODULELD="$CC -bundle -flat_namespace -undefined suppress"
36         SHLD="$CC -dynamiclib -flat_namespace -undefined suppress"
37         MODULEEXT=bundle
38         RLDFLAG="-Wl,--rpath="
39         ;;
40 *-*-solaris*)
41         AC_MSG_CHECKING([32 or 64 bit Solaris assembly])
42         if test -n "`echo $CFLAGS | grep m64`"; then
43                 AC_MSG_RESULT([64])
44                 ATOMIC_OBJS="noit_atomic_sol_x86_64.o"
45         else
46                 AC_MSG_RESULT([32])
47                 ATOMIC_OBJS="noit_atomic_sol_x86_32.o"
48         fi
49         PICFLAGS="-Kpic"
50         MODULELD="$CC -G"
51         SHLD="$CC -G"
52         MODULEEXT=so
53         RLDFLAG="-R"
54         WHOLE_ARCHIVE="-Wl,-z -Wl,allextract"
55         NOWHOLE_ARCHIVE="-Wl,-z -Wl,defaultextract"
56         ;;
57 *-*-openbsd*)
58         PICFLAGS="-fpic"
59         LDFLAGS="$LDFLAGS -Wl,-E"
60         MODULELD="$CC -shared"
61         SHLD="$CC -shared"
62         MODULEEXT=so
63         LDFLAGS="$LDFLAGS -L/usr/local/lib"
64         CFLAGS="$CFLAGS -I/usr/local/include"
65         RLDFLAG="-Wl,--rpath="
66         WHOLE_ARCHIVE="-Wl,--whole-archive"
67         NOWHOLE_ARCHIVE="-Wl,--no-whole-archive"
68         ;;
69 *-*-linux*)
70         LDFLAGS="$LDFLAGS -Wl,-E"
71         CPPFLAGS="$CPPFLAGS"
72         PICFLAGS="-fpic"
73         MODULELD="$CC -shared"
74         SHLD="$CC -shared"
75         MODULEEXT=so
76         RLDFLAG="-Wl,--rpath="
77         WHOLE_ARCHIVE="-Wl,--whole-archive"
78         NOWHOLE_ARCHIVE="-Wl,--no-whole-archive"
79         ;;
80 *)
81         PICFLAGS="-fpic"
82         MODULELD="$CC -shared"
83         MODULEEXT=so
84         RLDFLAG="-Wl,--rpath="
85         ;;
86 esac
87 AC_SUBST(SHLD)
88 AC_SUBST(RLDFLAG)
89 AC_SUBST(MODULELD)
90 AC_SUBST(MODULEEXT)
91 AC_SUBST(WHOLE_ARCHIVE)
92 AC_SUBST(NOWHOLE_ARCHIVE)
93 AC_SUBST(ATOMIC_OBJS)
94 AC_DEFINE_UNQUOTED(MODULEEXT, "$MODULEEXT", [module extension])
95
96 # Checks for data types
97 AC_CHECK_SIZEOF(char, 1)
98 AC_CHECK_SIZEOF(short int, 2)
99 AC_CHECK_SIZEOF(int, 4)
100 AC_CHECK_SIZEOF(long int, 4)
101 AC_CHECK_SIZEOF(long long int, 8)
102 AC_CHECK_SIZEOF(void *, 1)
103
104 AC_CHECK_LIB(rt, sem_init, , )
105 AC_CHECK_LIB(posix4, sem_wait, , )
106 AC_CHECK_LIB(pthread, pthread_create, , )
107 AC_CHECK_LIB(uuid, uuid_generate, , )
108 # Some libraries provide an unparse_lower command
109 # we use that, so if it isn't present, we'll need
110 # to implement it.
111 AC_CHECK_FUNC(uuid_unparse_lower, [AC_DEFINE(HAVE_UUID_UNPARSE_LOWER)], )
112 AC_CHECK_LIB(util, openpty, , )
113 AC_CHECK_LIB(termcap, tputs, , )
114 AC_CHECK_LIB(curses, clear, , )
115 CPPFLAGS="$CPPFLAGS `pcre-config --cflags`"
116 LDFLAGS="$LDFLAGS `pcre-config --libs`"
117 AC_CHECK_LIB(pcre, pcre_compile, ,
118         [
119                 AC_MSG_ERROR([libpcre not found, but required])
120         ]
121 )
122 AC_CHECK_LIB(crypto, ERR_load_CRYPTO_strings, ,
123         [
124                 AC_MSG_ERROR([libcrypto not found, but required])
125         ]
126 )
127 AC_CHECK_LIB(ssl, SSL_library_init, ,
128         [
129                 AC_MSG_ERROR([libssl not found, but required])
130         ]
131 )
132
133 old_LIBS=$LIBS
134 old_CFLAGS=$CFLAGS
135 AC_CHECK_LIB(pq, PQconnectdb,
136         [
137                 LIBS="$LIBS -lpq"
138                 PGLIBS="$LIBS"
139                 AC_SUBST(PGLIBS)
140         ],
141         [
142                 AC_MSG_ERROR([libpq required])
143         ]
144 )
145
146 AC_MSG_CHECKING([libpq includes])
147 PQICFLAGS=`pg_config --includedir`
148 if test -n "$PQICFLAGS" ; then
149   CFLAGS="$CFLAGS -I$PQICFLAGS"
150 fi
151
152 AC_TRY_LINK([
153         #include <libpq-fe.h>
154         ],
155         [ PGconn *dbh = PQconnectdb(""); ],
156         [],
157         [ AC_MSG_ERROR([Cannot compile/link against libpq]) ]
158 )
159 PGCFLAGS=$CFLAGS
160 AC_SUBST(PGCFLAGS)
161
162 LIBS=$old_LIBS
163 CFLAGS=$old_CFLAGS
164
165 ########
166 #
167 # CHECK FOR VARIOUS MODULE CRITERIA
168 # We don't track the libs themselves, as we'll just explictly link
169 # against the in the makefile if we enable them to build (by adding
170 # them to the BUILD_MODULES list).
171 #
172 ########
173
174 # Should we build snmp checks?
175 SAVELIBS="$LIBS"
176 AC_CHECK_LIB(netsnmp, snmp_sess_open,
177         [
178                 BUILD_MODULES="$BUILD_MODULES snmp.$MODULEEXT"
179         ],
180         [
181                 AC_MSG_WARN([No libnetsnmp, skipping snmp module])
182         ]
183 )
184 LIBS="$SAVELIBS"
185
186 # Should we build ssh2 checks?
187 SAVELIBS="$LIBS"
188 AC_CHECK_LIB(ssh2, libssh2_session_init_ex,
189         [
190                 BUILD_MODULES="$BUILD_MODULES ssh2.$MODULEEXT"
191         ],
192         [
193                 AC_MSG_WARN([No libssh2, skipping ssh2 module])
194         ]
195 )
196 LIBS="$SAVELIBS"
197
198 AC_MSG_CHECKING([libxml2 cflags])
199 XML2CFLAGS=`xml2-config --cflags`
200 CFLAGS="$CFLAGS $XML2CFLAGS"
201 AC_MSG_RESULT([$XML2CFLAGS])
202
203 AC_MSG_CHECKING([libxml2 libs])
204 XML2LIBS=`xml2-config --libs`
205 LIBS="$LIBS $XML2LIBS"
206 AC_MSG_RESULT([$XML2LIBS])
207
208 APRPREFIX="`apr-1-config --prefix`"
209 AC_MSG_CHECKING([libserf cflags])
210 AC_SUBST(APRPREFIX)
211 AC_MSG_RESULT([$APRPREFIX])
212
213 AC_MSG_CHECKING([libserf cflags])
214 SERFCFLAGS="`apr-1-config --cflags --cppflags`"
215 SERFCFLAGS="$SERFCFLAGS -I`apu-1-config --includedir` -I`apr-1-config --includedir`"
216 AC_SUBST(SERFCFLAGS)
217 AC_MSG_RESULT([$SERFCFLAGS])
218
219 AC_MSG_CHECKING([libserf libs])
220 SERFLIBS="`apu-1-config --link-ld --ldflags --libs` `apr-1-config --link-ld --ldflags --libs`"
221 AC_SUBST(SERFLIBS)
222 AC_MSG_RESULT([$SERFLIBS])
223
224 AC_TRY_LINK([],
225         [ issetugid(); ],
226         [ ac_cv_libc_defines_issetugid="yes" ],
227         [ ac_cv_libc_defines_issetugid="no" ]
228 )
229 if test "x$ac_cv_libc_defines_issetugid" = "xyes" ; then
230         AC_DEFINE(HAVE_ISSETUGID)
231 fi
232
233 AC_MSG_CHECKING([whether sem_init works])
234 AC_TRY_RUN(
235         [
236 #include <semaphore.h>
237 int main(void){sem_t s;return (0 != sem_init(&s,0,0));}
238         ],
239         [AC_MSG_RESULT(yes)],
240         [
241                 AC_MSG_RESULT(no)
242                 AC_DEFINE(BROKEN_SEM_INIT)
243                 AC_MSG_WARN([****** sem_init() is broken, I'll implement one myself.])
244         ]
245 )
246
247 AC_FUNC_STRFTIME
248 AC_CHECK_FUNC(ssetugid strlcpy strnstrn openpty)
249
250 # Checks for header files.
251 AC_CHECK_HEADERS(sys/file.h sys/types.h dirent.h sys/param.h fcntl.h errno.h limits.h \
252                  sys/resource.h pthread.h semaphore.h pwd.h stdio.h stdlib.h string.h \
253                  ctype.h unistd.h time.h sys/stat.h sys/event.h libkern/OSAtomic.h \
254                  term.h termio.h termios.h curses.h sys/cdefs.h pwd.h netinet/in_systm.h \
255                  sys/ioctl_compat.h sys/filio.h util.h sys/time.h sys/mman.h \
256                  stropts.h sys/stream.h)
257
258 AC_CACHE_CHECK([for epoll support], ac_cv_have_epoll, [
259         AC_TRY_LINK(
260                 [ #include <sys/types.h> ],
261                 [ u_int a; a = epoll_create(); ],
262                 [ ac_cv_have_epoll="yes" ],
263                 [ ac_cv_have_epoll="no" ]
264         )
265 ])
266 if test "x$ac_cv_have_epoll" = "xyes" ; then
267         AC_DEFINE(HAVE_EPOLL)
268         EVENTER_OBJS="$EVENTER_OBJS eventer_epoll_impl.o"
269         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "epoll")
270         have_epoll=1
271 fi
272
273 AC_CACHE_CHECK([for kqueue support], ac_cv_have_kqueue, [
274         AC_TRY_LINK(
275                 [ #include <sys/types.h> ],
276                 [ u_int a; a = kqueue(); ],
277                 [ ac_cv_have_kqueue="yes" ],
278                 [ ac_cv_have_kqueue="no" ]
279         )
280 ])
281 if test "x$ac_cv_have_kqueue" = "xyes" ; then
282         AC_DEFINE(HAVE_KQUEUE)
283         EVENTER_OBJS="$EVENTER_OBJS eventer_kqueue_impl.o"
284         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "kqueue")
285         have_kqueue=1
286 fi
287
288 AC_CACHE_CHECK([for Solaris ports support], ac_cv_have_ports, [
289         AC_TRY_LINK(
290                 [ #include <port.h> ],
291                 [ u_int a; a = port_create(); ],
292                 [ ac_cv_have_ports="yes" ],
293                 [ ac_cv_have_ports="no" ]
294         )
295 ])
296 if test "x$ac_cv_have_ports" = "xyes" ; then
297         AC_DEFINE(HAVE_PORTS)
298         EVENTER_OBJS="$EVENTER_OBJS eventer_ports_impl.o"
299         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "ports")
300         have_ports=1
301 fi
302
303 AC_SUBST(EVENTER_OBJS)
304
305 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
306         AC_TRY_COMPILE(
307                 [ #include <sys/types.h> ],
308                 [ u_int a; a = 1;],
309                 [ ac_cv_have_u_int="yes" ],
310                 [ ac_cv_have_u_int="no" ]
311         )
312 ])
313 if test "x$ac_cv_have_u_int" = "xyes" ; then
314         AC_DEFINE(HAVE_U_INT)
315         have_u_int=1
316 fi
317
318 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
319         AC_TRY_COMPILE(
320                 [ #include <sys/types.h> ],
321                 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
322                 [ ac_cv_have_intxx_t="yes" ],
323                 [ ac_cv_have_intxx_t="no" ]
324         )
325 ])
326 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
327         AC_DEFINE(HAVE_INTXX_T)
328         have_intxx_t=1
329 fi
330        
331 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
332         AC_TRY_COMPILE(
333                 [ #include <sys/types.h> ],
334                 [ int64_t a; a = 1;],
335                 [ ac_cv_have_int64_t="yes" ],
336                 [ ac_cv_have_int64_t="no" ]
337         )
338 ])
339 if test "x$ac_cv_have_int64_t" = "xyes" ; then
340         AC_DEFINE(HAVE_INT64_T)
341         have_int64_t=1
342 fi
343        
344 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
345         AC_TRY_COMPILE(
346                 [ #include <sys/types.h> ],
347                 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
348                 [ ac_cv_have_u_intxx_t="yes" ],
349                 [ ac_cv_have_u_intxx_t="no" ]
350         )
351 ])
352 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
353         AC_DEFINE(HAVE_U_INTXX_T)
354         have_u_intxx_t=1
355 fi
356
357 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
358         AC_TRY_COMPILE(
359                 [ #include <sys/types.h> ],
360                 [ u_int64_t a; a = 1;],
361                 [ ac_cv_have_u_int64_t="yes" ],
362                 [ ac_cv_have_u_int64_t="no" ]
363         )
364 ])
365 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
366         AC_DEFINE(HAVE_U_INT64_T)
367         have_u_int64_t=1
368 fi
369
370 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
371            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
372 then
373         AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
374         AC_TRY_COMPILE(
375                 [
376 #include <sys/bitypes.h>
377                 ],
378                 [
379                         int8_t a; int16_t b; int32_t c;
380                         u_int8_t e; u_int16_t f; u_int32_t g;
381                         a = b = c = e = f = g = 1;
382                 ],
383                 [
384                         AC_DEFINE(HAVE_U_INTXX_T)
385                         AC_DEFINE(HAVE_INTXX_T)
386                         AC_MSG_RESULT(yes)
387                 ],
388                 [AC_MSG_RESULT(no)]
389         )
390 fi
391
392 if test -z "$have_u_intxx_t" ; then
393         AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
394                 AC_TRY_COMPILE(
395                         [
396 #include <sys/types.h>
397                         ],
398                         [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
399                         [ ac_cv_have_uintxx_t="yes" ],
400                         [ ac_cv_have_uintxx_t="no" ]
401                 )
402         ])
403         if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
404                 AC_DEFINE(HAVE_UINTXX_T)
405         fi
406 fi
407
408 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
409         AC_TRY_COMPILE(
410                 [
411 #include <sys/types.h>
412 #include <sys/socket.h>
413                 ],
414                 [socklen_t foo; foo = 1235;],
415                 [ ac_cv_have_socklen_t="yes" ],
416                 [ ac_cv_have_socklen_t="no" ]
417         )
418 ])
419 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
420         AC_DEFINE(HAVE_SOCKLEN_T)
421 fi
422
423 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
424         AC_TRY_COMPILE(
425                 [
426 #include <sys/types.h>
427                 ],
428                 [ size_t foo; foo = 1235; ],
429                 [ ac_cv_have_size_t="yes" ],
430                 [ ac_cv_have_size_t="no" ]
431         )
432 ])
433 if test "x$ac_cv_have_size_t" = "xyes" ; then
434         AC_DEFINE(HAVE_SIZE_T)
435 fi
436
437 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
438         AC_TRY_COMPILE(
439                 [
440 #include <sys/types.h>
441                 ],
442                 [ ssize_t foo; foo = 1235; ],
443                 [ ac_cv_have_ssize_t="yes" ],
444                 [ ac_cv_have_ssize_t="no" ]
445         )
446 ])
447 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
448         AC_DEFINE(HAVE_SSIZE_T)
449 fi
450
451 AC_SUBST(BUILD_MODULES)
452
453 docdir="docs"
454 mansubdir="man"
455 AC_SUBST(docdir)
456 AC_SUBST(mansubdir)
457 SHCFLAGS="$PICFLAGS $CFLAGS"
458 AC_SUBST(SHCFLAGS)
459
460 AC_MSG_CHECKING([Resolving libexec path...])
461 fullpath=$libexecdir
462 while test "x$temppath" != "x$fullpath" ; do
463   temppath=$fullpath
464   fullpath=`eval echo ${fullpath}`
465 done
466 fullpath=`echo $fullpath | sed "s~NONE~$ac_default_prefix~"`
467 AC_MSG_RESULT([$fullpath])
468 AC_DEFINE_UNQUOTED(MODULES_DIR, "${fullpath}")
469 MODULES_DIR=${fullpath}
470 AC_SUBST(MODULES_DIR)
471
472 AC_MSG_CHECKING([Resolving sysconfdir path...])
473 fullpath=$sysconfdir
474 while test "x$temppath" != "x$fullpath" ; do
475   temppath=$fullpath
476   fullpath=`eval echo ${fullpath}`
477 done
478 fullpath=`echo $fullpath | sed "s~NONE~$ac_default_prefix~"`
479 AC_MSG_RESULT([$fullpath])
480 AC_DEFINE_UNQUOTED(ETC_DIR, "${fullpath}")
481 ETC_DIR=${fullpath}
482 AC_SUBST(ETC_DIR)
483
484
485 AC_OUTPUT([
486 Makefile
487 src/Makefile
488 src/eventer/Makefile
489 src/jlog/Makefile
490 src/jlog/perl/Makefile.PL
491 src/modules/Makefile
492 src/utils/Makefile
493 src/noitedit/Makefile
494 src/lua/Makefile
495 test/Makefile
496 ])
Note: See TracBrowser for help on using the browser.