File: aclocal.m4

package info (click to toggle)
ample 0.5.7-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 548 kB
  • ctags: 243
  • sloc: ansic: 2,823; sh: 2,624; makefile: 244
file content (160 lines) | stat: -rw-r--r-- 5,084 bytes parent folder | download | duplicates (8)
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
dnl Renamed to AC_TYPE_SOCKLEN_T and some tweaks - David H - 2001-12-12
dnl
dnl @synopsis TYPE_SOCKLEN_T
dnl
dnl Check whether sys/socket.h defines type socklen_t. Please note
dnl that some systems require sys/types.h to be included before
dnl sys/socket.h can be compiled.
dnl
dnl @version $Id: aclocal.m4,v 1.3 2001/12/16 01:35:44 alphix Exp $
dnl @author Lars Brinkhoff <lars@nocrew.org>
dnl
AC_DEFUN([AC_TYPE_SOCKLEN_T],
[
AC_CACHE_CHECK([for socklen_t], 
ac_cv_type_socklen_t, [
        AC_TRY_COMPILE([
                      #include <sys/types.h>
                      #include <sys/socket.h>
              ],
              [
                      socklen_t len = 42; return 0;
              ],
              ac_cv_type_socklen_t="yes", ac_cv_type_socklen_t="no")
        ])

        if test "x$ac_cv_type_socklen_t" = "xno"; then
              AC_DEFINE(socklen_t, int, [the type of the last argument to getsockopt etc])
        fi
])
dnl end of AC_TYPE_SOCKLEN_T


dnl Renamed to AC_CHECK_SOCKET_LIBS and partially rewritten - David H - 2001-12-12
dnl
dnl @synopsis ETR_SOCKET_NSL
dnl
dnl This macro figures out what libraries are required on this platform
dnl to link sockets programs.  It's usually -lsocket and/or -lnsl or
dnl neither.  We test for all three combinations.
dnl
dnl @version $Id: aclocal.m4,v 1.3 2001/12/16 01:35:44 alphix Exp $
dnl @author Warren Young <warren@etr-usa.com>
dnl
AC_DEFUN([AC_CHECK_SOCKET_LIBS],
[
AC_CACHE_CHECK([for extra libraries needed for socket functions],
ac_cv_socket_libs, [
        oLIBS=$LIBS

        AC_TRY_LINK([
                        #include <sys/types.h>
                        #include <sys/socket.h>
                        #include <netinet/in.h>
                        #include <arpa/inet.h>
                ],
                [
                        struct in_addr add;
                        int sd = socket(AF_INET, SOCK_STREAM, 0);
                        inet_ntoa(add);
                ],
                ac_cv_socket_libs="none", ac_cv_socket_libs=no)

        if test "x$ac_cv_socket_libs" = "xno"
        then
                LIBS="$oLIBS -lsocket"
                AC_TRY_LINK([
                                #include <sys/types.h>
                                #include <sys/socket.h>
                                #include <netinet/in.h>
                                #include <arpa/inet.h>
                        ],
                        [
                                struct in_addr add;
                                int sd = socket(AF_INET, SOCK_STREAM, 0);
                                inet_ntoa(add);
                        ],
                        ac_cv_socket_libs=-lsocket, ac_cv_socket_libs=no)
        fi

        if test "x$ac_cv_socket_libs" = "xno"
        then
                LIBS="$oLIBS -lsocket -lnsl"
                AC_TRY_LINK([
                                #include <sys/types.h>
                                #include <sys/socket.h>
                                #include <netinet/in.h>
                                #include <arpa/inet.h>
                        ],
                        [
                                struct in_addr add;
                                int sd = socket(AF_INET, SOCK_STREAM, 0);
                                inet_ntoa(add);
                        ],
                        ac_cv_socket_libs="-lsocket -lnsl", ac_cv_socket_libs=no)
        fi

])

        if test "x$ac_cv_socket_libs" = "xno"
        then
                AC_MSG_ERROR([cannot find socket libraries])
	fi
]) dnl AC_CHECK_SOCKET_LIBS


dnl Written by me - David H - 2001-12-12
dnl
dnl @synopsis AC_LIB_WRAP
dnl
dnl This macro makes sure that libwrap is found and also checks if
dnl libnsl is needed for libwrap to function correctly.
dnl
dnl @author David Hrdeman <david@2gen.com>
dnl
AC_DEFUN([AC_LIB_WRAP],
[
AC_CACHE_VAL(ac_cv_libwrap_libs, 
[

        oLIBS=$LIBS
	AC_CHECK_HEADER([tcpd.h],,AC_MSG_ERROR([cannot find tcpd.h]),)
	AC_MSG_CHECKING([for libwrap libraries])

	LIBS="$oLIBS -lwrap"
        AC_TRY_LINK([
			#include <syslog.h>
                        #include <tcpd.h>
       			int allow_severity = LOG_INFO;
			int deny_severity = LOG_WARNING;
         	],
                [
			struct request_info request;
			hosts_access(&request);
                ],
                ac_cv_libwrap_libs=-lwrap, ac_cv_libwrap_libs=no)

        if test "x$ac_cv_libwrap_libs" = "xno"
        then
                LIBS="$oLIBS -lwrap -lnsl"
                AC_TRY_LINK([
				#include <syslog.h>
                                #include <tcpd.h>
				int allow_severity = LOG_INFO;
				int deny_severity = LOG_WARNING;
                        ],
                        [
				struct request_info request;
				hosts_access(&request);
                        ],
                        ac_cv_libwrap_libs="-lwrap -lnsl", ac_cv_libwrap_libs=no)
        fi
])

        if test "x$ac_cv_libwrap_libs" = "xno"
        then
                AC_MSG_ERROR([cannot find libraries])
	else
		AC_MSG_RESULT($ac_cv_libwrap_libs)
	fi
]) dnl AC_LIB_WRAP