root/configure.in

Revision 125a593dd802ff9e00102dcfa8de54c1422c307e, 9.1 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 10 years ago)

implementation of the apply stuff

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