From 5ec55f35e97e814bb89d070bf44954f2b5bed733 Mon Sep 17 00:00:00 2001 From: hpa Date: Wed, 14 Nov 2001 02:54:25 +0000 Subject: [PATCH] Move feature test macros into configure.in -> CFLAGS so we don't end up with mismatch between "configure" and compile time --- Makefile | 6 +++--- config.h | 15 +++++---------- configure.in | 18 ++++++++++++++++++ tftpd/recvfrom.h | 7 +------ 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 3d8f959..454b7f7 100644 --- a/Makefile +++ b/Makefile @@ -52,13 +52,13 @@ acconfig.h: MCONFIG : Generated by side effect acconfig.h.in: configure.in aclocal.m4 + rm -f acconfig.h.in acconfig.h autoheader -f - touch -c acconfig.h.in - rm -f acconfig.h configure: configure.in aclocal.m4 + rm -f MCONFIG configure config.log acconfig.h + rm -rf *.cache autoconf - rm -f MCONFIG config.cache config.log acconfig.h version.h: version echo \#define VERSION \"tftp-hpa `cat version`\" > version.h diff --git a/config.h b/config.h index 1230971..1be817f 100644 --- a/config.h +++ b/config.h @@ -21,15 +21,6 @@ /* Must be included before we include any system headers! */ #include "acconfig.h" -/* This is necessary on Solaris with gcc */ -#define _XPG4_2 -#define _XOPEN_SOURCE -#define __EXTENSIONS__ - -/* This is necessary on glibc systems */ -#define _BSD_SOURCE -#define _ISO9X_SOURCE - /* Standard includes */ #include @@ -181,8 +172,12 @@ typedef unsigned long u_long; #endif #endif -/* arpa/tftp.h, and possible missing pieces */ +/* arpa/{inet,tftp}.h, and possible missing pieces */ +#ifdef HAVE_ARPA_INET_H +#include +#endif +/* If we don't have arpa/tftp.h we have problems... */ #include #ifndef OACK diff --git a/configure.in b/configure.in index 2cb2512..64b5046 100644 --- a/configure.in +++ b/configure.in @@ -11,6 +11,22 @@ AC_ISC_POSIX AC_AIX AC_MINIX AC_PROG_CC + +dnl +dnl Feature-test macros. These need to be set in CFLAGS, rather in +dnl acconfig.h, or "configure" will run in a different environment than +dnl we eventually we build in. +dnl + +dnl Needed on Solaris/cc or Solaris/gcc +CFLAGS="$CFLAGS -D_XPG4_2" +CFLAGS="$CFLAGS -D_XOPEN_SOURCE" +CFLAGS="$CFLAGS -D__EXTENSIONS__" + +dnl Needed on some glibc systems +CFLAGS="$CFLAGS -D_BSD_SOURCE" +CFLAGS="$CFLAGS -D_ISO9X_SOURCE" + AC_C_CONST AC_C_INLINE @@ -46,6 +62,7 @@ AC_CHECK_HEADERS(unistd.h) AC_CHECK_HEADERS(sys/filio.h) AC_CHECK_HEADERS(sys/stat.h) AC_CHECK_HEADERS(sys/types.h) +AC_CHECK_HEADERS(arpa/inet.h) dnl This is needed on some versions of FreeBSD... AC_CHECK_HEADERS(machine/param.h) @@ -55,6 +72,7 @@ AC_CHECK_TYPES(uint16_t) AC_CHECK_TYPES(uint32_t) AC_CHECK_TYPES(u_short) AC_CHECK_TYPES(u_long) +AC_TYPE_OFF_T AC_TYPE_PID_T AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR(socket library not found)]) diff --git a/tftpd/recvfrom.h b/tftpd/recvfrom.h index 1de145e..1177981 100644 --- a/tftpd/recvfrom.h +++ b/tftpd/recvfrom.h @@ -16,12 +16,7 @@ * */ -#define _XPG4_2 /* Needed on Solaris */ -#include -#include -#include -#include -#include +#include "config.h" int myrecvfrom(int s, void *buf, int len, unsigned int flags,