root/configure.in

Revision a50432366e0c6614924558d1aa82eaa82b967a0b, 9.7 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 7 years ago)

compiles on linux -- still no eventer, refs #12

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