source: zzuf/trunk/configure.ac @ 2552

Last change on this file since 2552 was 2552, checked in by sam, 6 years ago
  • Implement freopen64, fsetpos64 and fseeko64 for OpenSolaris?.
File size: 3.6 KB
Line 
1# $Id: configure.ac 98 2006-09-22 16:27:37Z sam $
2
3AC_INIT(zzuf, 0.12)
4AC_CONFIG_AUX_DIR(.auto)
5AM_CONFIG_HEADER(config.h)
6AM_INIT_AUTOMAKE([no-define tar-ustar])
7
8AC_PREREQ(2.50)
9
10AM_PROG_CC_C_O
11AC_PROG_CPP
12AC_PROG_LIBTOOL
13
14AC_C_INLINE
15
16# Optimizations
17AC_TRY_CFLAGS(-g -O2, CFLAGS="${CFLAGS} -g -O2")
18# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
19AC_TRY_CFLAGS(-Wall, CFLAGS="${CFLAGS} -Wall")
20AC_TRY_CFLAGS(-W, CFLAGS="${CFLAGS} -W")
21AC_TRY_CFLAGS(-Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare, CFLAGS="${CFLAGS} -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare")
22
23case "${host_os}" in
24  *mingw32*)
25    DLL_LDFLAGS="-Wl,-l,imagehlp" # Trick libtool here
26    WINSOCK2_LIBS="-lws2_32"
27    ac_cv_func_recv=yes
28    ac_cv_func_recvfrom=yes
29    ac_cv_func_socket=yes
30    ac_cv_func_accept=yes
31    ac_cv_func_bind=yes
32    ac_cv_func_connect=yes
33    ;;
34esac
35AC_SUBST(WINSOCK2_LIBS)
36AC_SUBST(DLL_LDFLAGS)
37
38AC_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 arpa/inet.h sys/uio.h aio.h sys/mman.h sys/wait.h sys/resource.h sys/time.h endian.h)
39
40AC_CHECK_FUNCS(setenv waitpid setrlimit gettimeofday fork kill pipe _pipe)
41AC_CHECK_FUNCS(open64 __open64 lseek64 __lseek64 mmap64 fopen64 __fopen64 freopen64 __freopen64 dup dup2 fseeko fseeko64 __fseeko64 fsetpos64 __fsetpos64 _IO_getc getline getdelim __getdelim fgetln __srefill __filbuf 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)
42
43AC_CHECK_TYPES(sighandler_t, [], [],
44  [#define _GNU_SOURCE
45   #include <signal.h>])
46AC_CHECK_TYPES(sig_t, [], [],
47  [#include <signal.h>])
48AC_CHECK_TYPES(socklen_t, [], [],
49  [#include <sys/types.h>
50   #include <sys/socket.h>])
51
52AC_MSG_CHECKING(for read() prototype)
53AC_TRY_COMPILE([#define _INCLUDE_POSIX_SOURCE
54                #include <unistd.h>],
55 [ssize_t read(int fd, void *buf, size_t count);],
56 [AC_MSG_RESULT(ssize_t read(... size_t);)
57  AC_DEFINE(READ_USES_SSIZE_T, 1, [Define to 1 if read() uses ssize_t.])],
58 [AC_MSG_RESULT(int read(... unsigned int);)])
59
60AC_MSG_CHECKING(for recv() return value)
61ac_v_recv_t="int"
62AC_TRY_COMPILE([#define _XOPEN_SOURCE_EXTENDED
63                #include <sys/types.h>
64                #include <sys/socket.h>],
65 [ssize_t recv(int s, void *buf, size_t len, int flags);],
66 [ac_v_recv_t="ssize_t"])
67AC_MSG_RESULT($ac_v_recv_t)
68AC_DEFINE_UNQUOTED(RECV_T, $ac_v_recv_t, [Define to the recv() return type])
69
70AC_MSG_CHECKING(for pragma INIT/FINI)
71AC_TRY_COMPILE([],
72 [#pragma INIT "my_init"
73  void my_init(void)],
74 [AC_MSG_RESULT(yes)
75  AC_DEFINE(HAVE_PRAGMA_INIT, 1, [Define to 1 if you have pragma INIT])],
76 [AC_MSG_RESULT(no)])
77
78ac_cv_have_getopt_long="no"
79AC_CHECK_FUNCS(getopt_long,
80 [ac_cv_have_getopt_long="yes"],
81 [AC_CHECK_LIB(gnugetopt, getopt_long,
82   [ac_cv_have_getopt_long="yes"
83    GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
84if test "$ac_cv_have_getopt_long" != "no"; then
85  AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)
86fi
87AM_CONDITIONAL(NEED_GETOPT_LONG, test "$ac_cv_have_getopt_long" = "no")
88AC_SUBST(GETOPT_LIBS)
89
90AC_CHECK_LIB(m, log, [MATH_LIBS="-lm"])
91AC_SUBST(MATH_LIBS)
92AC_CHECK_LIB(dl, dlopen, [DL_LIBS="-ldl"])
93AC_SUBST(DL_LIBS)
94
95AC_OUTPUT([
96  Makefile
97  src/Makefile
98  doc/Makefile
99  test/Makefile
100])
101
Note: See TracBrowser for help on using the repository browser.