root/configure.in

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

oh my... http

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