File: configure.ac

package info (click to toggle)
dnsproxy 1.17%2Bgit20211129.22329c4-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 256 kB
  • sloc: ansic: 1,153; sh: 157; makefile: 12
file content (169 lines) | stat: -rw-r--r-- 4,816 bytes parent folder | download | duplicates (2)
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
AC_INIT([dnsproxy],[1.17])
AC_PREREQ([2.69])

AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE

dnl ------------------------------------------------------------------
dnl Check for programs
dnl ------------------------------------------------------------------

AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_CACHE_SAVE

dnl ------------------------------------------------------------------
dnl Check for headers
dnl ------------------------------------------------------------------

AC_USE_SYSTEM_EXTENSIONS
AC_C_CONST
AC_PROG_EGREP

AC_CHECK_HEADERS(sys/socket.h sys/time.h)
AC_CHECK_HEADERS(netinet/in.h arpa/inet.h)
AC_CHECK_HEADERS(errno.h syslog.h)
AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
		    (`int' or `void').])

AC_CACHE_SAVE

dnl ------------------------------------------------------------------
dnl Check for functions
dnl ------------------------------------------------------------------

AC_CHECK_FUNCS(strchr memcpy)
AC_CHECK_FUNCS(setregid setresgid setresuid setreuid)
AC_CACHE_SAVE

dnl ------------------------------------------------------------------
dnl Check for additional libraries
dnl ------------------------------------------------------------------

AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([socket], [socket], [], [
	AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"], [],
		[-lnsl])
])
AC_CACHE_SAVE

dnl ------------------------------------------------------------------
dnl Enable extended warnings while developing
dnl ------------------------------------------------------------------

AC_ARG_ENABLE(warnings, [
AS_HELP_STRING([--enable-warnings],
[enable all sorts of warnings for debugging])],
[
	CFLAGS="${CFLAGS} -Wall -Werror -Wcast-qual -Wmissing-declarations \
		-W -Wmissing-prototypes -Wnested-externs -Wshadow \
		-Wwrite-strings -Wno-unused -Wno-sign-compare"
])
AC_SUBST(CFLAGS)

dnl ------------------------------------------------------------------
dnl Maximum EDNS packet size
dnl ------------------------------------------------------------------

AC_ARG_ENABLE([edns], [
AS_HELP_STRING([--enable-edns=N],
[maximum EDNS packet size (default is 4096)])],
[], [enable_edns=4096])
AS_IF([test $enable_edns = no], [enable_edns=4096])
AC_DEFINE_UNQUOTED([MAXEDNS],[$enable_edns],[Maximum EDNS packet size])

dnl ------------------------------------------------------------------
dnl Check for libevent library
dnl ------------------------------------------------------------------

lefound="no"
LIBS="$LIBS -levent"
AC_MSG_CHECKING(for libevent)
AC_ARG_WITH(libevent,
	AS_HELP_STRING(
            [--with-libevent=PATH],
            [directory prefix where libevent is found
	]),
	[
		if test -f $withval/include/event.h; then
			CFLAGS="${CFLAGS} -I$withval/include"
		elif test -f $withval/event.h; then
			CFLAGS="${CFLAGS} -I$withval"
		else
			AC_MSG_ERROR(event.h not found)
		fi
		if test -f $withval/lib; then
			LDFLAGS="${LDFLAGS} -L$withval/lib"
		else
			LDFLAGS="${LDFLAGS} -L$withval"
		fi
		AC_MSG_RESULT([using $withval])
		lefound="yes"
	],
	[
		saved_CFLAGS=$CFLAGS
		saved_LDFLAGS=$LDFLAGS
		for testdir in "" $prefix /usr/local /opt/csw; do
			if test -z "$testdir"; then
				CFLAGS="$saved_CFLAGS"
				LDFLAGS="$saved_LDFLAGS"
			else
				CFLAGS="$saved_CFLAGS -I$testdir/include"
				LDFLAGS="$saved_LDFLAGS -L$testdir/lib"
			fi

			AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>
			#include <event.h>]], [[ event_init(); ]])],[ lefound="$testdir" ],[ lefound="no" ])

			if test "$lefound" != "no"; then
				if test -z "$testdir"; then
					AC_MSG_RESULT([found])
				else
					AC_MSG_RESULT([found in $lefound])
				fi
				break
			fi
		done
	]
)

if test "$lefound" = "no"; then
	AC_MSG_ERROR([
	This software requires the libevent library
	available at http://libevent.org/

	You may specify it's directory prefix with
	./configure --with-libevent=/prefix/of/libevent
	])
fi

dnl ------------------------------------------------------------------
dnl Check for available nroff and manpage macro package
dnl ------------------------------------------------------------------

AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$PATH:/usr/ucb])
if ${NROFF} -mdoc dnsproxy.8 >/dev/null 2>&1; then
	MAN=mdoc
else
	MAN=man
fi
AC_SUBST(MAN)

dnl ------------------------------------------------------------------
dnl Generate Makefile by default. Others only if their .in file
dnl exists in the current directory, which happens in my workdir
dnl but not for distributed tarballs.
dnl ------------------------------------------------------------------

AC_CONFIG_FILES(Makefile)
if test -r "dnsproxy.8.in"; then
	AC_CONFIG_FILES(dnsproxy.8)
fi

AC_OUTPUT

AC_MSG_RESULT()
AC_MSG_RESULT([Configured successfully. Now run make.])
AC_MSG_RESULT()