root/configure.in

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

figure out what to add (for the libedit stuff)

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