2 dnl -----------------------------------------------------------------------
4 dnl Copyright 1999-2002 H. Peter Anvin - All Rights Reserved
6 dnl This program is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 dnl Bostom MA 02111-1307, USA; either version 2 of the License, or
10 dnl (at your option) any later version; incorporated herein by reference.
12 dnl -----------------------------------------------------------------------
14 dnl --------------------------------------------------------------------------
17 dnl Attempt to add the given option to CFLAGS, if it doesn't break compilation
18 dnl --------------------------------------------------------------------------
19 AC_DEFUN(PA_ADD_CFLAGS,
20 [AC_MSG_CHECKING([if $CC accepts $1])
21 pa_add_cflags__old_cflags="$CFLAGS"
23 AC_TRY_LINK([#include <stdio.h>],
24 [printf("Hello, World!\n");],
27 CFLAGS="$pa_add_cflags__old_cflags")])
29 dnl --------------------------------------------------------------------------
32 dnl Do we have sigsetjmp/siglongjmp? (AC_CHECK_FUNCS doesn't seem to work
33 dnl for these particular functions.)
34 dnl --------------------------------------------------------------------------
35 AC_DEFUN(PA_SIGSETJMP,
36 [AC_MSG_CHECKING([for sigsetjmp])
49 dnl --------------------------------------------------------------------------
50 dnl PA_MSGHDR_MSG_CONTROL
52 dnl Does struct msghdr have the msg_control field?
53 dnl --------------------------------------------------------------------------
54 AH_TEMPLATE([HAVE_MSGHDR_MSG_CONTROL],
55 [Define if struct msghdr has the msg_control field.])
57 AC_DEFUN(PA_MSGHDR_MSG_CONTROL,
58 [AC_CHECK_MEMBER(struct msghdr.msg_control,
59 [AC_DEFINE(HAVE_MSGHDR_MSG_CONTROL)],
62 #include <sys/types.h>
63 #include <sys/socket.h>
64 #include <netinet/in.h>
67 dnl ------------------------------------------------------------------------
68 dnl PA_STRUCT_IN_PKTINFO
70 dnl Look for definition of struct in_pktinfo, which at least has an
71 dnl ipi_addr member. Some versions of glibc lack struct in_pktinfo;
72 dnl if so we need to include the definition ourselves -- but we only
73 dnl want to do that if absolutely necessary!
75 dnl We don't use AC_CHECK_MEMBER() here, since at least in autoconf 2.52
76 dnl this is broken for a member of structure type.
77 dnl ------------------------------------------------------------------------
78 AH_TEMPLATE([HAVE_STRUCT_IN_PKTINFO],
79 [Define if struct in_pktinfo is defined.])
81 AC_DEFUN(PA_STRUCT_IN_PKTINFO,
82 [AC_MSG_CHECKING([for definition of struct in_pktinfo])
85 #include <sys/types.h>
86 #include <sys/socket.h>
87 #include <netinet/in.h>
88 #include <arpa/inet.h>
93 struct in_pktinfo pktinfo;
94 int foo = sizeof(struct in_pktinfo);
95 void *quux = (void *)(&pktinfo.ipi_addr);
98 AC_DEFINE(HAVE_STRUCT_IN_PKTINFO)
105 dnl --------------------------------------------------------------------------
106 dnl PA_HAVE_TCPWRAPPERS
108 dnl Do we have the tcpwrappers -lwrap? This can't be done using AC_CHECK_LIBS
109 dnl due to the need to provide "allow_severity" and "deny_severity" variables
110 dnl --------------------------------------------------------------------------
111 AH_TEMPLATE([HAVE_TCPWRAPPERS],
112 [Define if we have tcpwrappers (-lwrap) and <tcpd.h>.])
114 AC_DEFUN(PA_HAVE_TCPWRAPPERS,
115 [AC_CHECK_LIB([wrap], [main])
116 AC_MSG_CHECKING([for tcpwrappers])
120 int allow_severity = 0;
121 int deny_severity = 0;
124 hosts_ctl("sample_daemon", STRING_UNKNOWN, STRING_UNKNOWN, STRING_UNKNOWN);
127 AC_DEFINE(HAVE_TCPWRAPPERS)
134 dnl ------------------------------------------------------------------------
135 dnl PA_CHECK_INTTYPES_H_SANE
137 dnl At least some versions of AIX 4 have <inttypes.h> macros which are
138 dnl completely broken. Try to detect those.
139 dnl --------------------------------------------------------------------------
140 AH_TEMPLATE([INTTYPES_H_IS_SANE],
141 [Define if the macros in <inttypes.h> are usable])
143 AC_DEFUN(PA_CHECK_INTTYPES_H_SANE,
144 [AC_CHECK_HEADERS(inttypes.h,
146 AC_MSG_CHECKING([if inttypes.h is sane])
149 #include <inttypes.h>
152 [uintmax_t max = UINTMAX_C(0);
153 printf("%"PRIuMAX"\n", max);],
155 AC_DEFINE(INTTYPES_H_IS_SANE),
156 AC_MSG_RESULT([no (AIX, eh?)]))
160 dnl ------------------------------------------------------------------------
163 dnl PA_WITH_BOOL(option, default, help, enable, disable)
165 dnl Provides a more convenient way to specify --with-option and
166 dnl --without-option, with a default. default should be either 0 or 1.
167 dnl ------------------------------------------------------------------------
168 AC_DEFUN(PA_WITH_BOOL,
169 [AC_ARG_WITH([$1], [$3],
170 if test ["$withval"] != no; then
175 if test [$2] -ne 0; then
181 dnl --------------------------------------------------------------------------
182 dnl PA_HEADER_DEFINES
184 dnl PA_HEADER_DEFINES(header, type, value)
185 dnl --------------------------------------------------------------------------
186 AC_DEFUN(PA_HEADER_DEFINES,
187 [AC_MSG_CHECKING([if $1 defines $3])
188 AH_TEMPLATE([HAVE_$3_DEFINITION], [Define if $1 defines $3])
200 pa_header_define=`echo HAVE_$3_DEFINITION | tr '[a-z]' '[A-Z]'`
201 AC_DEFINE_UNQUOTED($pa_header_define)