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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304
|
# configure.ac - process this file with autoconf to produce configure
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Arthur de Jong
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
AC_PREREQ(2.59)
AC_COPYRIGHT(
[Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Arthur de Jong
This configure script is derived from configure.ac which is free software;
you can redistribute it and/or modify it under the terms of the GNU General
Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the configure.ac file for more details.])
# initialize and set version and bugreport address
AC_INIT([cvsd],[1.0.13],[arthur@ch.tudelft.nl])
RELEASE_MONTH="Aug 2006"
AC_SUBST(RELEASE_MONTH)
AC_CONFIG_SRCDIR(cvsd.c)
# display notice and initialize automake
AC_MSG_NOTICE([configuring AC_PACKAGE_TARNAME AC_PACKAGE_VERSION])
AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME,AC_PACKAGE_VERSION)
# create a config.h file (Automake will add -DHAVE_CONFIG_H)
AC_CONFIG_HEADERS([config.h])
# AJ_PROG_FIND(VARIABLE,PROG-TO-CHECK-FOR)
# ----------------------------------------
AC_DEFUN([AJ_PROG_FIND],[
AC_ARG_WITH([$2],
AS_HELP_STRING([--with-$2=PATH],
[specify location of $2 binary]),
[if test "x$withval" = "x" || test "x$withval" = "xyes" || test "x$withval" = "xno"
then
AC_MSG_ERROR([*** please specify the location of the $2 binary ***])
else
$1="$withval"
fi])
if test -z "$$1"
then
AC_PATH_PROG($1,$2)
fi
if test -z "$$1"
then
AC_MSG_ERROR([*** '$2' not found, please install, fix your \$PATH or use --with-$2 ***])
fi
if test ! -r "$$1" || test "x`basename "$$1"`" != "x$2"
then
AC_MSG_WARN([$$1 does not look like the $2 binary])
fi
AC_SUBST([$1])
])
# Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_LN_S
AC_PATH_PROG(CHMOD,chmod)
AC_SUBST(CHMOD)
AC_PATH_PROG(SED,sed)
if test -z "$SED" ; then
AC_MSG_ERROR([*** 'sed' missing, please install or fix your \$PATH ***])
fi
AJ_PROG_FIND(CVS,cvs)
AC_DEFINE_UNQUOTED(CVS_LOCATION,"$CVS",[location of cvs program])
AJ_PROG_FIND(PERL,perl)
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(string.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(errno.h)
AC_CHECK_HEADERS(syslog.h)
AC_CHECK_HEADERS(getopt.h)
AC_CHECK_HEADERS(pwd.h)
AC_CHECK_HEADERS(grp.h)
AC_CHECK_HEADERS(arpa/inet.h)
AC_CHECK_HEADERS(netinet/in.h)
AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(sys/resource.h)
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(signal.h)
AC_CHECK_HEADERS(sys/stat.h)
AC_CHECK_HEADERS(netdb.h)
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(stdarg.h)
AC_CHECK_HEADERS(stdio.h)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_VOLATILE
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_CHECK_TYPE(socklen_t,,
AC_DEFINE(socklen_t, size_t,
[Define to `size_t' if not defined elswhere.]),
[
#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_TYPE(struct sockaddr_storage,,
AC_DEFINE(sockaddr_storage,sockaddr_in,
[Define to 'sockaddr_in' if not defined elsewhere.]),
[
#include <sys/types.h>
#include <sys/socket.h>])
# Checks for library functions.
AC_FUNC_FORK
AC_SEARCH_LIBS(gethostbyname,nsl socket)
AC_SEARCH_LIBS(socket,socket)
AC_CHECK_FUNCS([malloc dup2 inet_ntoa strchr strrchr strerror strtol atexit sigaction \
memset memcpy sigemptyset select fcntl snprintf vsnprintf socket], ,
AC_MSG_ERROR([*** we really need this function ***]))
AC_CHECK_FUNCS(nice setpriority setgroups gethostbyname)
AC_FUNC_SELECT_ARGTYPES
# Only include Limit operations if system has setrlimit()
AC_CHECK_FUNCS(setrlimit,
[AC_LIBOBJ(reslimit)],
AC_MSG_NOTICE([disabling use of resource limits]))
# Replace getopt_long() function if it is not on the system
AC_CHECK_FUNCS(getopt_long, ,
[AC_MSG_NOTICE([using own getopt_long() replacement])
AC_LIBOBJ(getopt_long)])
# Replace daemon() function if it is not on the system
AC_SEARCH_LIBS(daemon,bsd)
AC_CHECK_FUNCS(daemon, ,
[AC_MSG_NOTICE([using own daemon() replacement])
AC_LIBOBJ(daemon)])
# check for getaddrinfo() and getnameinfo() and replace if not available
AC_SEARCH_LIBS(getaddrinfo,socket)
AC_CHECK_FUNCS(getaddrinfo getnameinfo freeaddrinfo gai_strerror)
AC_CHECK_TYPE(struct addrinfo,,,[
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>])
if test "$ac_cv_func_getaddrinfo" != yes || \
test "$ac_cv_func_getnameinfo" != yes
then
AC_MSG_NOTICE([using own getaddrinfo() and getnameinfo() replacements])
AC_LIBOBJ(getinfos)
AC_CHECK_FUNCS(getservbyname getservbyport gethostbyaddr htons hstrerror)
fi
# Check for debugging options
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
[enable extensive debugging and logging]),
[if test "x$enableval" != "no" ; then CFLAGS="-g -DDEBUG $CFLAGS" ; fi])
# Check for extra compiler warnings
AC_ARG_ENABLE(warnings,
AS_HELP_STRING([--enable-warnings],
[enable extra compiler warnings (gcc)]),
[if test "x$enableval" != "no" ; then CFLAGS="$CFLAGS -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Waggregate-return -Wmissing-declarations" ; fi])
# check wether we want use tcp wrappers (yes,no,maybe)
WANT_LIBWRAP="no"
AC_ARG_WITH(libwrap,
AS_HELP_STRING([--with-libwrap@<:@=PATH@:>@],
[enable tcp wrapper support (disabled by default)]),
[if test "x$withval" = "xno"
then
WANT_LIBWRAP="no"
else
WANT_LIBWRAP="yes"
# add supplied value to paths
if test "x$withval" != "x" && test "x$withval" != "xyes"
then
CPPFLAGS="-I$LIBWRAP/include $CPPFLAGS"
LDFLAGS="-L$LIBWRAP/lib $LDFLAGS"
fi
fi])
# check wether we can use tcp wrappers
if test "x$WANT_LIBWRAP" != "xno"
then
AC_CHECK_HEADERS(tcpd.h)
# try using tcp wrappers without a library, with -lwrap and with -lwrap and -lnsl
HAVE_LIBWRAP="yes"
SAVE_LIBS="$LIBS"
AC_MSG_CHECKING(for tcp wrapper functions)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[int allow_severity,deny_severity;]],
[[request_init((void *)0,0);hosts_access((void *)0)]]) ],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
LIBS="-lwrap $LIBS"
AC_MSG_CHECKING(for tcp wrapper functions in -lwrap)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[int allow_severity,deny_severity;]],
[[request_init((void *)0,0);hosts_access((void *)0)]]) ],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
LIBS="-lnsl $LIBS"
AC_MSG_CHECKING(for tcp wrapper functions in -lwrap -lnsl)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[int allow_severity,deny_severity;]],
[[request_init((void *)0,0);hosts_access((void *)0)]]) ],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
LIBS="$SAVE_LIBS"
HAVE_LIBWRAP="no"])
])
])
if test "x$HAVE_LIBWRAP" != "xno"
then
AC_DEFINE_UNQUOTED(USE_LIBWRAP,1,[whether tcp wrappers are enabled])
elif test "x$WANT_LIBWRAP" = "xyes"
then
AC_MSG_ERROR([*** tcp wrappers not found ***])
fi
fi
# check wether we want use capabilities (yes,no,maybe)
WANT_CAPABILITIES="no"
AC_ARG_WITH(capabilities,
AS_HELP_STRING([--with-capabilities],
[enable capabilities support (experimental)]),
[if test "x$withval" = "xno"
then
WANT_CAPABILITIES="no"
else
WANT_CAPABILITIES="yes"
# add supplied value to paths
if test "x$withval" != "x" && test "x$withval" != "xyes"
then
CPPFLAGS="-I$LIBWRAP/include $CPPFLAGS"
LDFLAGS="-L$LIBWRAP/lib $LDFLAGS"
fi
fi])
# check wether we can use capabilities
if test "x$WANT_CAPABILITIES" != "xno"
then
HAVE_CAPABILITIES="yes"
AC_CHECK_HEADERS(sys/capability.h,,HAVE_CAPABILITIES="no")
AC_CHECK_HEADERS(sys/prctl.h,,HAVE_CAPABILITIES="no")
AC_CHECK_TYPE(cap_t,,HAVE_CAPABILITIES="no",[
#include <sys/capability.h>])
AC_SEARCH_LIBS(cap_init,cap,,HAVE_CAPABILITIES="no")
AC_CHECK_FUNCS(prctl cap_from_text cap_to_text cap_get_proc cap_set_proc cap_free,,HAVE_CAPABILITIES="no")
if test "x$HAVE_CAPABILITIES" != "xno"
then
AC_DEFINE_UNQUOTED(USE_CAPABILITIES,1,[Define to 1 if capabilities code will be enabled])
elif test "x$WANT_CAPABILITIES" = "xyes"
then
AC_MSG_ERROR([*** capabilities not available ***])
fi
fi
# where to find the configuration file
# TODO: this should probably be fixed to be nicer
CONFIGFILE=`eval echo $sysconfdir/cvsd/cvsd.conf | \
sed "s%^NONE/%${prefix}/%" | \
sed "s%^NONE/%${ac_default_prefix}/%"`
AC_SUBST(CONFIGFILE)
AC_DEFINE_UNQUOTED(DEFAULT_CONFIGFILE,"$CONFIGFILE",[location of the configuration file])
AC_MSG_NOTICE([using $CONFIGFILE as default location for configfile])
# where to find the binary (for init scripts)
CVSD_BIN=`eval echo $sbindir/cvsd | \
sed "s%^NONE/%${exec_prefix}/%" | \
sed "s%^NONE/%${prefix}/%" | \
sed "s%^NONE/%${ac_default_prefix}/%"`
AC_SUBST(CVSD_BIN)
# store options passed to configure
CONFIGURE_CMD="$0 $ac_configure_args"
AC_SUBST(CONFIGURE_CMD)
# What files to output
AC_CONFIG_FILES(Makefile
cvsd.8 cvsd-buildroot.8 cvsd-passwd.8 cvsd.conf.5
cvsd-buginfo.8
cvsd.spec)
AC_CONFIG_FILES(cvsd-buildroot,chmod a+rx cvsd-buildroot)
AC_CONFIG_FILES(cvsd-passwd,chmod a+rx cvsd-passwd)
AC_CONFIG_FILES(cvsd-buginfo,chmod a+rx cvsd-buginfo)
AC_CONFIG_FILES(cvsd.init,chmod a+rx cvsd.init)
AC_CONFIG_FILES(cvsd.init.redhat71,chmod a+rx cvsd.init.redhat71)
AC_OUTPUT
|