root/configure.in

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

various valgrind noted leaks

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