[network-manager-libreswan/th/vpn-editor-split: 12/18] build: cleanup configure.ac



commit 410b0f463cd5be566723bc789b8016ffe035dad9
Author: Thomas Haller <thaller redhat com>
Date:   Tue May 10 12:57:35 2016 +0200

    build: cleanup configure.ac
    
    Make configure.ac more like done for nm-openvpn.
    
    - print options after ./configure
    - better handle invalid/conflicting options

 Makefile.am  |    4 +-
 configure.ac |   69 +++++++++++++++++++++++++++++++++++++++++----------------
 2 files changed, 51 insertions(+), 22 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index e1bb684..6173068 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,7 @@ install-data-hook:
        mkdir -p $(DESTDIR)$(sysconfdir)/NetworkManager/VPN
        sed -e "1s|^|# This file is obsoleted by a file in $(NM_VPN_SERVICE_DIR)\n\n|" \
            -e 's|[ ]LIBEXECDIR[@]|$(libexecdir)|g' \
-           -e 's|[ ]PLUGINDIR[@]|$(libdir)/NetworkManager|g' \
+           -e 's|[ ]PLUGINDIR[@]|@NM_PLUGIN_DIR@|g' \
            <$(srcdir)/nm-libreswan-service.name.in \
            >$(DESTDIR)$(sysconfdir)/NetworkManager/VPN/nm-libreswan-service.name
 
@@ -34,7 +34,7 @@ appdata_in_files = appdata/network-manager-libreswan.metainfo.xml.in
 
 nm-libreswan-service.name: $(srcdir)/nm-libreswan-service.name.in
        sed -e 's|[ ]LIBEXECDIR[@]|$(libexecdir)|g' \
-           -e 's|[ ]PLUGINDIR[@]/|@NM_PLUGIN_DIR@|g' \
+           -e 's|[ ]PLUGINDIR[@]/|@NM_PLUGIN_DIR_NAME_FILE@|g' \
            $< >$@
 
 DISTCHECK_CONFIGURE_FLAGS = --enable-more-warnings=yes
diff --git a/configure.ac b/configure.ac
index 5d6b805..9bad2f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,23 +42,38 @@ AC_PROG_GCC_TRADITIONAL
 AC_FUNC_MEMCMP
 AC_CHECK_FUNCS(select socket uname)
 
-dnl
-dnl GNOME support
-dnl
-AC_ARG_WITH(gnome, AS_HELP_STRING([--without-gnome], [Build NetworkManager-libreswan without GNOME support, 
e.g. vpn service only]))
-AM_CONDITIONAL(WITH_GNOME, test x"$with_gnome" != xno)
-AC_ARG_WITH(libnm-glib, AS_HELP_STRING([--without-libnm-glib], [Build NetworkManager-libreswan without 
libnm-glib comatibility]))
-AM_CONDITIONAL(WITH_LIBNM_GLIB, test x"$with_libnm_glib" != xno)
-AC_ARG_ENABLE(absolute-paths, AS_HELP_STRING([--enable-absolute-paths], [Use absolute paths to in .name 
files. Useful for development. (default is no)]))
-
 dnl ensure that when the Automake generated makefile calls aclocal,
 dnl it honours the $ACLOCAL_FLAGS environment variable
 ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
 if test -n "$ac_macro_dir"; then
-       ACLOCAL_AMFLAGS="-I $ac_macro_dir $ACLOCAL_AMFLAGS"
+    ACLOCAL_AMFLAGS="-I $ac_macro_dir $ACLOCAL_AMFLAGS"
 fi
 AC_SUBST([ACLOCAL_AMFLAGS])
 
+dnl
+dnl GNOME support
+dnl
+AC_ARG_WITH(gnome, AS_HELP_STRING([--without-gnome], [Build NetworkManager-libreswan without GNOME support, 
e.g. vpn service only]), [], [with_gnome_specified=no])
+AC_ARG_WITH(libnm-glib, AS_HELP_STRING([--without-libnm-glib], [Build NetworkManager-libreswan without 
libnm-glib comatibility]), [], [with_libnm_glib_specified=no])
+if test "$with_libnm_glib_specified" != no -a "$with_libnm_glib" != no; then
+       if test "$with_gnome_specified" != no -a "$with_gnome" == no; then
+               AC_MSG_ERROR(Building --with-libnm-glib conflicts with --without-gnome)
+       fi
+fi
+if test "$with_gnome" != no; then
+       with_gnome=yes
+fi
+if test "$with_libnm_glib_specified" == no; then
+       with_libnm_glib="$with_gnome"
+fi
+if test "$with_libnm_glib" != no; then
+       with_libnm_glib=yes
+fi
+AM_CONDITIONAL(WITH_GNOME, test "$with_gnome" != no)
+AM_CONDITIONAL(WITH_LIBNM_GLIB, test "$with_libnm_glib" != no)
+
+AC_ARG_ENABLE(absolute-paths, AS_HELP_STRING([--enable-absolute-paths], [Use absolute paths to in .name 
files. Useful for development. (default is no)]))
+
 GETTEXT_PACKAGE=NetworkManager-libreswan
 AC_SUBST(GETTEXT_PACKAGE)
 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
@@ -95,8 +110,24 @@ if test x"$with_gnome" != xno; then
        fi
 fi
 
-test x"$enable_absolute_paths" = x"yes" && NM_PLUGIN_DIR='$(libdir)/NetworkManager/'
+PKG_CHECK_MODULES(LIBNM, libnm >= 1.2.0)
+LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_2"
+LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_2"
+
+NM_VPN_SERVICE_DIR=`$PKG_CONFIG --define-variable prefix='\${prefix}' --variable vpnservicedir libnm`
+AC_SUBST(NM_VPN_SERVICE_DIR)
+
+NM_COMPILER_WARNINGS
+
+NM_PLUGIN_DIR="$libdir/NetworkManager"
 AC_SUBST(NM_PLUGIN_DIR)
+if test x"$enable_absolute_paths" == x"yes"; then
+       NM_PLUGIN_DIR_NAME_FILE="$NM_PLUGIN_DIR/"
+else
+       enable_absolute_paths=no
+       NM_PLUGIN_DIR_NAME_FILE=""
+fi
+AC_SUBST(NM_PLUGIN_DIR_NAME_FILE)
 
 dnl
 dnl Distribution version string
@@ -106,15 +137,6 @@ if ! test x"$ac_distver" = x""; then
   AC_DEFINE_UNQUOTED(DIST_VERSION, "$ac_distver", [Define the distribution version string])
 fi
 
-PKG_CHECK_MODULES(LIBNM, libnm >= 0.9.11)
-LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_2"
-LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_2"
-
-NM_VPN_SERVICE_DIR=`$PKG_CONFIG --define-variable prefix='\${prefix}' --variable vpnservicedir libnm`
-AC_SUBST(NM_VPN_SERVICE_DIR)
-
-NM_COMPILER_WARNINGS
-
 AC_CONFIG_FILES([
 Makefile
 src/Makefile
@@ -124,3 +146,10 @@ po/Makefile.in
 shared/Makefile
 ])
 AC_OUTPUT
+
+echo ""
+echo "Build configuration: "
+echo "  --with-gnome=$with_gnome"
+echo "  --with-libnm-glib=$with_libnm_glib"
+echo "  --enable-absolute-paths=$enable_absolute_paths"
+echo "  --enable-more-warnings=$set_more_warnings"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]