libpsl/configure.ac

240 lines
8.9 KiB
Plaintext
Raw Permalink Normal View History

2014-03-20 17:17:24 +01:00
2014-10-28 16:17:26 +01:00
AC_INIT([libpsl], [0.6.0], [tim.ruehsen@gmx.de], [libpsl], [http://github.com/rockdaboot/libpsl])
2014-03-20 17:17:24 +01:00
AC_PREREQ([2.59])
2014-06-27 17:13:30 +02:00
AM_INIT_AUTOMAKE([1.10 -Wall no-define foreign])
2014-03-20 17:17:24 +01:00
# Generate two configuration headers; one for building the library itself with
# an autogenerated template, and a second one that will be installed alongside
# the library.
AC_CONFIG_HEADERS([config.h])
AC_PROG_CC
2014-05-26 11:13:52 +02:00
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
#LT_INIT([disable-static])
LT_INIT
2014-03-20 22:43:04 +01:00
AC_CONFIG_MACRO_DIR([m4])
2014-03-20 17:17:24 +01:00
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
2014-03-20 22:43:04 +01:00
#
# Gettext
#
AM_GNU_GETTEXT([external],[need-ngettext])
AM_GNU_GETTEXT_VERSION([0.18.1])
2014-04-02 10:27:13 +02:00
#
# check for gtk-doc
#
m4_ifdef([GTK_DOC_CHECK], [
GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
],[
AM_CONDITIONAL([ENABLE_GTK_DOC], false)
])
#
# enable creation of man pages
#
AC_ARG_ENABLE(man,[AC_HELP_STRING([--enable-man],
[generate man pages [default=auto]])],enable_man=yes,enable_man=no)
AS_IF([test "$enable_man" != no], [
AC_PATH_PROG([XSLTPROC], [xsltproc])
AS_IF([test -z "$XSLTPROC"], [
AS_IF([test "$enable_man" = yes], [
AC_MSG_ERROR([xsltproc is required for --enable-man])
])
enable_man=no
])
])
AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno)
AC_MSG_CHECKING([whether to generate man pages])
AS_IF([ test "$enable_man" != no ], [
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
2014-03-20 17:17:24 +01:00
# Define these substitions here to keep all version information in one place.
# For information on how to properly maintain the library version information,
# refer to the libtool manual, section "Updating library version information":
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
2014-04-25 12:36:59 +02:00
#
# 1. Start with version information of 0:0:0 for each libtool library.
# 2. Update the version information only immediately before a public release of your software. More frequent updates are unnecessary, and only guarantee that the current interface number gets larger faster.
# 3. If the library source code has changed at all since the last update, then increment revision (c:r:a becomes c:r+1:a).
# 4. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0.
# 5. If any interfaces have been added since the last public release, then increment age.
2014-06-23 12:12:54 +02:00
# 6. If any existing interfaces have been removed or changed since the last public release, then set age to 0.
2014-10-28 16:17:26 +01:00
AC_SUBST([LIBPSL_SO_VERSION], [2:3:2])
AC_SUBST([LIBPSL_VERSION], $VERSION)
2014-03-20 17:17:24 +01:00
# Check for enable/disable builtin PSL data
AC_ARG_ENABLE(runtime,
2014-06-15 22:31:18 +02:00
[
--enable-runtime[[=IDNA library]]
Specify the IDNA library used for libpsl run-time conversions:
libicu [[default]]: IDNA2008 UTS#46 library
libidn2: IDNA2008 library (also needs libunistring)
libidn: IDNA2003 library (also needs libunistring)
--disable-runtime Do not link runtime IDNA functionality
], [
if test "$enableval" = "libicu" -o "$enableval" = "yes"; then
enable_runtime=libicu
AC_DEFINE([WITH_LIBICU], [1], [generate PSL data using libicu])
elif test "$enableval" = "libidn2"; then
enable_runtime=libidn2
AC_DEFINE([WITH_LIBIDN2], [1], [generate PSL data using libidn2])
elif test "$enableval" = "libidn"; then
enable_runtime=libidn
AC_DEFINE([WITH_LIBIDN], [1], [generate PSL data using libidn])
elif test "$enableval" = "no"; then
enable_runtime=no
else
AC_MSG_ERROR([Unknown value $enableval for --enable-runtime])
fi
], [
# this is the default if neither --enable-runtime nor --disable-runtime were specified
enable_runtime=libicu
AC_DEFINE([WITH_LIBICU], [1], [generate PSL data using libicu])
2014-06-15 22:31:18 +02:00
])
# Check for enable/disable builtin PSL data
AC_ARG_ENABLE(builtin,
[
--enable-builtin[[=IDNA library]]
2014-06-27 17:13:30 +02:00
Specify the IDNA library used for built-in data generation:
libicu [[default]]: IDNA2008 UTS#46 library
libidn2: IDNA2008 library (also needs libunistring)
libidn: IDNA2003 library (also needs libunistring)
--disable-builtin Do not generate built-in PSL data
], [
2014-06-27 17:13:30 +02:00
if test "$enableval" = "libicu" -o "$enableval" = "yes"; then
enable_builtin=libicu
AC_DEFINE([BUILTIN_GENERATOR_LIBICU], [1], [generate PSL data using libicu])
elif test "$enableval" = "libidn2"; then
enable_builtin=libidn2
AC_DEFINE([BUILTIN_GENERATOR_LIBIDN2], [1], [generate PSL data using libidn2])
elif test "$enableval" = "libidn"; then
enable_builtin=libidn
AC_DEFINE([BUILTIN_GENERATOR_LIBIDN], [1], [generate PSL data using libidn])
2014-06-27 17:13:30 +02:00
elif test "$enableval" = "no"; then
enable_builtin=no
else
AC_MSG_ERROR(Unknown value $enableval)
fi
], [
# this is the default if neither --enable-builtin nor --disable-builtin were specified
2014-06-27 17:13:30 +02:00
enable_builtin=libicu
AC_DEFINE([BUILTIN_GENERATOR_LIBICU], [1], [generate PSL data using libicu])
])
2014-06-27 17:13:30 +02:00
if test "$enable_runtime" = "libicu" -o "$enable_builtin" = "libicu"; then
# Check for libicu
# using pkg-config won't work on older systems like Ubuntu 12.04 LTS Server Edition 64bit
# using AC_SEARCH_LIBS also don't work since functions have the library version appended
OLDLIBS=$LIBS
LIBS="-licuuc $LIBS"
AC_MSG_CHECKING([for ICU unicode library])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <unicode/ustring.h>]],
[[u_strToUTF8(NULL, 0, NULL, NULL, 0, NULL);]])],
[HAVE_LIBICU=yes; AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no]); AC_MSG_ERROR(You requested libicu but it is not installed.)])
LIBS=$OLDLIBS
fi
if test "$enable_runtime" = "libidn2" -o "$enable_builtin" = "libidn2"; then
# Check for libidn2
OLDLIBS=$LIBS
AC_SEARCH_LIBS(idn2_lookup_u8, idn2, HAVE_LIBIDN2=yes, AC_MSG_ERROR(You requested libidn2 but it is not installed.))
LIBS=$OLDLIBS
fi
if test "$enable_runtime" = "libidn" -o "$enable_builtin" = "libidn"; then
# Check for libidn
OLDLIBS=$LIBS
AC_SEARCH_LIBS(idna_to_ascii_8z, idn, HAVE_LIBIDN=yes, AC_MSG_ERROR(You requested libidn but it is not installed.))
LIBS=$OLDLIBS
fi
if test "x$HAVE_LIBIDN2" = "xyes" -o "x$HAVE_LIBIDN" = "xyes"; then
# Check for libunistring, we need it for psl_str_to_utf8lower()
OLDLIBS=$LIBS
AC_SEARCH_LIBS(u8_tolower, unistring, HAVE_UNISTRING=yes, AC_MSG_ERROR(You requested libidn2 but libunistring is not installed.))
LIBS=$OLDLIBS
fi
AM_CONDITIONAL([WITH_LIBICU], test "x$enable_runtime" = "xlibicu")
AM_CONDITIONAL([WITH_LIBIDN2], test "x$enable_runtime" = "xlibidn2")
AM_CONDITIONAL([WITH_LIBIDN], test "x$enable_runtime" = "xlibidn")
2014-06-27 17:13:30 +02:00
AM_CONDITIONAL([BUILTIN_GENERATOR_LIBICU], test "x$enable_builtin" = "xlibicu")
AM_CONDITIONAL([BUILTIN_GENERATOR_LIBIDN2], test "x$enable_builtin" = "xlibidn2")
AM_CONDITIONAL([BUILTIN_GENERATOR_LIBIDN], test "x$enable_builtin" = "xlibidn")
2014-06-27 17:13:30 +02:00
AM_CONDITIONAL([WITH_BUILTIN], test $enable_builtin = yes)
2014-03-20 17:17:24 +01:00
# Check for valgrind
ac_enable_valgrind=no
AC_ARG_ENABLE(valgrind-tests,
AS_HELP_STRING([--enable-valgrind-tests], [enable using Valgrind for tests]),
2014-06-27 17:13:30 +02:00
[ac_enable_valgrind=$enableval],
[ac_enable_valgrind=no])
2014-03-20 17:17:24 +01:00
if test "${ac_enable_valgrind}" = "yes" ; then
AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
if test "$HAVE_VALGRIND" = "yes" ; then
VALGRIND_ENVIRONMENT="valgrind --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-origins=yes"
AC_SUBST(VALGRIND_ENVIRONMENT)
TESTS_INFO="Test suite will be run under Valgrind"
else
TESTS_INFO="Valgrind not found"
fi
else
TESTS_INFO="Valgrind testing not enabled"
fi
# Check for custom PSL file
AC_ARG_WITH(psl-file,
2014-06-15 22:31:18 +02:00
AC_HELP_STRING([--with-psl-file=[PATH]], [path to PSL file]),
PSL_FILE=$withval,
PSL_FILE="\$(top_srcdir)/data/effective_tld_names.dat")
AC_SUBST(PSL_FILE)
# Check for custom PSL test file
AC_ARG_WITH(psl-testfile,
2014-06-15 22:31:18 +02:00
AC_HELP_STRING([--with-psl-testfile=[PATH]], [path to PSL test file]),
PSL_TESTFILE=$withval,
PSL_TESTFILE="\$(top_srcdir)/data/test_psl.txt")
AC_SUBST(PSL_TESTFILE)
2014-10-28 15:41:35 +01:00
# check for alloca / alloca.h
AC_FUNC_ALLOCA
2014-03-20 17:17:24 +01:00
# Override the template file name of the generated .pc file, so that there
# is no need to rename the template file when the API version changes.
AC_CONFIG_FILES([Makefile
include/Makefile
src/Makefile
tools/Makefile
2014-03-20 17:17:24 +01:00
po/Makefile.in
2014-04-02 10:27:13 +02:00
docs/libpsl/Makefile
2014-04-23 17:13:15 +02:00
docs/libpsl/version.xml
2014-03-20 22:43:04 +01:00
data/Makefile
2014-03-20 17:17:24 +01:00
tests/Makefile
libpsl.pc:libpsl.pc.in])
2014-03-20 17:17:24 +01:00
AC_OUTPUT
AC_MSG_NOTICE([Summary of build options:
Version: ${PACKAGE_VERSION}
Host OS: ${host_os}
Install prefix: ${prefix}
Compiler: ${CC}
CFlags: ${CFLAGS} ${CPPFLAGS}
LDFlags: ${LDFLAGS}
Libs: ${LIBS}
Runtime: ${enable_runtime}
Builtin: ${enable_builtin}
PSL File: ${PSL_FILE}
PSL Test File: ${PSL_TESTFILE}
2014-03-20 17:17:24 +01:00
Tests: ${TESTS_INFO}
])