Browse Source

Add autotools support for radcli

Baptiste Jonglez 7 years ago
parent
commit
3846d3ba96
1 changed files with 66 additions and 0 deletions
  1. 66 0
      configure.ac

+ 66 - 0
configure.ac

@@ -595,6 +595,57 @@ AC_SUBST(USE_LCOV)
 # sets variables CRYPTO_*
 AX_CRYPTO
 
+radcli_path="yes"
+AC_ARG_WITH([radcli],
+  AC_HELP_STRING([--with-radcli=PATH],
+    [specify exact directory of radcli library and headers]),
+    [radcli_path="$withval"])
+if test "${radcli_path}" = "yes" ; then
+# Try some common paths.
+    radclidirs="/usr /usr/local /usr/pkg /opt /opt/local"
+    for d in $radclidirs
+    do
+            if test -f $d/include/radcli/radcli.h; then
+                    RADCLI_CFLAGS="-I$d/include"
+                    RADCLI_LIBS="-L$d/lib -L$d/lib64"
+                    AC_MSG_RESULT([searching for radcli/radcli.h... found in $d])
+                    break
+            fi
+    done
+    if test "${RADCLI_CFLAGS}" = "" ; then
+        AC_MSG_RESULT([searching for radcli/radcli.h... not found])
+    fi
+elif test "${radcli_path}" != "no" ; then
+    RADCLI_CFLAGS="-I${radcli_path}/include"
+    RADCLI_LIBS="-L${radcli_path}/lib"
+else
+    AC_MSG_RESULT([searching for radcli/radcli.h... disabled])
+fi
+
+if test "${RADCLI_CFLAGS}" != "" ; then
+    RADCLI_LIBS="$RADCLI_LIBS -lradcli"
+    AC_SUBST(RADCLI_CFLAGS)
+    AC_SUBST(RADCLI_LIBS)
+
+    CPPFLAGS_SAVED=$CPPFLAGS
+    CPPFLAGS="$RADCLI_CFLAGS $CPPFLAGS"
+    LIBS_SAVED="$LIBS"
+    LIBS="$RADCLI_LIBS $LIBS"
+
+    AC_CHECK_HEADERS([radcli/radcli.h],,AC_MSG_ERROR([Missing required header files.]))
+    AC_LINK_IFELSE(
+            [AC_LANG_PROGRAM([#include <radcli/radcli.h>
+                             ],
+                             [rc_handle *rh;
+                              rh = rc_new();
+                             ])],
+            [AC_MSG_RESULT([checking for radcli library... yes])
+             AC_DEFINE([HAVE_RADCLI], 1, [radcli is present])],
+            [AC_MSG_RESULT([checking for radcli library... no])]
+    )
+fi
+AM_CONDITIONAL(HAVE_RADCLI, test "${RADCLI_CFLAGS}" != "")
+
 # Check for MySql.  The path to the mysql_config program is given with
 # the --with-mysql-config (default to /usr/bin/mysql-config).  By default,
 # the software is not built with MySQL support enabled.
@@ -1520,6 +1571,21 @@ Cassandra CQL:
 END
 fi
 
+if test "$RADCLI_CFLAGS" != "" ; then
+cat >> config.report << END
+
+Radius client:
+  RADCLI_CFLAGS:    ${RADCLI_CFLAGS}
+  RADCLI_LIBS:      ${RADCLI_LIBS}
+END
+else
+cat >> config.report << END
+
+Radius client:
+  no
+END
+fi
+
 if test "$enable_gtest" != "no"; then
 cat >> config.report << END