root/configure.in

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

my hostname goes in mixed-case when I'm at home -- PoS

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