port 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           perl_ldflags='`perl -MExtUtils::Embed -e ldopts`'
40
41           CFLAGS=$old_CFLAGS
42         fi
43         targetname=modname
44
45 else
46         targetname=
47         echo \*\*\* module modname is disabled.  # keep this!  Don't change!
48 fi
49
50 dnl  Don't change this section.
51 if test x"$fail" != x""; then
52         if test x"${enable_strict_dependencies}" = x"yes"; then
53                 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
54         else
55                 AC_MSG_WARN([silently not building ]modname[.])
56                 AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
57                 targetname=""
58                 perl_cflags=""
59                 perl_ldflags=""
60         fi
61 fi
62
63
64 AC_SUBST(perl_cflags)
65 AC_SUBST(perl_ldflags)
66
67 AC_CONFIG_HEADER(config.h)
68
69 AC_SUBST(targetname)
70 AC_OUTPUT(Makefile)