[go: up one dir, main page]

Menu

[5e1efd]: / configure.ac  Maximize  Restore  History

Download this file

293 lines (264 with data), 7.2 kB

AC_INIT([pptpd],[1.5.0])
AC_CONFIG_SRCDIR([pptpmanager.c])

AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE

# check common command line options early

AC_DEFINE([PPP_BINARY], "/usr/sbin/pppd", [Where is my pppd?])
AC_MSG_CHECKING(command line for use of BSD PPP)
AC_ARG_WITH(bsdppp,
	[  --with-bsdppp           Use BSD user-space ppp ],
	[ 
	    case "$withval" in
		yes)
		    AC_MSG_RESULT(BSD user-space ppp)
		    AC_DEFINE(BSDUSER_PPP, 1, [Use BSD User land PPP?])
		    BSDUSER_PPP=$with_bsdppp
		    AC_DEFINE(PPP_BINARY, "/usr/sbin/ppp")
		    break;
		    ;;
		no)
		    AC_MSG_RESULT(explicit standard pppd)
		    ;;
		*)
		    # only yes or no are expected for this option
		    AC_MSG_RESULT(unrecognised... terminating)
		    exit 1
		    ;;
	    esac
	], [AC_MSG_RESULT(default standard pppd)])

AC_MSG_CHECKING(command line for use of SLIRP)
AC_ARG_WITH(slirp,
	[  --with-slirp            Use SLIRP instead of pppd ],
	[ 
	    case "$withval" in
		yes)
		    AC_MSG_RESULT(yes)
		    AC_DEFINE(SLIRP, 1, [Use SLIRP?])
		    SLIRP=$with_slirp
		    AC_DEFINE(PPP_BINARY, "/bin/slirp")
		    break;
		    ;;
		no)
		    AC_MSG_RESULT(explicit no)
		    ;;
		*)
		    # only yes or no are expected for this option
		    AC_MSG_RESULT(unrecognised... terminating)
		    exit 1
		    ;;
	    esac
	], [AC_MSG_RESULT(default no)])

AC_MSG_CHECKING(command line for syslog facility name)
AC_ARG_ENABLE(facility,
    [  --enable-facility=name    Use another syslog facility, default LOG_DAEMON ],
    [
	AC_MSG_RESULT($enableval)
	AC_DEFINE_UNQUOTED(PPTP_FACILITY, $enableval, [Syslog Facility to use?  See openlog(3).])
	],
    [
	AC_MSG_RESULT(default LOG_DAEMON)
	AC_DEFINE_UNQUOTED(PPTP_FACILITY, LOG_DAEMON, [Syslog Facility to use?  See openlog(3).])
    ])

AC_MSG_CHECKING(command line for bcrelay build)
AC_ARG_ENABLE(bcrelay,
	[  --enable-bcrelay          Enable broadcast relay function ],
	[ 
	    case "$enableval" in
		yes)
		    AC_MSG_RESULT(yes)
		    AC_DEFINE(BCRELAY, 1, [Enable Broadcast Relay?])
		    BCRELAY=$enableval
		    break;
		    ;;
		no)
		    AC_MSG_RESULT(explicit no)
		    ;;
		*)
		    # only yes or no are expected for this option
		    AC_MSG_RESULT(unrecognised... terminating)
		    exit 1
		    ;;
	    esac
	], [AC_MSG_RESULT(default no)])

AC_MSG_CHECKING(command line for VRF build)
AC_ARG_ENABLE(vrf,
	[  --enable-vrf              Enable support for VRFs],
	[
	    case "$enableval" in
		yes)
		    AC_MSG_RESULT(yes)
		    VRF=$enableval
		    ;;
		no)
		    AC_MSG_RESULT(explicit no)
		    ;;
		*)
		    AC_MSG_RESULT(unrecognised... terminating)
		    exit 1
		    ;;
	    esac
	], [AC_MSG_RESULT(default no)])


AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

AC_C_CONST
AC_C_INLINE

AC_EXEEXT
AC_OBJEXT
AC_SYS_INTERPRETER

AC_CHECK_FUNCS(setsid daemon setproctitle getservbyname strlcpy fork memmove strerror writev)

AC_CHECK_HEADERS(pty.h)
AC_CHECK_HEADERS(string.h)
AC_CHECK_HEADERS(syslog.h)
AC_CHECK_HEADERS(libintl.h)
AC_CHECK_HEADERS(libutil.h)
AC_CHECK_HEADERS(sys/uio.h)

AC_CHECK_TYPE(size_t, unsigned int)
AC_CHECK_TYPE(ssize_t, int)
AC_CHECK_TYPE(u_int8_t, unsigned char)
AC_CHECK_TYPE(u_int16_t, unsigned short)
AC_CHECK_TYPE(u_int32_t, unsigned int)

dnl Check for type in sys/socket.h - from Squid source (GPL)
AC_CACHE_CHECK(for socklen_t, ac_cv_type_socklen_t, [
  AC_EGREP_CPP([socklen_t[^a-zA-Z_0-9]], [#include <sys/types.h>
#include <sys/socket.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif],
    ac_cv_type_socklen_t=yes,
    ac_cv_type_socklen_t=no)
])
if test $ac_cv_type_socklen_t = no; then
  AC_DEFINE(socklen_t, int, [Just #define to int if it's not defined])
fi

dnl Check for libwrap (black magic check)
AC_ARG_WITH(libwrap,
	[  --with-libwrap          Use libwrap (tcp wrappers) ],
[
 if test "$with_libwrap" = "yes"; then
 XYZZY_LIBS="$LIBS"
 AC_MSG_CHECKING(for libwrap alone)
 LIBS="$XYZZY_LIBS -lwrap"
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ int allow_severity, deny_severity; ]], [[ hosts_access(); ]])],[ AC_MSG_RESULT(yes)
	       AC_DEFINE(HAVE_LIBWRAP, 1, [Have libwrap?])
	       LIBWRAP="yes"
	       XTRALIBS_MGR="-lwrap" ],[ AC_MSG_RESULT(no)
   LIBS="$XYZZY_LIBS -lwrap -lnsl"
   AC_MSG_CHECKING(for libwrap with libnsl)
   AC_LINK_IFELSE([AC_LANG_PROGRAM([[ int allow_severity, deny_severity; ]], [[ hosts_access(); ]])],[ AC_MSG_RESULT(yes)
	         AC_DEFINE(HAVE_LIBWRAP, 1, [Have libwrap?])
		 LIBWRAP="yes"
	         XTRALIBS_MGR="-lwrap -lnsl" ],[ AC_MSG_RESULT(no) ])
 ])
 LIBS="$XYZZY_LIBS"
 fi
])

dnl More ugliness; -lnsl, -lutil and -lsocket
XYZZY_LIBS="$LIBS"
AC_CHECK_LIB(c, accept)
AC_CHECK_LIB(c, gethostbyname)
AC_CHECK_LIB(c, openpty)
AC_CHECK_LIB(c, gettext)
AC_CHECK_LIB(socket, accept)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(util, openpty)
AC_CHECK_LIB(intl, gettext)
LIBS="$XYZZY_LIBS"
if test "$ac_cv_lib_c_accept" = no; then
  if test "$ac_cv_lib_socket_accept" = yes; then
	LIBS="$LIBS -lsocket"
  else
	echo "Couldn't find a usable accept!" 1>&2
	exit 1
  fi
fi
if test "$ac_cv_lib_c_gethostbyname" = no; then
  if test "$ac_cv_lib_nsl_gethostbyname" = yes; then
	LIBS="$LIBS -lnsl"
	if test "$XTRALIBS_MGR" = "-lwrap -lnsl"; then
	  XTRALIBS_MGR="-lwrap"
	fi
  else
	echo "Couldn't find a usable gethostbyname!" 1>&2
	exit 1
  fi
fi
if test "$ac_cv_lib_c_openpty" = yes; then
  AC_DEFINE(HAVE_OPENPTY, 1, [Define if you have an openpty() (non-standard check)])
else
  if test "$ac_cv_lib_util_openpty" = yes; then
    AC_DEFINE(HAVE_OPENPTY 1, [Define if you have an openpty() (non-standard check)])
    XTRALIBS_CTRL="-lutil"
  fi
fi
if test "$ac_cv_header_libintl_h" = yes; then
  if test "$ac_cv_lib_c_gettext" = no; then
    if test "$ac_cv_lib_intl_gettext" = yes; then
      XTRALIBS_MGR = "$XTRALIBS_MGR -lintl"
    else
      echo "Have libintl.h but no usable gettext!" 1>&2
      exit 1
    fi
  fi
fi

if test "$BCRELAY" = "yes"; then
  if test "$BCRELAY" = "yes"; then
    XTRA_PROG="bcrelay"
    true
  else
    echo "No BCrelay selected." 1>&2
  fi
fi

if test "$VRF" = "yes"; then
	AS_MESSAGE([checking for vrf Library and Header files...])
	AC_CHECK_HEADER(vrf.h, ,
		AC_MSG_ERROR([vrf headers were not found])
	)

	AC_CHECK_LIB(vrf, vrf_socket, [
		AC_DEFINE(VRF, 1, [Use vrf_socket from vrf library])
		XTRALIBS_CTRL="$XTRALIBS_CTRL -lvrf"
		XTRALIBS_MGR="$XTRALIBS_MGR -lvrf"
	], [
		AC_MSG_ERROR(vrf library was not found)
	])
fi

AC_SUBST(XTRALIBS_CTRL)
AC_SUBST(XTRALIBS_MGR)
AC_SUBST(XTRA_PROG)
AC_SUBST(HAVE_OPENPTY)

echo '==============================================================================='

echo 'Configuration chosen:'

echo -n '   PPPd:               '
if test "$BSDUSER_PPP" = "yes"; then
  echo 'BSD user-space PPPd.'
else
  if test "$SLIRP" = "yes"; then
    echo 'SLIRP.'
  else
    echo 'Standard.'
  fi
fi

echo -n '   LIBWRAP security:   '
if test "$LIBWRAP" = "yes"; then
  echo 'Yes.'
else
  echo 'No.'
fi

echo -n '   Broadcast Relay:    '
if test "$BCRELAY" = "yes"; then
  echo 'Yes.'
else
  echo 'No.'
fi

echo -n '   VRF support:        '
if test "$VRF" = "yes"; then
  echo 'Yes.'
else
  echo 'No.'
fi

AC_CACHE_SAVE
AC_CONFIG_FILES([Makefile])
AC_OUTPUT