1# Jailkit 2# configure.ac - the autoconf file 3# 4#Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2021 Olivier Sessink 5#All rights reserved. 6# 7#Redistribution and use in source and binary forms, with or without 8#modification, are permitted provided that the following conditions 9#are met: 10# * Redistributions of source code must retain the above copyright 11# notice, this list of conditions and the following disclaimer. 12# * Redistributions in binary form must reproduce the above 13# copyright notice, this list of conditions and the following 14# disclaimer in the documentation and/or other materials provided 15# with the distribution. 16# * The names of its contributors may not be used to endorse or 17# promote products derived from this software without specific 18# prior written permission. 19# 20#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29#LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30#ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31#POSSIBILITY OF SUCH DAMAGE. 32# 33# 34 35AC_INIT([jailkit],[2.22],[https://savannah.nongnu.org/bugs/?group=jailkit]) 36 37AC_SUBST([PACKAGE], AC_PACKAGE_NAME) 38AC_DEFINE_UNQUOTED([PACKAGE], "AC_PACKAGE_NAME", [The package name.]) 39AC_SUBST([VERSION], AC_PACKAGE_VERSION) 40AC_DEFINE_UNQUOTED([VERSION], "AC_PACKAGE_VERSION", [The package version.]) 41 42AC_PREFIX_DEFAULT([/usr]) 43dnl does this make sense? 44if test "$prefix" = "NONE"; then 45 sysconfdir="/etc" 46 AC_MSG_NOTICE([config files will be in /etc/jailkit/]) 47fi 48AC_CONFIG_SRCDIR([src/jk_socketd.c]) 49AC_CONFIG_HEADER([src/config.h]) 50 51AC_GNU_SOURCE 52 53AC_PROG_CC 54AC_ISC_POSIX 55AC_C_INLINE 56AC_PROG_INSTALL 57 58if test "$CC" = "gcc" ; then 59 CFLAGS="$CFLAGS -Wall -pipe" 60fi 61 62dnl ************************ 63dnl Check for standard headers 64dnl ************************ 65 66AC_HEADER_STDC 67 68dnl ************************ 69dnl Checks for header files. 70dnl ************************ 71 72AC_CHECK_HEADERS([errno.h stdio.h ctype.h getopt.h math.h time.h sys/socket.h pthread.h pwd.h wordexp.h liberty.h strings.h]) 73 74AC_CHECK_FUNCS([strnlen wordexp clearenv get_current_dir_name]) 75 76AC_CHECK_FUNCS( 77 [strndup],, 78 AC_CHECK_LIB([iberty], [strndup]) 79) 80 81AC_CHECK_FUNCS( 82 [mempcpy],, 83 AC_CHECK_LIB([iberty], [mempcpy]) 84) 85 86AC_CHECK_FUNCS( 87 [stpcpy],, 88 AC_CHECK_LIB([iberty], [stpcpy]) 89) 90 91# Check if -pthread is available 92# if not try -lpthread 93OLDCFLAGS=$CFLAGS 94OLDLDFLAGS=$LDFLAGS 95CFLAGS="$CFLAGS -pthread" 96LDFLAGS="$LDFLAGS -pthread" 97AC_MSG_CHECKING([for pthread support]) 98AC_LINK_IFELSE( 99 [AC_LANG_PROGRAM( 100 [#include <pthread.h> 101 void *g(void *d) { return NULL; }], 102 [pthread_t t; pthread_create(&t,NULL,g,NULL);])], 103 [AC_MSG_RESULT([use -pthread])] 104 , 105 CFLAGS=$OLDCFLAGS 106 LDFLAGS=$OLDLDFLAGS 107 [AC_CHECK_LIB( 108 [pthread], 109 [pthread_create],, 110 AC_CHECK_LIB( 111 [c_r], 112 [pthread_create],, 113 AC_MSG_ERROR([libpthread not found]) 114 ) 115 )] 116) 117 118# solaris has -lsocket or -lxnet for various socket functions 119AC_CHECK_FUNCS( 120 [recvfrom],, 121 AC_CHECK_LIB([xnet], [recvfrom]) 122) 123AC_CHECK_FUNCS( 124 [send],, 125 AC_CHECK_LIB([socket], [send]) 126) 127 128# solaris needs -lrt or -lposix4 for nanosleep() 129AC_CHECK_FUNCS( 130 [nanosleep],, 131 AC_CHECK_LIB( 132 [posix4], 133 [nanosleep],, 134 AC_CHECK_LIB( 135 [rt], 136 [nanosleep],, 137 AC_MSG_ERROR(nanosleep not found) 138 ) 139 ) 140) 141 142# FreeBSD has a gnugetopt library for this 143# Solaris might have libiberty 144AC_CHECK_FUNCS( 145 [getopt_long],, 146 AC_CHECK_LIB( 147 [gnugetopt], 148 [getopt_long],, 149 AC_CHECK_LIB( 150 [iberty], 151 [getopt_long],, 152 AC_MSG_ERROR(getopt_long not found) 153 ) 154 ) 155) 156AC_CHECK_HEADERS([sys/capability.h]) 157 158AC_CHECK_FUNCS( 159 [cap_get_proc],, 160 AC_CHECK_LIB([cap], [cap_get_proc], 161 AC_DEFINE(HAVE_CAP_GET_PROC) 162 LDFLAGS="$LDFLAGS -lcap", 163 ) 164) 165 166dnl you should maybe add AC_ARG_VAR for every AC_PATH_PROG to allow users 167dnl to specify the binary path if it is not in PATH 168AC_ARG_VAR( 169 [PYTHONINTERPRETER], 170 [The `python' binary with path. Use it to define or override the location of `python'.] 171) 172AC_PATH_PROG([PYTHONINTERPRETER], [python], [no]) 173if test "x$PYTHONINTERPRETER" = "xno" ; then 174 AC_MSG_ERROR([python not found please install python]) 175fi 176AC_SUBST(PYTHONINTERPRETER) 177AC_MSG_CHECKING([for up to date python]) 178echo -n "checking for up to date python... " 179if $PYTHONINTERPRETER -c 'i=1;i+=1' >/dev/null 2>&1 ; then 180 AC_MSG_RESULT([ok]) 181else 182 AC_MSG_RESULT([failed]) 183 AC_MSG_ERROR([your python version is too old, please install python 2 or newer]) 184fi 185 186AC_ARG_VAR( 187 [PROCMAILPATH], 188 [The `procmail' binary with path. Use it to define or override the location of `procmail'.] 189) 190AC_PATH_PROG([PROCMAILPATH], [procmail], [no]) 191if test "x$PROCMAILPATH" != "xno" ; then 192 AC_DEFINE_UNQUOTED([PROCMAILPATH], "$PROCMAILPATH", [The procmail path.]) 193 AC_SUBST([HAVEPROCMAIL_TRUE], []) 194else 195 AC_SUBST([HAVEPROCMAIL_TRUE], [#]) 196fi 197 198AC_CONFIG_FILES([Makefile src/Makefile py/Makefile man/Makefile]) 199AC_OUTPUT 200