+#ifndef _DEFINES_H
+#define _DEFINES_H
+
/* Necessary headers */
-#include <sys/types.h> /* For u_intXX_t */
+#include <sys/types.h>
#include <sys/socket.h> /* For SHUT_XXXX */
+#ifdef HAVE_SYS_BITYPES_H
+# include <sys/bitypes.h> /* For u_intXX_t */
+#endif
+
#ifdef HAVE_PATHS_H
# include <paths.h> /* For _PATH_XXX */
#endif
/* If sys/types.h does not supply intXX_t, supply them ourselves */
/* (or die trying) */
#ifndef HAVE_INTXX_T
+# if (SIZEOF_CHAR == 1)
+typedef char int8_t;
+# else
+# error "8 bit int type not found."
+# endif
# if (SIZEOF_SHORT_INT == 2)
typedef short int int16_t;
# else
# else
# if (SIZEOF_LONG_LONG_INT == 8)
typedef long long int int64_t;
+# define HAVE_INTXX_T 1
# else
# error "64 bit int type not found."
# endif
/* If sys/types.h does not supply u_intXX_t, supply them ourselves */
#ifndef HAVE_U_INTXX_T
# ifdef HAVE_UINTXX_T
+typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
+# define HAVE_U_INTXX_T 1
# else
+# if (SIZEOF_CHAR == 1)
+typedef unsigned char u_int8_t;
+# else
+# error "8 bit int type not found."
+# endif
# if (SIZEOF_SHORT_INT == 2)
typedef unsigned short int u_int16_t;
# else
# else
# if (SIZEOF_LONG_LONG_INT == 8)
typedef unsigned long long int u_int64_t;
+# define HAVE_U_INTXX_T 1
# else
# error "64 bit int type not found."
# endif
# endif
#endif
-/* If quad_t is not supplied, then supply it now. We can rely on int64_t */
-/* being defined by the above */
-#ifndef HAVE_QUAD_T
-typedef int64_t quad_t;
-#endif
-
#ifndef HAVE_SOCKLEN_T
typedef unsigned int socklen_t;
+# define HAVE_SOCKLEN_T
#endif /* HAVE_SOCKLEN_T */
#ifndef HAVE_SIZE_T
typedef unsigned int size_t;
+# define HAVE_SIZE_T
#endif /* HAVE_SIZE_T */
+#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
+# define ss_family __ss_family
+#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */
+
/* Paths */
/* If _PATH_LASTLOG is not defined by system headers, set it to the */
#endif
#if !defined(__GNUC__) || (__GNUC__ < 2)
-# define __attribute__(x)
+# define __attribute__(x)
#endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
#if defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM)
# define PAM_STRERROR(a,b) pam_strerror((a),(b))
#endif
+#if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO)
+# undef HAVE_GETADDRINFO
+#endif /* defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO) */
+
+#endif /* _DEFINES_H */