Pulled fix from branch_1_1
[freeradius.git] / src / modules / rlm_perl / configure.in
1 AC_PREREQ([2.53])
2 AC_INIT(rlm_perl.c)
3 AC_REVISION($Revision$)
4 AC_DEFUN(modname,[rlm_perl])
5
6 if test x$with_[]modname != xno; then
7
8         AC_PROG_CC
9         AC_PROG_CPP
10
11         dnl put configuration checks here.
12         dnl set $fail to what's missing, on fatal errors.
13         dnl use AC_MSG_WARN() on important messages.
14
15         AC_CHECK_PROG(PERL, perl, yes, no)
16         if test "$PERL" = "no"; then
17            fail=$fail" perl"
18         else
19           old_CFLAGS=$CFLAGS
20           CFLAGS="$CFLAGS `perl -MExtUtils::Embed -e ccopts`"
21
22           smart_try_dir=
23           FR_SMART_CHECK_INCLUDE(EXTERN.h)
24           if test "x$ac_cv_header_EXTERN_h" = "xyes"; then
25                 perl_cflags='`perl -MExtUtils::Embed -e ccopts`'
26           else
27                 fail="$fail EXTERN.h"
28                 targetname=
29           fi
30
31           FR_SMART_CHECK_INCLUDE(perl.h, [#include <EXTERN.h>])
32           if test "x$ac_cv_header_perl_h" = "xyes"; then
33                 perl_cflags='`perl -MExtUtils::Embed -e ccopts`'
34           else
35                 fail="$fail perl.h"
36                 targetname=
37           fi
38
39           old_LIBS="$LIBS"
40           LIBS="$old_LIBS `perl -MExtUtils::Embed -e ldopts`"
41           AC_TRY_LINK([extern char boot_DynaLoader();],
42                       [ boot_DynaLoader()],
43                       BROKEN=,
44                       BROKEN="yes")
45
46           if test "x$BROKEN" = "x"; then
47                 perl_ldflags='`perl -MExtUtils::Embed -e ldopts`'
48           else
49                 fail="$fail libperl.so"
50                 targetname=
51           fi
52
53           CFLAGS=$old_CFLAGS
54         fi
55         targetname=modname
56
57 else
58         targetname=
59         echo \*\*\* module modname is disabled.  # keep this!  Don't change!
60 fi
61
62 dnl  Don't change this section.
63 if test x"$fail" != x""; then
64         if test x"${enable_strict_dependencies}" = x"yes"; then
65                 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
66         else
67                 AC_MSG_WARN([silently not building ]modname[.])
68                 AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
69                 targetname=""
70                 perl_cflags=""
71                 perl_ldflags=""
72         fi
73 fi
74
75
76 AC_SUBST(perl_cflags)
77 AC_SUBST(perl_ldflags)
78
79 AC_CONFIG_HEADER(config.h)
80
81 AC_SUBST(targetname)
82 AC_OUTPUT(Makefile)