root/configure.in

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

some extra autoconf wizardry for libedit

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