diff --git a/src/modules/Perl/configure.in b/src/modules/Perl/configure.in
index 0bf5621187588dc1d3e11d741699d95173ce2815..1c2adecfa8e2548c00519fd3b7d666fbe30105e4 100644
--- a/src/modules/Perl/configure.in
+++ b/src/modules/Perl/configure.in
@@ -1,15 +1,15 @@
-# $Id: configure.in,v 1.4 1999/01/01 01:03:31 hubbe Exp $
+# $Id: configure.in,v 1.5 1999/01/07 13:39:27 hubbe Exp $
 AC_INIT(perlmod.c)
 AC_CONFIG_HEADER(perl_machine.h)
 
 AC_MODULE_INIT()
 
+AC_CHECK_PROGS(perl, perl perl5, x)
+
 AC_CACHE_VAL(pike_cv_perlmod_have_perl,
 [
 pike_cv_perlmod_have_perl=no
 
-AC_CHECK_PROGS(perl, perl perl5, x)
-
 objs=
 
 if test x$perl != xx ; then
@@ -58,6 +58,10 @@ fi
 
 if test "x$pike_cv_perlmod_have_perl" = xyes ; then
   extra_objs='perlxsi.o'
+  if test "x$PERL_CCFLAGS" = x ; then
+    PERL_LDFLAGS=`perl -MExtUtils::Embed -e ldopts`
+    PERL_CCFLAGS=`perl -MExtUtils::Embed -e ccopts`
+  fi
   AC_DEFINE(HAVE_PERL)
   AC_MSG_RESULT(yes)
 else