1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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)
|