root/configure.in

Revision 625628acfb7f3623d81f48a89a59459ebbb8dfd9, 6.3 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 11 years ago)

we need libxml2

  • Property mode set to 100755
Line 
1 AC_INIT(src/noitd.c)
2 AC_CANONICAL_HOST
3 AC_CONFIG_HEADER(src/noit_config.h)
4 AC_CONFIG_HEADER(src/jlog/jlog_config.h)
5
6 AC_PROG_CC
7 AC_C_INLINE
8 AC_C_BIGENDIAN
9 AC_PROG_CPP
10 AC_PROG_RANLIB
11 AC_PROG_INSTALL
12 AC_PROG_LN_S
13 AC_PATH_PROG(AR, ar)
14 AC_PATH_PROGS(PERL, perl)
15 AC_SUBST(PERL)
16
17 if test "x$CC" = "xgcc" ; then
18   CFLAGS="$CFLAGS -g -Wall"
19 fi
20
21 case $host in
22 *-*-darwin*)
23         PICFLAGS="-fpic"
24         MODULELD="$CC -bundle -flat_namespace -undefined suppress"
25         MODULEEXT=bundle
26         ;;
27 *-*-solaris*)
28         PICFLAGS="-Kpic"
29         MODULELD="$CC -G"
30         MODULEEXT=so
31         ;;
32 *)
33         PICFLAGS="-fpic"
34         MODULELD="$CC -shared"
35         MODULEEXT=so
36         ;;
37 esac
38 SHCFLAGS="$PICFLAGS $CFLAGS"
39 AC_SUBST(MODULELD)
40 AC_SUBST(MODULEEXT)
41 AC_DEFINE_UNQUOTED(MODULEEXT, "$MODULEEXT", [module extension])
42
43 # Checks for data types
44 AC_CHECK_SIZEOF(char, 1)
45 AC_CHECK_SIZEOF(short int, 2)
46 AC_CHECK_SIZEOF(int, 4)
47 AC_CHECK_SIZEOF(long int, 4)
48 AC_CHECK_SIZEOF(long long int, 8)
49 AC_CHECK_SIZEOF(void *, 1)
50
51 AC_CHECK_LIB(rt, sem_init, , )
52 AC_CHECK_LIB(posix4, sem_wait, , )
53 AC_CHECK_LIB(pthread, pthread_create, , )
54 AC_CHECK_LIB(uuid, uuid_generate, , )
55
56 AC_MSG_CHECKING([libxml2 cflags])
57 XML2CFLAGS=`xml2-config --cflags`
58 CFLAGS="$CFLAGS $XML2CFLAGS"
59 AC_MSG_RESULT([$XML2CFLAGS])
60
61 AC_MSG_CHECKING([libxml2 libs])
62 XML2LIBS=`xml2-config --libs`
63 LIBS="$LIBS $XML2LIBS"
64 AC_MSG_RESULT([$XML2LIBS])
65
66 AC_MSG_CHECKING([whether sem_init works])
67 AC_TRY_RUN(
68         [
69 #include <semaphore.h>
70 int main(void){sem_t s;return (0 != sem_init(&s,0,0));}
71         ],
72         [AC_MSG_RESULT(yes)],
73         [
74                 AC_MSG_RESULT(no)
75                 AC_DEFINE(BROKEN_SEM_INIT)
76                 AC_MSG_WARN([****** sem_init() is broken, I'll implement one myself.])
77         ]
78 )
79
80 AC_CHECK_LIB(rt, sem_init, , )
81 AC_FUNC_STRFTIME
82
83 # Checks for header files.
84 AC_CHECK_HEADERS(sys/file.h sys/types.h dirent.h sys/param.h fcntl.h errno.h limits.h \
85                  sys/resource.h pthread.h semaphore.h pwd.h stdio.h stdlib.h string.h \
86                  ctype.h unistd.h time.h sys/stat.h sys/event.h libkern/OSAtomic.h)
87
88 AC_CACHE_CHECK([for kqueue support], ac_cv_have_kqueue, [
89         AC_TRY_LINK(
90                 [ #include <sys/types.h> ],
91                 [ u_int a; a = kqueue(); ],
92                 [ ac_cv_have_kqueue="yes" ],
93                 [ ac_cv_have_kqueue="no" ]
94         )
95 ])
96 if test "x$ac_cv_have_kqueue" = "xyes" ; then
97         AC_DEFINE(HAVE_KQUEUE)
98         have_kqueue=1
99 fi
100
101
102 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
103         AC_TRY_COMPILE(
104                 [ #include <sys/types.h> ],
105                 [ u_int a; a = 1;],
106                 [ ac_cv_have_u_int="yes" ],
107                 [ ac_cv_have_u_int="no" ]
108         )
109 ])
110 if test "x$ac_cv_have_u_int" = "xyes" ; then
111         AC_DEFINE(HAVE_U_INT)
112         have_u_int=1
113 fi
114
115 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
116         AC_TRY_COMPILE(
117                 [ #include <sys/types.h> ],
118                 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
119                 [ ac_cv_have_intxx_t="yes" ],
120                 [ ac_cv_have_intxx_t="no" ]
121         )
122 ])
123 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
124         AC_DEFINE(HAVE_INTXX_T)
125         have_intxx_t=1
126 fi
127        
128 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
129         AC_TRY_COMPILE(
130                 [ #include <sys/types.h> ],
131                 [ int64_t a; a = 1;],
132                 [ ac_cv_have_int64_t="yes" ],
133                 [ ac_cv_have_int64_t="no" ]
134         )
135 ])
136 if test "x$ac_cv_have_int64_t" = "xyes" ; then
137         AC_DEFINE(HAVE_INT64_T)
138         have_int64_t=1
139 fi
140        
141 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
142         AC_TRY_COMPILE(
143                 [ #include <sys/types.h> ],
144                 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
145                 [ ac_cv_have_u_intxx_t="yes" ],
146                 [ ac_cv_have_u_intxx_t="no" ]
147         )
148 ])
149 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
150         AC_DEFINE(HAVE_U_INTXX_T)
151         have_u_intxx_t=1
152 fi
153
154 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
155         AC_TRY_COMPILE(
156                 [ #include <sys/types.h> ],
157                 [ u_int64_t a; a = 1;],
158                 [ ac_cv_have_u_int64_t="yes" ],
159                 [ ac_cv_have_u_int64_t="no" ]
160         )
161 ])
162 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
163         AC_DEFINE(HAVE_U_INT64_T)
164         have_u_int64_t=1
165 fi
166
167 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
168            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
169 then
170         AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
171         AC_TRY_COMPILE(
172                 [
173 #include <sys/bitypes.h>
174                 ],
175                 [
176                         int8_t a; int16_t b; int32_t c;
177                         u_int8_t e; u_int16_t f; u_int32_t g;
178                         a = b = c = e = f = g = 1;
179                 ],
180                 [
181                         AC_DEFINE(HAVE_U_INTXX_T)
182                         AC_DEFINE(HAVE_INTXX_T)
183                         AC_MSG_RESULT(yes)
184                 ],
185                 [AC_MSG_RESULT(no)]
186         )
187 fi
188
189 if test -z "$have_u_intxx_t" ; then
190         AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
191                 AC_TRY_COMPILE(
192                         [
193 #include <sys/types.h>
194                         ],
195                         [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
196                         [ ac_cv_have_uintxx_t="yes" ],
197                         [ ac_cv_have_uintxx_t="no" ]
198                 )
199         ])
200         if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
201                 AC_DEFINE(HAVE_UINTXX_T)
202         fi
203 fi
204
205 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
206         AC_TRY_COMPILE(
207                 [
208 #include <sys/types.h>
209 #include <sys/socket.h>
210                 ],
211                 [socklen_t foo; foo = 1235;],
212                 [ ac_cv_have_socklen_t="yes" ],
213                 [ ac_cv_have_socklen_t="no" ]
214         )
215 ])
216 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
217         AC_DEFINE(HAVE_SOCKLEN_T)
218 fi
219
220 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
221         AC_TRY_COMPILE(
222                 [
223 #include <sys/types.h>
224                 ],
225                 [ size_t foo; foo = 1235; ],
226                 [ ac_cv_have_size_t="yes" ],
227                 [ ac_cv_have_size_t="no" ]
228         )
229 ])
230 if test "x$ac_cv_have_size_t" = "xyes" ; then
231         AC_DEFINE(HAVE_SIZE_T)
232 fi
233
234 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
235         AC_TRY_COMPILE(
236                 [
237 #include <sys/types.h>
238                 ],
239                 [ ssize_t foo; foo = 1235; ],
240                 [ ac_cv_have_ssize_t="yes" ],
241                 [ ac_cv_have_ssize_t="no" ]
242         )
243 ])
244 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
245         AC_DEFINE(HAVE_SSIZE_T)
246 fi
247
248 docdir="docs"
249 mansubdir="man"
250 AC_SUBST(docdir)
251 AC_SUBST(mansubdir)
252
253 CPPFLAGS='-I$(top_srcdir)/src'
254 AC_SUBST(SHCFLAGS)
255
256 AC_MSG_CHECKING([Resolving libexec path...])
257 fullpath=$libexecdir
258 while test "x$temppath" != "x$fullpath" ; do
259   temppath=$fullpath
260   fullpath=`eval echo ${fullpath}`
261 done
262 fullpath=`echo $fullpath | sed "s~NONE~$ac_default_prefix~"`
263 AC_MSG_RESULT([$fullpath])
264 AC_DEFINE_UNQUOTED(MODULES_DIR, "${fullpath}")
265 MODULES_DIR=${fullpath}
266 AC_SUBST(MODULES_DIR)
267
268 AC_MSG_CHECKING([Resolving sysconfdir path...])
269 fullpath=$sysconfdir
270 while test "x$temppath" != "x$fullpath" ; do
271   temppath=$fullpath
272   fullpath=`eval echo ${fullpath}`
273 done
274 fullpath=`echo $fullpath | sed "s~NONE~$ac_default_prefix~"`
275 AC_MSG_RESULT([$fullpath])
276 AC_DEFINE_UNQUOTED(ETC_DIR, "${fullpath}")
277 ETC_DIR=${fullpath}
278 AC_SUBST(ETC_DIR)
279
280
281 AC_OUTPUT([
282 Makefile
283 src/Makefile
284 src/eventer/Makefile
285 src/jlog/Makefile
286 src/modules/Makefile
287 src/utils/Makefile
288 ])
Note: See TracBrowser for help on using the browser.