Move feature test macros into configure.in -> CFLAGS so we don't

end up with mismatch between "configure" and compile time
This commit is contained in:
hpa 2001-11-14 02:54:25 +00:00
parent fd7a812f26
commit 5ec55f35e9
4 changed files with 27 additions and 19 deletions

View file

@ -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

View file

@ -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 <stdio.h>
@ -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 <arpa/inet.h>
#endif
/* If we don't have arpa/tftp.h we have problems... */
#include <arpa/tftp.h>
#ifndef OACK

View file

@ -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)])

View file

@ -16,12 +16,7 @@
*
*/
#define _XPG4_2 /* Needed on Solaris */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include "config.h"
int
myrecvfrom(int s, void *buf, int len, unsigned int flags,