[network-manager-sstp] Making the configure script detect if mppe_keys_xyz functions are declared.



commit 53c4c71000e0e9cfe19c8c528d9221353f564a01
Author: Eivind Næss <eivnaes yahoo com>
Date:   Wed Jun 16 16:50:24 2021 -0700

    Making the configure script detect if mppe_keys_xyz functions are declared.

 configure.ac            | 19 ++++++++++++++++---
 src/nm-sstp-pppd-mppe.c |  4 ++--
 src/nm-sstp-pppd-mppe.h |  4 ++--
 3 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index bb64480..9e1859d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,9 +54,22 @@ AC_CHECK_HEADERS(pppd/pppd.h,,
     [AC_MSG_ERROR([pppd.h missing, Hint: apt-get install ppp-dev])])
 
 #
-# More recent versions will have mppe.h defined
-AC_CHECK_HEADER(pppd/mppe.h,
-    [AC_DEFINE(HAVE_MPPE_H, 1, [Define if PPP is of recent version])])
+# Check if the version of mppe.h define mppe_keys_xxx() functions, 2.4.9 does not; but 2.4.10 will.
+AC_CACHE_CHECK([if pppd/mppe.h defines mppe_keys_xyz() functions], ac_cv_working_mppe_h,
+[AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM([[
+        @%:@define MPPE 1
+        @%:@include <pppd/pppd.h>
+        @%:@include <pppd/chap_ms.h>
+        @%:@include <pppd/mppe.h>]],
+        [[if (mppe_keys_isset())
+            return 0;]])],
+    [ac_cv_working_mppe_h=yes],
+    [ac_cv_working_mppe_h=no])])
+if test $ac_cv_working_mppe_h = yes; then
+    AC_DEFINE(HAVE_MPPE_KEYS_FUNCTIONS, 1,
+        [Define to 1 if you have <pppd/mppe.h> and it declares the mppe_keys_xyz() functions])
+fi
 
 #
 # Versions >= 2.4.9 will have support for the auth notify callback
diff --git a/src/nm-sstp-pppd-mppe.c b/src/nm-sstp-pppd-mppe.c
index e0aa189..297d46e 100644
--- a/src/nm-sstp-pppd-mppe.c
+++ b/src/nm-sstp-pppd-mppe.c
@@ -25,7 +25,7 @@
 #include <pppd/pppd.h>
 #include "nm-sstp-pppd-mppe.h"
 
-#ifndef HAVE_MPPE_H
+#ifndef HAVE_MPPE_KEYS_FUNCTIONS
 #define MPPE_MAX_KEY_SIZE 16
 extern u_char mppe_send_key[MPPE_MAX_KEY_SIZE];
 extern u_char mppe_recv_key[MPPE_MAX_KEY_SIZE];
@@ -67,4 +67,4 @@ bool mppe_keys_isset(void)
     return !!mppe_keys_set;
 }
 
-#endif
+#endif  // #ifdef HAVE_MPPE_KEYS_FUNCTIONS
diff --git a/src/nm-sstp-pppd-mppe.h b/src/nm-sstp-pppd-mppe.h
index d913fd3..312cdbc 100644
--- a/src/nm-sstp-pppd-mppe.h
+++ b/src/nm-sstp-pppd-mppe.h
@@ -24,7 +24,7 @@
 #define __SSTP_MPPE_H__
 
 
-#ifdef HAVE_MPPE_H
+#ifdef HAVE_MPPE_KEYS_FUNCTIONS
 #define MPPE 1
 #include <pppd/chap_ms.h>
 #include <pppd/mppe.h>
@@ -45,5 +45,5 @@ int mppe_get_send_key(unsigned char *send_key, int length);
  */
 bool mppe_keys_isset(void);
 
-#endif  // #ifdef HAVE_MPPE_H
+#endif  // #ifdef HAVE_MPPE_KEYS_FUNCTIONS
 #endif  // #ifdef __SSTP_MPPE_H__


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