Postmoderize use of AC_CHECK_TYPE

Use AC_TYPE_SSIZE_T to handle the ssize_t check (introduced in Autconf
2.60).  Use AC_CHECK_TYPE, not AC_CHECK_TYPES, to check for sig_atomic_t
and socklen_t, and define them in afsconfig.h if they're not present on
this platform.  Do not define them in stds.h, since stds.h is an installed
header file and cannot rely on Autoconf defines.

Change-Id: I80e1a00efc84420002a95d6cafc25ea70befa49d
Reviewed-on: http://gerrit.openafs.org/2018
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Russ Allbery 2010-05-24 21:34:53 -05:00 committed by Derrick Brashear
parent 48d3ec164b
commit 8aa5328bd5
2 changed files with 13 additions and 15 deletions

View File

@ -1285,11 +1285,15 @@ AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned int) AC_CHECK_SIZEOF(unsigned int)
AC_TYPE_INTPTR_T AC_TYPE_INTPTR_T
AC_TYPE_UINTPTR_T AC_TYPE_UINTPTR_T
AC_CHECK_TYPES([ssize_t]) AC_TYPE_SSIZE_T
AC_CHECK_TYPES([sig_atomic_t],[],[], AC_CHECK_TYPE([sig_atomic_t],[],
[AC_DEFINE([sig_atomic_t], [int],
[Define to int if <signal.h> does not define.])],
[#include <sys/types.h> [#include <sys/types.h>
#include <signal.h>]) #include <signal.h>])
AC_CHECK_TYPES([socklen_t],[],[], AC_CHECK_TYPE([socklen_t],[],
[AC_DEFINE([socklen_t], [int],
[Define to int if <sys/socket.h> does not define.])],
[#include <sys/types.h> [#include <sys/types.h>
#include <sys/socket.h>]) #include <sys/socket.h>])
AC_SIZEOF_TYPE(long) AC_SIZEOF_TYPE(long)

View File

@ -7,6 +7,12 @@
* directory or online at http://www.openafs.org/dl/license10.html * directory or online at http://www.openafs.org/dl/license10.html
*/ */
/*
* Do not put anything in this file that relies on Autoconf defines, since
* we're not guaranteed to have included afsconfig.h before this header file.
* This is an installed header file, and afsconfig.h is not.
*/
#ifndef OPENAFS_AFS_CONFIG_STDS_H #ifndef OPENAFS_AFS_CONFIG_STDS_H
#define OPENAFS_AFS_CONFIG_STDS_H 1 #define OPENAFS_AFS_CONFIG_STDS_H 1
@ -51,18 +57,6 @@ pragma Off(Prototype_override_warnings);
#define MIN_AFS_INT64 (-MAX_AFS_INT64 - 1) #define MIN_AFS_INT64 (-MAX_AFS_INT64 - 1)
#define MAX_AFS_UINT64 0xFFFFFFFFFFFFFFFFL #define MAX_AFS_UINT64 0xFFFFFFFFFFFFFFFFL
#ifndef HAVE_SSIZE_T
typedef int ssize_t;
#endif
#ifndef HAVE_SIG_ATOMIC_T
typedef int sig_atomic_t;
#endif
#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif
typedef short afs_int16; typedef short afs_int16;
typedef unsigned short afs_uint16; typedef unsigned short afs_uint16;
#ifdef AFS_64BIT_ENV #ifdef AFS_64BIT_ENV