* Build on HP-UX systems: disable unsupported warning flags, define
_XOPEN_SOURCE_EXTENDED where appropriate, use AC_C_INLINE to avoid using
the inline keyword when unsupported, and use #pragma INIT for library
initialisation routines.
This commit is contained in:
parent
88ddd7f4ac
commit
b448cd4759
@ -3,6 +3,7 @@
|
||||
SUBDIRS = src test doc
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
|
||||
EXTRA_DIST = bootstrap AUTHORS
|
||||
EXTRA_DIST = bootstrap AUTHORS m4/cflags.m4
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
AUTOMAKE_OPTIONS = foreign dist-bzip2
|
||||
|
||||
|
||||
27
configure.ac
27
configure.ac
@ -11,6 +11,15 @@ AM_PROG_CC_C_O
|
||||
AC_PROG_CPP
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
AC_C_INLINE
|
||||
|
||||
# Optimizations
|
||||
AC_TRY_CFLAGS(-g -O2, CFLAGS="${CFLAGS} -g -O2")
|
||||
# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
|
||||
AC_TRY_CFLAGS(-Wall, CFLAGS="${CFLAGS} -Wall")
|
||||
AC_TRY_CFLAGS(-W, CFLAGS="${CFLAGS} -W")
|
||||
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")
|
||||
|
||||
case "${host_os}" in
|
||||
*mingw32*)
|
||||
DLL_LDFLAGS="-Wl,-l,imagehlp" # Trick libtool here
|
||||
@ -49,13 +58,22 @@ AC_TRY_COMPILE([#include <unistd.h>],
|
||||
|
||||
AC_MSG_CHECKING(for recv() return value)
|
||||
ac_v_recv_t="int"
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/socket.h>],
|
||||
AC_TRY_COMPILE([#define _XOPEN_SOURCE_EXTENDED
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>],
|
||||
[ssize_t recv(int s, void *buf, size_t len, int flags);],
|
||||
[ac_v_recv_t="ssize_t"])
|
||||
AC_MSG_RESULT($ac_v_recv_t)
|
||||
AC_DEFINE_UNQUOTED(RECV_T, $ac_v_recv_t, [Define to the recv() return type])
|
||||
|
||||
AC_MSG_CHECKING(for pragma INIT/FINI)
|
||||
AC_TRY_COMPILE([],
|
||||
[#pragma INIT "my_init"
|
||||
void my_init(void)],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_PRAGMA_INIT, 1, [Define to 1 if you have pragma INIT])],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
ac_cv_have_getopt_long="no"
|
||||
AC_CHECK_FUNCS(getopt_long,
|
||||
[ac_cv_have_getopt_long="yes"],
|
||||
@ -73,11 +91,6 @@ AC_SUBST(MATH_LIBS)
|
||||
AC_CHECK_LIB(dl, dlopen, [DL_LIBS="-ldl"])
|
||||
AC_SUBST(DL_LIBS)
|
||||
|
||||
# Optimizations
|
||||
CFLAGS="${CFLAGS} -g -O2"
|
||||
# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
|
||||
CFLAGS="${CFLAGS} -Wall -W -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
src/Makefile
|
||||
|
||||
14
m4/cflags.m4
Normal file
14
m4/cflags.m4
Normal file
@ -0,0 +1,14 @@
|
||||
dnl AC_TRY_CFLAGS (CFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS])
|
||||
dnl check if $CC supports a given set of cflags
|
||||
AC_DEFUN([AC_TRY_CFLAGS],
|
||||
[AC_MSG_CHECKING([if $CC supports $1 flags])
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$1"
|
||||
AC_TRY_COMPILE([],[],[ac_cv_try_cflags_ok=yes],[ac_cv_try_cflags_ok=no])
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
AC_MSG_RESULT([$ac_cv_try_cflags_ok])
|
||||
if test x"$ac_cv_try_cflags_ok" = x"yes"; then
|
||||
ifelse([$2],[],[:],[$2])
|
||||
else
|
||||
ifelse([$3],[],[:],[$3])
|
||||
fi])
|
||||
@ -25,6 +25,8 @@
|
||||
#define _GNU_SOURCE
|
||||
/* Use this to get lseek64() on glibc systems */
|
||||
#define _LARGEFILE64_SOURCE
|
||||
/* Use this to get proper prototypes on HP-UX systems */
|
||||
#define _XOPEN_SOURCE_EXTENDED
|
||||
|
||||
#if defined HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
|
||||
@ -48,8 +48,14 @@
|
||||
#include "fuzz.h"
|
||||
|
||||
/* Library initialisation shit */
|
||||
#if defined __GNUC__
|
||||
void _zz_init(void) __attribute__((constructor));
|
||||
void _zz_fini(void) __attribute__((destructor));
|
||||
#elif defined HAVE_PRAGMA_INIT
|
||||
# pragma INIT "_zz_init"
|
||||
# pragma FINI "_zz_fini"
|
||||
#endif
|
||||
|
||||
#if defined HAVE_WINDOWS_H
|
||||
BOOL WINAPI DllMain(HINSTANCE, DWORD, PVOID);
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user