[1731] | 1 | # $Id: configure.ac 98 2006-09-22 16:27:37Z sam $ |
---|
| 2 | |
---|
[4311] | 3 | AC_INIT(zzuf, 0.13) |
---|
[2319] | 4 | AC_CONFIG_AUX_DIR(.auto) |
---|
| 5 | AM_CONFIG_HEADER(config.h) |
---|
| 6 | AM_INIT_AUTOMAKE([no-define tar-ustar]) |
---|
[1731] | 7 | |
---|
| 8 | AC_PREREQ(2.50) |
---|
| 9 | |
---|
| 10 | AM_PROG_CC_C_O |
---|
| 11 | AC_PROG_CPP |
---|
| 12 | AC_PROG_LIBTOOL |
---|
| 13 | |
---|
[2527] | 14 | AC_C_INLINE |
---|
[2562] | 15 | AC_C_FUNC |
---|
[2527] | 16 | |
---|
[3951] | 17 | # Library suffix |
---|
| 18 | AC_MSG_CHECKING(for libzzuf full name) |
---|
| 19 | case "$shrext_cmds" in |
---|
| 20 | "") SONAME="libzzuf.so" ;; |
---|
[4256] | 21 | *) eval SONAME="libzzuf$shrext_cmds" ;; |
---|
[3951] | 22 | esac |
---|
| 23 | AC_MSG_RESULT($SONAME) |
---|
[3979] | 24 | AC_DEFINE_UNQUOTED(SONAME, "$SONAME", [Define to the libzzuf full name]) |
---|
[3951] | 25 | |
---|
[2527] | 26 | # Optimizations |
---|
| 27 | AC_TRY_CFLAGS(-g -O2, CFLAGS="${CFLAGS} -g -O2") |
---|
| 28 | # Code qui fait des warnings == code de porc == deux baffes dans ta gueule |
---|
| 29 | AC_TRY_CFLAGS(-Wall, CFLAGS="${CFLAGS} -Wall") |
---|
| 30 | AC_TRY_CFLAGS(-W, CFLAGS="${CFLAGS} -W") |
---|
| 31 | AC_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") |
---|
| 32 | |
---|
[1731] | 33 | case "${host_os}" in |
---|
| 34 | *mingw32*) |
---|
| 35 | DLL_LDFLAGS="-Wl,-l,imagehlp" # Trick libtool here |
---|
| 36 | WINSOCK2_LIBS="-lws2_32" |
---|
| 37 | ac_cv_func_recv=yes |
---|
| 38 | ac_cv_func_recvfrom=yes |
---|
| 39 | ac_cv_func_socket=yes |
---|
| 40 | ac_cv_func_accept=yes |
---|
[1854] | 41 | ac_cv_func_bind=yes |
---|
[1861] | 42 | ac_cv_func_connect=yes |
---|
[1731] | 43 | ;; |
---|
| 44 | esac |
---|
| 45 | AC_SUBST(WINSOCK2_LIBS) |
---|
| 46 | AC_SUBST(DLL_LDFLAGS) |
---|
| 47 | |
---|
[4258] | 48 | 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/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 mach/task.h) |
---|
[1731] | 49 | |
---|
| 50 | AC_CHECK_FUNCS(setenv waitpid setrlimit gettimeofday fork kill pipe _pipe) |
---|
[4041] | 51 | AC_CHECK_FUNCS(open64 __open64 lseek64 __lseek64 mmap64 fopen64 __fopen64 freopen64 __freopen64 dup dup2 ftello ftello64 __ftello64 fseeko fseeko64 __fseeko64 fsetpos64 __fsetpos64 _IO_getc getline getdelim __getdelim fgetln __srefill __filbuf __srget __uflow 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) |
---|
[1731] | 52 | |
---|
| 53 | AC_CHECK_TYPES(sighandler_t, [], [], |
---|
| 54 | [#define _GNU_SOURCE |
---|
| 55 | #include <signal.h>]) |
---|
| 56 | AC_CHECK_TYPES(sig_t, [], [], |
---|
| 57 | [#include <signal.h>]) |
---|
| 58 | AC_CHECK_TYPES(socklen_t, [], [], |
---|
| 59 | [#include <sys/types.h> |
---|
| 60 | #include <sys/socket.h>]) |
---|
| 61 | |
---|
[4262] | 62 | AC_MSG_CHECKING(for connect() second argument) |
---|
| 63 | AC_TRY_COMPILE([#include <sys/types.h> |
---|
| 64 | #include <sys/socket.h>], |
---|
| 65 | [#if defined HAVE_SOCKLEN_T |
---|
| 66 | int connect(int, const struct sockaddr *, socklen_t); |
---|
| 67 | #else |
---|
| 68 | int connect(int, const struct sockaddr *, int); |
---|
| 69 | #endif], |
---|
| 70 | [AC_MSG_RESULT(const struct sockaddr *) |
---|
| 71 | AC_DEFINE(CONNECT_USES_STRUCT_SOCKADDR, 1, [Define to 1 if connect() uses struct sockaddr.])], |
---|
| 72 | [AC_MSG_RESULT(const void *)]) |
---|
| 73 | |
---|
[1731] | 74 | AC_MSG_CHECKING(for read() prototype) |
---|
[2530] | 75 | AC_TRY_COMPILE([#define _INCLUDE_POSIX_SOURCE |
---|
| 76 | #include <unistd.h>], |
---|
[1731] | 77 | [ssize_t read(int fd, void *buf, size_t count);], |
---|
| 78 | [AC_MSG_RESULT(ssize_t read(... size_t);) |
---|
| 79 | AC_DEFINE(READ_USES_SSIZE_T, 1, [Define to 1 if read() uses ssize_t.])], |
---|
| 80 | [AC_MSG_RESULT(int read(... unsigned int);)]) |
---|
| 81 | |
---|
| 82 | AC_MSG_CHECKING(for recv() return value) |
---|
| 83 | ac_v_recv_t="int" |
---|
[2527] | 84 | AC_TRY_COMPILE([#define _XOPEN_SOURCE_EXTENDED |
---|
| 85 | #include <sys/types.h> |
---|
| 86 | #include <sys/socket.h>], |
---|
[1731] | 87 | [ssize_t recv(int s, void *buf, size_t len, int flags);], |
---|
| 88 | [ac_v_recv_t="ssize_t"]) |
---|
| 89 | AC_MSG_RESULT($ac_v_recv_t) |
---|
| 90 | AC_DEFINE_UNQUOTED(RECV_T, $ac_v_recv_t, [Define to the recv() return type]) |
---|
| 91 | |
---|
[4248] | 92 | AC_MSG_CHECKING([for _IO_read_ptr and _IO_read_end in FILE (glibc-style)]) |
---|
[2553] | 93 | AC_TRY_COMPILE([#include <stdio.h>], |
---|
[4011] | 94 | [FILE *fp; fp->_IO_read_ptr++; fp->_IO_read_end++], |
---|
[4285] | 95 | [ac_cv_have_glibc_file=yes], |
---|
| 96 | [ac_cv_have_glibc_file=no]) |
---|
| 97 | AC_MSG_RESULT($ac_cv_have_glibc_file) |
---|
| 98 | if test "$ac_cv_have_glibc_file" != "no"; then |
---|
[4248] | 99 | AC_DEFINE(HAVE_GLIBC_FILE, 1, [Define to 1 if FILE has glibc-style members]) |
---|
[4011] | 100 | fi |
---|
[2553] | 101 | |
---|
[4248] | 102 | AC_MSG_CHECKING([for _bf._base, _r and _p in FILE (FreeBSD-style)]) |
---|
| 103 | AC_TRY_COMPILE([#include <stdio.h>], |
---|
| 104 | [FILE *fp; fp->_bf._base++; fp->_r++; fp->_p++], |
---|
[4285] | 105 | [ac_cv_have_freebsd_file=yes], |
---|
| 106 | [ac_cv_have_freebsd_file=no]) |
---|
| 107 | AC_MSG_RESULT($ac_cv_have_freebsd_file) |
---|
| 108 | if test "$ac_cv_have_freebsd_file" != "no"; then |
---|
[4248] | 109 | AC_DEFINE(HAVE_FREEBSD_FILE, 1, [Define to 1 if FILE has FreeBSD-style members]) |
---|
| 110 | fi |
---|
| 111 | |
---|
[4285] | 112 | AC_MSG_CHECKING([for _base, _cnt and _ptr in FILE (Solaris-style)]) |
---|
| 113 | AC_TRY_COMPILE([#include <stdio.h>], |
---|
| 114 | [FILE *fp; fp->_base++; fp->_cnt++; fp->_ptr++], |
---|
| 115 | [ac_cv_have_solaris_file=yes], |
---|
| 116 | [ac_cv_have_solaris_file=no]) |
---|
| 117 | AC_MSG_RESULT($ac_cv_have_solaris_file) |
---|
| 118 | if test "$ac_cv_have_solaris_file" != "no"; then |
---|
| 119 | AC_DEFINE(HAVE_SOLARIS_FILE, 1, [Define to 1 if FILE has Solaris-style members]) |
---|
| 120 | fi |
---|
| 121 | |
---|
[2559] | 122 | dnl On HP-UX, fpos64_t == int64_t, but on Linux it's a compound object. |
---|
| 123 | AC_MSG_CHECKING(how to access fpos64_t x) |
---|
| 124 | ac_v_fpos64_t="unknown" |
---|
| 125 | AC_TRY_COMPILE( |
---|
| 126 | [#define _LARGEFILE64_SOURCE |
---|
[4285] | 127 | #define _LARGEFILE_SOURCE |
---|
[2559] | 128 | #include <stdio.h>], |
---|
| 129 | [fpos64_t x; long long int y = x.__pos;], |
---|
| 130 | [ac_v_fpos64_t="(x).__pos"]) |
---|
| 131 | AC_TRY_COMPILE( |
---|
| 132 | [#define _LARGEFILE64_SOURCE |
---|
[4285] | 133 | #define _LARGEFILE_SOURCE |
---|
[2559] | 134 | #include <stdio.h>], |
---|
| 135 | [fpos64_t x; long long int y = (long long int)x;], |
---|
| 136 | [ac_v_fpos64_t="(x)"]) |
---|
| 137 | AC_MSG_RESULT($ac_v_fpos64_t) |
---|
| 138 | AC_DEFINE_UNQUOTED(FPOS_CAST(x), $ac_v_fpos64_t, [Define to a macro for accessing an fpos64_t variable]) |
---|
| 139 | |
---|
[2527] | 140 | AC_MSG_CHECKING(for pragma INIT/FINI) |
---|
| 141 | AC_TRY_COMPILE([], |
---|
| 142 | [#pragma INIT "my_init" |
---|
| 143 | void my_init(void)], |
---|
| 144 | [AC_MSG_RESULT(yes) |
---|
| 145 | AC_DEFINE(HAVE_PRAGMA_INIT, 1, [Define to 1 if you have pragma INIT])], |
---|
| 146 | [AC_MSG_RESULT(no)]) |
---|
| 147 | |
---|
[2577] | 148 | AC_MSG_CHECKING(for __printf__ attribute) |
---|
[2578] | 149 | ac_v_attribute_printf="" |
---|
[2577] | 150 | AC_TRY_COMPILE([], |
---|
| 151 | [extern void foo(const char *, ...) |
---|
| 152 | __attribute__((__format__(__printf__, 1, 2)));], |
---|
| 153 | [AC_MSG_RESULT(yes) |
---|
[2578] | 154 | ac_v_attribute_printf="__attribute__((__format__(__printf__, x, y)))"], |
---|
[2577] | 155 | [AC_MSG_RESULT(no)]) |
---|
[2578] | 156 | AC_DEFINE_UNQUOTED(ATTRIBUTE_PRINTF(x,y), $ac_v_attribute_printf, [Define to the __printf__ attribute if present]) |
---|
[2577] | 157 | |
---|
[1733] | 158 | ac_cv_have_getopt_long="no" |
---|
[1731] | 159 | AC_CHECK_FUNCS(getopt_long, |
---|
[1733] | 160 | [ac_cv_have_getopt_long="yes"], |
---|
[1731] | 161 | [AC_CHECK_LIB(gnugetopt, getopt_long, |
---|
[1733] | 162 | [ac_cv_have_getopt_long="yes" |
---|
[1731] | 163 | GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])]) |
---|
[1733] | 164 | if test "$ac_cv_have_getopt_long" != "no"; then |
---|
| 165 | AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.) |
---|
| 166 | fi |
---|
| 167 | AM_CONDITIONAL(NEED_GETOPT_LONG, test "$ac_cv_have_getopt_long" = "no") |
---|
[1731] | 168 | AC_SUBST(GETOPT_LIBS) |
---|
| 169 | |
---|
| 170 | AC_CHECK_LIB(m, log, [MATH_LIBS="-lm"]) |
---|
| 171 | AC_SUBST(MATH_LIBS) |
---|
| 172 | AC_CHECK_LIB(dl, dlopen, [DL_LIBS="-ldl"]) |
---|
| 173 | AC_SUBST(DL_LIBS) |
---|
| 174 | |
---|
[4236] | 175 | AC_CONFIG_FILES([ |
---|
[1731] | 176 | Makefile |
---|
| 177 | src/Makefile |
---|
| 178 | doc/Makefile |
---|
| 179 | test/Makefile |
---|
| 180 | ]) |
---|
[4236] | 181 | AC_CONFIG_FILES([ |
---|
[4244] | 182 | doc/zzcat.1 |
---|
[4236] | 183 | doc/zzuf.1 |
---|
| 184 | doc/libzzuf.3 |
---|
| 185 | ]) |
---|
| 186 | AC_OUTPUT |
---|
[1731] | 187 | |
---|