| 1 | # $Id: configure.ac 98 2006-09-22 16:27:37Z sam $ |
|---|
| 2 | |
|---|
| 3 | AC_INIT(zzuf, 0.5) |
|---|
| 4 | |
|---|
| 5 | AC_PREREQ(2.50) |
|---|
| 6 | AC_CONFIG_SRCDIR(src/zzuf.c) |
|---|
| 7 | AC_CONFIG_AUX_DIR(autotools) |
|---|
| 8 | AC_CANONICAL_SYSTEM |
|---|
| 9 | |
|---|
| 10 | AM_INIT_AUTOMAKE(zzuf, 0.5) |
|---|
| 11 | AM_CONFIG_HEADER(config.h) |
|---|
| 12 | |
|---|
| 13 | AM_PROG_CC_C_O |
|---|
| 14 | AC_PROG_CPP |
|---|
| 15 | AC_PROG_LIBTOOL |
|---|
| 16 | |
|---|
| 17 | AC_CHECK_HEADERS(inttypes.h stdint.h getopt.h libc.h malloc.h dlfcn.h regex.h sys/socket.h sys/uio.h aio.h sys/mman.h sys/wait.h sys/resource.h) |
|---|
| 18 | AC_CHECK_FUNCS(open64 lseek64 mmap64 fopen64 fseeko _IO_getc getline getdelim __getdelim fgetln __srefill map_fd memalign posix_memalign aio_read accept socket readv pread recv recvfrom recvmsg mmap valloc sigaction) |
|---|
| 19 | AC_CHECK_TYPES(sighandler_t, [], [], |
|---|
| 20 | [#define _GNU_SOURCE |
|---|
| 21 | #include <signal.h>]) |
|---|
| 22 | AC_CHECK_TYPES(sig_t, [], [], |
|---|
| 23 | [#include <signal.h>]) |
|---|
| 24 | AC_CHECK_TYPES(socklen_t, [], [], |
|---|
| 25 | [#include <sys/types.h> |
|---|
| 26 | #include <sys/socket.h>]) |
|---|
| 27 | |
|---|
| 28 | AC_MSG_CHECKING(for read() prototype) |
|---|
| 29 | AC_TRY_COMPILE([#include <unistd.h>], |
|---|
| 30 | [ssize_t read(int fd, void *buf, size_t count);], |
|---|
| 31 | [AC_MSG_RESULT(ssize_t read(... size_t);) |
|---|
| 32 | AC_DEFINE(READ_USES_SSIZE_T, 1, [Define to 1 if read() uses ssize_t.])], |
|---|
| 33 | [AC_MSG_RESULT(int read(... unsigned int);)]) |
|---|
| 34 | |
|---|
| 35 | AC_MSG_CHECKING(for recv() return value) |
|---|
| 36 | ac_v_recv_t="int" |
|---|
| 37 | AC_TRY_COMPILE([#include <sys/types.h> |
|---|
| 38 | #include <sys/socket.h>], |
|---|
| 39 | [ssize_t recv(int s, void *buf, size_t len, int flags);], |
|---|
| 40 | [ac_v_recv_t="ssize_t"]) |
|---|
| 41 | AC_MSG_RESULT($ac_v_recv_t) |
|---|
| 42 | AC_DEFINE_UNQUOTED(RECV_T, $ac_v_recv_t, [Define to the recv() return type]) |
|---|
| 43 | |
|---|
| 44 | AC_CHECK_FUNCS(getopt_long, |
|---|
| 45 | [AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)], |
|---|
| 46 | [AC_CHECK_LIB(gnugetopt, getopt_long, |
|---|
| 47 | [AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.) |
|---|
| 48 | GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])]) |
|---|
| 49 | AC_SUBST(GETOPT_LIBS) |
|---|
| 50 | |
|---|
| 51 | AC_CHECK_LIB(m, log, [MATH_LIBS="-lm"]) |
|---|
| 52 | AC_SUBST(MATH_LIBS) |
|---|
| 53 | AC_CHECK_LIB(dl, dlopen, [DL_LIBS="-ldl"]) |
|---|
| 54 | AC_SUBST(DL_LIBS) |
|---|
| 55 | |
|---|
| 56 | # Optimizations |
|---|
| 57 | CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer" |
|---|
| 58 | # Code qui fait des warnings == code de porc == deux baffes dans ta gueule |
|---|
| 59 | CFLAGS="${CFLAGS} -Wall -W -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare" |
|---|
| 60 | |
|---|
| 61 | AC_OUTPUT([ |
|---|
| 62 | Makefile |
|---|
| 63 | src/Makefile |
|---|
| 64 | doc/Makefile |
|---|
| 65 | test/Makefile |
|---|
| 66 | ]) |
|---|
| 67 | |
|---|