configure.ac 2.56 KB
Newer Older
Nils Goroll's avatar
Nils Goroll committed
1 2
AC_PREREQ([2.69])
AC_INIT([libvmod-dispatch],[trunk],[varnish-support@uplex.de],[vmod-dispatch])
Geoff Simmons's avatar
Geoff Simmons committed
3 4 5 6
AC_COPYRIGHT([Copyright 2016-2017 UPLEX - Nils Goroll Systemoptimierung])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR(src/vmod_dispatch.vcc)
Nils Goroll's avatar
Nils Goroll committed
7 8
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_TARGET
Geoff Simmons's avatar
Geoff Simmons committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
AC_LANG(C)

AM_INIT_AUTOMAKE([1.12 -Wall -Werror foreign parallel-tests])
AM_SILENT_RULES([yes])
AM_PROG_AR

LT_PREREQ([2.2.6])
LT_INIT([dlopen disable-static])

AX_PTHREAD(,[AC_MSG_ERROR([Could not configure pthreads support])])

LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"

AC_ARG_WITH([rst2man],
	AS_HELP_STRING(
		[--with-rst2man=PATH],
		[Location of rst2man (auto)]),
	[RST2MAN="$withval"],
Nils Goroll's avatar
Nils Goroll committed
29
	[AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py], [])])
Geoff Simmons's avatar
Geoff Simmons committed
30 31 32 33 34

m4_ifndef([VARNISH_PREREQ], AC_MSG_ERROR([Need varnish.m4 -- see INSTALL.rst]))

VARNISH_VMODS([dispatch])

35 36 37 38 39 40 41 42 43
AC_ARG_VAR([VARNISHSRC], [path to Varnish source])
if test "x$VARNISHSRC" = x; then
	AC_MSG_FAILURE([Need VARNISHSRC])
fi
AC_CHECK_FILE([$VARNISHSRC/include/vcc_interface.h], [
	VARNISHAPI_CFLAGS="$VARNISHAPI_CFLAGS -I$VARNISHSRC/include"
	],[
	   AC_MSG_FAILURE([Could not find "$VARNISHSRC/include/vcc_interface.h"])])

Geoff Simmons's avatar
Geoff Simmons committed
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
VMOD_TESTS="$(cd $srcdir/src && echo tests/*.vtc)"
AC_SUBST(VMOD_TESTS)

PKG_CHECK_VAR([LIBVARNISHAPI_LIBDIR], [varnishapi], [libdir])
AC_SUBST([VARNISH_LIBRARY_PATH],
	[$LIBVARNISHAPI_LIBDIR:$LIBVARNISHAPI_LIBDIR/varnish])

AC_CONFIG_FILES([
	Makefile
	src/Makefile
])

AM_CONDITIONAL(HAVE_RST2MAN, [test "x$RST2MAN" != "xno"])
AC_PROG_CPP

# Checks for C sources
60 61
AC_CHECK_FUNCS([strdup])
AC_FUNC_REALLOC
Geoff Simmons's avatar
Geoff Simmons committed
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

# --enable-stack-protector
AC_ARG_ENABLE(stack-protector,
       AS_HELP_STRING([--enable-stack-protector],[enable stack protector (default is YES)]),
       [],
       [enable_stack_protector=yes])

if test "x$enable_stack_protector" != "xno"; then
	AX_CHECK_COMPILE_FLAG([-fstack-protector],
		AX_CHECK_LINK_FLAG([-fstack-protector],
			[CFLAGS="${CFLAGS} -fstack-protector"], [], []),
		[], [])
fi

# --enable-debugging
AC_ARG_ENABLE(debugging,
	AS_HELP_STRING([--enable-debugging],[enable debugging (default is NO)]),
	[],
	[enable_debugging=no])

# AC_PROG_CC sets CFLAGS to '-g -O2' unless already set, so there's no
# need to add -g. Disable or change by explicitly setting CFLAGS. If
# this option is enabled, then -Og or -O0 becomes the last
# optimization option, and hence takes precedence.
if test "x$enable_debugging" != "xno"; then
	CFLAGS="${CFLAGS} -fno-inline"
	AX_CHECK_COMPILE_FLAG([-Og],
		[CFLAGS="${CFLAGS} -Og"],
		[CFLAGS="${CFLAGS} -O0"],
		[])
fi

AC_OUTPUT