source: zzuf/trunk/configure.ac @ 1713

Last change on this file since 1713 was 1713, checked in by Sam Hocevar, 13 years ago
File size: 2.6 KB
Line 
1# $Id: configure.ac 98 2006-09-22 16:27:37Z sam $
2
3AC_INIT(zzuf, 0.6.1)
4
5AC_PREREQ(2.50)
6AC_CONFIG_SRCDIR(src/zzuf.c)
7AC_CONFIG_AUX_DIR(autotools)
8AC_CANONICAL_SYSTEM
9
10AM_INIT_AUTOMAKE(zzuf, 0.6.1)
11AM_CONFIG_HEADER(config.h)
12
13AM_PROG_CC_C_O
14AC_PROG_CPP
15AC_PROG_LIBTOOL
16
17case "${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    ;;
26esac
27AC_SUBST(WINSOCK2_LIBS)
28AC_SUBST(DLL_LDFLAGS)
29
30AC_CHECK_HEADERS(windows.h winsock2.h io.h 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)
31
32AC_CHECK_FUNCS(setenv waitpid setrlimit gettimeofday fork kill pipe _pipe)
33AC_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)
34
35AC_CHECK_TYPES(sighandler_t, [], [],
36  [#define _GNU_SOURCE
37   #include <signal.h>])
38AC_CHECK_TYPES(sig_t, [], [],
39  [#include <signal.h>])
40AC_CHECK_TYPES(socklen_t, [], [],
41  [#include <sys/types.h>
42   #include <sys/socket.h>])
43
44AC_MSG_CHECKING(for read() prototype)
45AC_TRY_COMPILE([#include <unistd.h>],
46 [ssize_t read(int fd, void *buf, size_t count);],
47 [AC_MSG_RESULT(ssize_t read(... size_t);)
48  AC_DEFINE(READ_USES_SSIZE_T, 1, [Define to 1 if read() uses ssize_t.])],
49 [AC_MSG_RESULT(int read(... unsigned int);)])
50
51AC_MSG_CHECKING(for recv() return value)
52ac_v_recv_t="int"
53AC_TRY_COMPILE([#include <sys/types.h>
54  #include <sys/socket.h>],
55 [ssize_t recv(int s, void *buf, size_t len, int flags);],
56 [ac_v_recv_t="ssize_t"])
57AC_MSG_RESULT($ac_v_recv_t)
58AC_DEFINE_UNQUOTED(RECV_T, $ac_v_recv_t, [Define to the recv() return type])
59
60AC_CHECK_FUNCS(getopt_long,
61 [AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)],
62 [AC_CHECK_LIB(gnugetopt, getopt_long,
63   [AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)
64    GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
65AC_SUBST(GETOPT_LIBS)
66
67AC_CHECK_LIB(m, log, [MATH_LIBS="-lm"])
68AC_SUBST(MATH_LIBS)
69AC_CHECK_LIB(dl, dlopen, [DL_LIBS="-ldl"])
70AC_SUBST(DL_LIBS)
71
72# Optimizations
73CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
74# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
75CFLAGS="${CFLAGS} -Wall -W -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
76
77AC_OUTPUT([
78  Makefile
79  src/Makefile
80  doc/Makefile
81  test/Makefile
82])
83
Note: See TracBrowser for help on using the repository browser.