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])
25 [#include <setjmp.h>],
34 dnl --------------------------------------------------------------------------
35 dnl PA_MSGHDR_MSG_CONTROL
37 dnl Does struct msghdr have the msg_control field?
38 dnl --------------------------------------------------------------------------
39 AH_TEMPLATE([HAVE_MSGHDR_MSG_CONTROL],
40 [Define if struct msghdr has the msg_control field.])
42 AC_DEFUN(PA_MSGHDR_MSG_CONTROL,
43 [AC_MSG_CHECKING([for msg_control in struct msghdr])
46 #define _XPG4_2 /* Needed on Solaris */
47 #include <sys/types.h>
48 #include <sys/socket.h>
49 #include <netinet/in.h>
53 void *p = (void *) &msg.msg_control;
56 AC_DEFINE(HAVE_MSGHDR_MSG_CONTROL)
63 dnl ------------------------------------------------------------------------
64 dnl PA_STRUCT_IN_PKTINFO
66 dnl Look for definition of struct in_pktinfo. Some versions of glibc
67 dnl lack struct in_pktinfo; if so we need to include the definition
68 dnl ourselves -- but we only want to do that if absolutely necessary!
69 dnl ------------------------------------------------------------------------
70 AH_TEMPLATE([HAVE_STRUCT_IN_PKTINFO],
71 [Define if struct in_pktinfo is defined.])
73 AC_DEFUN(PA_STRUCT_IN_PKTINFO,
74 [AC_MSG_CHECKING([for definition of struct in_pktinfo])
77 #include <sys/types.h>
78 #include <sys/socket.h>
79 #include <netinet/in.h>
80 #include <arpa/inet.h>
85 struct in_pktinfo pktinfo;
86 int foo = sizeof(struct in_pktinfo);
87 void *quux = (void *)(&pktinfo.ipi_addr);
90 AC_DEFINE(HAVE_STRUCT_IN_PKTINFO)
97 dnl --------------------------------------------------------------------------
98 dnl PA_HAVE_TCPWRAPPERS
100 dnl Do we have the tcpwrappers -lwrap? This can't be done using AC_CHECK_LIBS
101 dnl due to the need to provide "allow_severity" and "deny_severity" variables
102 dnl --------------------------------------------------------------------------
103 AH_TEMPLATE([HAVE_TCPWRAPPERS],
104 [Define if we have tcpwrappers (-lwrap) and <tcpd.h>.])
106 AC_DEFUN(PA_HAVE_TCPWRAPPERS,
107 [AC_CHECK_LIB([wrap], [main])
108 AC_MSG_CHECKING([for tcpwrappers])
112 int allow_severity = 0;
113 int deny_severity = 0;
116 hosts_ctl("sample_daemon", STRING_UNKNOWN, STRING_UNKNOWN, STRING_UNKNOWN);
119 AC_DEFINE(HAVE_TCPWRAPPERS)
126 dnl ------------------------------------------------------------------------
129 dnl PA_WITH_BOOL(option, default, help, enable, disable)
131 dnl Provides a more convenient way to specify --with-option and
132 dnl --without-option, with a default. default should be either 0 or 1.
133 dnl ------------------------------------------------------------------------
134 AC_DEFUN(PA_WITH_BOOL,
135 [AC_ARG_WITH([$1], [$3],
136 if test ["$withval"] != no; then
141 if test [$2] -ne 0; then
147 dnl --------------------------------------------------------------------------
148 dnl PA_HEADER_DEFINES
150 dnl PA_HEADER_DEFINES(header, type, value)
151 dnl --------------------------------------------------------------------------
152 AC_DEFUN(PA_HEADER_DEFINES,
153 [AC_MSG_CHECKING([if $1 defines $3])
165 pa_header_define=`echo HAVE_$3_DEFINITION | tr '[a-z]' '[A-Z]'`
166 AC_DEFINE_UNQUOTED($pa_header_define)