root/configure.in

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

update.. prep for config system and module loading

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