root/configure.in

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

SSL support that doesn't quite work -- so so so close.

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