summaryrefslogtreecommitdiffstats
path: root/src/lib/rpc/configure.in
blob: 31eaf180774ee2fcd86020a7dc64378c3d14be22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
AC_INIT(auth_gssapi.c)
CONFIG_RULES
AC_CONFIG_SUBDIRS(unit-test)
AC_CHECK_HEADERS(sys/uio.h sys/param.h)
AC_TYPE_GETGROUPS
### Check where struct rpcent is declared.
#
# This is necessary to determine:
# 1. If /usr/include/netdb.h declares struct rpcent
# 2. If /usr/include/rpc/netdb.h declares struct rpcent
#
# We have our own rpc/netdb.h, and if /usr/include/netdb.h includes
# rpc/netdb.h, then nastiness could happen.
#
# Logic: If /usr/include/netdb.h declares struct rpcent, then check
# rpc/netdb.h.  If /usr/include/rpc/netdb.h declares struct rpcent,
# then define STRUCT_RPCENT_IN_RPC_NETDB_H, otherwise do not.  If
# neither netdb.h nor rpc/netdb.h declares struct rpcent, then define
# STRUCT_RPCENT_IN_RPC_NETDB_H anyway.
#
AC_MSG_CHECKING([where struct rpcent is declared])
AC_TRY_COMPILE([#include <netdb.h>],
[struct rpcent e;
char c = e.r_name[0];
int i = e.r_number;],
[AC_TRY_COMPILE([#include <rpc/netdb.h>],
[struct rpcent e;
char c = e.r_name[0];
int i = e.r_number;],
[AC_MSG_RESULT([rpc/netdb.h])
rpcent_define='#define STRUCT_RPCENT_IN_RPC_NETDB_H'],
[AC_MSG_RESULT([netdb.h])])],
[AC_MSG_RESULT([nowhere])
rpcent_define='#define STRUCT_RPCENT_IN_RPC_NETDB_H'])
AC_SUBST(rpcent_define)

AC_CHECK_HEADERS(sys/select.h sys/time.h unistd.h)
if test $ac_cv_header_sys_select_h = yes; then
  GSSRPC__SYS_SELECT_H='#include <sys/select.h>'
else
  GSSRPC__SYS_SELECT_H='/* #include <sys/select.h> */'
fi
AC_SUBST(GSSRPC__SYS_SELECT_H)
if test $ac_cv_header_sys_time_h = yes; then
  GSSRPC__SYS_TIME_H='#include <sys/time.h>'
else
  GSSRPC__SYS_TIME_H='/* #include <sys/time.h> */'
fi
AC_SUBST(GSSRPC__SYS_TIME_H)
if test $ac_cv_header_unistd_h = yes; then
  GSSRPC__UNISTD_H='#include <unistd.h>'
else
  GSSRPC__UNISTD_H='/* #include <unistd.h> */'
fi
AC_SUBST(GSSRPC__UNISTD_H)

AC_CACHE_CHECK([for MAXHOSTNAMELEN in sys/param.h],
  [krb5_cv_header_sys_param_h_maxhostnamelen],
  [AC_TRY_COMPILE([#include <sys/param.h>],
    [int i = MAXHOSTNAMELEN;],
    [krb5_cv_header_sys_param_h_maxhostnamelen=yes],
    [krb5_cv_header_sys_param_h_maxhostnamelen=no])])
AC_CACHE_CHECK([for MAXHOSTNAMELEN in netdb.h],
  [krb5_cv_header_netdb_h_maxhostnamelen],
  [AC_TRY_COMPILE([#include <netdb.h>],
    [int i = MAXHOSTNAMELEN;],
    [krb5_cv_header_netdb_h_maxhostnamelen=yes],
    [krb5_cv_header_netdb_h_maxhostnamelen=no])])

GSSRPC__SYS_PARAM_H='/* #include <sys/param.h> */'
GSSRPC__NETDB_H='/* #include <netdb.h> */'
if test $krb5_cv_header_sys_param_h_maxhostnamelen = yes; then
  GSSRPC__SYS_PARAM_H='#include <sys/param.h>'
else
  if test $krb5_cv_header_netdb_h_maxhostnamelen = yes; then
    GSSRPC__NETDB_H='#include <netdb.h>'
  else
    AC_MSG_WARN([can't find MAXHOSTNAMELEN definition; faking it])
  fi
fi
AC_SUBST(GSSRPC__SYS_PARAM_H)
AC_SUBST(GSSRPC__NETDB_H)

AC_CACHE_CHECK([for uint32_t in sys/types.h],
  [krb5_cv_header_sys_types_h_uint32_t],
  [AC_TRY_COMPILE([#include <sys/types.h>],
      [uint32_t i = 0;],
      [krb5_cv_header_sys_types_h_uint32_t=yes],
      [krb5_cv_header_sys_types_h_uint32_t=no])])
AC_CACHE_CHECK([for uint32_t in stdint.h],
  [krb5_cv_header_stdint_h_uint32_t],
  [AC_TRY_COMPILE([#include <stdint.h>],
      [uint32_t i = 0;],
      [krb5_cv_header_stdint_h_uint32_t=yes],
      [krb5_cv_header_stdint_h_uint32_t=no])])
AC_CACHE_CHECK([for uint32_t in inttypes.h],
  [krb5_cv_header_inttypes_h_uint32_t],
  [AC_TRY_COMPILE([#include <inttypes.h>],
      [uint32_t i = 0;],
      [krb5_cv_header_inttypes_h_uint32_t=yes],
      [krb5_cv_header_inttypes_h_uint32_t=no])])
GSSRPC__STDINT_H='/* #include <stdint.h> */'
GSSRPC__INTTYPES_H='/* #include <inttypes.h> */'
GSSRPC__FAKE_UINT32='/* #undef GSSRPC__FAKE_INT32 */'
if test $krb5_cv_header_sys_types_h_uint32_t = yes; then
  : # already included sys/types.h
else
  if test $krb5_cv_header_stdint_h_uint32_t = yes; then
    GSSRPC__STDINT_H='#include <stdint.h>'
  else
    if test $krb5_cv_header_inttypes_h_uint32_t = yes; then
      GSSRPC__INTTYPES_H='#include <inttypes.h>'
    else
      AC_MSG_WARN([can't find a fixed-width 32-bit type anywhere; faking it])
      GSSRPC__FAKE_UINT32='#define GSSRPC__FAKE_UINT32 1'
    fi
  fi
fi
AC_SUBST(GSSRPC__STDINT_H)
AC_SUBST(GSSRPC__INTTYPES_H)
AC_SUBST(GSSRPC__FAKE_UINT32)

AC_CACHE_CHECK([for BSD type aliases], [krb5_cv_type_bsdaliases],
  [AC_TRY_COMPILE(
    [#include <sys/types.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif],
    [u_char c;
u_int i;
u_long l;], [krb5_cv_type_bsdaliases=yes], [krb5_cv_type_bsdaliases=no])])
if test $krb5_cv_type_bsdaliases = yes; then
  GSSRPC__BSD_TYPEALIASES='/* #undef GSSRPC__BSD_TYPEALIASES */'
else
  GSSRPC__BSD_TYPEALIASES='#define GSSRPC__BSD_TYPEALIASES 1'
fi
AC_SUBST(GSSRPC__BSD_TYPEALIASES)

AC_CHECK_FUNCS(strerror)
#
# sockaddr length field checks
#
AC_CHECK_MEMBERS([struct sockaddr_in.sin_len], , ,
  [#include <sys/types.h>
@%:@include <netinet/in.h>])
AC_CHECK_MEMBERS([struct sockaddr.sa_len], , ,
  [#include <sys/types.h>
@%:@include <sys/socket.h>])

AC_MSG_CHECKING([return type of setrpcent])
AC_CACHE_VAL(k5_cv_type_setrpcent,
[AC_TRY_COMPILE([#include <netdb.h>
#ifdef __cplusplus
extern "C"
#endif
extern void setrpcent();],
[int i;], k5_cv_type_setrpcent=void, k5_cv_type_setrpcent=int)])dnl
AC_MSG_RESULT($k5_cv_type_setrpcent)
AC_DEFINE_UNQUOTED(SETRPCENT_TYPE, $k5_cv_type_setrpcent)
dnl
AC_MSG_CHECKING([return type of endrpcent])
AC_CACHE_VAL(k5_cv_type_endrpcent,
[AC_TRY_COMPILE([#include <netdb.h>
#ifdef __cplusplus
extern "C"
#endif
extern void endrpcent();],
[int i;], k5_cv_type_endrpcent=void, k5_cv_type_endrpcent=int)])dnl
AC_MSG_RESULT($k5_cv_type_endrpcent)
AC_DEFINE_UNQUOTED(ENDRPCENT_TYPE, $k5_cv_type_endrpcent)
DECLARE_SYS_ERRLIST
KRB5_BUILD_LIBOBJS
KRB5_BUILD_LIBRARY_WITH_DEPS
K5_GEN_FILE(types.h:types.hin)
V5_AC_OUTPUT_MAKEFILE