configure.ac: Actually check the CFLAGS and LDFLAGS returned by ExtUtils::Embed before deciding to compile the Perl plugin.

- openSUSE has ExtUtils::Embed, EXTERN.h and perl.so in the base perl package.
- Fedora has ExtUtils::Embed in a separate perl-devel package.
- Mageia has ExtUtils::Embed in the base perl package but EXTERN.h in a separate perl-devel package. Without this package, the compiler complains about the missing header.
- Debian has ExtUtils::Embed and EXTERN.h in the base perl package but perl.so in a separate libperl-dev package. Without this package, gcc compiles successfully but complains at link-time about -lperl (ExtUtils::Embed returns '-lperl' in ldopts but it's not actually installed).

configure.ac already requires ExtUtil::Embed to enable perl. To handle the case of Mageia and Debian, this change uses AC_TRY_LINK to verify that the flags returned by ExtUtils::Embed can actually be used to compile before deciding to enable the perl plugin.
This commit is contained in:
Arnavion 2014-01-13 18:27:32 -08:00
parent a87b61c73f
commit 599b9b0379
1 changed files with 19 additions and 12 deletions

View File

@ -228,15 +228,21 @@ if test "$perl" = yes; then
PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-lc //'` PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-lc //'`
AC_MSG_RESULT(ok) AC_MSG_RESULT(ok)
# oldLIBS=$LIBS
# LIBS="$LIBS $PERL_LDFLAGS"
# AC_CHECK_FUNC(eval_pv)
# AC_CHECK_FUNC(call_pv)
# LIBS=$oldLIBS
AC_MSG_CHECKING(for perl >= 5.8.0) AC_MSG_CHECKING(for perl >= 5.8.0)
PERL_VER=`$perlpath -e 'print $]>= 5.008?"yes":"no"'` PERL_VER=`$perlpath -e 'print $]>= 5.008?"yes":"no"'`
if test "$PERL_VER" = "yes"; then if test "$PERL_VER" = "yes"; then
original_cflags="$CFLAGS"
original_ldflags="$LDFLAGS"
CFLAGS="$PERL_CFLAGS"
LDFLAGS="$PERL_LDFLAGS"
AC_TRY_LINK([#include <EXTERN.h>
#include <perl.h>], [], perl_is_usable=yes, perl_is_usable=no)
CFLAGS="$original_cflags"
LDFLAGS="$original_ldflags"
if test x$perl_is_usable = xno ; then
AC_MSG_RESULT(no)
perl=no
else
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_MSG_CHECKING(if perl plugin will be backward compatible) AC_MSG_CHECKING(if perl plugin will be backward compatible)
if test "$perl_old" = "yes"; then if test "$perl_old" = "yes"; then
@ -245,6 +251,7 @@ if test "$perl" = yes; then
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi fi
fi
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
echo "perl version too old, building without perl." echo "perl version too old, building without perl."