root/configure.in

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

I sure hope this doesn't break other platforms too badly. Solaris support sans the eventer... untested, of course. refs #32.

  • 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 -I/usr/local/include/postgresql"
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 SAVELIBS="$LIBS"
134 AC_CHECK_LIB(pq, PQconnectdb,
135         [
136                 LIBS="$LIBS -lpq"
137                 PGLIBS="$LIBS"
138                 AC_SUBST(PGLIBS)
139         ],
140         [
141                 AC_MSG_ERROR([libpq required])
142         ]
143 )
144
145 old_CFLAGS=$CFLAGS
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 PQICFLAGS=`pg_config --includedir-server`
152 if test -n "$PQICFLAGS" ; then
153   CFLAGS="$CFLAGS -I$PQICFLAGS"
154 fi
155 AC_MSG_RESULT([$PQICFLAGS])
156
157 AC_TRY_LINK([
158         #include <libpq-fe.h>
159         #include <postgres.h>
160         #include <fmgr.h>
161         ],
162         [ PGconn *dbh = PQconnectdb(""); ],
163         [],
164         [ AC_MSG_ERROR([Cannot compile/link against libpq]) ]
165 )
166 PGCFLAGS=$CFLAGS
167 AC_SUBST(PGCFLAGS)
168 LIBS="$SAVELIBS"
169 CFLAGS=$old_CFLAGS
170
171 ########
172 #
173 # CHECK FOR VARIOUS MODULE CRITERIA
174 # We don't track the libs themselves, as we'll just explictly link
175 # against the in the makefile if we enable them to build (by adding
176 # them to the BUILD_MODULES list).
177 #
178 ########
179
180 # Should we build snmp checks?
181 SAVELIBS="$LIBS"
182 AC_CHECK_LIB(netsnmp, snmp_sess_open,
183         [
184                 BUILD_MODULES="$BUILD_MODULES snmp.$MODULEEXT"
185         ],
186         [
187                 AC_MSG_WARN([No libnetsnmp, skipping snmp module])
188         ]
189 )
190 LIBS="$SAVELIBS"
191
192 # Should we build ssh2 checks?
193 SAVELIBS="$LIBS"
194 AC_CHECK_LIB(ssh2, libssh2_session_init_ex,
195         [
196                 BUILD_MODULES="$BUILD_MODULES ssh2.$MODULEEXT"
197         ],
198         [
199                 AC_MSG_WARN([No libssh2, skipping ssh2 module])
200         ]
201 )
202 LIBS="$SAVELIBS"
203
204 AC_MSG_CHECKING([libxml2 cflags])
205 XML2CFLAGS=`xml2-config --cflags`
206 CFLAGS="$CFLAGS $XML2CFLAGS"
207 AC_MSG_RESULT([$XML2CFLAGS])
208
209 AC_MSG_CHECKING([libxml2 libs])
210 XML2LIBS=`xml2-config --libs`
211 LIBS="$LIBS $XML2LIBS"
212 AC_MSG_RESULT([$XML2LIBS])
213
214 APRPREFIX="`apr-1-config --prefix`"
215 AC_MSG_CHECKING([libserf cflags])
216 AC_SUBST(APRPREFIX)
217 AC_MSG_RESULT([$APRPREFIX])
218
219 AC_MSG_CHECKING([libserf cflags])
220 SERFCFLAGS="`apr-1-config --cflags --cppflags`"
221 SERFCFLAGS="$SERFCFLAGS -I`apu-1-config --includedir` -I`apr-1-config --includedir`"
222 AC_SUBST(SERFCFLAGS)
223 AC_MSG_RESULT([$SERFCFLAGS])
224
225 AC_MSG_CHECKING([libserf libs])
226 SERFLIBS="`apu-1-config --link-ld --ldflags --libs` `apr-1-config --link-ld --ldflags --libs`"
227 AC_SUBST(SERFLIBS)
228 AC_MSG_RESULT([$SERFLIBS])
229
230 AC_TRY_LINK([],
231         [ issetugid(); ],
232         [ ac_cv_libc_defines_issetugid="yes" ],
233         [ ac_cv_libc_defines_issetugid="no" ]
234 )
235 if test "x$ac_cv_libc_defines_issetugid" = "xyes" ; then
236         AC_DEFINE(HAVE_ISSETUGID)
237 fi
238
239 AC_MSG_CHECKING([whether sem_init works])
240 AC_TRY_RUN(
241         [
242 #include <semaphore.h>
243 int main(void){sem_t s;return (0 != sem_init(&s,0,0));}
244         ],
245         [AC_MSG_RESULT(yes)],
246         [
247                 AC_MSG_RESULT(no)
248                 AC_DEFINE(BROKEN_SEM_INIT)
249                 AC_MSG_WARN([****** sem_init() is broken, I'll implement one myself.])
250         ]
251 )
252
253 AC_FUNC_STRFTIME
254 AC_CHECK_FUNC(ssetugid strlcpy strnstrn openpty)
255
256 # Checks for header files.
257 AC_CHECK_HEADERS(sys/file.h sys/types.h dirent.h sys/param.h fcntl.h errno.h limits.h \
258                  sys/resource.h pthread.h semaphore.h pwd.h stdio.h stdlib.h string.h \
259                  ctype.h unistd.h time.h sys/stat.h sys/event.h libkern/OSAtomic.h \
260                  term.h termio.h termios.h curses.h sys/cdefs.h pwd.h netinet/in_systm.h \
261                  sys/ioctl_compat.h sys/filio.h util.h sys/time.h sys/mman.h \
262                  stropts.h sys/stream.h)
263
264 AC_CACHE_CHECK([for epoll support], ac_cv_have_epoll, [
265         AC_TRY_LINK(
266                 [ #include <sys/types.h> ],
267                 [ u_int a; a = epoll_create(); ],
268                 [ ac_cv_have_epoll="yes" ],
269                 [ ac_cv_have_epoll="no" ]
270         )
271 ])
272 if test "x$ac_cv_have_epoll" = "xyes" ; then
273         AC_DEFINE(HAVE_EPOLL)
274         EVENTER_OBJS="$EVENTER_OBJS eventer_epoll_impl.o"
275         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "epoll")
276         have_epoll=1
277 fi
278
279 AC_CACHE_CHECK([for kqueue support], ac_cv_have_kqueue, [
280         AC_TRY_LINK(
281                 [ #include <sys/types.h> ],
282                 [ u_int a; a = kqueue(); ],
283                 [ ac_cv_have_kqueue="yes" ],
284                 [ ac_cv_have_kqueue="no" ]
285         )
286 ])
287 if test "x$ac_cv_have_kqueue" = "xyes" ; then
288         AC_DEFINE(HAVE_KQUEUE)
289         EVENTER_OBJS="$EVENTER_OBJS eventer_kqueue_impl.o"
290         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "kqueue")
291         have_kqueue=1
292 fi
293
294 AC_CACHE_CHECK([for Solaris ports support], ac_cv_have_ports, [
295         AC_TRY_LINK(
296                 [ #include <port.h> ],
297                 [ u_int a; a = port_create(); ],
298                 [ ac_cv_have_ports="yes" ],
299                 [ ac_cv_have_ports="no" ]
300         )
301 ])
302 if test "x$ac_cv_have_ports" = "xyes" ; then
303         AC_DEFINE(HAVE_PORTS)
304         EVENTER_OBJS="$EVENTER_OBJS eventer_ports_impl.o"
305         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "ports")
306         have_ports=1
307 fi
308
309 AC_SUBST(EVENTER_OBJS)
310
311 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
312         AC_TRY_COMPILE(
313                 [ #include <sys/types.h> ],
314                 [ u_int a; a = 1;],
315                 [ ac_cv_have_u_int="yes" ],
316                 [ ac_cv_have_u_int="no" ]
317         )
318 ])
319 if test "x$ac_cv_have_u_int" = "xyes" ; then
320         AC_DEFINE(HAVE_U_INT)
321         have_u_int=1
322 fi
323
324 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
325         AC_TRY_COMPILE(
326                 [ #include <sys/types.h> ],
327                 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
328                 [ ac_cv_have_intxx_t="yes" ],
329                 [ ac_cv_have_intxx_t="no" ]
330         )
331 ])
332 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
333         AC_DEFINE(HAVE_INTXX_T)
334         have_intxx_t=1
335 fi
336        
337 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
338         AC_TRY_COMPILE(
339                 [ #include <sys/types.h> ],
340                 [ int64_t a; a = 1;],
341                 [ ac_cv_have_int64_t="yes" ],
342                 [ ac_cv_have_int64_t="no" ]
343         )
344 ])
345 if test "x$ac_cv_have_int64_t" = "xyes" ; then
346         AC_DEFINE(HAVE_INT64_T)
347         have_int64_t=1
348 fi
349        
350 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
351         AC_TRY_COMPILE(
352                 [ #include <sys/types.h> ],
353                 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
354                 [ ac_cv_have_u_intxx_t="yes" ],
355                 [ ac_cv_have_u_intxx_t="no" ]
356         )
357 ])
358 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
359         AC_DEFINE(HAVE_U_INTXX_T)
360         have_u_intxx_t=1
361 fi
362
363 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
364         AC_TRY_COMPILE(
365                 [ #include <sys/types.h> ],
366                 [ u_int64_t a; a = 1;],
367                 [ ac_cv_have_u_int64_t="yes" ],
368                 [ ac_cv_have_u_int64_t="no" ]
369         )
370 ])
371 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
372         AC_DEFINE(HAVE_U_INT64_T)
373         have_u_int64_t=1
374 fi
375
376 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
377            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
378 then
379         AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
380         AC_TRY_COMPILE(
381                 [
382 #include <sys/bitypes.h>
383                 ],
384                 [
385                         int8_t a; int16_t b; int32_t c;
386                         u_int8_t e; u_int16_t f; u_int32_t g;
387                         a = b = c = e = f = g = 1;
388                 ],
389                 [
390                         AC_DEFINE(HAVE_U_INTXX_T)
391                         AC_DEFINE(HAVE_INTXX_T)
392                         AC_MSG_RESULT(yes)
393                 ],
394                 [AC_MSG_RESULT(no)]
395         )
396 fi
397
398 if test -z "$have_u_intxx_t" ; then
399         AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
400                 AC_TRY_COMPILE(
401                         [
402 #include <sys/types.h>
403                         ],
404                         [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
405                         [ ac_cv_have_uintxx_t="yes" ],
406                         [ ac_cv_have_uintxx_t="no" ]
407                 )
408         ])
409         if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
410                 AC_DEFINE(HAVE_UINTXX_T)
411         fi
412 fi
413
414 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
415         AC_TRY_COMPILE(
416                 [
417 #include <sys/types.h>
418 #include <sys/socket.h>
419                 ],
420                 [socklen_t foo; foo = 1235;],
421                 [ ac_cv_have_socklen_t="yes" ],
422                 [ ac_cv_have_socklen_t="no" ]
423         )
424 ])
425 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
426         AC_DEFINE(HAVE_SOCKLEN_T)
427 fi
428
429 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
430         AC_TRY_COMPILE(
431                 [
432 #include <sys/types.h>
433                 ],
434                 [ size_t foo; foo = 1235; ],
435                 [ ac_cv_have_size_t="yes" ],
436                 [ ac_cv_have_size_t="no" ]
437         )
438 ])
439 if test "x$ac_cv_have_size_t" = "xyes" ; then
440         AC_DEFINE(HAVE_SIZE_T)
441 fi
442
443 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
444         AC_TRY_COMPILE(
445                 [
446 #include <sys/types.h>
447                 ],
448                 [ ssize_t foo; foo = 1235; ],
449                 [ ac_cv_have_ssize_t="yes" ],
450                 [ ac_cv_have_ssize_t="no" ]
451         )
452 ])
453 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
454         AC_DEFINE(HAVE_SSIZE_T)
455 fi
456
457 AC_SUBST(BUILD_MODULES)
458
459 docdir="docs"
460 mansubdir="man"
461 AC_SUBST(docdir)
462 AC_SUBST(mansubdir)
463 SHCFLAGS="$PICFLAGS $CFLAGS"
464 AC_SUBST(SHCFLAGS)
465
466 AC_MSG_CHECKING([Resolving libexec path...])
467 fullpath=$libexecdir
468 while test "x$temppath" != "x$fullpath" ; do
469   temppath=$fullpath
470   fullpath=`eval echo ${fullpath}`
471 done
472 fullpath=`echo $fullpath | sed "s~NONE~$ac_default_prefix~"`
473 AC_MSG_RESULT([$fullpath])
474 AC_DEFINE_UNQUOTED(MODULES_DIR, "${fullpath}")
475 MODULES_DIR=${fullpath}
476 AC_SUBST(MODULES_DIR)
477
478 AC_MSG_CHECKING([Resolving sysconfdir path...])
479 fullpath=$sysconfdir
480 while test "x$temppath" != "x$fullpath" ; do
481   temppath=$fullpath
482   fullpath=`eval echo ${fullpath}`
483 done
484 fullpath=`echo $fullpath | sed "s~NONE~$ac_default_prefix~"`
485 AC_MSG_RESULT([$fullpath])
486 AC_DEFINE_UNQUOTED(ETC_DIR, "${fullpath}")
487 ETC_DIR=${fullpath}
488 AC_SUBST(ETC_DIR)
489
490
491 AC_OUTPUT([
492 Makefile
493 src/Makefile
494 src/eventer/Makefile
495 src/jlog/Makefile
496 src/jlog/perl/Makefile.PL
497 src/modules/Makefile
498 src/utils/Makefile
499 src/noitedit/Makefile
500 src/lua/Makefile
501 test/Makefile
502 ])
Note: See TracBrowser for help on using the browser.