Support EAP-TLS in Moonshot (requires OpenSSL)
[mech_eap.orig] / acinclude.m4
index ea542db..401ad2a 100644 (file)
@@ -25,16 +25,18 @@ for dir in $check_krb5_dir $prefix /usr /usr/local ; do
         KRB5_CFLAGS=-I"$check_krb5_dir/include";
         KRB5_LIBS="-L$check_krb5_dir/lib/ -lkrb5_32 -lgssapi32";
         COMPILE_ET="$check_krb5_dir/bin/compile_et";
+       AC_MSG_RESULT([yes])
      else
         KRB5_CFLAGS=`$dir/bin/krb5-config gssapi --cflags`;
-        KRB5_LIBS=`$dir/bin/krb5-config gssapi --libs`;
-        COMPILE_ET="$dir/bin/compile_et";
+        KRB5_LIBS=`$dir/bin/krb5-config gssapi --libs`
+AC_MSG_RESULT([yes])
+        AC_PATH_PROG(COMPILE_ET, [compile_et], [compile_et], [$dir/bin$PATH_SEPARATOr])
      fi
      break;
    fi
 done
-AC_MSG_RESULT($found_krb5)
 if test x_$found_krb5 != x_yes; then
+   AC_MSG_RESULT($found_krb5)
    AC_MSG_ERROR([
 ----------------------------------------------------------------------
   Cannot find GSS-API/Kerberos libraries.
@@ -113,7 +115,7 @@ else
 -DEAP_SERVER_GPSK \
 -DEAP_SERVER_GPSK_SHA256 \
 -DIEEE8021X_EAPOL";
-       EAP_LIBS="-leap -lutils -lcrypto -ltls";
+       EAP_LIBS="-leap -lutils -lcrypto -ltls -lssl";
        EAP_LDFLAGS="-L$eapdir/eap_example -L$eapdir/src/utils -L$eapdir/src/crypto -L$eapdir/src/tls";
        AC_SUBST(EAP_CFLAGS)
        AC_SUBST(EAP_LDFLAGS)
@@ -247,6 +249,44 @@ fi
 fi
 ])dnl
 
+AC_DEFUN([AX_CHECK_OPENSSL],
+[AC_MSG_CHECKING(for OpenSSL)
+OPENSSL_DIR=
+found_openssl="no"
+AC_ARG_WITH(openssl,
+    AC_HELP_STRING([--with-openssl],
+       [Use OpenSSL (in specified installation directory)]),
+    [check_openssl_dir="$withval"],
+    [check_openssl_dir=])
+for dir in $check_openssl_dir $prefix /usr /usr/local ; do
+   openssldir="$dir"
+   if test -f "$dir/include/openssl/opensslv.h"; then
+     found_openssl="yes";
+     OPENSSL_DIR="${openssldir}"
+     OPENSSL_CFLAGS="-I$openssldir/include";
+     break;
+   fi
+done
+AC_MSG_RESULT($found_openssl)
+if test x_$found_openssl != x_yes; then
+   AC_MSG_ERROR([
+----------------------------------------------------------------------
+  Cannot find OpenSSL libraries.
+
+  Please install libssl or specify installation directory with
+  --with-openssl=(dir).
+----------------------------------------------------------------------
+])
+else
+       printf "OpenSSL found in $openssldir\n";
+       OPENSSL_LIBS="-lssl -lcrypto";
+       OPENSSL_LDFLAGS="-L$openssldir/lib";
+       AC_SUBST(OPENSSL_CFLAGS)
+       AC_SUBST(OPENSSL_LDFLAGS)
+       AC_SUBST(OPENSSL_LIBS)
+fi
+])dnl
+
 AC_DEFUN([AX_CHECK_RADSEC],
 [AC_MSG_CHECKING(for radsec)
 RADSEC_DIR=
@@ -326,13 +366,16 @@ fi
 AC_DEFUN([AX_CHECK_LIBMOONSHOT],
 [AC_MSG_CHECKING(for Moonshot identity selector implementation)
 LIBMOONSHOT_DIR=
+LIBMOONSHOT_CFLAGS=
+LIBMOONSHOT_LDFLAGS=
+LIBMOONSHOT_LIBS=
 found_libmoonshot="no"
 AC_ARG_WITH(libmoonshot,
     AC_HELP_STRING([--with-libmoonshot],
        [Use libmoonshot (in specified installation directory)]),
     [check_libmoonshot_dir="$withval"],
     [check_libmoonshot_dir=])
-for dir in $check_libmoonshot_dir $prefix /usr /usr/local ../../moonshot-ui/libmoonshot ; do
+for dir in $check_libmoonshot_dir $prefix /usr /usr/local ; do
    libmoonshotdir="$dir"
    if test -f "$dir/include/libmoonshot.h"; then
      found_libmoonshot="yes";
@@ -342,23 +385,15 @@ for dir in $check_libmoonshot_dir $prefix /usr /usr/local ../../moonshot-ui/libm
    fi
 done
 AC_MSG_RESULT($found_libmoonshot)
-if test x_$found_libmoonshot != x_yes; then
-   AC_MSG_ERROR([
-----------------------------------------------------------------------
-  Cannot find Moonshot identity selector libraries.
-
-  Please install wpa_supplicant or specify installation directory with
-  --with-libmoonshot=(dir).
-----------------------------------------------------------------------
-])
-else
-       printf "libmoonshot found in $libmoonshotdir\n";
-       LIBMOONSHOT_LIBS="-lmoonshot";
-       LIBMOONSHOT_LDFLAGS="-L$libmoonshot/lib";
-       AC_SUBST(LIBMOONSHOT_CFLAGS)
-       AC_SUBST(LIBMOONSHOT_LDFLAGS)
-       AC_SUBST(LIBMOONSHOT_LIBS)
-       AC_CHECK_LIB(moonshot, moonshot_get_identity, [AC_DEFINE_UNQUOTED([HAVE_MOONSHOT_GET_IDENTITY], 1, [Define if Moonshot identity selector is available])], [], "$LIBMOONSHOT_LIBS")
+if test x_$found_libmoonshot = x_yes; then
+    printf "libmoonshot found in $libmoonshotdir\n";
+    LIBMOONSHOT_LIBS="-lmoonshot";
+    LIBMOONSHOT_LDFLAGS="-L$libmoonshot/lib";
+    AC_CHECK_LIB(moonshot, moonshot_get_identity, [AC_DEFINE_UNQUOTED([HAVE_MOONSHOT_GET_IDENTITY], 1, [Define if Moonshot identity selector is available])], [], "$LIBMOONSHOT_LIBS")
 fi
+    AC_SUBST(LIBMOONSHOT_CFLAGS)
+    AC_SUBST(LIBMOONSHOT_LDFLAGS)
+    AC_SUBST(LIBMOONSHOT_LIBS)
+    AM_CONDITIONAL(LIBMOONSHOT, test "x$found_libmoonshot" != "xno")
 ])dnl