Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1f3ed51

Browse files
committed
Add explicit configure-time checks for perl.h and libperl.so.
Although most platforms seem to package Perl in such a way that these files are present even in basic Perl installations, Debian does not. Hence, make an effort to fail during configure rather than build if --with-perl was given and these files are lacking. Per gripe from Josh Berkus.
1 parent 7fb97ec commit 1f3ed51

File tree

2 files changed

+149
-0
lines changed

2 files changed

+149
-0
lines changed

configure

+125
Original file line numberDiff line numberDiff line change
@@ -29124,6 +29124,131 @@ fi
2912429124
CPPFLAGS=$ac_save_CPPFLAGS
2912529125
fi
2912629126

29127+
# check for <perl.h>
29128+
if test "$with_perl" = yes; then
29129+
ac_save_CPPFLAGS=$CPPFLAGS
29130+
CPPFLAGS="-I$perl_archlibexp/CORE $CPPFLAGS"
29131+
{ $as_echo "$as_me:$LINENO: checking for perl.h" >&5
29132+
$as_echo_n "checking for perl.h... " >&6; }
29133+
if test "${ac_cv_header_perl_h+set}" = set; then
29134+
$as_echo_n "(cached) " >&6
29135+
else
29136+
cat >conftest.$ac_ext <<_ACEOF
29137+
/* confdefs.h. */
29138+
_ACEOF
29139+
cat confdefs.h >>conftest.$ac_ext
29140+
cat >>conftest.$ac_ext <<_ACEOF
29141+
/* end confdefs.h. */
29142+
#include <EXTERN.h>
29143+
29144+
#include <perl.h>
29145+
_ACEOF
29146+
rm -f conftest.$ac_objext
29147+
if { (ac_try="$ac_compile"
29148+
case "(($ac_try" in
29149+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29150+
*) ac_try_echo=$ac_try;;
29151+
esac
29152+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
29153+
$as_echo "$ac_try_echo") >&5
29154+
(eval "$ac_compile") 2>conftest.er1
29155+
ac_status=$?
29156+
grep -v '^ *+' conftest.er1 >conftest.err
29157+
rm -f conftest.er1
29158+
cat conftest.err >&5
29159+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
29160+
(exit $ac_status); } && {
29161+
test -z "$ac_c_werror_flag" ||
29162+
test ! -s conftest.err
29163+
} && test -s conftest.$ac_objext; then
29164+
ac_cv_header_perl_h=yes
29165+
else
29166+
$as_echo "$as_me: failed program was:" >&5
29167+
sed 's/^/| /' conftest.$ac_ext >&5
29168+
29169+
ac_cv_header_perl_h=no
29170+
fi
29171+
29172+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
29173+
fi
29174+
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_perl_h" >&5
29175+
$as_echo "$ac_cv_header_perl_h" >&6; }
29176+
if test "x$ac_cv_header_perl_h" = x""yes; then
29177+
:
29178+
else
29179+
{ { $as_echo "$as_me:$LINENO: error: header file <perl.h> is required for Perl" >&5
29180+
$as_echo "$as_me: error: header file <perl.h> is required for Perl" >&2;}
29181+
{ (exit 1); exit 1; }; }
29182+
fi
29183+
29184+
29185+
# While we're at it, check that we can link to libperl.
29186+
# On most platforms, if perl.h is there then libperl.so will be too, but at
29187+
# this writing Debian packages them separately. There is no known reason to
29188+
# waste cycles on separate probes for the Tcl or Python libraries, though.
29189+
pgac_save_LIBS=$LIBS
29190+
LIBS="$perl_embed_ldflags $LIBS"
29191+
{ $as_echo "$as_me:$LINENO: checking for libperl" >&5
29192+
$as_echo_n "checking for libperl... " >&6; }
29193+
cat >conftest.$ac_ext <<_ACEOF
29194+
/* confdefs.h. */
29195+
_ACEOF
29196+
cat confdefs.h >>conftest.$ac_ext
29197+
cat >>conftest.$ac_ext <<_ACEOF
29198+
/* end confdefs.h. */
29199+
29200+
#include <EXTERN.h>
29201+
#include <perl.h>
29202+
29203+
int
29204+
main ()
29205+
{
29206+
perl_alloc();
29207+
;
29208+
return 0;
29209+
}
29210+
_ACEOF
29211+
rm -f conftest.$ac_objext conftest$ac_exeext
29212+
if { (ac_try="$ac_link"
29213+
case "(($ac_try" in
29214+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29215+
*) ac_try_echo=$ac_try;;
29216+
esac
29217+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
29218+
$as_echo "$ac_try_echo") >&5
29219+
(eval "$ac_link") 2>conftest.er1
29220+
ac_status=$?
29221+
grep -v '^ *+' conftest.er1 >conftest.err
29222+
rm -f conftest.er1
29223+
cat conftest.err >&5
29224+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
29225+
(exit $ac_status); } && {
29226+
test -z "$ac_c_werror_flag" ||
29227+
test ! -s conftest.err
29228+
} && test -s conftest$ac_exeext && {
29229+
test "$cross_compiling" = yes ||
29230+
$as_test_x conftest$ac_exeext
29231+
}; then
29232+
{ $as_echo "$as_me:$LINENO: result: yes" >&5
29233+
$as_echo "yes" >&6; }
29234+
else
29235+
$as_echo "$as_me: failed program was:" >&5
29236+
sed 's/^/| /' conftest.$ac_ext >&5
29237+
29238+
{ $as_echo "$as_me:$LINENO: result: no" >&5
29239+
$as_echo "no" >&6; }
29240+
{ { $as_echo "$as_me:$LINENO: error: libperl library is required for Perl" >&5
29241+
$as_echo "$as_me: error: libperl library is required for Perl" >&2;}
29242+
{ (exit 1); exit 1; }; }
29243+
fi
29244+
29245+
rm -rf conftest.dSYM
29246+
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
29247+
conftest$ac_exeext conftest.$ac_ext
29248+
LIBS=$pgac_save_LIBS
29249+
CPPFLAGS=$ac_save_CPPFLAGS
29250+
fi
29251+
2912729252
# check for <Python.h>
2912829253
if test "$with_python" = yes; then
2912929254
ac_save_CPPFLAGS=$CPPFLAGS

configure.in

+24
Original file line numberDiff line numberDiff line change
@@ -1792,6 +1792,30 @@ if test "$with_tcl" = yes; then
17921792
CPPFLAGS=$ac_save_CPPFLAGS
17931793
fi
17941794

1795+
# check for <perl.h>
1796+
if test "$with_perl" = yes; then
1797+
ac_save_CPPFLAGS=$CPPFLAGS
1798+
CPPFLAGS="-I$perl_archlibexp/CORE $CPPFLAGS"
1799+
AC_CHECK_HEADER(perl.h, [], [AC_MSG_ERROR([header file <perl.h> is required for Perl])],
1800+
[#include <EXTERN.h>])
1801+
# While we're at it, check that we can link to libperl.
1802+
# On most platforms, if perl.h is there then libperl.so will be too, but at
1803+
# this writing Debian packages them separately. There is no known reason to
1804+
# waste cycles on separate probes for the Tcl or Python libraries, though.
1805+
pgac_save_LIBS=$LIBS
1806+
LIBS="$perl_embed_ldflags $LIBS"
1807+
AC_MSG_CHECKING([for libperl])
1808+
AC_TRY_LINK([
1809+
#include <EXTERN.h>
1810+
#include <perl.h>
1811+
], [perl_alloc();],
1812+
[AC_MSG_RESULT(yes)],
1813+
[AC_MSG_RESULT(no)
1814+
AC_MSG_ERROR([libperl library is required for Perl])])
1815+
LIBS=$pgac_save_LIBS
1816+
CPPFLAGS=$ac_save_CPPFLAGS
1817+
fi
1818+
17951819
# check for <Python.h>
17961820
if test "$with_python" = yes; then
17971821
ac_save_CPPFLAGS=$CPPFLAGS

0 commit comments

Comments
 (0)