root/configure.in

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

allow for node-local config settings. determine if we have uuid_unparse_lower

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