X-Git-Url: http://git.ipfire.org/?p=location%2Flibloc.git;a=blobdiff_plain;f=configure.ac;h=cc9de27a680946da4f01efba4436859b6c41c142;hp=733a648a25f30236722c7f22aba65f42790dc0e9;hb=HEAD;hpb=e293dac1f4fd8114f9960a8068e3ed07b822b3b8 diff --git a/configure.ac b/configure.ac index 733a648..bd4d3d0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,9 @@ AC_PREREQ(2.60) AC_INIT([libloc], - [0], - [michael.tremer@ipfire.org], + [0.9.17], + [location@lists.ipfire.org], [libloc], - [https://www.ipfire.org/]) + [https://location.ipfire.org/]) AC_CONFIG_SRCDIR([src/libloc.c]) AC_CONFIG_AUX_DIR([build-aux]) @@ -18,7 +18,7 @@ AM_INIT_AUTOMAKE([ dist-xz subdir-objects ]) -AC_PROG_CC_STDC +AC_PROG_CC AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE AC_CONFIG_MACRO_DIR([m4]) @@ -31,6 +31,10 @@ AC_PREFIX_DEFAULT([/usr]) gl_LD_VERSION_SCRIPT IT_PROG_INTLTOOL([0.40.0]) + +# Interpret embedded Python in HTML files +XGETTEXT="${XGETTEXT} -L Python --keyword=_:1,2 --keyword=N_:1,2 --no-location" + GETTEXT_PACKAGE=${PACKAGE_TARNAME} AC_SUBST(GETTEXT_PACKAGE) @@ -39,18 +43,53 @@ AC_PROG_MKDIR_P # - man ------------------------------------------------------------------------ -have_manpages=no -AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-man-pages], +have_man_pages=no +AC_ARG_ENABLE(man_pages, AS_HELP_STRING([--disable-man-pages], [do not install man pages])) -AS_IF([test "x$enable_manpages" != xno], [have_manpages=yes]) -AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$have_manpages" = "xyes"]) +AS_IF([test "x$enable_man_pages" != xno], [have_man_pages=yes]) +AM_CONDITIONAL(ENABLE_MAN_PAGES, [test "x$have_man_pages" = "xyes"]) AC_PATH_PROG([XSLTPROC], [xsltproc]) AC_CHECK_PROGS(ASCIIDOC, [asciidoc]) -if test "${have_manpages}" = "yes" && test -z "${ASCIIDOC}"; then +if test "${have_man_pages}" = "yes" && test -z "${ASCIIDOC}"; then AC_MSG_ERROR([Required program 'asciidoc' not found]) fi + +# - pkg-config ----------------------------------------------------------------- + +m4_ifndef([PKG_PROG_PKG_CONFIG], + [m4_fatal([Could not locate the pkg-config autoconf + macros. These are usually located in /usr/share/aclocal/pkg.m4. + If your macros are in a different location, try setting the + environment variable AL_OPTS="-I/other/macro/dir" before running + ./autogen.sh or autoreconf again. Make sure pkg-config is installed.])]) + +PKG_PROG_PKG_CONFIG +PKG_INSTALLDIR(['${usrlib_execdir}/pkgconfig']) + +# - bash-completion ------------------------------------------------------------ + +#enable_bash_completion=yes +AC_ARG_WITH([bashcompletiondir], + AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]), + [], + [AS_IF([`$PKG_CONFIG --exists bash-completion`], [ + with_bashcompletiondir=`$PKG_CONFIG --variable=completionsdir bash-completion` + ], [ + with_bashcompletiondir=${datadir}/bash-completion/completions + ]) +]) + +AC_SUBST([bashcompletiondir], [$with_bashcompletiondir]) + +AC_ARG_ENABLE([bash-completion], + AS_HELP_STRING([--disable-bash-completion], [do not install bash completion files]), + [], [enable_bash_completion=yes] +) + +AM_CONDITIONAL([BUILD_BASH_COMPLETION], [test "x$enable_bash_completion" = xyes]) + # - debug ---------------------------------------------------------------------- AC_ARG_ENABLE([debug], @@ -77,6 +116,7 @@ AC_CHECK_FUNCS([ \ htobe16 \ htobe32 \ htobe64 \ + madvise \ mmap \ munmap \ res_query \ @@ -99,9 +139,35 @@ my_CFLAGS="\ -Wtype-limits \ " AC_SUBST([my_CFLAGS]) +AC_SUBST([my_LDFLAGS]) + +# Enable -fanalyzer if requested +AC_ARG_ENABLE([analyzer], + AS_HELP_STRING([--enable-analyzer], [enable static analyzer (-fanalyzer) @<:@default=disabled@:>@]), + [], [enable_analyzer=no]) +AS_IF([test "x$enable_analyzer" = "xyes"], + CC_CHECK_FLAGS_APPEND([my_CFLAGS], [CFLAGS], [-fanalyzer]) +) + +# Enable -fno-semantic-interposition (if available) +CC_CHECK_FLAGS_APPEND([my_CFLAGS], [CFLAGS], [-fno-semantic-interposition]) +CC_CHECK_FLAGS_APPEND([my_LDFLAGS], [LDFLAGS], [-fno-semantic-interposition]) # ------------------------------------------------------------------------------ +AC_ARG_WITH([database-path], + AS_HELP_STRING([--with-database-path], [The default database path]), + [], [with_database_path=/var/lib/location/database.db] +) + +if test -z "${with_database_path}"; then + AC_MSG_ERROR([The default database path is empty]) +fi + +AC_DEFINE_UNQUOTED([LIBLOC_DEFAULT_DATABASE_PATH], ["${with_database_path}"], + [The default path for the database]) +AC_SUBST([DEFAULT_DATABASE_PATH], [${with_database_path}]) + AC_ARG_WITH([systemd], AS_HELP_STRING([--with-systemd], [Enable systemd support.]) ) @@ -136,26 +202,62 @@ AM_CONDITIONAL(HAVE_SYSTEMD, [test "x$have_systemd" = "xyes"]) # ------------------------------------------------------------------------------ +AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + # Python AM_PATH_PYTHON([3.4]) PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}]) +# Lua +AC_ARG_ENABLE(lua, + AS_HELP_STRING([--disable-lua], [do not build the Lua modules]), [], [enable_lua=yes]) + +AM_CONDITIONAL(ENABLE_LUA, test "$enable_lua" = "yes") + +AS_IF( + [test "$enable_lua" = "yes"], [ + PKG_CHECK_MODULES([LUA], [lua]) + + AX_PROG_LUA_MODULES([luaunit],, [AC_MSG_ERROR([Lua modules are missing])]) + + LUA_INSTALL_LMOD=$($PKG_CONFIG --define-variable=prefix=${prefix} --variable=INSTALL_LMOD lua) + AC_SUBST(LUA_INSTALL_LMOD) + LUA_INSTALL_CMOD=$($PKG_CONFIG --define-variable=prefix=${prefix} --variable=INSTALL_CMOD lua) + AC_SUBST(LUA_INSTALL_CMOD) + ], +) + # Perl AC_PATH_PROG(PERL, perl, no) AC_SUBST(PERL) -AX_PROG_PERL_MODULES(ExtUtils::MakeMaker,, AC_MSG_WARN(Need some Perl modules)) +AX_PROG_PERL_MODULES(Config ExtUtils::MakeMaker,, AC_MSG_WARN(Need some Perl modules)) AC_ARG_ENABLE(perl, AS_HELP_STRING([--disable-perl], [do not build the perl modules]), [],[enable_perl=yes]) AM_CONDITIONAL(ENABLE_PERL, test "$enable_perl" = "yes") +AS_IF([test "$enable_perl" = "yes"], + [ + PERL_MODPATH=$($PERL -MConfig -e 'print $Config{installvendorarch}') + PERL_MANPATH=$($PERL -MConfig -e 'print $Config{installvendorman3dir}') + AC_SUBST(PERL_MODPATH) + AC_SUBST(PERL_MANPATH) + ], +) dnl Checking for libresolv -if test ${gm_platform} = "linux" ; then - AC_CHECK_LIB(resolv, ns_msg_getflag, [LIBS="-lresolv $LIBS"], AC_MSG_ERROR([libresolv has not been found]), -lresolv) -else - AC_CHECK_LIB(resolv, res_init, [LIBS="-lresolv $LIBS"], AC_MSG_ERROR([libresolv has not been found]), -lresolv) -fi +case "${host}" in + *-gnu*) + AC_CHECK_LIB(resolv, ns_msg_getflag, [LIBS="-lresolv $LIBS"], AC_MSG_ERROR([libresolv has not been found]), -lresolv) + ;; + *) + AC_CHECK_LIB(resolv, res_init, [LIBS="-lresolv $LIBS"], AC_MSG_ERROR([libresolv has not been found]), -lresolv) + ;; +esac RESOLV_LIBS="${LIBS}" +AC_SUBST(RESOLV_LIBS) + +dnl Checking for OpenSSL +PKG_CHECK_MODULES([OPENSSL], [openssl]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ @@ -177,9 +279,16 @@ AC_MSG_RESULT([ cflags: ${CFLAGS} ldflags: ${LDFLAGS} + database path: ${with_database_path} debug: ${enable_debug} systemd support: ${have_systemd} + bash-completion: ${enable_bash_completion} Bindings: - perl: ${enable_perl} + Lua: ${enable_lua} + Lua shared path: ${LUA_INSTALL_LMOD} + Lua module path: ${LUA_INSTALL_CMOD} + Perl: ${enable_perl} + Perl module path: ${PERL_MODPATH} + Perl manual path: ${PERL_MANPATH} ])