From: Pieter Lexis Date: Mon, 25 Apr 2016 12:17:53 +0000 (+0200) Subject: Move systemd-related m4 files X-Git-Tag: rec-4.0.0-alpha3~5^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e9c43b4b586a9188a11c2c111fdbc69f93a2a7b;p=thirdparty%2Fpdns.git Move systemd-related m4 files --- diff --git a/m4/ax_arg_default_enable_disable.m4 b/m4/ax_arg_default_enable_disable.m4 new file mode 100644 index 0000000000..bd672ab8bc --- /dev/null +++ b/m4/ax_arg_default_enable_disable.m4 @@ -0,0 +1,21 @@ +AC_DEFUN([AX_ARG_DEFAULT_ENABLE], [ +AC_ARG_ENABLE([$1], AS_HELP_STRING([--disable-$1], [$2 (default is ENABLED)])) +AX_PARSE_VALUE([$1], [y]) +]) + +AC_DEFUN([AX_ARG_DEFAULT_DISABLE], [ +AC_ARG_ENABLE([$1], AS_HELP_STRING([--enable-$1], [$2 (default is DISABLED)])) +AX_PARSE_VALUE([$1], [n]) +]) + +dnl This function should not be called outside of this file +AC_DEFUN([AX_PARSE_VALUE], [ +AS_IF([test "x$enable_$1" = "xno"], [ + ax_cv_$1="n" +], [test "x$enable_$1" = "xyes"], [ + ax_cv_$1="y" +], [test -z $ax_cv_$1], [ + ax_cv_$1="$2" +]) +$1=$ax_cv_$1 +AC_SUBST($1)]) diff --git a/m4/systemd.m4 b/m4/systemd.m4 new file mode 100644 index 0000000000..68d1cda00d --- /dev/null +++ b/m4/systemd.m4 @@ -0,0 +1,130 @@ +# systemd.m4 - Macros to check for and enable systemd -*- Autoconf -*- +# +# Copyright (C) 2014 Luis R. Rodriguez +# Copyright (C) 2016 Pieter Lexis +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +#serial 2 + +dnl Some optional path options +AC_DEFUN([AX_SYSTEMD_OPTIONS], [ + AC_ARG_WITH(systemd, [ --with-systemd set directory for systemd service files], + SYSTEMD_DIR="$withval", SYSTEMD_DIR="") + AC_SUBST(SYSTEMD_DIR) + + AC_ARG_WITH(systemd, [ --with-systemd-modules-load set directory for systemd modules load files], + SYSTEMD_MODULES_LOAD="$withval", SYSTEMD_MODULES_LOAD="") + AC_SUBST(SYSTEMD_MODULES_LOAD) +]) + +AC_DEFUN([AX_ENABLE_SYSTEMD_OPTS], [ + AX_ARG_DEFAULT_ENABLE([systemd], [Disable systemd support]) + AX_SYSTEMD_OPTIONS() +]) + +AC_DEFUN([AX_ALLOW_SYSTEMD_OPTS], [ + AX_ARG_DEFAULT_DISABLE([systemd], [Enable systemd support]) + AX_SYSTEMD_OPTIONS() +]) + +AC_DEFUN([AX_CHECK_SYSTEMD_LIBS], [ + AC_REQUIRE([AX_CHECK_SYSTEMD_DETECT_AND_ENABLE]) + AS_IF([test "x$libsystemd" = x], [ + AC_MSG_ERROR([Unable to find a suitable libsystemd library]) + ]) + + PKG_CHECK_MODULES([SYSTEMD], [$libsystemd_daemon]) + dnl pkg-config older than 0.24 does not set these for + dnl PKG_CHECK_MODULES() worth also noting is that as of version 208 + dnl of systemd pkg-config --cflags currently yields no extra flags yet. + AC_SUBST([SYSTEMD_CFLAGS]) + AC_SUBST([SYSTEMD_LIBS]) + + AS_IF([test "x$SYSTEMD_DIR" = x], [ + dnl In order to use the line below we need to fix upstream systemd + dnl to properly ${prefix} for child variables in + dnl src/core/systemd.pc.in but this is a bit complex at the + dnl moment as they depend on another rootprefix, which can vary + dnl from prefix in practice. We provide our own definition as we + dnl *know* where systemd will dump this to, but this does limit + dnl us to stick to a non custom systemdsystemunitdir, dnl to work + dnl around this we provide the additional configure option + dnl --with-systemd where you can specify the directory for the unit + dnl files. It would also be best to just extend the upstream + dnl pkg-config pkg.m4 with an AC_DEFUN() to do this neatly. + dnl SYSTEMD_DIR="`$PKG_CONFIG --define-variable=prefix=$PREFIX --variable=systemdsystemunitdir systemd`" + SYSTEMD_DIR="\$(prefix)/lib/systemd/system/" + ], []) + + AS_IF([test "x$SYSTEMD_DIR" = x], [ + AC_MSG_ERROR([SYSTEMD_DIR is unset]) + ], []) + + dnl There is no variable for this yet for some reason + AS_IF([test "x$SYSTEMD_MODULES_LOAD" = x], [ + SYSTEMD_MODULES_LOAD="\$(prefix)/lib/modules-load.d/" + ], []) + + AS_IF([test "x$SYSTEMD_MODULES_LOAD" = x], [ + AC_MSG_ERROR([SYSTEMD_MODULES_LOAD is unset]) + ], []) +]) + +AC_DEFUN([AX_CHECK_SYSTEMD], [ + dnl Respect user override to disable + AS_IF([test "x$enable_systemd" != "xno"], [ + AS_IF([test "x$systemd" = "xy" ], [ + AC_DEFINE([HAVE_SYSTEMD], [1], [Systemd available and enabled]) + systemd=y + AX_CHECK_SYSTEMD_LIBS() + ],[systemd=n]) + ],[systemd=n]) +]) + +AC_DEFUN([AX_CHECK_SYSTEMD_DETECT_AND_ENABLE], [ + AC_CHECK_HEADER([systemd/sd-daemon.h], [ + for libname in systemd-daemon systemd; do + AC_CHECK_LIB([$libname], [sd_listen_fds], [ + libsystemd_daemon="lib$libname" + systemd=y + libsystemd=y + ]) + done + ]) +]) + +dnl Enables systemd by default and requires a --disable-systemd option flag +dnl to configure if you want to disable. +AC_DEFUN([AX_ENABLE_SYSTEMD], [ + AX_ENABLE_SYSTEMD_OPTS() + AX_CHECK_SYSTEMD() +]) + +dnl Systemd will be disabled by default and requires you to run configure with +dnl --enable-systemd to look for and enable systemd. +AC_DEFUN([AX_ALLOW_SYSTEMD], [ + AX_ALLOW_SYSTEMD_OPTS() + AX_CHECK_SYSTEMD() +]) + +dnl Systemd will be disabled by default but if your build system is detected +dnl to have systemd build libraries it will be enabled. You can always force +dnl disable with --disable-systemd +AC_DEFUN([AX_AVAILABLE_SYSTEMD], [ + AX_ALLOW_SYSTEMD_OPTS() + AX_CHECK_SYSTEMD_DETECT_AND_ENABLE() + AX_CHECK_SYSTEMD() +]) diff --git a/pdns/dnsdistdist/m4/ax_arg_default_enable_disable.m4 b/pdns/dnsdistdist/m4/ax_arg_default_enable_disable.m4 deleted file mode 100644 index bd672ab8bc..0000000000 --- a/pdns/dnsdistdist/m4/ax_arg_default_enable_disable.m4 +++ /dev/null @@ -1,21 +0,0 @@ -AC_DEFUN([AX_ARG_DEFAULT_ENABLE], [ -AC_ARG_ENABLE([$1], AS_HELP_STRING([--disable-$1], [$2 (default is ENABLED)])) -AX_PARSE_VALUE([$1], [y]) -]) - -AC_DEFUN([AX_ARG_DEFAULT_DISABLE], [ -AC_ARG_ENABLE([$1], AS_HELP_STRING([--enable-$1], [$2 (default is DISABLED)])) -AX_PARSE_VALUE([$1], [n]) -]) - -dnl This function should not be called outside of this file -AC_DEFUN([AX_PARSE_VALUE], [ -AS_IF([test "x$enable_$1" = "xno"], [ - ax_cv_$1="n" -], [test "x$enable_$1" = "xyes"], [ - ax_cv_$1="y" -], [test -z $ax_cv_$1], [ - ax_cv_$1="$2" -]) -$1=$ax_cv_$1 -AC_SUBST($1)]) diff --git a/pdns/dnsdistdist/m4/ax_arg_default_enable_disable.m4 b/pdns/dnsdistdist/m4/ax_arg_default_enable_disable.m4 new file mode 120000 index 0000000000..dcdfa5baa5 --- /dev/null +++ b/pdns/dnsdistdist/m4/ax_arg_default_enable_disable.m4 @@ -0,0 +1 @@ +../../../m4/ax_arg_default_enable_disable.m4 \ No newline at end of file diff --git a/pdns/dnsdistdist/m4/systemd.m4 b/pdns/dnsdistdist/m4/systemd.m4 deleted file mode 100644 index 68d1cda00d..0000000000 --- a/pdns/dnsdistdist/m4/systemd.m4 +++ /dev/null @@ -1,130 +0,0 @@ -# systemd.m4 - Macros to check for and enable systemd -*- Autoconf -*- -# -# Copyright (C) 2014 Luis R. Rodriguez -# Copyright (C) 2016 Pieter Lexis -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -#serial 2 - -dnl Some optional path options -AC_DEFUN([AX_SYSTEMD_OPTIONS], [ - AC_ARG_WITH(systemd, [ --with-systemd set directory for systemd service files], - SYSTEMD_DIR="$withval", SYSTEMD_DIR="") - AC_SUBST(SYSTEMD_DIR) - - AC_ARG_WITH(systemd, [ --with-systemd-modules-load set directory for systemd modules load files], - SYSTEMD_MODULES_LOAD="$withval", SYSTEMD_MODULES_LOAD="") - AC_SUBST(SYSTEMD_MODULES_LOAD) -]) - -AC_DEFUN([AX_ENABLE_SYSTEMD_OPTS], [ - AX_ARG_DEFAULT_ENABLE([systemd], [Disable systemd support]) - AX_SYSTEMD_OPTIONS() -]) - -AC_DEFUN([AX_ALLOW_SYSTEMD_OPTS], [ - AX_ARG_DEFAULT_DISABLE([systemd], [Enable systemd support]) - AX_SYSTEMD_OPTIONS() -]) - -AC_DEFUN([AX_CHECK_SYSTEMD_LIBS], [ - AC_REQUIRE([AX_CHECK_SYSTEMD_DETECT_AND_ENABLE]) - AS_IF([test "x$libsystemd" = x], [ - AC_MSG_ERROR([Unable to find a suitable libsystemd library]) - ]) - - PKG_CHECK_MODULES([SYSTEMD], [$libsystemd_daemon]) - dnl pkg-config older than 0.24 does not set these for - dnl PKG_CHECK_MODULES() worth also noting is that as of version 208 - dnl of systemd pkg-config --cflags currently yields no extra flags yet. - AC_SUBST([SYSTEMD_CFLAGS]) - AC_SUBST([SYSTEMD_LIBS]) - - AS_IF([test "x$SYSTEMD_DIR" = x], [ - dnl In order to use the line below we need to fix upstream systemd - dnl to properly ${prefix} for child variables in - dnl src/core/systemd.pc.in but this is a bit complex at the - dnl moment as they depend on another rootprefix, which can vary - dnl from prefix in practice. We provide our own definition as we - dnl *know* where systemd will dump this to, but this does limit - dnl us to stick to a non custom systemdsystemunitdir, dnl to work - dnl around this we provide the additional configure option - dnl --with-systemd where you can specify the directory for the unit - dnl files. It would also be best to just extend the upstream - dnl pkg-config pkg.m4 with an AC_DEFUN() to do this neatly. - dnl SYSTEMD_DIR="`$PKG_CONFIG --define-variable=prefix=$PREFIX --variable=systemdsystemunitdir systemd`" - SYSTEMD_DIR="\$(prefix)/lib/systemd/system/" - ], []) - - AS_IF([test "x$SYSTEMD_DIR" = x], [ - AC_MSG_ERROR([SYSTEMD_DIR is unset]) - ], []) - - dnl There is no variable for this yet for some reason - AS_IF([test "x$SYSTEMD_MODULES_LOAD" = x], [ - SYSTEMD_MODULES_LOAD="\$(prefix)/lib/modules-load.d/" - ], []) - - AS_IF([test "x$SYSTEMD_MODULES_LOAD" = x], [ - AC_MSG_ERROR([SYSTEMD_MODULES_LOAD is unset]) - ], []) -]) - -AC_DEFUN([AX_CHECK_SYSTEMD], [ - dnl Respect user override to disable - AS_IF([test "x$enable_systemd" != "xno"], [ - AS_IF([test "x$systemd" = "xy" ], [ - AC_DEFINE([HAVE_SYSTEMD], [1], [Systemd available and enabled]) - systemd=y - AX_CHECK_SYSTEMD_LIBS() - ],[systemd=n]) - ],[systemd=n]) -]) - -AC_DEFUN([AX_CHECK_SYSTEMD_DETECT_AND_ENABLE], [ - AC_CHECK_HEADER([systemd/sd-daemon.h], [ - for libname in systemd-daemon systemd; do - AC_CHECK_LIB([$libname], [sd_listen_fds], [ - libsystemd_daemon="lib$libname" - systemd=y - libsystemd=y - ]) - done - ]) -]) - -dnl Enables systemd by default and requires a --disable-systemd option flag -dnl to configure if you want to disable. -AC_DEFUN([AX_ENABLE_SYSTEMD], [ - AX_ENABLE_SYSTEMD_OPTS() - AX_CHECK_SYSTEMD() -]) - -dnl Systemd will be disabled by default and requires you to run configure with -dnl --enable-systemd to look for and enable systemd. -AC_DEFUN([AX_ALLOW_SYSTEMD], [ - AX_ALLOW_SYSTEMD_OPTS() - AX_CHECK_SYSTEMD() -]) - -dnl Systemd will be disabled by default but if your build system is detected -dnl to have systemd build libraries it will be enabled. You can always force -dnl disable with --disable-systemd -AC_DEFUN([AX_AVAILABLE_SYSTEMD], [ - AX_ALLOW_SYSTEMD_OPTS() - AX_CHECK_SYSTEMD_DETECT_AND_ENABLE() - AX_CHECK_SYSTEMD() -]) diff --git a/pdns/dnsdistdist/m4/systemd.m4 b/pdns/dnsdistdist/m4/systemd.m4 new file mode 120000 index 0000000000..d95ceb7cf2 --- /dev/null +++ b/pdns/dnsdistdist/m4/systemd.m4 @@ -0,0 +1 @@ +../../../m4/systemd.m4 \ No newline at end of file