dnl -*-autoconf-*-
dnl
-dnl Configuration script for fw
+dnl Configuration script for fwd
dnl
dnl (c) 2008 Straylight/Edgeware
dnl
dnl ----- Licensing notice --------------------------------------------------
dnl
-dnl This file is part of the `fw' port forwarder.
+dnl This file is part of the `fwd' port forwarder.
dnl
-dnl `fw' is free software; you can redistribute it and/or modify
+dnl `fwd' is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
-dnl `fw' is distributed in the hope that it will be useful,
+dnl `fwd' is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
-dnl along with `fw'; if not, write to the Free Software Foundation,
+dnl along with `fwd'; if not, write to the Free Software Foundation,
dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
dnl--------------------------------------------------------------------------
dnl Initialization.
mdw_AUTO_VERSION
-AC_INIT([fw], AUTO_VERSION, [mdw@distorted.org.uk])
-AC_CONFIG_SRCDIR([fw.c])
+AC_INIT([fwd], AUTO_VERSION, [mdw@distorted.org.uk])
+AC_CONFIG_SRCDIR([fwd.c])
AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE([foreign])
+mdw_SILENT_RULES
dnl--------------------------------------------------------------------------
dnl C programming environment.
dnl Types.
AC_TYPE_UID_T
AC_TYPE_PID_T
+AX_TYPE_SOCKLEN_T
dnl Declarations.
AC_CHECK_DECLS([environ])
AC_CHECK_DECLS([_sys_siglist])
dnl Libraries.
+AC_SEARCH_LIBS([modf], [m])
AC_SEARCH_LIBS([socket], [socket])
AC_SEARCH_LIBS([gethostbyname], [nsl resolv])
dnl Packages.
-PKG_CHECK_MODULES([mLib], [mLib >= 2.0.4])
+PKG_CHECK_MODULES([mLib], [mLib >= 2.2.1])
dnl Functions.
AC_CHECK_FUNCS([inet_aton])
AC_CHECK_FUNCS([getnetbyname])
AC_CHECK_FUNCS([strsignal])
+dnl Logging is weird under Termux. Unfortunately, it involves macros, so we
+dnl have to do this the hard way.
+AC_CACHE_CHECK(
+ [library needed for syslog], [mdw_cv_syslog_lib],
+ [mdw_ORIG_LIBS=$LIBS LIBS=
+ for i in 0 1; do
+ AC_TRY_LINK([#include <syslog.h>],
+ [openlog("test", LOG_PID, LOG_DAEMON);
+ syslog(LOG_ERR, "this is a test");],
+ [ok=t], [ok=nil])
+ case $i,$ok in
+ *,t) mdw_cv_syslog_lib=${LIBS:-none}; break ;;
+ 0,nil) LIBS="-llog" ;;
+ 1,nil) AC_MSG_ERROR("failed to link test program") ;;
+ esac
+ done
+ LIBS=$mdw_ORIG_LIBS])
+case $mdw_cv_syslog_lib in
+ none) ;;
+ *) LIBS="$LIBS $mdw_cv_syslog_lib" ;;
+esac
+AC_SUBST([LOGLIBS])
+
dnl--------------------------------------------------------------------------
dnl Output.