2009-09-20 12:13:26 +05:30
|
|
|
# Process this file with autoconf to produce a configure script.
|
|
|
|
# Portions of this file were adapted from GIMP.
|
|
|
|
|
2008-05-24 16:17:29 +05:30
|
|
|
AC_PREREQ(2.54)
|
2008-08-24 12:28:39 +05:30
|
|
|
|
2018-09-04 01:23:01 +02:00
|
|
|
m4_define([tinyproxy_version], esyscmd(sh scripts/version.sh | tr -d '\n'))
|
2009-09-20 12:13:26 +05:30
|
|
|
|
|
|
|
AC_INIT([Tinyproxy], [tinyproxy_version],
|
2016-01-03 21:16:21 +00:00
|
|
|
[https://tinyproxy.github.io/],
|
2009-09-20 12:13:26 +05:30
|
|
|
[tinyproxy])
|
|
|
|
|
2020-09-06 20:32:52 +01:00
|
|
|
tpv=tinyproxy_version
|
|
|
|
if test "x$tpv" = "x" ; then
|
|
|
|
AC_MSG_ERROR([got empty result from version script!])
|
|
|
|
fi
|
|
|
|
|
2001-11-25 02:18:47 +00:00
|
|
|
AC_CANONICAL_TARGET
|
2016-09-11 00:11:21 +02:00
|
|
|
AM_INIT_AUTOMAKE([dist-bzip2 dist-xz])
|
2013-04-09 16:55:13 +02:00
|
|
|
AC_CONFIG_HEADERS(config.h)
|
2009-09-13 17:14:08 +05:30
|
|
|
AC_CONFIG_MACRO_DIR([m4macros])
|
2001-11-25 02:18:47 +00:00
|
|
|
|
2009-11-14 15:43:18 +05:30
|
|
|
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
build: import the AM_SILENT_RULES if available, but default to verbose.
Automake 1.11 (and I think 1.10b already) offers the AM_SILENT_RULES macro.
This adds switches --quiet, --enable-silent-rules and --disable-silent-rules
to configure.
--quiet makes the configure run itself quite.
--enable-silent-rules makes the compile process less verbose:
for a file that is compiled without errors or warnings, a simple
"CC main.o" is printed (e.g.). Compiler warnings and errors
are printed of course.
This makes it much easier (IMHO) to spot build problems.
--disable-silent-rules turns the silent rules off
I have set it up such that the default for tinyproxy is to build
in verbose mode (i.e. with silent rules disabled). This prints
the whole compile call command line for each source file compiled,
precisely as before.
You can also control verbose/non-verbose mode at "make" time, i.e.
after configure has run, by calling "make V=0 ..." or "make V=1 ..."
for running in silent and verbose mode, respectively.
If the version automake used to create configure is too old,
the result is unaltered, compared to the result before this change.
Wow - this is a long commit message for a 1-liner.
But since I discussed this with Mukund earlier, and he did
not seem to be too fond if this, I felt the need to justify
this change... :-)
Michael
2009-09-22 13:09:25 +02:00
|
|
|
|
2009-09-20 12:13:26 +05:30
|
|
|
dnl Temporarily defined here until we get tinyproxy-version.h
|
|
|
|
AC_DEFINE(TINYPROXY_VERSION, "tinyproxy_version", [Tinyproxy version number])
|
|
|
|
|
|
|
|
|
2001-11-25 02:18:47 +00:00
|
|
|
dnl Check if we're compiling on a weird platform :)
|
2009-05-29 00:07:30 +02:00
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
2001-11-25 02:18:47 +00:00
|
|
|
|
|
|
|
|
2009-09-20 13:45:47 +05:30
|
|
|
dnl Set the domain name for find the statistics of tinyproxy
|
|
|
|
AH_TEMPLATE([TINYPROXY_STATHOST],
|
2002-05-02 04:44:03 +00:00
|
|
|
[This controls remote proxy stats display.])
|
2001-11-25 02:18:47 +00:00
|
|
|
AC_ARG_WITH(stathost,
|
|
|
|
[AC_HELP_STRING([--with-stathost=HOST], [Default status host])],
|
2009-11-10 13:36:03 +01:00
|
|
|
[AC_DEFINE_UNQUOTED(TINYPROXY_STATHOST, "$withval")
|
|
|
|
TINYPROXY_STATHOST="$withval"],
|
|
|
|
[AC_DEFINE_UNQUOTED(TINYPROXY_STATHOST, "tinyproxy.stats")
|
|
|
|
TINYPROXY_STATHOST="tinyproxy.stats"])
|
|
|
|
|
|
|
|
AC_SUBST(TINYPROXY_STATHOST)
|
2001-11-25 02:18:47 +00:00
|
|
|
|
|
|
|
dnl Add compiler-specific optimization flags
|
2004-08-24 18:43:17 +00:00
|
|
|
TP_ARG_ENABLE(debug,
|
|
|
|
[Enable debugging support code and methods (default is NO)],
|
|
|
|
no)
|
2001-11-25 02:18:47 +00:00
|
|
|
|
|
|
|
dnl Check to see if the XTinyproxy header is to be included
|
2002-06-06 20:27:01 +00:00
|
|
|
AH_TEMPLATE([XTINYPROXY_ENABLE],
|
|
|
|
[Define if you want to have the peer's IP address included in a XTinyproxy header sent to the server.])
|
2004-08-24 18:43:17 +00:00
|
|
|
TP_ARG_ENABLE(xtinyproxy,
|
|
|
|
[Include the X-Tinyproxy header (default is YES)],
|
|
|
|
yes)
|
2001-11-25 02:18:47 +00:00
|
|
|
|
|
|
|
if test x"$xtinyproxy_enabled" = x"yes"; then
|
|
|
|
AC_DEFINE(XTINYPROXY_ENABLE)
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl Include filtering for domain/URLs
|
2002-06-06 20:27:01 +00:00
|
|
|
AH_TEMPLATE([FILTER_ENABLE],
|
|
|
|
[Defined if you would like filtering code included.])
|
2004-08-24 18:43:17 +00:00
|
|
|
TP_ARG_ENABLE(filter,
|
|
|
|
[Enable filtering of domains/URLS (default is YES)],
|
|
|
|
yes)
|
2001-11-25 02:18:47 +00:00
|
|
|
|
|
|
|
if test x"$filter_enabled" = x"yes"; then
|
2002-04-11 02:57:20 +00:00
|
|
|
ADDITIONAL_OBJECTS="$ADDITIONAL_OBJECTS filter.o"
|
2001-11-25 02:18:47 +00:00
|
|
|
AC_DEFINE(FILTER_ENABLE)
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl Include support for upstream proxies?
|
2002-06-06 20:27:01 +00:00
|
|
|
AH_TEMPLATE([UPSTREAM_SUPPORT],
|
|
|
|
[Include support for connecting to an upstream proxy.])
|
2004-08-24 18:43:17 +00:00
|
|
|
TP_ARG_ENABLE(upstream,
|
|
|
|
[Enable upstream proxying (default is YES)],
|
|
|
|
yes)
|
2001-11-25 02:18:47 +00:00
|
|
|
if test x"$upstream_enabled" = x"yes"; then
|
|
|
|
AC_DEFINE(UPSTREAM_SUPPORT)
|
|
|
|
fi
|
|
|
|
|
2004-01-26 19:11:52 +00:00
|
|
|
dnl Include support for reverse proxy?
|
|
|
|
AH_TEMPLATE([REVERSE_SUPPORT],
|
|
|
|
[Include support for reverse proxy.])
|
2004-08-24 18:43:17 +00:00
|
|
|
TP_ARG_ENABLE(reverse,
|
2018-01-09 20:16:31 +00:00
|
|
|
[Enable reverse proxying (default is YES)],
|
|
|
|
yes)
|
2004-01-26 19:11:52 +00:00
|
|
|
if test x"$reverse_enabled" = x"yes"; then
|
2008-03-08 17:33:54 -08:00
|
|
|
ADDITIONAL_OBJECTS="$ADDITIONAL_OBJECTS reverse-proxy.o"
|
2004-01-26 19:11:52 +00:00
|
|
|
AC_DEFINE(REVERSE_SUPPORT)
|
|
|
|
fi
|
|
|
|
|
2002-06-06 20:27:01 +00:00
|
|
|
dnl Include the transparent proxy support
|
|
|
|
AH_TEMPLATE([TRANSPARENT_PROXY],
|
|
|
|
[Include support for using tinyproxy as a transparent proxy.])
|
2004-08-24 18:43:17 +00:00
|
|
|
TP_ARG_ENABLE(transparent,
|
2018-02-25 23:42:31 +00:00
|
|
|
[Enable transparent proxying code (default is YES)],
|
|
|
|
yes)
|
2002-06-06 20:27:01 +00:00
|
|
|
if test x"$transparent_enabled" = x"yes"; then
|
2008-06-08 18:50:23 -04:00
|
|
|
ADDITIONAL_OBJECTS="$ADDITIONAL_OBJECTS transparent-proxy.o"
|
2002-06-06 20:27:01 +00:00
|
|
|
AC_DEFINE(TRANSPARENT_PROXY)
|
|
|
|
fi
|
|
|
|
|
2020-08-12 00:15:45 +01:00
|
|
|
dnl Let user decide whether he wants support for manpages
|
2020-08-19 22:33:59 +01:00
|
|
|
dnl Which require either pod2man or a tarball release
|
2020-08-12 00:15:45 +01:00
|
|
|
AH_TEMPLATE([MANPAGE_SUPPORT],
|
2020-08-19 22:33:59 +01:00
|
|
|
[Build manpages with pod2man if they are missing from the distribution.])
|
2020-08-12 00:15:45 +01:00
|
|
|
TP_ARG_ENABLE(manpage_support,
|
|
|
|
[Enable support for building manpages (default is YES)],
|
|
|
|
yes)
|
|
|
|
AM_CONDITIONAL(HAVE_MANPAGE_INTEREST, test x"$manpage_support_enabled" = x"yes")
|
|
|
|
|
2009-09-20 13:54:57 +05:30
|
|
|
# This is required to build test programs below
|
2001-11-25 02:18:47 +00:00
|
|
|
AC_PROG_CC
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Checks for libraries
|
|
|
|
dnl
|
|
|
|
AC_CHECK_LIB(socket, socket, , [AC_CHECK_LIB(socket, htonl)])
|
|
|
|
|
|
|
|
dnl Some systems (OpenServer 5) dislike -lsocket -lnsl, so we try to
|
|
|
|
dnl avoid -lnsl checks, if we already have the functions which are
|
|
|
|
dnl usually in libnsl
|
|
|
|
|
|
|
|
unset ac_cv_func_yp_get_default_domain
|
|
|
|
AC_CHECK_FUNC(yp_get_default_domain,
|
|
|
|
tinyproxy_no_nsl_checks=yes,
|
|
|
|
tinyproxy_no_nsl_checks=no)
|
|
|
|
unset ac_cv_func_yp_get_default_domain
|
|
|
|
|
|
|
|
if test x"$tinyproxy_no_nsl_checks" != x"yes"; then
|
|
|
|
AC_CHECK_LIB(nsl, gethostname, , [AC_CHECK_LIB(nsl, gethostbyaddr)])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_CHECK_LIB(resolv, inet_aton)
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Checks for headers
|
|
|
|
dnl
|
|
|
|
AC_HEADER_STDC
|
2003-04-01 16:46:45 +00:00
|
|
|
AC_HEADER_TIME
|
2004-08-24 16:41:11 +00:00
|
|
|
AC_HEADER_SYS_WAIT
|
2016-12-21 20:58:20 +00:00
|
|
|
AC_CHECK_HEADERS([sys/ioctl.h alloca.h memory.h malloc.h sysexits.h \
|
2020-09-15 20:01:01 +01:00
|
|
|
values.h poll.h])
|
2001-11-25 02:18:47 +00:00
|
|
|
|
|
|
|
dnl Checks for libary functions
|
2004-08-24 16:41:11 +00:00
|
|
|
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
|
|
|
|
|
2013-09-09 08:33:48 +02:00
|
|
|
AC_CHECK_FUNCS([strlcpy strlcat setgroups])
|
2001-11-25 02:18:47 +00:00
|
|
|
|
2009-09-20 13:32:46 +05:30
|
|
|
dnl Enable extra warnings
|
2018-02-25 17:02:15 +00:00
|
|
|
DESIRED_FLAGS="-fdiagnostics-show-option -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wfloat-equal -Wundef -Wformat=2 -Wlogical-op -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wpointer-arith -Waggregate-return -Winit-self -Wpacked --std=c89 -ansi -Wno-overlength-strings -Wno-long-long -Wno-overlength-strings -Wdeclaration-after-statement -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-qual -Wcast-align -Wwrite-strings -Wp,-D_FORTIFY_SOURCE=2 -fno-common"
|
2009-09-20 13:38:53 +05:30
|
|
|
|
2009-09-25 04:50:10 +05:30
|
|
|
if test -n "${MAINTAINER_MODE_FALSE}"; then
|
2009-09-23 07:36:34 +05:30
|
|
|
DESIRED_FLAGS="-Werror $DESIRED_FLAGS"
|
|
|
|
fi
|
|
|
|
|
2020-09-06 16:58:28 +01:00
|
|
|
all_desired_work=false
|
|
|
|
AS_COMPILER_FLAG([$DESIRED_FLAGS], [all_desired_work=true])
|
|
|
|
if $all_desired_work ; then
|
|
|
|
CFLAGS="$CFLAGS $DESIRED_FLAGS"
|
|
|
|
else
|
2009-09-23 07:36:34 +05:30
|
|
|
for flag in $DESIRED_FLAGS; do
|
2009-09-20 13:32:46 +05:30
|
|
|
AS_COMPILER_FLAG([$flag], [CFLAGS="$CFLAGS $flag"])
|
|
|
|
done
|
2020-09-06 16:58:28 +01:00
|
|
|
fi
|
2009-09-20 13:32:46 +05:30
|
|
|
|
2009-09-20 13:38:53 +05:30
|
|
|
dnl Disable debugging if it's not specified
|
|
|
|
if test x"$debug_enabled" != x"yes" ; then
|
|
|
|
CFLAGS="-DNDEBUG $CFLAGS"
|
2001-11-25 02:18:47 +00:00
|
|
|
fi
|
|
|
|
|
2016-12-27 17:24:02 -05:00
|
|
|
AS_ECHO_N(["checking to see if linker understands -z,defs... "])
|
|
|
|
LDFLAGS_OLD="-Wl $LDFLAGS"
|
2012-01-23 16:25:24 +05:30
|
|
|
LDFLAGS="-Wl,-z,defs $LDFLAGS"
|
2016-12-27 17:24:02 -05:00
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
|
|
|
|
AS_ECHO("yes"),
|
|
|
|
AS_ECHO("no"); LDFLAGS="$LDFLAGS_OLD")
|
2009-09-20 13:38:53 +05:30
|
|
|
|
2001-11-25 02:18:47 +00:00
|
|
|
dnl
|
|
|
|
dnl Make sure we can actually handle the "--with-*" and "--enable-*" stuff.
|
|
|
|
dnl
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Substitute the variables into the various Makefiles
|
|
|
|
dnl
|
|
|
|
AC_SUBST(CFLAGS)
|
|
|
|
AC_SUBST(LDFLAGS)
|
|
|
|
AC_SUBST(CPPFLAGS)
|
|
|
|
AC_SUBST(LIBS)
|
2002-04-11 02:57:20 +00:00
|
|
|
AC_SUBST(ADDITIONAL_OBJECTS)
|
2001-11-25 02:18:47 +00:00
|
|
|
|
2020-08-12 00:15:45 +01:00
|
|
|
if test x"$manpage_support_enabled" = x"yes"; then
|
2020-08-19 22:33:59 +01:00
|
|
|
AC_PATH_PROG(POD2MAN, pod2man, no)
|
2020-08-12 00:15:45 +01:00
|
|
|
|
2020-08-19 22:33:59 +01:00
|
|
|
if test "x$POD2MAN" = "xno" && \
|
2020-08-12 00:15:45 +01:00
|
|
|
! test -e docs/man5/tinyproxy.conf.5 -a -e docs/man8/tinyproxy.8 ; then
|
|
|
|
AC_MSG_ERROR([
|
2020-08-19 22:33:59 +01:00
|
|
|
manpage generation requested, but neither pod2man
|
2020-08-12 00:15:45 +01:00
|
|
|
nor pre-generated manpages found.
|
|
|
|
Use --disable-manpage-support if you want to compile anyway.])
|
|
|
|
fi
|
|
|
|
fi #manpage_support_enabled
|
|
|
|
|
2020-08-19 22:33:59 +01:00
|
|
|
AM_CONDITIONAL(HAVE_POD2MAN, test "x$POD2MAN" != "x" -a "x$POD2MAN" != "xno")
|
2016-12-27 13:53:02 -05:00
|
|
|
|
2008-03-30 17:12:26 -07:00
|
|
|
AC_CONFIG_FILES([
|
|
|
|
Makefile
|
|
|
|
src/Makefile
|
2009-09-13 03:48:24 +05:30
|
|
|
data/Makefile
|
|
|
|
data/templates/Makefile
|
2009-09-13 04:04:18 +05:30
|
|
|
etc/Makefile
|
2009-09-14 16:56:12 +05:30
|
|
|
docs/Makefile
|
2009-09-19 09:57:24 +05:30
|
|
|
docs/man5/Makefile
|
|
|
|
docs/man5/tinyproxy.conf.txt
|
2009-09-14 16:56:12 +05:30
|
|
|
docs/man8/Makefile
|
|
|
|
docs/man8/tinyproxy.txt
|
2009-09-13 04:12:32 +05:30
|
|
|
m4macros/Makefile
|
2009-09-16 16:35:39 +02:00
|
|
|
tests/Makefile
|
|
|
|
tests/scripts/Makefile
|
2018-09-04 01:23:01 +02:00
|
|
|
scripts/Makefile
|
2008-03-30 17:12:26 -07:00
|
|
|
])
|
|
|
|
|
2001-12-17 00:28:28 +00:00
|
|
|
AC_OUTPUT
|
2016-12-20 20:07:23 +00:00
|
|
|
|
|
|
|
# the manpages are shipped in the release tarball and we don't want them to
|
2020-08-19 22:33:59 +01:00
|
|
|
# get regenerated if pod2man is not available. the intermediate files from
|
2016-12-20 20:07:23 +00:00
|
|
|
# AC_CONFIG_FILES are created with config.status, which is created at configure
|
|
|
|
# runtime, so we need to touch them after config.status terminated to prevent
|
|
|
|
# make from rebuild them.
|
|
|
|
|
2020-08-19 22:33:59 +01:00
|
|
|
if test "x$POD2MAN" = "xno" ; then
|
2016-12-20 20:07:23 +00:00
|
|
|
touch docs/man5/tinyproxy.conf.txt
|
|
|
|
touch docs/man8/tinyproxy.txt
|
|
|
|
if test -e docs/man5/tinyproxy.conf.5 ; then
|
|
|
|
touch docs/man5/tinyproxy.conf.5
|
|
|
|
fi
|
|
|
|
if test -e docs/man8/tinyproxy.8 ; then
|
|
|
|
touch docs/man8/tinyproxy.8
|
|
|
|
fi
|
|
|
|
fi
|