Reconfig for new acinclude stuff
[freeradius.git] / src / modules / rlm_eap / types / rlm_eap_tnc / configure
index a672a63..7d4fcf1 100755 (executable)
@@ -636,6 +636,9 @@ SHELL'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+with_eap_tnc_include_dir
+with_eap_tnc_lib_dir
+with_eap_tnc_dir
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1248,6 +1251,15 @@ if test -n "$ac_init_help"; then
 
   cat <<\_ACEOF
 
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-eap-tnc-include-dir=DIR
+                          Directory where the libtnc includes may be found
+  --with-eap-tnc-lib-dir=DIR
+                          Directory where the libtnc libraries may be found
+  --with-eap-tnc-dir=DIR  Base directory where libtnc is installed
+
 Some influential environment variables:
   CC          C compiler command
   CFLAGS      C compiler flags
@@ -1776,7 +1788,70 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 if test x$with_rlm_eap_tnc != xno; then
+               eap_tnc_include_dir=
+
+# Check whether --with-eap-tnc-include-dir was given.
+if test "${with_eap_tnc_include_dir+set}" = set; then :
+  withval=$with_eap_tnc_include_dir; case "$withval" in
+                   no)
+                       as_fn_error $? "Need eap-tnc-include-dir" "$LINENO" 5
+                   ;;
+                       yes)
+                   ;;
+                   *)
+                       eap_tnc_include_dir="$withval"
+                   ;;
+               esac
+fi
+
+
+               eap_tnc_lib_dir=
+
+# Check whether --with-eap-tnc-lib-dir was given.
+if test "${with_eap_tnc_lib_dir+set}" = set; then :
+  withval=$with_eap_tnc_lib_dir; case "$withval" in
+                   no)
+                       as_fn_error $? "Need eap-tnc-lib-dir" "$LINENO" 5
+                       ;;
+                   yes)
+                       ;;
+                   *)
+                       eap_tnc_lib_dir="$withval"
+                       ;;
+               esac
+fi
+
 
+
+# Check whether --with-eap-tnc-dir was given.
+if test "${with_eap_tnc_dir+set}" = set; then :
+  withval=$with_eap_tnc_dir; case "$withval" in
+                   no)
+                       as_fn_error $? "Need eap-tnc-dir" "$LINENO" 5
+                       ;;
+                   yes)
+                       ;;
+                   *)
+                       eap_tnc_lib_dir="$withval/lib"
+                       eap_tnc_include_dir="$withval/include"
+                       ;;
+               esac
+fi
+
+
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL support" >&5
+$as_echo_n "checking for OpenSSL support... " >&6; }
+       if test "x$OPENSSL_LIBS" != "x"; then
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       else
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+               fail="OpenSSL"
+       fi
+
+                               smart_try_dir="$eap_tnc_include_dir"
        ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2567,61 +2642,331 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exchangeTNCCSMessages in -lTNCS" >&5
-$as_echo_n "checking for exchangeTNCCSMessages in -lTNCS... " >&6; }
-if ${ac_cv_lib_TNCS_exchangeTNCCSMessages+:} false; then :
-  $as_echo_n "(cached) " >&6
+
+
+ac_safe=`echo "libtnc.h" | sed 'y%./+-%__pm%'`
+old_CFLAGS="$CFLAGS"
+smart_include=
+smart_include_dir=
+
+if test "x$smart_try_dir" != "x"; then
+  for try in $smart_try_dir; do
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtnc.h in $try" >&5
+$as_echo_n "checking for libtnc.h in $try... " >&6; }
+    CFLAGS="$old_CFLAGS -I$try"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                   #include <libtnc.h>
+int
+main ()
+{
+int a = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+                    smart_include="-I$try"
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                    break
+
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lTNCS  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+                    smart_include=
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+  CFLAGS="$old_CFLAGS"
+fi
+
+if test "x$smart_include" = "x"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtnc.h" >&5
+$as_echo_n "checking for libtnc.h... " >&6; }
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char exchangeTNCCSMessages ();
+                 #include <libtnc.h>
+int
+main ()
+{
+int a = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+                  smart_include=" "
+                  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                  break
+
+else
+
+                  smart_include=
+                  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+if test "x$smart_include" = "x"; then
+
+
+if test "x$LOCATE" != "x"; then
+        DIRS=
+  file=libtnc.h
+
+  for x in `${LOCATE} $file 2>/dev/null`; do
+                                        base=`echo $x | sed "s%/${file}%%"`
+    if test "x$x" = "x$base"; then
+      continue;
+    fi
+
+    dir=`${DIRNAME} $x 2>/dev/null`
+                exclude=`echo ${dir} | ${GREP} /home`
+    if test "x$exclude" != "x"; then
+      continue
+    fi
+
+                    already=`echo \$smart_include_dir ${DIRS} | ${GREP} ${dir}`
+    if test "x$already" = "x"; then
+      DIRS="$DIRS $dir"
+    fi
+  done
+fi
+
+eval "smart_include_dir=\"\$smart_include_dir $DIRS\""
+
+  for try in $smart_include_dir /usr/local/include /opt/include; do
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtnc.h in $try" >&5
+$as_echo_n "checking for libtnc.h in $try... " >&6; }
+    CFLAGS="$old_CFLAGS -I$try"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                   #include <libtnc.h>
+int
+main ()
+{
+int a = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+                    smart_include="-I$try"
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                    break
+
+else
+
+                    smart_include=
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+  CFLAGS="$old_CFLAGS"
+fi
+
+if test "x$smart_include" != "x"; then
+  eval "ac_cv_header_$ac_safe=yes"
+  CFLAGS="$old_CFLAGS $smart_include"
+  SMART_CFLAGS="$SMART_CFLAGS $smart_include"
+fi
+
+       if test "x$ac_cv_header_libtnc_h" != "xyes"; then
+               fail="$fail libtnc.h"
+       fi
+
+
+       LIBS="${OPENSSL_LIBS}"
+       smart_try_dir="$eap_tnc_lib_dir"
+
+
+sm_lib_safe=`echo "tnc" | sed 'y%./+-%__p_%'`
+sm_func_safe=`echo "exchangeTNCCSMessages" | sed 'y%./+-%__p_%'`
+
+old_LIBS="$LIBS"
+smart_lib=
+smart_lib_dir=
+
+if test "x$smart_try_dir" != "x"; then
+  for try in $smart_try_dir; do
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exchangeTNCCSMessages in -ltnc in $try" >&5
+$as_echo_n "checking for exchangeTNCCSMessages in -ltnc in $try... " >&6; }
+    LIBS="-L$try -ltnc $old_LIBS -Wl,-rpath,$try"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+extern char exchangeTNCCSMessages();
 int
 main ()
 {
-return exchangeTNCCSMessages ();
+exchangeTNCCSMessages()
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_TNCS_exchangeTNCCSMessages=yes
+
+                smart_lib="-L$try -ltnc -Wl,-rpath,$try"
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                break
+
 else
-  ac_cv_lib_TNCS_exchangeTNCCSMessages=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  done
+  LIBS="$old_LIBS"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_TNCS_exchangeTNCCSMessages" >&5
-$as_echo "$ac_cv_lib_TNCS_exchangeTNCCSMessages" >&6; }
-if test "x$ac_cv_lib_TNCS_exchangeTNCCSMessages" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBTNCS 1
+
+if test "x$smart_lib" = "x"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exchangeTNCCSMessages in -ltnc" >&5
+$as_echo_n "checking for exchangeTNCCSMessages in -ltnc... " >&6; }
+  LIBS="-ltnc $old_LIBS"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+extern char exchangeTNCCSMessages();
+int
+main ()
+{
+exchangeTNCCSMessages()
+  ;
+  return 0;
+}
 _ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
 
-  LIBS="-lTNCS $LIBS"
+               smart_lib="-ltnc"
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LIBS="$old_LIBS"
 fi
 
-       if test "x$ac_cv_lib_tncs_exchangetnccsmessages" != xyes; then
-               { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: the TNCS library isn't found!" >&5
-$as_echo "$as_me: WARNING: the TNCS library isn't found!" >&2;}
-               fail="$fail -lTNCS"
+if test "x$smart_lib" = "x"; then
+
+
+if test "x$LOCATE" != "x"; then
+        DIRS=
+  file=libtnc${libltdl_cv_shlibext}
+
+  for x in `${LOCATE} $file 2>/dev/null`; do
+                                        base=`echo $x | sed "s%/${file}%%"`
+    if test "x$x" = "x$base"; then
+      continue;
+    fi
+
+    dir=`${DIRNAME} $x 2>/dev/null`
+                exclude=`echo ${dir} | ${GREP} /home`
+    if test "x$exclude" != "x"; then
+      continue
+    fi
+
+                    already=`echo \$smart_lib_dir ${DIRS} | ${GREP} ${dir}`
+    if test "x$already" = "x"; then
+      DIRS="$DIRS $dir"
+    fi
+  done
+fi
+
+eval "smart_lib_dir=\"\$smart_lib_dir $DIRS\""
+
+
+
+if test "x$LOCATE" != "x"; then
+        DIRS=
+  file=libtnc.a
+
+  for x in `${LOCATE} $file 2>/dev/null`; do
+                                        base=`echo $x | sed "s%/${file}%%"`
+    if test "x$x" = "x$base"; then
+      continue;
+    fi
+
+    dir=`${DIRNAME} $x 2>/dev/null`
+                exclude=`echo ${dir} | ${GREP} /home`
+    if test "x$exclude" != "x"; then
+      continue
+    fi
+
+                    already=`echo \$smart_lib_dir ${DIRS} | ${GREP} ${dir}`
+    if test "x$already" = "x"; then
+      DIRS="$DIRS $dir"
+    fi
+  done
+fi
+
+eval "smart_lib_dir=\"\$smart_lib_dir $DIRS\""
+
+
+  for try in $smart_lib_dir /usr/local/lib /opt/lib; do
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exchangeTNCCSMessages in -ltnc in $try" >&5
+$as_echo_n "checking for exchangeTNCCSMessages in -ltnc in $try... " >&6; }
+    LIBS="-L$try -rpath$try -ltnc $old_LIBS -Wl,-rpath,$try"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+extern char exchangeTNCCSMessages();
+int
+main ()
+{
+exchangeTNCCSMessages()
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+                 smart_lib="-L$try -ltnc -Wl,-rpath,$try"
+                 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                 break
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  done
+  LIBS="$old_LIBS"
+fi
+
+if test "x$smart_lib" != "x"; then
+  eval "ac_cv_lib_${sm_lib_safe}_${sm_func_safe}=yes"
+  LIBS="$smart_lib $old_LIBS"
+  SMART_LIBS="$smart_lib $SMART_LIBS"
+fi
+
+       if test "x$ac_cv_lib_tnc_exchangetnccsmessages" != "xyes"; then
+               fail="$fail libtnc"
        fi
 
-       targetname=rlm_eap_tnc
+       targetname=rlm_eap_tnc     # keep this!  Don't change!
 else
-       targetname=
-       echo \*\*\* module rlm_eap_tnc is disabled.
+       targetname=            # keep this!  Don't change!
+       echo \*\*\* module rlm_eap_tnc is disabled.  # keep this!  Don't change!
 fi
 
 if test x"$fail" != x""; then
@@ -2636,10 +2981,13 @@ $as_echo "$as_me: WARNING: FAILURE: rlm_eap_tnc requires: $fail." >&2;};
        fi
 fi
 
+eap_tnc_cflags="${SMART_CFLAGS}"
+eap_tnc_ldflags="${SMART_LIBS}"
 
 
 
 
+  # keep this!  Don't change!
 
   unset ac_cv_env_LIBS_set
   unset ac_cv_env_LIBS_value
@@ -3801,4 +4149,4 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-
+  # keep this!  Don't change!