root/configure.in

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

oh yeah.. need libpq

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