Commit be32548b authored by Nils Goroll's avatar Nils Goroll

update build infrastructure to current libvmod-example

parent 92864399
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4 -I ${LIBVARNISHAPI_DATAROOTDIR}/aclocal
SUBDIRS = src SUBDIRS = src
EXTRA_DIST = README.rst DISTCHECK_CONFIGURE_FLAGS = \
VMOD_DIR='$${libdir}/varnish/vmods'
dist_man_MANS = vmod_vtstor.3 EXTRA_DIST = README.rst LICENSE
MAINTAINERCLEANFILES = $(dist_man_MANS)
vmod_vtstor.3: README.rst doc_DATA = README.rst LICENSE
if HAVE_RST2MAN
${RST2MAN} README.rst $@
else
@echo "========================================"
@echo "You need rst2man installed to make dist"
@echo "========================================"
@false
endif
...@@ -6,38 +6,47 @@ warn() { ...@@ -6,38 +6,47 @@ warn() {
case `uname -s` in case `uname -s` in
Darwin) Darwin)
LIBTOOLIZE=glibtoolize LIBTOOLIZE=glibtoolize
;; ;;
FreeBSD) FreeBSD)
LIBTOOLIZE=libtoolize LIBTOOLIZE=libtoolize
;; ;;
Linux) Linux)
LIBTOOLIZE=libtoolize LIBTOOLIZE=libtoolize
;; ;;
SunOS) SunOS)
LIBTOOLIZE=libtoolize LIBTOOLIZE=libtoolize
;; ;;
*) *)
warn "unrecognized platform:" `uname -s` warn "unrecognized platform:" `uname -s`
LIBTOOLIZE=libtoolize LIBTOOLIZE=libtoolize
esac esac
automake_version=`automake --version | tr ' ' '\n' | egrep '^[0-9]\.[0-9a-z.-]+'` automake_version=`automake --version | tr ' ' '\n' | egrep '^[0-9]\.[0-9a-z.-]+'`
if [ -z "$automake_version" ] ; then if [ -z "$automake_version" ] ; then
warn "unable to determine automake version" warn "unable to determine automake version"
else else
case $automake_version in case $automake_version in
0.*|1.[0-8]|1.[0-8][.-]*) 0.*|1.[0-8]|1.[0-8][.-]*)
warn "automake ($automake_version) detected; 1.9 or newer recommended" warn "automake ($automake_version) detected; 1.9 or newer recommended"
;; ;;
*) *)
;; ;;
esac esac
fi fi
# check for varnishapi.m4 in custom paths
dataroot=$(pkg-config --variable=datarootdir varnishapi 2>/dev/null)
if [ -z "$dataroot" ] ; then
cat >&2 <<'EOF'
Package varnishapi was not found in the pkg-config search path.
Perhaps you should add the directory containing `varnishapi.pc'
to the PKG_CONFIG_PATH environment variable
EOF
exit 1
fi
set -ex set -ex
aclocal -I m4 -I ${dataroot}/aclocal
aclocal -I m4
$LIBTOOLIZE --copy --force $LIBTOOLIZE --copy --force
autoheader autoheader
automake --add-missing --copy --foreign automake --add-missing --copy --foreign
......
...@@ -2,6 +2,7 @@ AC_PREREQ(2.59) ...@@ -2,6 +2,7 @@ AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (c) 2015 UPLEX - Nils Goroll Systemoptimierung]) AC_COPYRIGHT([Copyright (c) 2015 UPLEX - Nils Goroll Systemoptimierung])
AC_INIT([libvmod-vtstor], [4.0]) AC_INIT([libvmod-vtstor], [4.0])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
m4_ifndef([VARNISH_VMOD_INCLUDES], AC_MSG_ERROR([Need varnish.m4 -- see README.rst]))
AC_CONFIG_SRCDIR(src/vmod_vtstor.vcc) AC_CONFIG_SRCDIR(src/vmod_vtstor.vcc)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
...@@ -18,6 +19,13 @@ if test "x$ac_cv_prog_cc_c99" = xno; then ...@@ -18,6 +19,13 @@ if test "x$ac_cv_prog_cc_c99" = xno; then
fi fi
AC_PROG_CPP AC_PROG_CPP
AX_PTHREAD(,[AC_MSG_ERROR([Could not configure pthreads support])])
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
LT_INIT([disable-static])
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
...@@ -25,37 +33,50 @@ AC_PROG_MAKE_SET ...@@ -25,37 +33,50 @@ AC_PROG_MAKE_SET
# Check for rst utilities # Check for rst utilities
AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py], "no") AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py], "no")
if test "x$RST2MAN" = "xno"; then if test "x$RST2MAN" = "xno"; then
AC_MSG_WARN([rst2man not found - not building man pages]) AC_MSG_ERROR([rst2man not found - cannot build man pages])
fi fi
AM_CONDITIONAL(HAVE_RST2MAN, [test "x$RST2MAN" != "xno"])
# Check for pkg-config
PKG_PROG_PKG_CONFIG
# Checks for header files. # Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS([sys/stdlib.h]) AC_CHECK_HEADERS([sys/stdlib.h])
# Check for python # backwards compat with older pkg-config
AC_CHECK_PROGS(PYTHON, [python3 python3.1 python3.2 python2.7 python2.6 python2.5 python2 python], [AC_MSG_ERROR([Python is needed to build this vmod, please install python.])]) # - pull in AC_DEFUN from pkg.m4
m4_ifndef([PKG_CHECK_VAR], [
# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# -------------------------------------------
# Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])# PKG_CHECK_VAR
])
PKG_CHECK_MODULES([libvarnishapi], [varnishapi])
PKG_CHECK_VAR([LIBVARNISHAPI_PREFIX], [varnishapi], [prefix])
PKG_CHECK_VAR([LIBVARNISHAPI_DATAROOTDIR], [varnishapi], [datarootdir])
PKG_CHECK_VAR([LIBVARNISHAPI_BINDIR], [varnishapi], [bindir])
PKG_CHECK_VAR([LIBVARNISHAPI_SBINDIR], [varnishapi], [sbindir])
AC_SUBST([LIBVARNISHAPI_DATAROOTDIR])
# Varnish include files tree # Varnish include files tree
VARNISH_VMOD_INCLUDES VARNISH_VMOD_INCLUDES
VARNISH_VMOD_DIR VARNISH_VMOD_DIR
VARNISH_VMODTOOL VARNISH_VMODTOOL
# inherit the prefix from Varnish.
# acessing ac_ variable because AC_PREFIX_DEFAULT acts too early
ac_default_prefix=$LIBVARNISHAPI_PREFIX
# Check paths to varnishd and varnishtest AC_PATH_PROG([VARNISHTEST], [varnishtest], [],
AC_ARG_VAR([VARNISHTEST], [path to varnishtest (mandatory for make check)]) [$LIBVARNISHAPI_BINDIR:$LIBVARNISHAPI_SBINDIR:$PATH])
AC_ARG_VAR([VARNISHD], [path to varnishd (mandatory for make check)]) AC_PATH_PROG([VARNISHD], [varnishd], [],
AC_PATH_PROG([VARNISHTEST], [varnishtest]) [$LIBVARNISHAPI_SBINDIR:$LIBVARNISHAPI_BINDIR:$PATH])
AC_PATH_PROG([VARNISHD], [varnishd], [/bin/false],
[${PATH}${PATH_SEPARATOR}/usr/local/sbin${PATH_SEPARATOR}/usr/sbin])
if test "x$VARNISHD" = x; then
AC_MSG_FAILURE([Can't locate varnishd])
fi
if test "x$VARNISHTEST" = x; then
AC_MSG_FAILURE([Can't locate varnishtest])
fi
# This corresponds to FreeBSD's WARNS level 6 # This corresponds to FreeBSD's WARNS level 6
DEVELOPER_CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wformat" DEVELOPER_CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wformat"
...@@ -110,11 +131,6 @@ if test "x$enable_stack_protector" != "xno"; then ...@@ -110,11 +131,6 @@ if test "x$enable_stack_protector" != "xno"; then
CFLAGS="$save_CFLAGS"]) CFLAGS="$save_CFLAGS"])
fi fi
# --enable-tests
AC_ARG_ENABLE(tests,
AS_HELP_STRING([--enable-tests],[build test programs (default is NO)]))
AM_CONDITIONAL([ENABLE_TESTS], [test x$enable_tests = xyes])
# --enable-werror # --enable-werror
AC_ARG_ENABLE(werror, AC_ARG_ENABLE(werror,
AS_HELP_STRING([--enable-werror],[use -Werror (default is NO)]), AS_HELP_STRING([--enable-werror],[use -Werror (default is NO)]),
......
AM_CPPFLAGS = @VMOD_INCLUDES@ -Wall -Werror
AM_CPPFLAGS = @VMOD_INCLUDES@
AM_LDFLAGS = $(AM_LT_LDFLAGS)
vmoddir = @VMOD_DIR@ vmoddir = @VMOD_DIR@
vmod_LTLIBRARIES = libvmod_vtstor.la vmod_LTLIBRARIES = libvmod_vtstor.la
libvmod_vtstor_la_LDFLAGS = $(AM_LDFLAGS) -module -export-dynamic -avoid-version -shared libvmod_vtstor_la_LDFLAGS = -module -export-dynamic -avoid-version -shared
libvmod_vtstor_la_SOURCES = \ libvmod_vtstor_la_SOURCES = \
vmod_vtstor.c \ vtstor.c \
vtstor.c vmod_vtstor.c
nodist_libvmod_vtstor_la_SOURCES = \ nodist_libvmod_vtstor_la_SOURCES = \
vcc_if.c \ vcc_if.c \
vcc_if.h vcc_if.h
vmod_vtstor.lo: vcc_if.h dist_man_MANS = vmod_vtstor.3
vmod_vtstor.3: vmod_vtstor.man.rst
${RST2MAN} $< $@
vcc_if.c vcc_if.h: @VMODTOOL@ $(top_srcdir)/src/vmod_vtstor.vcc
@VMODTOOL@ $(top_srcdir)/src/vmod_vtstor.vcc
VMOD_TESTS = tests/*.vtc vmod_vtstor.lo vmod_vtstor.man.rst: vcc
.PHONY: $(VMOD_TESTS)
tests/*.vtc: vcc: @VMODTOOL@ $(top_srcdir)/src/vmod_vtstor.vcc
@PYTHON@ @VMODTOOL@ $(top_srcdir)/src/vmod_vtstor.vcc
VMOD_TESTS = $(top_srcdir)/src/tests/*.vtc
.PHONY: $(VMOD_TESTS) vcc
$(top_srcdir)/src/tests/*.vtc: libvmod_vtstor.la
@VARNISHTEST@ -Dvarnishd=@VARNISHD@ -Dvmod_topbuild=$(abs_top_builddir) $@ @VARNISHTEST@ -Dvarnishd=@VARNISHD@ -Dvmod_topbuild=$(abs_top_builddir) $@
check: $(VMOD_TESTS) check: $(VMOD_TESTS)
EXTRA_DIST = \ EXTRA_DIST = \
vmod_vtstor.vcc \ vmod_vtstor.vcc \
$(VMOD_TESTS) $(VMOD_TESTS)
CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h CLEANFILES = \
$(builddir)/vcc_if.c \
$(builddir)/vcc_if.h \
$(builddir)/vmod_vtstor.rst \
$(builddir)/vmod_vtstor.man.rst \
$(dist_man_MANS)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment