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