[libgit2-glib] configure: Add flag to force on or off SSH support



commit e5e6aaf195d464f325d71ae6a4639a8aa8ce0e17
Author: Rémi Cardona <remi gentoo org>
Date:   Tue Jan 20 08:12:41 2015 +0100

    configure: Add flag to force on or off SSH support
    
    Remove an automagic dependency on libgit2's SSH support.
    
    Signed-off-by: Rémi Cardona <remi gentoo org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=743236

 configure.ac |   64 ++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 38 insertions(+), 26 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5841887..5d4cd54 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,32 +79,44 @@ dnl ===========================================================================
 dnl Check for libgit2 ssh support
 dnl ===========================================================================
 
-AC_MSG_CHECKING([for libgit2 ssh support])
-
-cflags_save="${CFLAGS}"
-libs_save="${LIBS}"
-
-CFLAGS="${LIBGIT2_GLIB_CFLAGS}"
-LIBS="${LIBGIT2_GLIB_LIBS}"
-
-AC_TRY_RUN([
-        #include <git2.h>
-        int
-        main(int argc, const char *argv[])
-        {
-                git_libgit2_init ();
-                return ((git_libgit2_features() & GIT_FEATURE_SSH) != 0) ? 0 : 1;
-        }
-],[
-    AC_MSG_RESULT([yes])
-    git_ssh=yes
-],[
-    AC_MSG_RESULT([no])
-    git_ssh=no
-])
-
-CFLAGS="${cflags_save}"
-LIBS="${libs_save}"
+AC_ARG_ENABLE([ssh],
+              AS_HELP_STRING([--enable-ssh[=@<:@no/auto/yes@:>@]],[Build with libgit2 ssh support]),
+              [enable_ssh=$enableval],
+              [enable_ssh="auto"])
+
+git_ssh=no
+
+if test "x$enable_ssh" != "xno"; then
+    AC_MSG_CHECKING([for libgit2 ssh support])
+
+    cflags_save="${CFLAGS}"
+    libs_save="${LIBS}"
+
+    CFLAGS="${LIBGIT2_GLIB_CFLAGS}"
+    LIBS="${LIBGIT2_GLIB_LIBS}"
+
+    AC_TRY_RUN([
+            #include <git2.h>
+            int
+            main(int argc, const char *argv[])
+            {
+                    git_libgit2_init ();
+                    return ((git_libgit2_features() & GIT_FEATURE_SSH) != 0) ? 0 : 1;
+            }
+    ],[
+        AC_MSG_RESULT([yes])
+        git_ssh=yes
+    ],[
+        AC_MSG_RESULT([no])
+        git_ssh=no
+        if test "x$enable_ssh" = "xyes"; then
+            AC_MSG_ERROR([libgit2 ssh support was requiested, but not found])
+        fi
+    ])
+
+    CFLAGS="${cflags_save}"
+    LIBS="${libs_save}"
+fi
 
 if test "x$git_ssh" = "xyes"; then
        LIBGIT2_GLIB_CFLAGS="${LIBGIT2_GLIB_CFLAGS} -DGIT_SSH=1"


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