1AC_INIT(pptpmanager.c)
2
3AM_CONFIG_HEADER(config.h)
4AM_INIT_AUTOMAKE(pptpd,1.3.4)
5
6# check common command line options early
7
8AC_DEFINE(PPP_BINARY, "/usr/sbin/pppd")
9AC_MSG_CHECKING(command line for use of BSD PPP)
10AC_ARG_WITH(bsdppp,
11	[  --with-bsdppp           Use BSD user-space ppp ],
12	[ 
13	    case "$withval" in
14		yes)
15		    AC_MSG_RESULT(BSD user-space ppp)
16		    AC_DEFINE(BSDUSER_PPP)
17		    BSDUSER_PPP=$with_bsdppp
18		    AC_DEFINE(PPP_BINARY, "/usr/sbin/ppp")
19		    break;
20		    ;;
21		no)
22		    AC_MSG_RESULT(explicit standard pppd)
23		    ;;
24		*)
25		    # only yes or no are expected for this option
26		    AC_MSG_RESULT(unrecognised... terminating)
27		    exit 1
28		    ;;
29	    esac
30	], [AC_MSG_RESULT(default standard pppd)])
31
32AC_MSG_CHECKING(command line for use of SLIRP)
33AC_ARG_WITH(slirp,
34	[  --with-slirp            Use SLIRP instead of pppd ],
35	[ 
36	    case "$withval" in
37		yes)
38		    AC_MSG_RESULT(yes)
39		    AC_DEFINE(SLIRP)
40		    SLIRP=$with_slirp
41		    AC_DEFINE(PPP_BINARY, "/bin/slirp")
42		    break;
43		    ;;
44		no)
45		    AC_MSG_RESULT(explicit no)
46		    ;;
47		*)
48		    # only yes or no are expected for this option
49		    AC_MSG_RESULT(unrecognised... terminating)
50		    exit 1
51		    ;;
52	    esac
53	], [AC_MSG_RESULT(default no)])
54
55AC_MSG_CHECKING(command line for syslog facility name)
56AC_ARG_ENABLE(facility,
57    [  --enable-facility=name    Use another syslog facility, default LOG_DAEMON ],
58    [
59	AC_MSG_RESULT($enableval)
60	AC_DEFINE_UNQUOTED(PPTP_FACILITY, $enableval)
61	],
62    [
63	AC_MSG_RESULT(default LOG_DAEMON)
64	AC_DEFINE_UNQUOTED(PPTP_FACILITY, LOG_DAEMON)
65    ])
66
67AC_MSG_CHECKING(command line for bcrelay build)
68AC_ARG_ENABLE(bcrelay,
69	[  --enable-bcrelay          Enable broadcast relay function ],
70	[ 
71	    case "$enableval" in
72		yes)
73		    AC_MSG_RESULT(yes)
74		    AC_DEFINE(BCRELAY)
75		    BCRELAY=$enableval
76		    break;
77		    ;;
78		no)
79		    AC_MSG_RESULT(explicit no)
80		    ;;
81		*)
82		    # only yes or no are expected for this option
83		    AC_MSG_RESULT(unrecognised... terminating)
84		    exit 1
85		    ;;
86	    esac
87	], [AC_MSG_RESULT(default no)])
88
89AC_PROG_CC
90AC_PROG_RANLIB
91AC_PROG_INSTALL
92AC_PROG_LN_S
93AC_PROG_MAKE_SET
94
95AC_C_CONST
96AC_C_INLINE
97
98AC_EXEEXT
99AC_OBJEXT
100AC_SYS_INTERPRETER
101
102AC_CHECK_FUNCS(setsid daemon setproctitle getservbyname strlcpy fork memmove strerror writev)
103
104AC_CHECK_HEADERS(pty.h)
105AC_CHECK_HEADERS(string.h)
106AC_CHECK_HEADERS(syslog.h)
107AC_CHECK_HEADERS(libintl.h)
108AC_CHECK_HEADERS(libutil.h)
109AC_CHECK_HEADERS(sys/uio.h)
110
111AC_CHECK_TYPE(size_t, unsigned int)
112AC_CHECK_TYPE(ssize_t, int)
113AC_CHECK_TYPE(u_int8_t, unsigned char)
114AC_CHECK_TYPE(u_int16_t, unsigned short)
115AC_CHECK_TYPE(u_int32_t, unsigned int)
116
117dnl Check for type in sys/socket.h - from Squid source (GPL)
118AC_CACHE_CHECK(for socklen_t, ac_cv_type_socklen_t, [
119  AC_EGREP_CPP([socklen_t[^a-zA-Z_0-9]], [#include <sys/types.h>
120#include <sys/socket.h>
121#if STDC_HEADERS
122#include <stdlib.h>
123#include <stddef.h>
124#endif],
125    ac_cv_type_socklen_t=yes,
126    ac_cv_type_socklen_t=no)
127])
128if test $ac_cv_type_socklen_t = no; then
129  AC_DEFINE(socklen_t, int)
130fi
131
132dnl Check for libwrap (black magic check)
133AC_ARG_WITH(libwrap,
134	[  --with-libwrap          Use libwrap (tcp wrappers) ],
135[
136 if test "$with_libwrap" = "yes"; then
137 XYZZY_LIBS="$LIBS"
138 AC_MSG_CHECKING(for libwrap alone)
139 LIBS="$XYZZY_LIBS -lwrap"
140 AC_TRY_LINK([ int allow_severity, deny_severity; ],
141	     [ hosts_access(); ],
142	     [ AC_MSG_RESULT(yes)
143	       AC_DEFINE(HAVE_LIBWRAP)
144	       LIBWRAP="yes"
145	       XTRALIBS_MGR="-lwrap" ],
146	     [ AC_MSG_RESULT(no)
147   LIBS="$XYZZY_LIBS -lwrap -lnsl"
148   AC_MSG_CHECKING(for libwrap with libnsl)
149   AC_TRY_LINK([ int allow_severity, deny_severity; ],
150	       [ hosts_access(); ],
151	       [ AC_MSG_RESULT(yes)
152	         AC_DEFINE(HAVE_LIBWRAP)
153		 LIBWRAP="yes"
154	         XTRALIBS_MGR="-lwrap -lnsl" ],
155	       [ AC_MSG_RESULT(no) ])
156 ])
157 LIBS="$XYZZY_LIBS"
158 fi
159])
160
161dnl More ugliness; -lnsl, -lutil and -lsocket
162XYZZY_LIBS="$LIBS"
163AC_CHECK_LIB(c, accept)
164AC_CHECK_LIB(c, gethostbyname)
165AC_CHECK_LIB(c, openpty)
166AC_CHECK_LIB(c, gettext)
167AC_CHECK_LIB(socket, accept)
168AC_CHECK_LIB(nsl, gethostbyname)
169AC_CHECK_LIB(util, openpty)
170AC_CHECK_LIB(intl, gettext)
171LIBS="$XYZZY_LIBS"
172if test "$ac_cv_lib_c_accept" = no; then
173  if test "$ac_cv_lib_socket_accept" = yes; then
174	LIBS="$LIBS -lsocket"
175  else
176	echo "Couldn't find a usable accept!" 1>&2
177	exit 1
178  fi
179fi
180if test "$ac_cv_lib_c_gethostbyname" = no; then
181  if test "$ac_cv_lib_nsl_gethostbyname" = yes; then
182	LIBS="$LIBS -lnsl"
183	if test "$XTRALIBS_MGR" = "-lwrap -lnsl"; then
184	  XTRALIBS_MGR="-lwrap"
185	fi
186  else
187	echo "Couldn't find a usable gethostbyname!" 1>&2
188	exit 1
189  fi
190fi
191if test "$ac_cv_lib_c_openpty" = yes; then
192  AC_DEFINE(HAVE_OPENPTY)
193else
194  if test "$ac_cv_lib_util_openpty" = yes; then
195    AC_DEFINE(HAVE_OPENPTY)
196    XTRALIBS_CTRL="-lutil"
197  fi
198fi
199if test "$ac_cv_header_libintl_h" = yes; then
200  if test "$ac_cv_lib_c_gettext" = no; then
201    if test "$ac_cv_lib_intl_gettext" = yes; then
202      XTRALIBS_MGR = "$XTRALIBS_MGR -lintl"
203    else
204      echo "Have libintl.h but no usable gettext!" 1>&2
205      exit 1
206    fi
207  fi
208fi
209
210AC_SUBST(XTRALIBS_CTRL)
211AC_SUBST(XTRALIBS_MGR)
212AC_SUBST(HAVE_OPENPTY)
213
214if test "$BCRELAY" = "yes"; then
215  if test "$BCRELAY" = "yes"; then
216    XTRA_PROG="bcrelay"
217    true
218  else
219    echo "No BCrelay selected." 1>&2
220  fi
221fi
222
223AC_SUBST(XTRA_PROG)
224
225echo '==============================================================================='
226
227echo 'Configuration chosen:'
228
229echo -n '   PPPd:               '
230if test "$BSDUSER_PPP" = "yes"; then
231  echo 'BSD user-space PPPd.'
232else
233  if test "$SLIRP" = "yes"; then
234    echo 'SLIRP.'
235  else
236    echo 'Standard.'
237  fi
238fi
239
240echo -n '   LIBWRAP security:   '
241if test "$LIBWRAP" = "yes"; then
242  echo 'Yes.'
243else
244  echo 'No.'
245fi
246
247echo -n '   Broadcast Relay:    '
248if test "$BCRELAY" = "yes"; then
249  echo 'Yes.'
250else
251  echo 'No.'
252fi
253
254AC_CACHE_SAVE
255AC_OUTPUT(Makefile)
256