1 dnl --------------------------------------------------------------------------
4 dnl Attempt to add the given option to CFLAGS, if it doesn't break compilation
5 dnl --------------------------------------------------------------------------
6 AC_DEFUN(PA_ADD_CFLAGS,
7 [AC_MSG_CHECKING([if $CC accepts $1])
8 pa_add_cflags__old_cflags="$CFLAGS"
10 AC_TRY_COMPILE([#include <stdio.h>],
11 [printf("Hello, World!\n");],
14 CFLAGS="$pa_add_cflags__old_cflags")])
16 dnl --------------------------------------------------------------------------
19 dnl Do we have sigsetjmp/siglongjmp? (AC_CHECK_FUNCS doesn't seem to work
20 dnl for these particular functions.)
21 dnl --------------------------------------------------------------------------
22 AC_DEFUN(PA_SIGSETJMP,
23 [AC_MSG_CHECKING([for sigsetjmp])
36 dnl --------------------------------------------------------------------------
37 dnl PA_MSGHDR_MSG_CONTROL
39 dnl Does struct msghdr have the msg_control field?
40 dnl --------------------------------------------------------------------------
41 AH_TEMPLATE([HAVE_MSGHDR_MSG_CONTROL],
42 [Define if struct msghdr has the msg_control field.])
44 AC_DEFUN(PA_MSGHDR_MSG_CONTROL,
45 [AC_CHECK_MEMBER(struct msghdr.msg_control,
46 [AC_DEFINE(HAVE_MSGHDR_MSG_CONTROL)],
49 #include <sys/types.h>
50 #include <sys/socket.h>
51 #include <netinet/in.h>
54 dnl ------------------------------------------------------------------------
55 dnl PA_STRUCT_IN_PKTINFO
57 dnl Look for definition of struct in_pktinfo, which at least has an
58 dnl ipi_addr member. Some versions of glibc lack struct in_pktinfo;
59 dnl if so we need to include the definition ourselves -- but we only
60 dnl want to do that if absolutely necessary!
61 dnl ------------------------------------------------------------------------
62 AH_TEMPLATE([HAVE_STRUCT_IN_PKTINFO],
63 [Define if struct in_pktinfo is defined.])
65 AC_DEFUN(PA_STRUCT_IN_PKTINFO,
66 [AC_CHECK_MEMBER(struct in_pktinfo.ipi_addr,
67 [AC_DEFINE(HAVE_STRUCT_IN_PKTINFO)],
70 #include <sys/types.h>
71 #include <sys/socket.h>
72 #include <netinet/in.h>
73 #include <arpa/inet.h>
78 dnl --------------------------------------------------------------------------
79 dnl PA_HAVE_TCPWRAPPERS
81 dnl Do we have the tcpwrappers -lwrap? This can't be done using AC_CHECK_LIBS
82 dnl due to the need to provide "allow_severity" and "deny_severity" variables
83 dnl --------------------------------------------------------------------------
84 AH_TEMPLATE([HAVE_TCPWRAPPERS],
85 [Define if we have tcpwrappers (-lwrap) and <tcpd.h>.])
87 AC_DEFUN(PA_HAVE_TCPWRAPPERS,
88 [AC_CHECK_LIB([wrap], [main])
89 AC_MSG_CHECKING([for tcpwrappers])
93 int allow_severity = 0;
94 int deny_severity = 0;
97 hosts_ctl("sample_daemon", STRING_UNKNOWN, STRING_UNKNOWN, STRING_UNKNOWN);
100 AC_DEFINE(HAVE_TCPWRAPPERS)
107 dnl ------------------------------------------------------------------------
108 dnl PA_CHECK_INTTYPES_H_SANE
110 dnl At least some versions of AIX 4 have <inttypes.h> macros which are
111 dnl completely broken. Try to detect those.
112 dnl --------------------------------------------------------------------------
113 AH_TEMPLATE([INTTYPES_H_IS_SANE],
114 [Define if the macros in <inttypes.h> are usable])
116 AC_DEFUN(PA_CHECK_INTTYPES_H_SANE,
117 [AC_CHECK_HEADERS(inttypes.h,
119 AC_MSG_CHECKING([if inttypes.h is sane])
122 #include <inttypes.h>
125 [uintmax_t max = UINTMAX_C(0);
126 printf("%"PRIuMAX"\n", max);],
128 AC_DEFINE(INTTYPES_H_IS_SANE),
129 AC_MSG_RESULT([no (AIX, eh?)]))
133 dnl ------------------------------------------------------------------------
136 dnl PA_WITH_BOOL(option, default, help, enable, disable)
138 dnl Provides a more convenient way to specify --with-option and
139 dnl --without-option, with a default. default should be either 0 or 1.
140 dnl ------------------------------------------------------------------------
141 AC_DEFUN(PA_WITH_BOOL,
142 [AC_ARG_WITH([$1], [$3],
143 if test ["$withval"] != no; then
148 if test [$2] -ne 0; then
154 dnl --------------------------------------------------------------------------
155 dnl PA_HEADER_DEFINES
157 dnl PA_HEADER_DEFINES(header, type, value)
158 dnl --------------------------------------------------------------------------
159 AC_DEFUN(PA_HEADER_DEFINES,
160 [AC_MSG_CHECKING([if $1 defines $3])
161 AH_TEMPLATE([HAVE_$3_DEFINITION], [Define if $1 defines $3])
173 pa_header_define=`echo HAVE_$3_DEFINITION | tr '[a-z]' '[A-Z]'`
174 AC_DEFINE_UNQUOTED($pa_header_define)
181 dnl --------------------------------------------------------------------------