| 1 | dnl ------------------------------------------------------------------------ |
|---|
| 2 | dnl configure.in: GNU autoconf script generator. |
|---|
| 3 | dnl |
|---|
| 4 | dnl Copyright 2002-2005 the Ithildin Project. |
|---|
| 5 | dnl See the COPYING file for more information on licensing and use. |
|---|
| 6 | AC_REVISION($Id$) |
|---|
| 7 | dnl ------------------------------------------------------------------------ |
|---|
| 8 | AC_INIT(ithildin, 1.1, wd@ithildin.org, ithildin) |
|---|
| 9 | |
|---|
| 10 | AC_CONFIG_AUX_DIR(autoconf) |
|---|
| 11 | AC_CONFIG_HEADER(include/config.h) |
|---|
| 12 | AC_PREFIX_DEFAULT(/usr/local) |
|---|
| 13 | |
|---|
| 14 | dnl ------------------------------------------------------------------------ |
|---|
| 15 | dnl Get the version number/name/etc |
|---|
| 16 | dnl ------------------------------------------------------------------------ |
|---|
| 17 | PACKAGE=ithildin |
|---|
| 18 | |
|---|
| 19 | VERSION=`grep -E '^#define BASENAME_VER' include/ithildin/stand.h | sed s/'.define BASENAME_VER '// | sed s/'\"'//g | xargs echo -n` |
|---|
| 20 | VERSION="$VERSION-`grep -E '^#define MAJOR_VER' include/ithildin/stand.h | sed s/'.define MAJOR_VER '// | xargs echo -n`" |
|---|
| 21 | VERSION="$VERSION.`grep -E '^#define MINOR_VER' include/ithildin/stand.h | sed s/'.define MINOR_VER '// | xargs echo -n`" |
|---|
| 22 | VERSION="$VERSION.`grep -E '^#define PATCH_VER' include/ithildin/stand.h | sed s/'.define PATCH_VER '// | xargs echo -n`" |
|---|
| 23 | |
|---|
| 24 | AC_SUBST(PACKAGE) |
|---|
| 25 | AC_SUBST(VERSION) |
|---|
| 26 | |
|---|
| 27 | dnl ------------------------------------------------------------------------ |
|---|
| 28 | dnl Check for machine/vendor/operating system type |
|---|
| 29 | dnl ------------------------------------------------------------------------ |
|---|
| 30 | AC_CANONICAL_HOST |
|---|
| 31 | |
|---|
| 32 | dnl ------------------------------------------------------------------------ |
|---|
| 33 | dnl Checks for programs. |
|---|
| 34 | dnl ------------------------------------------------------------------------ |
|---|
| 35 | AC_PROG_CC |
|---|
| 36 | ICC=no |
|---|
| 37 | AC_MSG_CHECKING([whether we are using the Intel C Compiler]) |
|---|
| 38 | case `$CC -V 2>&1` in |
|---|
| 39 | *Intel*) |
|---|
| 40 | AC_MSG_RESULT([yes]) |
|---|
| 41 | ICC=yes |
|---|
| 42 | ;; |
|---|
| 43 | *) |
|---|
| 44 | AC_MSG_RESULT([no]) |
|---|
| 45 | ;; |
|---|
| 46 | esac |
|---|
| 47 | AC_PROG_INSTALL |
|---|
| 48 | AC_PROG_LN_S |
|---|
| 49 | AC_PROG_MAKE_SET |
|---|
| 50 | AC_CHECK_PROG(RM, rm, rm) |
|---|
| 51 | |
|---|
| 52 | dnl ------------------------------------------------------------------------ |
|---|
| 53 | dnl Checks for libraries. |
|---|
| 54 | dnl ------------------------------------------------------------------------ |
|---|
| 55 | found_dlopen="yes" |
|---|
| 56 | AC_CHECK_LIB(dl, dlopen,, found_dlopen="no") |
|---|
| 57 | AC_CHECK_LIB(nsl, gethostbyname) |
|---|
| 58 | AC_CHECK_LIB(socket, socket) |
|---|
| 59 | |
|---|
| 60 | dnl ------------------------------------------------------------------------ |
|---|
| 61 | dnl Checks for header files. |
|---|
| 62 | dnl ------------------------------------------------------------------------ |
|---|
| 63 | AC_HEADER_STDC |
|---|
| 64 | AC_CHECK_HEADERS(assert.h dl.h dlfcn.h errno.h fcntl.h features.h grp.h) |
|---|
| 65 | AC_CHECK_HEADERS(limits.h math.h netdb.h pwd.h unistd.h stdbool.h) |
|---|
| 66 | AC_CHECK_HEADERS(arpa/inet.h) |
|---|
| 67 | AC_CHECK_HEADERS(machine/endian.h) |
|---|
| 68 | AC_CHECK_HEADERS(netinet/in.h) |
|---|
| 69 | AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/socket.h sys/stat.h sys/time.h) |
|---|
| 70 | AC_HEADER_TIME |
|---|
| 71 | |
|---|
| 72 | dnl ------------------------------------------------------------------------ |
|---|
| 73 | dnl Checks for typedefs, structures, and compiler characteristics. |
|---|
| 74 | dnl ------------------------------------------------------------------------ |
|---|
| 75 | AC_C_CONST |
|---|
| 76 | if test "$ac_cv_header_machine_endian_h" = "no" ; then |
|---|
| 77 | AC_C_BIGENDIAN |
|---|
| 78 | fi |
|---|
| 79 | AC_TYPE_PID_T |
|---|
| 80 | AC_TYPE_SIZE_T |
|---|
| 81 | AC_CHECK_SIZEOF(short) |
|---|
| 82 | AC_CHECK_SIZEOF(int) |
|---|
| 83 | AC_CHECK_SIZEOF(long) |
|---|
| 84 | AC_CHECK_SIZEOF(long long) |
|---|
| 85 | if test "$ac_cv_sizeof_short" = "2" ; then |
|---|
| 86 | AC_CHECK_TYPE(int16_t, short) |
|---|
| 87 | AC_CHECK_TYPE(uint16_t, unsigned short) |
|---|
| 88 | else |
|---|
| 89 | if test "$ac_cv_sizeof_int" = "2" ; then |
|---|
| 90 | AC_CHECK_TYPE(int16_t, int) |
|---|
| 91 | AC_CHECK_TYPE(uint16_t, unsigned int) |
|---|
| 92 | else |
|---|
| 93 | AC_MSG_ERROR([I can't seem to find a 2 byte integer on your system!]) |
|---|
| 94 | fi |
|---|
| 95 | fi |
|---|
| 96 | if test "$ac_cv_sizeof_int" = "4" ; then |
|---|
| 97 | AC_CHECK_TYPE(int32_t, int) |
|---|
| 98 | AC_CHECK_TYPE(uint32_t, unsigned int) |
|---|
| 99 | else |
|---|
| 100 | if test "$ac_cv_sizeof_long" = "4" ; then |
|---|
| 101 | AC_CHECK_TYPE(int32_t, long) |
|---|
| 102 | AC_CHECK_TYPE(uint32_t, unsigned long) |
|---|
| 103 | else |
|---|
| 104 | AC_MSG_ERROR([I can't seem to find a 4 byte integer on your system!]) |
|---|
| 105 | fi |
|---|
| 106 | fi |
|---|
| 107 | if test "$ac_cv_sizeof_long_long" = "8" ; then |
|---|
| 108 | AC_CHECK_TYPE(int64_t, long long) |
|---|
| 109 | AC_CHECK_TYPE(uint64_t, unsigned long long) |
|---|
| 110 | else |
|---|
| 111 | if test "$ac_cv_sizeof_long" = "8" ; then |
|---|
| 112 | AC_CHECK_TYPE(int64_t, long long) |
|---|
| 113 | AC_CHECK_TYPE(uint64_t, unsigned long) |
|---|
| 114 | else |
|---|
| 115 | AC_MSG_ERROR([I can't seem to find an 8 byte integer on your system!]) |
|---|
| 116 | fi |
|---|
| 117 | fi |
|---|
| 118 | AC_C_LONG_DOUBLE |
|---|
| 119 | AC_C_INLINE |
|---|
| 120 | |
|---|
| 121 | if test "$ac_cv_c_inline" = "no" ; then |
|---|
| 122 | AC_MSG_ERROR([Your compiler has no inline support.]) |
|---|
| 123 | fi |
|---|
| 124 | |
|---|
| 125 | dnl ------------------------------------------------------------------------ |
|---|
| 126 | dnl Checks for library functions. |
|---|
| 127 | dnl ------------------------------------------------------------------------ |
|---|
| 128 | AC_FUNC_VPRINTF |
|---|
| 129 | AC_CHECK_FUNCS(strdup strerror strtod strtol strsep vsnprintf) |
|---|
| 130 | AC_CHECK_FUNCS(getcwd gettimeofday usleep) |
|---|
| 131 | if test "$found_dlopen" = "no" ; then |
|---|
| 132 | AC_CHECK_FUNCS(dlopen) |
|---|
| 133 | fi |
|---|
| 134 | |
|---|
| 135 | if test "$ac_cv_func_dlopen" = "no" ; then |
|---|
| 136 | AC_MSG_ERROR([your system does not have dynamic library functions, you will be unable to use this software, sorry.]) |
|---|
| 137 | fi |
|---|
| 138 | |
|---|
| 139 | dnl ----- |
|---|
| 140 | dnl look for 'fmtcheck' (on FreeBSD and NetBSD at least). If it's not there |
|---|
| 141 | dnl use the contrib/ bits. Also look for 'strlcpy' (a similar BSD call) |
|---|
| 142 | dnl ----- |
|---|
| 143 | AC_CHECK_FUNCS(fmtcheck strlcat strlcpy) |
|---|
| 144 | |
|---|
| 145 | dnl ---- |
|---|
| 146 | dnl socket functions |
|---|
| 147 | dnl ---- |
|---|
| 148 | AC_CHECK_FUNCS(kqueue poll select socket) |
|---|
| 149 | AC_CHECK_FUNCS(recv send setsockopt) |
|---|
| 150 | |
|---|
| 151 | dnl ---- |
|---|
| 152 | dnl stuff for malloc |
|---|
| 153 | dnl ---- |
|---|
| 154 | AC_CHECK_FUNCS(mmap munmap madvise brk sbrk) |
|---|
| 155 | AC_CHECK_FUNCS(readlink getenv) |
|---|
| 156 | |
|---|
| 157 | dnl ---- |
|---|
| 158 | dnl some stuff for changing user ids |
|---|
| 159 | dnl ---- |
|---|
| 160 | AC_CHECK_FUNCS(setuid seteuid setreuid setgid setegid setgroups) |
|---|
| 161 | AC_CHECK_FUNCS(geteuid getuid getgid getpwnam getgrnam) |
|---|
| 162 | |
|---|
| 163 | dnl ---- |
|---|
| 164 | dnl stuff to change coredump sizes |
|---|
| 165 | dnl ---- |
|---|
| 166 | AC_CHECK_FUNCS(getrlimit setrlimit) |
|---|
| 167 | |
|---|
| 168 | dnl ------------------------------------------------------------------------ |
|---|
| 169 | dnl try to figure out the 'page shift' of the system by executing a test |
|---|
| 170 | dnl program which returns that count. in our case a non-zero return |
|---|
| 171 | dnl actually means success |
|---|
| 172 | dnl ------------------------------------------------------------------------ |
|---|
| 173 | AC_MSG_CHECKING([the system's memory page size]) |
|---|
| 174 | pagesize="no" |
|---|
| 175 | AC_TRY_RUN([ |
|---|
| 176 | #include <stdio.h> |
|---|
| 177 | #if HAVE_UNISTD_H |
|---|
| 178 | # include <unistd.h> |
|---|
| 179 | #endif |
|---|
| 180 | |
|---|
| 181 | int main(void) { |
|---|
| 182 | FILE *fp = fopen("conftest.malloc", "w"); |
|---|
| 183 | |
|---|
| 184 | if (fp != NULL) { |
|---|
| 185 | fprintf(fp, "%d\n", getpagesize()); |
|---|
| 186 | fclose(fp); |
|---|
| 187 | } else |
|---|
| 188 | exit(1); |
|---|
| 189 | exit(0); |
|---|
| 190 | }],[ |
|---|
| 191 | if test -f "conftest.malloc" ; then |
|---|
| 192 | pagesize=`cat conftest.malloc` |
|---|
| 193 | fi |
|---|
| 194 | ]) |
|---|
| 195 | if test "$pagesize" != "no" ; then |
|---|
| 196 | AC_MSG_RESULT($pagesize) |
|---|
| 197 | else |
|---|
| 198 | if test "$ac_cv_sizeof_int" = "4" ; then |
|---|
| 199 | pagesize=4096 |
|---|
| 200 | else |
|---|
| 201 | pagesize=8192 |
|---|
| 202 | fi |
|---|
| 203 | AC_MSG_RESULT([$pagesize (guessing)]) |
|---|
| 204 | fi |
|---|
| 205 | AC_DEFINE_UNQUOTED(MALLOC_PAGESIZE, $pagesize, |
|---|
| 206 | [the system's memory page size]) |
|---|
| 207 | |
|---|
| 208 | dnl ------------------------------------------------------------------------ |
|---|
| 209 | dnl various malloc tests: |
|---|
| 210 | dnl - see if we can override the system malloc |
|---|
| 211 | dnl - see if we can use mmap and sbrk/brk |
|---|
| 212 | dnl ------------------------------------------------------------------------ |
|---|
| 213 | AC_MSG_CHECKING([whether erobbins will hate me (override system malloc?)]) |
|---|
| 214 | malloc_alternatives="no" |
|---|
| 215 | AC_TRY_RUN([ |
|---|
| 216 | int okay = 0; |
|---|
| 217 | #define malloc test_malloc |
|---|
| 218 | char *test_malloc(int size) { |
|---|
| 219 | okay = size; |
|---|
| 220 | return (char *)0; |
|---|
| 221 | } |
|---|
| 222 | int main(void) { |
|---|
| 223 | malloc(42); |
|---|
| 224 | if (okay) |
|---|
| 225 | exit(0); |
|---|
| 226 | exit(1); |
|---|
| 227 | }],[malloc_override="yes"]) |
|---|
| 228 | if test "$ac_cv_func_sbrk" = "yes" -a "$ac_cv_func_brk" = "yes" -a \ |
|---|
| 229 | "$ac_cv_func_mmap" = "yes" -a "$ac_cv_func_munmap" = yes ; then |
|---|
| 230 | AC_DEFINE(MALLOC_LOWLEVEL, 1, [Really do low level malloc management]) |
|---|
| 231 | malloc_alternatives="yes" |
|---|
| 232 | fi |
|---|
| 233 | |
|---|
| 234 | if test "$malloc_override" = "yes" -a "$malloc_alternatives" = "yes" ; then |
|---|
| 235 | AC_DEFINE(MALLOC_OVERRIDE, 1, [Go ahead and override the system malloc]) |
|---|
| 236 | AC_MSG_RESULT([yes]) |
|---|
| 237 | else |
|---|
| 238 | AC_MSG_RESULT([no]) |
|---|
| 239 | fi |
|---|
| 240 | |
|---|
| 241 | dnl ------------------------------------------------------------------------ |
|---|
| 242 | dnl Below are checks to determine how to do shared object support |
|---|
| 243 | dnl for making shared libraries and stuff like that. This has been borrowed |
|---|
| 244 | dnl or based on various projects I've seen floating around. |
|---|
| 245 | dnl ------------------------------------------------------------------------ |
|---|
| 246 | CCDLL="${CC}" |
|---|
| 247 | tldf=$LDFLAGS |
|---|
| 248 | AC_MSG_CHECKING(for the -export-dynamic ld flag) |
|---|
| 249 | LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" |
|---|
| 250 | AC_TRY_LINK(, [int i;], found=yes, found=no) |
|---|
| 251 | AC_MSG_RESULT($found) |
|---|
| 252 | if test "$found" = "no" ; then |
|---|
| 253 | LDFLAGS=$tldf |
|---|
| 254 | fi |
|---|
| 255 | |
|---|
| 256 | if test -n "$GCC" ; then |
|---|
| 257 | CFLAGSDLL="${CFLAGSDLL} -fPIC -DPIC -shared" |
|---|
| 258 | else if test -n "$ICC" ; then |
|---|
| 259 | CFLAGSDLL="${CFLAGSDLL} -KPIC -DPIC -shared" |
|---|
| 260 | fi |
|---|
| 261 | fi |
|---|
| 262 | |
|---|
| 263 | LDFLAGSDLL="-shared" |
|---|
| 264 | |
|---|
| 265 | tldf=$LDFLAGS |
|---|
| 266 | AC_MSG_CHECKING(for the -nostdlib compiler flag) |
|---|
| 267 | LDFLAGS="${LDFLAGS} -nostdlib" |
|---|
| 268 | AC_TRY_LINK(, [int i;], found=yes, found=no) |
|---|
| 269 | AC_MSG_RESULT($found) |
|---|
| 270 | if test "$found" = "yes" ; then |
|---|
| 271 | LDFLAGSDLL="$LDFLAGSDLL -nostdlib" |
|---|
| 272 | fi |
|---|
| 273 | LDFLAGS=$tldf |
|---|
| 274 | |
|---|
| 275 | AC_SUBST(CCDLL) |
|---|
| 276 | AC_SUBST(CFLAGSDLL) |
|---|
| 277 | AC_SUBST(LDFLAGSDLL) |
|---|
| 278 | |
|---|
| 279 | dnl ------------------------------------------------------------------- |
|---|
| 280 | dnl Choose our type of socket handling. the default is to use select() |
|---|
| 281 | dnl we add the --with argument first so the user can manually select, |
|---|
| 282 | dnl if desired. in this case no checks as to the validity of their |
|---|
| 283 | dnl selection are made. |
|---|
| 284 | dnl ------------------------------------------------------------------- |
|---|
| 285 | POLLER="" |
|---|
| 286 | AC_ARG_WITH(poller, |
|---|
| 287 | AC_HELP_STRING([--with-poller=x], |
|---|
| 288 | [set the poller to x (one of select, poll, kqueue, devpoll)]), |
|---|
| 289 | POLLER="$with_poller" |
|---|
| 290 | ithildin_cv_poller="$POLLER" |
|---|
| 291 | ) |
|---|
| 292 | |
|---|
| 293 | AC_CACHE_CHECK([for which polling function to use], ithildin_cv_poller, |
|---|
| 294 | [ |
|---|
| 295 | |
|---|
| 296 | if test "x$POLLER" = "x" ; then |
|---|
| 297 | case "$host_os" in |
|---|
| 298 | freebsd*|netbsd*|openbsd*) |
|---|
| 299 | if test "$ac_cv_func_kqueue" = "yes" ; then |
|---|
| 300 | POLLER=kqueue |
|---|
| 301 | fi |
|---|
| 302 | ;; |
|---|
| 303 | solaris*|sunos*|linux*) |
|---|
| 304 | if test -e /dev/poll ; then |
|---|
| 305 | POLLER=/dev/poll |
|---|
| 306 | fi |
|---|
| 307 | ;; |
|---|
| 308 | esac |
|---|
| 309 | |
|---|
| 310 | if test -z "$POLLER" ; then |
|---|
| 311 | if test "$ac_cv_func_select" = "yes" ; then |
|---|
| 312 | POLLER=select |
|---|
| 313 | else |
|---|
| 314 | if test "$ac_cv_func_poll" = "yes" ; then |
|---|
| 315 | POLLER=poll |
|---|
| 316 | else |
|---|
| 317 | AC_MSG_ERROR( |
|---|
| 318 | [your system doesn't seem to have select or poll, or any other |
|---|
| 319 | method by which to check socket activity. this daemon will not |
|---|
| 320 | function, sorry.]) |
|---|
| 321 | fi |
|---|
| 322 | fi |
|---|
| 323 | fi |
|---|
| 324 | fi |
|---|
| 325 | ithildin_cv_poller="$POLLER" |
|---|
| 326 | ]) |
|---|
| 327 | |
|---|
| 328 | POLLER="$ithildin_cv_poller" |
|---|
| 329 | case "$POLLER" in |
|---|
| 330 | select) |
|---|
| 331 | AC_DEFINE(POLLER_SELECT, 1, [The select() system call]) |
|---|
| 332 | ;; |
|---|
| 333 | poll) |
|---|
| 334 | AC_DEFINE(POLLER_POLL, 1, [The poll() system call]) |
|---|
| 335 | ;; |
|---|
| 336 | kqueue) |
|---|
| 337 | AC_DEFINE(POLLER_KQUEUE, 1, [The kqueue() system call]) |
|---|
| 338 | ;; |
|---|
| 339 | devpoll) |
|---|
| 340 | AC_DEFINE(POLLER_DEVPOLL, 1, [The /dev/poll device]) |
|---|
| 341 | ;; |
|---|
| 342 | *) |
|---|
| 343 | AC_MSG_ERROR([The poller "$POLLER" is not supported by this system, |
|---|
| 344 | try again?]) |
|---|
| 345 | ;; |
|---|
| 346 | esac |
|---|
| 347 | AC_SUBST(POLLER) |
|---|
| 348 | |
|---|
| 349 | dnl ------------------------------------------------------------------------ |
|---|
| 350 | dnl this function is used for pretty output generation. |
|---|
| 351 | dnl ------------------------------------------------------------------------ |
|---|
| 352 | ith_feature_append () { |
|---|
| 353 | if test -z "$extra_features" ; then |
|---|
| 354 | extra_features="$*" |
|---|
| 355 | else |
|---|
| 356 | extra_features="${extra_features}, $*" |
|---|
| 357 | fi |
|---|
| 358 | } |
|---|
| 359 | |
|---|
| 360 | dnl ------------------------------------------------------------------------ |
|---|
| 361 | dnl IPv6 checks |
|---|
| 362 | dnl ------------------------------------------------------------------------ |
|---|
| 363 | |
|---|
| 364 | dnl look for getaddrinfo and company. |
|---|
| 365 | AC_CHECK_FUNCS(getaddrinfo getnameinfo) |
|---|
| 366 | AC_CHECK_FUNCS(inet_ntoa getservbyport) |
|---|
| 367 | AC_CHECK_FUNCS(inet_ntop inet_pton) |
|---|
| 368 | |
|---|
| 369 | AC_ARG_WITH(ipv6, |
|---|
| 370 | AC_HELP_STRING([--with-ipv6], |
|---|
| 371 | [enable IPv6 support]), |
|---|
| 372 | [if test -z "$withval" ; then |
|---|
| 373 | with_ipv6="yes" |
|---|
| 374 | fi] |
|---|
| 375 | ) |
|---|
| 376 | |
|---|
| 377 | if test "x$with_ipv6" != "xno" ; then |
|---|
| 378 | AC_MSG_CHECKING([whether to support IPv6]) |
|---|
| 379 | if test "$ac_cv_func_getaddrinfo" = "no" ; then |
|---|
| 380 | AC_MSG_RESULT([no]) |
|---|
| 381 | else |
|---|
| 382 | AC_DEFINE(INET6, 1, [IPv6 network protocol support]) |
|---|
| 383 | AC_MSG_RESULT([yes]) |
|---|
| 384 | ith_feature_append IPv6 support |
|---|
| 385 | fi |
|---|
| 386 | else |
|---|
| 387 | AC_MSG_RESULT([no]) |
|---|
| 388 | fi |
|---|
| 389 | |
|---|
| 390 | dnl ------------------------------------------------------------------------ |
|---|
| 391 | dnl OpenSSL checks (code based on borrows from various places) |
|---|
| 392 | dnl ------------------------------------------------------------------------ |
|---|
| 393 | AC_ARG_WITH(openssl, |
|---|
| 394 | AC_HELP_STRING([--with-openssl=PATH], |
|---|
| 395 | [use the OpenSSL library (PATH is OpenSSL's install prefix)]), |
|---|
| 396 | [if test -z "$withval" ; then |
|---|
| 397 | with_openssl="yes" |
|---|
| 398 | fi] |
|---|
| 399 | ) |
|---|
| 400 | |
|---|
| 401 | if test "x$with_openssl" != "xno" ; then |
|---|
| 402 | if test "x$with_openssl" = "xyes" -o -z "$with_openssl" ; then |
|---|
| 403 | AC_MSG_CHECKING([for an OpenSSL installation]) |
|---|
| 404 | else |
|---|
| 405 | openssl_dirs="$with_openssl" |
|---|
| 406 | AC_MSG_CHECKING([for an OpenSSL installation in $with_openssl]) |
|---|
| 407 | fi |
|---|
| 408 | |
|---|
| 409 | old_LIBS="$LIBS" |
|---|
| 410 | old_CFLAGS="$CFLAGS" |
|---|
| 411 | LIBS="$LIBS -lssl -lcrypto" |
|---|
| 412 | AC_TRY_LINK([#include <openssl/ssl.h>],[SSL_accept(NULL);], |
|---|
| 413 | have_openssl="yes") |
|---|
| 414 | |
|---|
| 415 | if test -z "$have_openssl" ; then |
|---|
| 416 | for dir in "$openssl_dirs" /usr/local /usr/ssl /usr/openssl \ |
|---|
| 417 | /usr/local/ssl /usr/local/openssl ; do |
|---|
| 418 | if test -n "$have_openssl" -o -z "$dir"; then |
|---|
| 419 | break; |
|---|
| 420 | fi |
|---|
| 421 | |
|---|
| 422 | if test -f "$dir/include/openssl/ssl.h" -a -f \ |
|---|
| 423 | "$ssldir/lib/libssl.a" ; then |
|---|
| 424 | CFLAGS="$CFLAGS -I$dir/include" |
|---|
| 425 | LIBS="$old_LIBS -L$dir/lib -lssl -lcrypto" |
|---|
| 426 | AC_TRY_LINK([#include <openssl/ssl.h>],[SSL_accept(NULL);], |
|---|
| 427 | have_openssl="yes") |
|---|
| 428 | fi |
|---|
| 429 | done |
|---|
| 430 | fi |
|---|
| 431 | |
|---|
| 432 | if test -n "$have_openssl" ; then |
|---|
| 433 | AC_DEFINE(HAVE_OPENSSL, 1, [OpenSSL Library Support]) |
|---|
| 434 | AC_MSG_RESULT(found) |
|---|
| 435 | ith_feature_append SSL support |
|---|
| 436 | else |
|---|
| 437 | CLFAGS="$old_CFLAGS" |
|---|
| 438 | LIBS="$old_LIBS" |
|---|
| 439 | AC_MSG_RESULT(not found) |
|---|
| 440 | fi |
|---|
| 441 | fi |
|---|
| 442 | |
|---|
| 443 | dnl ------------------------------------------------------------------------ |
|---|
| 444 | dnl Local configuration stuff below |
|---|
| 445 | dnl ------------------------------------------------------------------------ |
|---|
| 446 | MODULES="*" |
|---|
| 447 | AC_ARG_WITH(modules, |
|---|
| 448 | AC_HELP_STRING([--with-modules="list"], |
|---|
| 449 | [list of modules to build and install (defaults to * in modules/)]), |
|---|
| 450 | if test -n "$withval " ; then |
|---|
| 451 | if test "$withval" != "yes" -a "$withval" != "no" ; then |
|---|
| 452 | MODULES="$withval" |
|---|
| 453 | fi |
|---|
| 454 | fi |
|---|
| 455 | ) |
|---|
| 456 | AC_SUBST(MODULES) |
|---|
| 457 | AC_ARG_WITH(dmalloc, |
|---|
| 458 | AC_HELP_STRING([--with-dmalloc=PATH], |
|---|
| 459 | [use the debug malloc library (PATH is dmalloc's install prefix)]), |
|---|
| 460 | if test "x$withval" != "no" ; then |
|---|
| 461 | if test -z "$withval" -o "x$withval" = "xyes" ; then |
|---|
| 462 | dmallocdir="/usr/local" |
|---|
| 463 | else |
|---|
| 464 | dmallocdir="$withval" |
|---|
| 465 | fi |
|---|
| 466 | LDFLAGS="$LDFLAGS -L$dmallocdir/lib" |
|---|
| 467 | CFLAGS="$CFLAGS -I$dmallocdir/include" |
|---|
| 468 | AC_CHECK_LIB(dmalloc, dmalloc_verify,, |
|---|
| 469 | AC_MSG_ERROR([I cannot find the dmalloc library on your system])) |
|---|
| 470 | AC_DEFINE(USE_DMALLOC, 1, [dmalloc library support]) |
|---|
| 471 | fi |
|---|
| 472 | ) |
|---|
| 473 | AC_ARG_ENABLE(debug, |
|---|
| 474 | AC_HELP_STRING([--enable-debug], |
|---|
| 475 | [enable debugging in code (changes CFLAGS, adds code)]), |
|---|
| 476 | if test -n "$GCC" ; then |
|---|
| 477 | CFLAGS="$CFLAGS -O0 -g3 -Wall -Wshadow -Wmissing-declarations -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Winline -Wbad-function-cast" |
|---|
| 478 | fi |
|---|
| 479 | AC_DEFINE(DEBUG_CODE, 1, [Extra debugging instructions]) |
|---|
| 480 | ) |
|---|
| 481 | AC_ARG_ENABLE(custom-libc, |
|---|
| 482 | AC_HELP_STRING([--enable-custom-libc], |
|---|
| 483 | [enable custom libc functions (may not work on all systems)]), |
|---|
| 484 | ith_feature_append internal libc functions, |
|---|
| 485 | AC_DEFINE(NO_INTERNAL_LIBC, 1, [No internal libc functions]), |
|---|
| 486 | ) |
|---|
| 487 | AC_ARG_ENABLE(fd-setsize, |
|---|
| 488 | AC_HELP_STRING([--enable-fd-setsize], |
|---|
| 489 | [set FD_SETSIZE to the specified value (useful only if your system is |
|---|
| 490 | using select() and you you want more file descriptors to work)]), |
|---|
| 491 | AC_DEFINE_UNQUOTED(FD_SETSIZE, $enable_fd_setsize, |
|---|
| 492 | [the size of FD_SETSIZE]), |
|---|
| 493 | ) |
|---|
| 494 | |
|---|
| 495 | DIRSUFFIX="/$PACKAGE" |
|---|
| 496 | AC_ARG_ENABLE(dir-suffix, |
|---|
| 497 | AC_HELP_STRING([--disable-dir-suffix], |
|---|
| 498 | [keep 'make install' from appending the package name to target |
|---|
| 499 | installation directories]), |
|---|
| 500 | DIRSUFFIX="" |
|---|
| 501 | ) |
|---|
| 502 | AC_SUBST(DIRSUFFIX) |
|---|
| 503 | |
|---|
| 504 | AC_OUTPUT(Makefile source/Makefile modules/Makefile) |
|---|
| 505 | |
|---|
| 506 | dnl ------------------------------------------------------------------------ |
|---|
| 507 | dnl finally, output our configuration to the user. |
|---|
| 508 | dnl ------------------------------------------------------------------------ |
|---|
| 509 | |
|---|
| 510 | eval "realbin=${bindir}" |
|---|
| 511 | eval "realbin=${realbin}" |
|---|
| 512 | eval "reallib=${libdir}${DIRSUFFIX}" |
|---|
| 513 | eval "reallib=${reallib}" |
|---|
| 514 | eval "realconf=${sysconfdir}${DIRSUFFIX}" |
|---|
| 515 | eval "realconf=${realconf}" |
|---|
| 516 | eval "realdata=${datadir}${DIRSUFFIX}" |
|---|
| 517 | eval "realdata=${realdata}" |
|---|
| 518 | |
|---|
| 519 | AC_MSG_RESULT([ |
|---|
| 520 | ithildin configuration |
|---|
| 521 | -----------------------]) |
|---|
| 522 | echo "ithildin version : ${VERSION}" |
|---|
| 523 | echo "host system : ${host_cpu}-${host_vendor}-${host_os}" |
|---|
| 524 | echo "compiler : ${CC}" |
|---|
| 525 | echo "compiler flags : ${CFLAGS}" |
|---|
| 526 | echo "module compiler flags : ${CFLAGS} ${CFLAGSDLL}" |
|---|
| 527 | echo "linker flags : ${LDFLAGS} ${EXTRA_LDFLAGS}" |
|---|
| 528 | echo "module linker : ${CCDLL}" |
|---|
| 529 | echo "module linker flags : ${LDFLAGS} ${LDFLAGSDLL}" |
|---|
| 530 | echo "extra features : ${extra_features}" |
|---|
| 531 | echo "socket polling method : ${POLLER}" |
|---|
| 532 | echo -n "building modules : " |
|---|
| 533 | if test "$MODULES" = "*" ; then |
|---|
| 534 | echo "(all modules available)" |
|---|
| 535 | else |
|---|
| 536 | echo "$MODULES" |
|---|
| 537 | fi |
|---|
| 538 | echo "binary install path : ${realbin}" |
|---|
| 539 | echo "library install path : ${reallib}" |
|---|
| 540 | echo "configuration data path: ${realconf}" |
|---|
| 541 | echo "static data path : ${realdata}" |
|---|
| 542 | |
|---|