]> granicus.if.org Git - postgresql/blob - config/perl.m4
Fix typo in setrefs.c
[postgresql] / config / perl.m4
1 # config/perl.m4
2
3
4 # PGAC_PATH_PERL
5 # --------------
6 AC_DEFUN([PGAC_PATH_PERL],
7 [# Let the user override the search
8 if test -z "$PERL"; then
9   AC_PATH_PROG(PERL, perl)
10 fi
11
12 if test "$PERL"; then
13   pgac_perl_version=`$PERL -v 2>/dev/null | sed -n ['s/This is perl.*v[a-z ]*\([0-9]\.[0-9][0-9.]*\).*$/\1/p']`
14   AC_MSG_NOTICE([using perl $pgac_perl_version])
15   if echo "$pgac_perl_version" | sed ['s/[.a-z_]/ /g'] | \
16     $AWK '{ if ([$]1 = 5 && [$]2 >= 8) exit 1; else exit 0;}'
17   then
18     AC_MSG_WARN([
19 *** The installed version of Perl, $PERL, is too old to use with PostgreSQL.
20 *** Perl version 5.8 or later is required, but this is $pgac_perl_version.])
21     PERL=""
22   fi
23 fi
24
25 if test -z "$PERL"; then
26   AC_MSG_WARN([
27 *** Without Perl you will not be able to build PostgreSQL from Git.
28 *** You can obtain Perl from any CPAN mirror site.
29 *** (If you are using the official distribution of PostgreSQL then you do not
30 *** need to worry about this, because the Perl output is pre-generated.)])
31 fi
32 ])# PGAC_PATH_PERL
33
34
35 # PGAC_CHECK_PERL_CONFIG(NAME)
36 # ----------------------------
37 AC_DEFUN([PGAC_CHECK_PERL_CONFIG],
38 [AC_REQUIRE([PGAC_PATH_PERL])
39 AC_MSG_CHECKING([for Perl $1])
40 perl_$1=`$PERL -MConfig -e 'print $Config{$1}'`
41 test "$PORTNAME" = "win32" && perl_$1=`echo $perl_$1 | sed 's,\\\\,/,g'`
42 AC_SUBST(perl_$1)dnl
43 AC_MSG_RESULT([$perl_$1])])
44
45
46 # PGAC_CHECK_PERL_CONFIGS(NAMES)
47 # ------------------------------
48 AC_DEFUN([PGAC_CHECK_PERL_CONFIGS],
49 [m4_foreach([pgac_item], [$1], [PGAC_CHECK_PERL_CONFIG(pgac_item)])])
50
51
52 # PGAC_CHECK_PERL_EMBED_LDFLAGS
53 # -----------------------------
54 # We are after Embed's ldopts, but without the subset mentioned in
55 # Config's ccdlflags; and also without any -arch flags, which recent
56 # Apple releases put in unhelpfully.  (If you want a multiarch build
57 # you'd better be specifying it in more places than plperl's final link.)
58 AC_DEFUN([PGAC_CHECK_PERL_EMBED_LDFLAGS],
59 [AC_REQUIRE([PGAC_PATH_PERL])
60 AC_MSG_CHECKING(for flags to link embedded Perl)
61 if test "$PORTNAME" = "win32" ; then
62 perl_lib=`basename $perl_archlibexp/CORE/perl[[5-9]]*.lib .lib`
63 test -e "$perl_archlibexp/CORE/$perl_lib.lib" && perl_embed_ldflags="-L$perl_archlibexp/CORE -l$perl_lib"
64 else
65 pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts`
66 pgac_tmp2=`$PERL -MConfig -e 'print $Config{ccdlflags}'`
67 perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e "s%$pgac_tmp2%%" -e ["s/ -arch [-a-zA-Z0-9_]*//g"]`
68 fi
69 AC_SUBST(perl_embed_ldflags)dnl
70 if test -z "$perl_embed_ldflags" ; then
71         AC_MSG_RESULT(no)
72         AC_MSG_ERROR([could not determine flags for linking embedded Perl.
73 This probably means that ExtUtils::Embed or ExtUtils::MakeMaker is not
74 installed.])
75 else
76         AC_MSG_RESULT([$perl_embed_ldflags])
77 fi
78 ])# PGAC_CHECK_PERL_EMBED_LDFLAGS