| 1 |
AC_INIT(src/noitd.c) |
|---|
| 2 |
AC_CONFIG_HEADER(src/noit_config.h) |
|---|
| 3 |
|
|---|
| 4 |
AC_PROG_CC |
|---|
| 5 |
AC_C_INLINE |
|---|
| 6 |
AC_C_BIGENDIAN |
|---|
| 7 |
AC_PROG_CPP |
|---|
| 8 |
AC_PROG_RANLIB |
|---|
| 9 |
AC_PROG_INSTALL |
|---|
| 10 |
AC_PROG_LN_S |
|---|
| 11 |
AC_PATH_PROG(AR, ar) |
|---|
| 12 |
AC_PATH_PROGS(PERL, perl) |
|---|
| 13 |
AC_SUBST(PERL) |
|---|
| 14 |
|
|---|
| 15 |
# Checks for data types |
|---|
| 16 |
AC_CHECK_SIZEOF(char, 1) |
|---|
| 17 |
AC_CHECK_SIZEOF(short int, 2) |
|---|
| 18 |
AC_CHECK_SIZEOF(int, 4) |
|---|
| 19 |
AC_CHECK_SIZEOF(long int, 4) |
|---|
| 20 |
AC_CHECK_SIZEOF(long long int, 8) |
|---|
| 21 |
AC_CHECK_SIZEOF(void *, 1) |
|---|
| 22 |
|
|---|
| 23 |
AC_CHECK_LIB(rt, sem_init, , ) |
|---|
| 24 |
AC_CHECK_LIB(posix4, sem_wait, , ) |
|---|
| 25 |
|
|---|
| 26 |
AC_MSG_CHECKING([whether sem_init works]) |
|---|
| 27 |
AC_TRY_RUN( |
|---|
| 28 |
[ |
|---|
| 29 |
#include <semaphore.h> |
|---|
| 30 |
int main(void){sem_t s;return (0 != sem_init(&s,0,0));} |
|---|
| 31 |
], |
|---|
| 32 |
[AC_MSG_RESULT(yes)], |
|---|
| 33 |
[ |
|---|
| 34 |
AC_MSG_RESULT(no) |
|---|
| 35 |
AC_DEFINE(BROKEN_SEM_INIT) |
|---|
| 36 |
AC_MSG_WARN([****** sem_init() is broken, I'll implement one myself.]) |
|---|
| 37 |
] |
|---|
| 38 |
) |
|---|
| 39 |
|
|---|
| 40 |
AC_CHECK_LIB(rt, sem_init, , ) |
|---|
| 41 |
AC_FUNC_STRFTIME |
|---|
| 42 |
|
|---|
| 43 |
# Checks for header files. |
|---|
| 44 |
AC_CHECK_HEADERS(sys/file.h sys/types.h dirent.h sys/param.h fcntl.h errno.h limits.h \ |
|---|
| 45 |
sys/resource.h pthread.h semaphore.h pwd.h stdio.h stdlib.h string.h \ |
|---|
| 46 |
ctype.h unistd.h time.h sys/stat.h sys/event.h libkern/OSAtomic.h) |
|---|
| 47 |
|
|---|
| 48 |
AC_CACHE_CHECK([for kqueue support], ac_cv_have_kqueue, [ |
|---|
| 49 |
AC_TRY_LINK( |
|---|
| 50 |
[ #include <sys/types.h> ], |
|---|
| 51 |
[ u_int a; a = kqueue(); ], |
|---|
| 52 |
[ ac_cv_have_kqueue="yes" ], |
|---|
| 53 |
[ ac_cv_have_kqueue="no" ] |
|---|
| 54 |
) |
|---|
| 55 |
]) |
|---|
| 56 |
if test "x$ac_cv_have_kqueue" = "xyes" ; then |
|---|
| 57 |
AC_DEFINE(HAVE_KQUEUE) |
|---|
| 58 |
have_kqueue=1 |
|---|
| 59 |
fi |
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [ |
|---|
| 63 |
AC_TRY_COMPILE( |
|---|
| 64 |
[ #include <sys/types.h> ], |
|---|
| 65 |
[ u_int a; a = 1;], |
|---|
| 66 |
[ ac_cv_have_u_int="yes" ], |
|---|
| 67 |
[ ac_cv_have_u_int="no" ] |
|---|
| 68 |
) |
|---|
| 69 |
]) |
|---|
| 70 |
if test "x$ac_cv_have_u_int" = "xyes" ; then |
|---|
| 71 |
AC_DEFINE(HAVE_U_INT) |
|---|
| 72 |
have_u_int=1 |
|---|
| 73 |
fi |
|---|
| 74 |
|
|---|
| 75 |
AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [ |
|---|
| 76 |
AC_TRY_COMPILE( |
|---|
| 77 |
[ #include <sys/types.h> ], |
|---|
| 78 |
[ int8_t a; int16_t b; int32_t c; a = b = c = 1;], |
|---|
| 79 |
[ ac_cv_have_intxx_t="yes" ], |
|---|
| 80 |
[ ac_cv_have_intxx_t="no" ] |
|---|
| 81 |
) |
|---|
| 82 |
]) |
|---|
| 83 |
if test "x$ac_cv_have_intxx_t" = "xyes" ; then |
|---|
| 84 |
AC_DEFINE(HAVE_INTXX_T) |
|---|
| 85 |
have_intxx_t=1 |
|---|
| 86 |
fi |
|---|
| 87 |
|
|---|
| 88 |
AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [ |
|---|
| 89 |
AC_TRY_COMPILE( |
|---|
| 90 |
[ #include <sys/types.h> ], |
|---|
| 91 |
[ int64_t a; a = 1;], |
|---|
| 92 |
[ ac_cv_have_int64_t="yes" ], |
|---|
| 93 |
[ ac_cv_have_int64_t="no" ] |
|---|
| 94 |
) |
|---|
| 95 |
]) |
|---|
| 96 |
if test "x$ac_cv_have_int64_t" = "xyes" ; then |
|---|
| 97 |
AC_DEFINE(HAVE_INT64_T) |
|---|
| 98 |
have_int64_t=1 |
|---|
| 99 |
fi |
|---|
| 100 |
|
|---|
| 101 |
AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [ |
|---|
| 102 |
AC_TRY_COMPILE( |
|---|
| 103 |
[ #include <sys/types.h> ], |
|---|
| 104 |
[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;], |
|---|
| 105 |
[ ac_cv_have_u_intxx_t="yes" ], |
|---|
| 106 |
[ ac_cv_have_u_intxx_t="no" ] |
|---|
| 107 |
) |
|---|
| 108 |
]) |
|---|
| 109 |
if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then |
|---|
| 110 |
AC_DEFINE(HAVE_U_INTXX_T) |
|---|
| 111 |
have_u_intxx_t=1 |
|---|
| 112 |
fi |
|---|
| 113 |
|
|---|
| 114 |
AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [ |
|---|
| 115 |
AC_TRY_COMPILE( |
|---|
| 116 |
[ #include <sys/types.h> ], |
|---|
| 117 |
[ u_int64_t a; a = 1;], |
|---|
| 118 |
[ ac_cv_have_u_int64_t="yes" ], |
|---|
| 119 |
[ ac_cv_have_u_int64_t="no" ] |
|---|
| 120 |
) |
|---|
| 121 |
]) |
|---|
| 122 |
if test "x$ac_cv_have_u_int64_t" = "xyes" ; then |
|---|
| 123 |
AC_DEFINE(HAVE_U_INT64_T) |
|---|
| 124 |
have_u_int64_t=1 |
|---|
| 125 |
fi |
|---|
| 126 |
|
|---|
| 127 |
if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \ |
|---|
| 128 |
test "x$ac_cv_header_sys_bitypes_h" = "xyes") |
|---|
| 129 |
then |
|---|
| 130 |
AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h]) |
|---|
| 131 |
AC_TRY_COMPILE( |
|---|
| 132 |
[ |
|---|
| 133 |
#include <sys/bitypes.h> |
|---|
| 134 |
], |
|---|
| 135 |
[ |
|---|
| 136 |
int8_t a; int16_t b; int32_t c; |
|---|
| 137 |
u_int8_t e; u_int16_t f; u_int32_t g; |
|---|
| 138 |
a = b = c = e = f = g = 1; |
|---|
| 139 |
], |
|---|
| 140 |
[ |
|---|
| 141 |
AC_DEFINE(HAVE_U_INTXX_T) |
|---|
| 142 |
AC_DEFINE(HAVE_INTXX_T) |
|---|
| 143 |
AC_MSG_RESULT(yes) |
|---|
| 144 |
], |
|---|
| 145 |
[AC_MSG_RESULT(no)] |
|---|
| 146 |
) |
|---|
| 147 |
fi |
|---|
| 148 |
|
|---|
| 149 |
if test -z "$have_u_intxx_t" ; then |
|---|
| 150 |
AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [ |
|---|
| 151 |
AC_TRY_COMPILE( |
|---|
| 152 |
[ |
|---|
| 153 |
#include <sys/types.h> |
|---|
| 154 |
], |
|---|
| 155 |
[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ], |
|---|
| 156 |
[ ac_cv_have_uintxx_t="yes" ], |
|---|
| 157 |
[ ac_cv_have_uintxx_t="no" ] |
|---|
| 158 |
) |
|---|
| 159 |
]) |
|---|
| 160 |
if test "x$ac_cv_have_uintxx_t" = "xyes" ; then |
|---|
| 161 |
AC_DEFINE(HAVE_UINTXX_T) |
|---|
| 162 |
fi |
|---|
| 163 |
fi |
|---|
| 164 |
|
|---|
| 165 |
AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [ |
|---|
| 166 |
AC_TRY_COMPILE( |
|---|
| 167 |
[ |
|---|
| 168 |
#include <sys/types.h> |
|---|
| 169 |
#include <sys/socket.h> |
|---|
| 170 |
], |
|---|
| 171 |
[socklen_t foo; foo = 1235;], |
|---|
| 172 |
[ ac_cv_have_socklen_t="yes" ], |
|---|
| 173 |
[ ac_cv_have_socklen_t="no" ] |
|---|
| 174 |
) |
|---|
| 175 |
]) |
|---|
| 176 |
if test "x$ac_cv_have_socklen_t" = "xyes" ; then |
|---|
| 177 |
AC_DEFINE(HAVE_SOCKLEN_T) |
|---|
| 178 |
fi |
|---|
| 179 |
|
|---|
| 180 |
AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [ |
|---|
| 181 |
AC_TRY_COMPILE( |
|---|
| 182 |
[ |
|---|
| 183 |
#include <sys/types.h> |
|---|
| 184 |
], |
|---|
| 185 |
[ size_t foo; foo = 1235; ], |
|---|
| 186 |
[ ac_cv_have_size_t="yes" ], |
|---|
| 187 |
[ ac_cv_have_size_t="no" ] |
|---|
| 188 |
) |
|---|
| 189 |
]) |
|---|
| 190 |
if test "x$ac_cv_have_size_t" = "xyes" ; then |
|---|
| 191 |
AC_DEFINE(HAVE_SIZE_T) |
|---|
| 192 |
fi |
|---|
| 193 |
|
|---|
| 194 |
AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [ |
|---|
| 195 |
AC_TRY_COMPILE( |
|---|
| 196 |
[ |
|---|
| 197 |
#include <sys/types.h> |
|---|
| 198 |
], |
|---|
| 199 |
[ ssize_t foo; foo = 1235; ], |
|---|
| 200 |
[ ac_cv_have_ssize_t="yes" ], |
|---|
| 201 |
[ ac_cv_have_ssize_t="no" ] |
|---|
| 202 |
) |
|---|
| 203 |
]) |
|---|
| 204 |
if test "x$ac_cv_have_ssize_t" = "xyes" ; then |
|---|
| 205 |
AC_DEFINE(HAVE_SSIZE_T) |
|---|
| 206 |
fi |
|---|
| 207 |
|
|---|
| 208 |
docdir="docs" |
|---|
| 209 |
mansubdir="man" |
|---|
| 210 |
AC_SUBST(docdir) |
|---|
| 211 |
AC_SUBST(mansubdir) |
|---|
| 212 |
|
|---|
| 213 |
CPPFLAGS='-I$(top_srcdir)/src' |
|---|
| 214 |
|
|---|
| 215 |
AC_OUTPUT([ |
|---|
| 216 |
Makefile |
|---|
| 217 |
src/Makefile |
|---|
| 218 |
src/utils/Makefile |
|---|
| 219 |
src/jlog/Makefile |
|---|
| 220 |
src/eventer/Makefile |
|---|
| 221 |
]) |
|---|