[network-manager-openconnect: 9/15] build: cleanup configure.ac



commit 2eabd82b7143b332f3598ee7f7f6100db302ef5a
Author: Thomas Haller <thaller redhat com>
Date:   Tue Jun 14 23:08:07 2016 +0200

    build: cleanup configure.ac
    
    Modify configure.ac to be more like for other VPN plugins.
    
    - print options after ./configure
    - better handle invalid/conflicting options

 Makefile.am  |    4 +-
 configure.ac |   99 +++++++++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 76 insertions(+), 27 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 2fbcf84..ca4a6c4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,7 +23,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-openconnect-service.name.in \
            >$(DESTDIR)$(sysconfdir)/NetworkManager/VPN/nm-openconnect-service.name
 
@@ -38,7 +38,7 @@ appdata_in_files = appdata/network-manager-openconnect.metainfo.xml.in
 
 nm-openconnect-service.name: $(srcdir)/nm-openconnect-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 ff1b897..2f55537 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,19 +39,38 @@ AC_PROG_GCC_TRADITIONAL
 AC_FUNC_MEMCMP
 AC_CHECK_FUNCS(select socket uname)
 
+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"
+fi
+AC_SUBST([ACLOCAL_AMFLAGS])
+
 dnl
 dnl GNOME support
 dnl
-AC_ARG_WITH(gnome, AS_HELP_STRING([--without-gnome], [Build NetworkManager-openconnect without GNOME 
support, e.g. vpn service only]))
-AM_CONDITIONAL(WITH_GNOME, test x"$with_gnome" != xno)
+AC_ARG_WITH(gnome, AS_HELP_STRING([--without-gnome], [Build NetworkManager-openconnect 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-openconnect 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_WITH(libnm-glib, AS_HELP_STRING([--without-libnm-glib], [Build NetworkManager-openconnect 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)]))
 
-AC_ARG_WITH(authdlg, AS_HELP_STRING([--without-authdlg], [Build NetworkManager-openconnect without 
authentication dialog]))
-AM_CONDITIONAL(WITH_AUTHDLG, test x"$with_authdlg" != xno)
-
 GETTEXT_PACKAGE=NetworkManager-openconnect
 AC_SUBST(GETTEXT_PACKAGE)
 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
@@ -74,21 +93,52 @@ if test x"$with_gnome" != xno; then
                LIBSECRET_CFLAGS="$LIBSECRET_CFLAGS -DSECRET_API_SUBJECT_TO_CHANGE"
        ])
 
-       if test x"$with_authdlg" != xno; then
-               PKG_CHECK_MODULES(OPENCONNECT, openconnect >= 3.02)
-       fi
-
        if test x"$with_libnm_glib" != xno; then
                PKG_CHECK_MODULES(LIBNM_GLIB,
-                                 NetworkManager >= 1.3.0
-                                 libnm-util >= 1.3.0
-                                 libnm-glib  >= 1.3.0
-                                 libnm-glib-vpn >= 1.3.0)
+                       NetworkManager >= 1.3.0
+                       libnm-util >= 1.3.0
+                       libnm-glib >= 1.3.0
+                       libnm-glib-vpn >= 1.3.0);
+
+               LIBNM_GLIB_CFLAGS="$LIBNM_GLIB_CFLAGS -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_4"
+               LIBNM_GLIB_CFLAGS="$LIBNM_GLIB_CFLAGS -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_4"
        fi
 fi
 
-test x"$enable_absolute_paths" = x"yes" && NM_PLUGIN_DIR='$(libdir)/NetworkManager/'
+PKG_CHECK_MODULES(LIBNM, libnm >= 1.3.0)
+LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_4"
+LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_4"
+
+AC_ARG_WITH(authdlg, AS_HELP_STRING([--without-authdlg], [Build NetworkManager-openconnect without 
authentication dialog]), [], [with_authdlg_specified=no])
+if test x"$with_authdlg_specified" == xno; then
+       with_authdlg="$with_gnome"
+else
+       if test x"$with_authdlg" != xno; then
+               if test x"$with_gnome" == xno; then
+                       AC_MSG_ERROR(Building --with-authdlg requires --with-gnome)
+               fi
+               with_authdlg=yes
+       fi
+fi
+if test x"$with_authdlg" != xno; then
+       PKG_CHECK_MODULES(OPENCONNECT, openconnect >= 3.02)
+fi
+AM_CONDITIONAL(WITH_AUTHDLG, test x"$with_authdlg" != xno)
+
+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
@@ -98,15 +148,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 >= 1.3.0)
-LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_4"
-LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_4"
-
-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
@@ -116,3 +157,11 @@ po/Makefile.in
 shared/Makefile
 ])
 AC_OUTPUT
+
+echo ""
+echo "Build configuration: "
+echo "  --with-gnome=$with_gnome"
+echo "  --with-libnm-glib=$with_libnm_glib"
+echo "  --with-authdlg=$with_authdlg"
+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]