source: zzuf/trunk/configure.ac @ 1857

Last change on this file since 1857 was 1857, checked in by Sam Hocevar, 13 years ago
  • Check for <netinet/in.h>, it’s needed for struct sockaddr_in.
File size: 2.8 KB
Line 
1# $Id: configure.ac 98 2006-09-22 16:27:37Z sam $
2
3AC_INIT(zzuf, 0.9)
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.9)
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    ac_cv_func_bind=yes
26    ;;
27esac
28AC_SUBST(WINSOCK2_LIBS)
29AC_SUBST(DLL_LDFLAGS)
30
31AC_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)
32
33AC_CHECK_FUNCS(setenv waitpid setrlimit gettimeofday fork kill pipe _pipe)
34AC_CHECK_FUNCS(open64 lseek64 mmap64 fopen64 fseeko _IO_getc getline getdelim __getdelim fgetln __srefill map_fd memalign posix_memalign aio_read accept bind socket readv pread recv recvfrom recvmsg mmap valloc sigaction getpagesize)
35
36AC_CHECK_TYPES(sighandler_t, [], [],
37  [#define _GNU_SOURCE
38   #include <signal.h>])
39AC_CHECK_TYPES(sig_t, [], [],
40  [#include <signal.h>])
41AC_CHECK_TYPES(socklen_t, [], [],
42  [#include <sys/types.h>
43   #include <sys/socket.h>])
44
45AC_MSG_CHECKING(for read() prototype)
46AC_TRY_COMPILE([#include <unistd.h>],
47 [ssize_t read(int fd, void *buf, size_t count);],
48 [AC_MSG_RESULT(ssize_t read(... size_t);)
49  AC_DEFINE(READ_USES_SSIZE_T, 1, [Define to 1 if read() uses ssize_t.])],
50 [AC_MSG_RESULT(int read(... unsigned int);)])
51
52AC_MSG_CHECKING(for recv() return value)
53ac_v_recv_t="int"
54AC_TRY_COMPILE([#include <sys/types.h>
55  #include <sys/socket.h>],
56 [ssize_t recv(int s, void *buf, size_t len, int flags);],
57 [ac_v_recv_t="ssize_t"])
58AC_MSG_RESULT($ac_v_recv_t)
59AC_DEFINE_UNQUOTED(RECV_T, $ac_v_recv_t, [Define to the recv() return type])
60
61ac_cv_have_getopt_long="no"
62AC_CHECK_FUNCS(getopt_long,
63 [ac_cv_have_getopt_long="yes"],
64 [AC_CHECK_LIB(gnugetopt, getopt_long,
65   [ac_cv_have_getopt_long="yes"
66    GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
67if test "$ac_cv_have_getopt_long" != "no"; then
68  AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)
69fi
70AM_CONDITIONAL(NEED_GETOPT_LONG, test "$ac_cv_have_getopt_long" = "no")
71AC_SUBST(GETOPT_LIBS)
72
73AC_CHECK_LIB(m, log, [MATH_LIBS="-lm"])
74AC_SUBST(MATH_LIBS)
75AC_CHECK_LIB(dl, dlopen, [DL_LIBS="-ldl"])
76AC_SUBST(DL_LIBS)
77
78# Optimizations
79CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
80# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
81CFLAGS="${CFLAGS} -Wall -W -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
82
83AC_OUTPUT([
84  Makefile
85  src/Makefile
86  doc/Makefile
87  test/Makefile
88])
89
Note: See TracBrowser for help on using the repository browser.