diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:49:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:49:46 +0000 |
commit | 50b37d4a27d3295a29afca2286f1a5a086142cec (patch) | |
tree | 9212f763934ee090ef72d823f559f52ce387f268 /src/modules/rlm_perl/configure.ac | |
parent | Initial commit. (diff) | |
download | freeradius-upstream/3.2.1+dfsg.tar.xz freeradius-upstream/3.2.1+dfsg.zip |
Adding upstream version 3.2.1+dfsg.upstream/3.2.1+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/modules/rlm_perl/configure.ac')
-rw-r--r-- | src/modules/rlm_perl/configure.ac | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/src/modules/rlm_perl/configure.ac b/src/modules/rlm_perl/configure.ac new file mode 100644 index 0000000..4f87ae7 --- /dev/null +++ b/src/modules/rlm_perl/configure.ac @@ -0,0 +1,125 @@ +AC_PREREQ([2.68]) +AC_INIT(rlm_perl.c) +AC_REVISION($Revision$) +FR_INIT_MODULE([rlm_perl], [support for embedded Perl functions]) + +if test x$with_[]modname != xno; then + AC_PROG_CC + AC_PROG_CPP + + dnl put configuration checks here. + dnl set $fail to what's missing, on fatal errors. + dnl use AC_MSG_WARN() on important messages. + + AX_WITH_PROG([PERL],[perl],[not-found],[${PATH}:/usr/bin:/usr/local/bin]) + if test "$PERL" = "not-found" -o ! -x "$PERL"; then + fail=$fail" perl" + else + old_CFLAGS="${CFLAGS}" + old_LIBS="${LIBS}" + + dnl ############################################################ + dnl # Call ExtUtils::Embed to get compiler flags + dnl ############################################################ + AC_MSG_NOTICE([Calling ExtUtils::Embed to get 'ccopts']) + mod_cflags=$($PERL -MExtUtils::Embed -e ccopts) + + AC_MSG_NOTICE([ExtUtil's ccopts were \"${mod_cflags}\"]) + + mod_cflags=[$(echo "$mod_cflags" | sed 's/-I[ ]*/-isystem /g' | sed 's/-arch [^ ]*//g;s/ / /g;s/^ *//;s/ *$//')] + + AC_MSG_NOTICE([Sanitized ccopts are \"${mod_cflags}\"]) + + CFLAGS="${mod_cflags} ${CFLAGS}" + + dnl ############################################################ + dnl # Call ExtUtils::Embed to get linker flags + dnl ############################################################ + AC_MSG_NOTICE([Calling ExtUtils::Embed to get 'ldflags']) + mod_ldflags=$($PERL -MExtUtils::Embed -e ldopts) + + AC_MSG_NOTICE([ExtUtil's ldopts were \"${mod_ldflags}\"]) + + mod_ldflags=[$(echo "$mod_ldflags" | sed 's/-arch [^ ]*//g;s/ / /g;s/^ *//;s/ *$//')] + + AC_MSG_NOTICE([Sanitized ldopts are \"${mod_ldflags}\"]) + + LIBS="${mod_ldflags} ${LIBS}" + + dnl ############################################################ + dnl # Check required headers are available + dnl ############################################################ + smart_try_dir= + FR_SMART_CHECK_INCLUDE(EXTERN.h) + if test "x$ac_cv_header_EXTERN_h" != "xyes"; then + fail="$fail EXTERN.h" + targetname= + fi + + FR_SMART_CHECK_INCLUDE(perl.h, [#include <EXTERN.h>]) + if test "x$ac_cv_header_perl_h" != "xyes"; then + fail="$fail EXTERN.h" + targetname= + fi + + dnl ############################################################ + dnl # Link test functions + dnl ############################################################ + AC_MSG_CHECKING([we can link to boot_DynaLoader]) + AC_TRY_LINK([], + [ + extern char boot_DynaLoader(); + boot_DynaLoader(); + ], + [LINKS="yes"], [LINKS="no"]) + + AC_MSG_RESULT($LINKS) + if test "x$LINKS" = "xno"; then + fail="$fail libperl.so" + targetname= + fi + + AC_MSG_CHECKING([we can link to Perl_hv_store()]) + AC_TRY_LINK([], + [ + extern char Perl_hv_store(); + Perl_hv_store(); + ], + [LINKS="yes"], [LINKS="no"]) + + AC_MSG_RESULT($LINKS) + if test "x$LINKS" = "xno"; then + fail="$fail libperl.so" + targetname= + fi + + CFLAGS="$old_CFLAGS" + LIBS="$old_LIBS" + + targetname=modname + fi +else + targetname= + echo \*\*\* module modname is disabled. +fi + +dnl Don't change this section. +if test x"$fail" != x""; then + if test x"${enable_strict_dependencies}" = x"yes"; then + AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.]) + else + AC_MSG_WARN([silently not building ]modname[.]) + AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); + + targetname= + fi +fi + + +AC_SUBST(mod_cflags) +AC_SUBST(mod_ldflags) + +AC_CONFIG_HEADER(config.h) + +AC_SUBST(targetname) +AC_OUTPUT(all.mk) |