root/configure.in

Revision bafab25395cb398ddf5eae42145f0d0bfc00ec22, 6.7 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 6 years ago)

import of libedit... prepare to hack

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