| 1 | # $Id: configure.ac 98 2006-09-22 16:27:37Z sam $ |
|---|
| 2 | |
|---|
| 3 | AC_INIT(zzuf, 0.12) |
|---|
| 4 | AC_CONFIG_AUX_DIR(.auto) |
|---|
| 5 | AM_CONFIG_HEADER(config.h) |
|---|
| 6 | AM_INIT_AUTOMAKE([no-define tar-ustar]) |
|---|
| 7 | |
|---|
| 8 | AC_PREREQ(2.50) |
|---|
| 9 | |
|---|
| 10 | AM_PROG_CC_C_O |
|---|
| 11 | AC_PROG_CPP |
|---|
| 12 | AC_PROG_LIBTOOL |
|---|
| 13 | |
|---|
| 14 | case "${host_os}" in |
|---|
| 15 | *mingw32*) |
|---|
| 16 | DLL_LDFLAGS="-Wl,-l,imagehlp" # Trick libtool here |
|---|
| 17 | WINSOCK2_LIBS="-lws2_32" |
|---|
| 18 | ac_cv_func_recv=yes |
|---|
| 19 | ac_cv_func_recvfrom=yes |
|---|
| 20 | ac_cv_func_socket=yes |
|---|
| 21 | ac_cv_func_accept=yes |
|---|
| 22 | ac_cv_func_bind=yes |
|---|
| 23 | ac_cv_func_connect=yes |
|---|
| 24 | ;; |
|---|
| 25 | esac |
|---|
| 26 | AC_SUBST(WINSOCK2_LIBS) |
|---|
| 27 | AC_SUBST(DLL_LDFLAGS) |
|---|
| 28 | |
|---|
| 29 | AC_CHECK_HEADERS(windows.h winsock2.h io.h process.h unistd.h inttypes.h stdint.h getopt.h libc.h malloc.h dlfcn.h regex.h sys/cdefs.h sys/socket.h netinet/in.h sys/uio.h aio.h sys/mman.h sys/wait.h sys/resource.h sys/time.h endian.h) |
|---|
| 30 | |
|---|
| 31 | AC_CHECK_FUNCS(setenv waitpid setrlimit gettimeofday fork kill pipe _pipe) |
|---|
| 32 | AC_CHECK_FUNCS(open64 lseek64 mmap64 fopen64 dup dup2 fseeko _IO_getc getline getdelim __getdelim fgetln __srefill map_fd memalign posix_memalign aio_read accept bind connect socket readv pread recv recvfrom recvmsg mmap valloc sigaction getpagesize getc_unlocked getchar_unlocked fgetc_unlocked fread_unlocked fgets_unlocked) |
|---|
| 33 | |
|---|
| 34 | AC_CHECK_TYPES(sighandler_t, [], [], |
|---|
| 35 | [#define _GNU_SOURCE |
|---|
| 36 | #include <signal.h>]) |
|---|
| 37 | AC_CHECK_TYPES(sig_t, [], [], |
|---|
| 38 | [#include <signal.h>]) |
|---|
| 39 | AC_CHECK_TYPES(socklen_t, [], [], |
|---|
| 40 | [#include <sys/types.h> |
|---|
| 41 | #include <sys/socket.h>]) |
|---|
| 42 | |
|---|
| 43 | AC_MSG_CHECKING(for read() prototype) |
|---|
| 44 | AC_TRY_COMPILE([#include <unistd.h>], |
|---|
| 45 | [ssize_t read(int fd, void *buf, size_t count);], |
|---|
| 46 | [AC_MSG_RESULT(ssize_t read(... size_t);) |
|---|
| 47 | AC_DEFINE(READ_USES_SSIZE_T, 1, [Define to 1 if read() uses ssize_t.])], |
|---|
| 48 | [AC_MSG_RESULT(int read(... unsigned int);)]) |
|---|
| 49 | |
|---|
| 50 | AC_MSG_CHECKING(for recv() return value) |
|---|
| 51 | ac_v_recv_t="int" |
|---|
| 52 | AC_TRY_COMPILE([#include <sys/types.h> |
|---|
| 53 | #include <sys/socket.h>], |
|---|
| 54 | [ssize_t recv(int s, void *buf, size_t len, int flags);], |
|---|
| 55 | [ac_v_recv_t="ssize_t"]) |
|---|
| 56 | AC_MSG_RESULT($ac_v_recv_t) |
|---|
| 57 | AC_DEFINE_UNQUOTED(RECV_T, $ac_v_recv_t, [Define to the recv() return type]) |
|---|
| 58 | |
|---|
| 59 | ac_cv_have_getopt_long="no" |
|---|
| 60 | AC_CHECK_FUNCS(getopt_long, |
|---|
| 61 | [ac_cv_have_getopt_long="yes"], |
|---|
| 62 | [AC_CHECK_LIB(gnugetopt, getopt_long, |
|---|
| 63 | [ac_cv_have_getopt_long="yes" |
|---|
| 64 | GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])]) |
|---|
| 65 | if test "$ac_cv_have_getopt_long" != "no"; then |
|---|
| 66 | AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.) |
|---|
| 67 | fi |
|---|
| 68 | AM_CONDITIONAL(NEED_GETOPT_LONG, test "$ac_cv_have_getopt_long" = "no") |
|---|
| 69 | AC_SUBST(GETOPT_LIBS) |
|---|
| 70 | |
|---|
| 71 | AC_CHECK_LIB(m, log, [MATH_LIBS="-lm"]) |
|---|
| 72 | AC_SUBST(MATH_LIBS) |
|---|
| 73 | AC_CHECK_LIB(dl, dlopen, [DL_LIBS="-ldl"]) |
|---|
| 74 | AC_SUBST(DL_LIBS) |
|---|
| 75 | |
|---|
| 76 | # Optimizations |
|---|
| 77 | CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer" |
|---|
| 78 | # Code qui fait des warnings == code de porc == deux baffes dans ta gueule |
|---|
| 79 | CFLAGS="${CFLAGS} -Wall -W -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare" |
|---|
| 80 | |
|---|
| 81 | AC_OUTPUT([ |
|---|
| 82 | Makefile |
|---|
| 83 | src/Makefile |
|---|
| 84 | doc/Makefile |
|---|
| 85 | test/Makefile |
|---|
| 86 | ]) |
|---|
| 87 | |
|---|