Make rlm_perl configure script more verbose
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 22 Feb 2013 04:45:01 +0000 (23:45 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 22 Feb 2013 04:45:01 +0000 (23:45 -0500)
src/modules/rlm_perl/configure
src/modules/rlm_perl/configure.in

index 8523b77..6b3cd63 100755 (executable)
@@ -1864,7 +1864,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 if test x$with_rlm_perl != xno; then
-
        ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2929,18 +2928,40 @@ fi
 
 
        if test "$PERL" = "not-found" -o ! -x "$PERL"; then
-           fail=$fail" perl"
+               fail=$fail" perl"
        else
-         old_CFLAGS="$CFLAGS"
+               old_CFLAGS="${CFLAGS}"
+               old_LIBS="${LIBS}"
+
+                                                               { $as_echo "$as_me:${as_lineno-$LINENO}: Calling ExtUtils::Embed to get 'ccopts'" >&5
+$as_echo "$as_me: Calling ExtUtils::Embed to get 'ccopts'" >&6;}
+               perl_cflags=$($PERL -MExtUtils::Embed -e ccopts)
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: ExtUtil's ccopts were \"${perl_cflags}\"" >&5
+$as_echo "$as_me: ExtUtil's ccopts were \"${perl_cflags}\"" >&6;}
+
+               perl_cflags=$(echo "$perl_cflags" | sed 's/-arch [^ ]*//g;s/  / /g;s/^ *//;s/ *$//')
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: Sanitized ccopts are \"${perl_cflags}\"" >&5
+$as_echo "$as_me: Sanitized ccopts are \"${perl_cflags}\"" >&6;}
+
+               CFLAGS="${perl_cflags} ${CFLAGS}"
 
-         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl ccopts" >&5
-$as_echo_n "checking for Perl ccopts... " >&6; }
-         perl_cflags=$($PERL -MExtUtils::Embed -e ccopts | sed 's/-arch [^ ]*[ ]*//g')
-          CFLAGS+=" $perl_cflags"
-          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_cflags" >&5
-$as_echo "$perl_cflags" >&6; }
+                                                               { $as_echo "$as_me:${as_lineno-$LINENO}: Calling ExtUtils::Embed to get 'ldflags'" >&5
+$as_echo "$as_me: Calling ExtUtils::Embed to get 'ldflags'" >&6;}
+               perl_ldflags=$($PERL -MExtUtils::Embed -e ldopts)
 
-         smart_try_dir=
+               { $as_echo "$as_me:${as_lineno-$LINENO}: ExtUtil's ldopts were \"${perl_ldflags}\"" >&5
+$as_echo "$as_me: ExtUtil's ldopts were \"${perl_ldflags}\"" >&6;}
+
+               perl_ldflags=$(echo "$perl_ldflags" | sed 's/-arch [^ ]*//g;s/  / /g;s/^ *//;s/ *$//')
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: Sanitized ldopts are \"${perl_ldflags}\"" >&5
+$as_echo "$as_me: Sanitized ldopts are \"${perl_ldflags}\"" >&6;}
+
+               LIBS="${perl_ldflags} ${LIBS}"
+
+                                                               smart_try_dir=
 
 
 
@@ -3068,10 +3089,10 @@ else
 $as_echo "no" >&6; }
 fi
 
-         if test "x$ac_cv_header_EXTERN_h" != "xyes"; then
-               fail="$fail EXTERN.h"
-               targetname=
-         fi
+               if test "x$ac_cv_header_EXTERN_h" != "xyes"; then
+                       fail="$fail EXTERN.h"
+                       targetname=
+               fi
 
 
 
@@ -3199,76 +3220,81 @@ else
 $as_echo "no" >&6; }
 fi
 
-         if test "x$ac_cv_header_perl_h" != "xyes"; then
-               fail="$fail EXTERN.h"
-               targetname=
-         fi
-
-         old_LIBS="$LIBS"
-
-         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl ldopts" >&5
-$as_echo_n "checking for Perl ldopts... " >&6; }
-         perl_ldflags=$($PERL -MExtUtils::Embed -e ldopts | sed 's/-arch [^ ]*[ ]*//g')
-         LIBS+=" $perl_ldflags"
-          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_ldflags" >&5
-$as_echo "$perl_ldflags" >&6; }
+               if test "x$ac_cv_header_perl_h" != "xyes"; then
+                       fail="$fail EXTERN.h"
+                       targetname=
+               fi
 
-         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+                                                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking we can link to boot_DynaLoader" >&5
+$as_echo_n "checking we can link to boot_DynaLoader... " >&6; }
+               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-extern char boot_DynaLoader();
+
 int
 main ()
 {
- boot_DynaLoader()
+
+                       extern char boot_DynaLoader();
+                       boot_DynaLoader();
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  BROKEN=
+  LINKS="yes"
 else
-  BROKEN="yes"
+  LINKS="no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-         if test "x$BROKEN" != "x"; then
-               fail="$fail libperl.so"
-               targetname=
-          fi
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINKS" >&5
+$as_echo "$LINKS" >&6; }
+               if test "x$LINKS" == "xno"; then
+                       fail="$fail libperl.so"
+                       targetname=
+               fi
 
-         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+               { $as_echo "$as_me:${as_lineno-$LINENO}: checking we can link to Perl_hv_store()" >&5
+$as_echo_n "checking we can link to Perl_hv_store()... " >&6; }
+               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-extern char Perl_hv_store();
+
 int
 main ()
 {
- Perl_hv_store()
+
+                       extern char Perl_hv_store();
+                       Perl_hv_store();
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  BROKEN=
+  LINKS="yes"
 else
-  BROKEN="yes"
+  LINKS="no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-        if test "x$BROKEN" != "x"; then
-               fail="$fail libperl.so"
-               targetname=
-         fi
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINKS" >&5
+$as_echo "$LINKS" >&6; }
+               if test "x$LINKS" == "xno"; then
+                       fail="$fail libperl.so"
+                       targetname=
+               fi
 
-          CFLAGS=$old_CFLAGS
-          LIBS=$old_libs
-        fi
-       targetname=rlm_perl
+               CFLAGS="$old_CFLAGS"
+               LIBS="$old_LIBS"
 
+               targetname=rlm_perl
+       fi
 else
-       targetname=
-       echo \*\*\* module rlm_perl is disabled.  # keep this!  Don't change!
+               targetname=
+               echo \*\*\* module rlm_perl is disabled.  # keep this!  Don't change!
 fi
 
 if test x"$fail" != x""; then
index 2192ec2..11dce59 100644 (file)
@@ -6,7 +6,6 @@ AC_DEFUN(modname,[rlm_perl])
 m4_include([ax_with_prog.m4])
 
 if test x$with_[]modname != xno; then
-
        AC_PROG_CC
        AC_PROG_CPP
 
@@ -14,65 +13,96 @@ if test x$with_[]modname != xno; then
        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])
+       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"
+               fail=$fail" perl"
        else
-         old_CFLAGS="$CFLAGS"
-         
-         AC_MSG_CHECKING([for Perl ccopts])
-         perl_cflags=$($PERL -MExtUtils::Embed -e ccopts | sed ['s/-arch [^ ]*[ ]*//g'])
-          CFLAGS+=" $perl_cflags"
-          AC_MSG_RESULT([$perl_cflags])
-
-         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
-
-         old_LIBS="$LIBS"
-         
-         AC_MSG_CHECKING([for Perl ldopts])
-         perl_ldflags=$($PERL -MExtUtils::Embed -e ldopts | sed ['s/-arch [^ ]*[ ]*//g'])
-         LIBS+=" $perl_ldflags"
-          AC_MSG_RESULT([$perl_ldflags])
-         
-         AC_TRY_LINK([extern char boot_DynaLoader();],
-                     [ boot_DynaLoader()],
-                     BROKEN=,
-                     BROKEN="yes")
-
-         if test "x$BROKEN" != "x"; then
-               fail="$fail libperl.so"
-               targetname=
-          fi
-
-         AC_TRY_LINK([extern char Perl_hv_store();],
-                     [ Perl_hv_store()],
-                     BROKEN=,
-                     BROKEN="yes")
-
-        if test "x$BROKEN" != "x"; then
-               fail="$fail libperl.so"
-               targetname=
-         fi
-
-          CFLAGS=$old_CFLAGS
-          LIBS=$old_libs
-        fi
-       targetname=modname
-
+               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'])
+               perl_cflags=$($PERL -MExtUtils::Embed -e ccopts)
+               
+               AC_MSG_NOTICE([ExtUtil's ccopts were \"${perl_cflags}\"])
+               
+               perl_cflags=[$(echo "$perl_cflags" | sed 's/-arch [^ ]*//g;s/  / /g;s/^ *//;s/ *$//')]
+               
+               AC_MSG_NOTICE([Sanitized ccopts are \"${perl_cflags}\"])
+               
+               CFLAGS="${perl_cflags} ${CFLAGS}"
+               
+               dnl ############################################################
+               dnl #  Call ExtUtils::Embed to get linker flags
+               dnl ############################################################
+               AC_MSG_NOTICE([Calling ExtUtils::Embed to get 'ldflags'])
+               perl_ldflags=$($PERL -MExtUtils::Embed -e ldopts)
+               
+               AC_MSG_NOTICE([ExtUtil's ldopts were \"${perl_ldflags}\"])
+               
+               perl_ldflags=[$(echo "$perl_ldflags" | sed 's/-arch [^ ]*//g;s/  / /g;s/^ *//;s/ *$//')]
+               
+               AC_MSG_NOTICE([Sanitized ldopts are \"${perl_ldflags}\"])
+
+               LIBS="${perl_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.  # keep this!  Don't change!
+               targetname=
+               echo \*\*\* module modname is disabled.  # keep this!  Don't change!
 fi
 
 dnl  Don't change this section.