Code

libperl's ldopts include libaries and therefore should go in LIBS not LDFLAGS
authorJim Radford <radford@galvanix.com>
Wed, 7 Aug 2013 20:21:08 +0000 (13:21 -0700)
committerMarc Fournier <marc.fournier@camptocamp.com>
Fri, 6 Feb 2015 15:36:26 +0000 (16:36 +0100)
Without this configure fails compile its libperl test program because
-lperl comes before the test program on the compiler command line.

Conflicts:
src/Makefile.am

configure.in
src/Makefile.am

index c2d577478167b115841387501698d79d61555ae1..42028b7d9f1478130b11e1c3d5e25f7083e2418d 100644 (file)
@@ -3092,12 +3092,12 @@ if test "x$with_libperl" = "xyes" \
        && test -n "$perl_interpreter"
 then
   SAVE_CFLAGS="$CFLAGS"
-  SAVE_LDFLAGS="$LDFLAGS"
+  SAVE_LIBS="$LIBS"
 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
   PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
-  PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
+  PERL_LIBS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
   CFLAGS="$CFLAGS $PERL_CFLAGS"
-  LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
+  LIBS="$LIBS $PERL_LIBS"
 
   AC_CACHE_CHECK([for libperl],
     [c_cv_have_libperl],
@@ -3124,13 +3124,13 @@ dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string
   then
          AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
          AC_SUBST(PERL_CFLAGS)
-         AC_SUBST(PERL_LDFLAGS)
+         AC_SUBST(PERL_LIBS)
   else
          with_libperl="no"
   fi
 
   CFLAGS="$SAVE_CFLAGS"
-  LDFLAGS="$SAVE_LDFLAGS"
+  LIBS="$SAVE_LIBS"
 else if test -z "$perl_interpreter"; then
   with_libperl="no (no perl interpreter found)"
   c_cv_have_libperl="no"
@@ -3140,9 +3140,9 @@ AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
 if test "x$with_libperl" = "xyes"
 then
        SAVE_CFLAGS="$CFLAGS"
-       SAVE_LDFLAGS="$LDFLAGS"
+       SAVE_LIBS="$LIBS"
        CFLAGS="$CFLAGS $PERL_CFLAGS"
-       LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
+       LIBS="$LIBS $PERL_LIBS"
 
        AC_CACHE_CHECK([if perl supports ithreads],
                [c_cv_have_perl_ithreads],
@@ -3169,17 +3169,17 @@ then
        fi
 
        CFLAGS="$SAVE_CFLAGS"
-       LDFLAGS="$SAVE_LDFLAGS"
+       LIBS="$SAVE_LIBS"
 fi
 
 if test "x$with_libperl" = "xyes"
 then
        SAVE_CFLAGS="$CFLAGS"
-       SAVE_LDFLAGS="$LDFLAGS"
+       SAVE_LIBS="$LIBS"
        # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
        # (see issues #41 and #42)
        CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
-       LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
+       LIBS="$LIBS $PERL_LIBS"
 
        AC_CACHE_CHECK([for broken Perl_load_module()],
                [c_cv_have_broken_perl_load_module],
@@ -3203,7 +3203,7 @@ then
        )
 
        CFLAGS="$SAVE_CFLAGS"
-       LDFLAGS="$SAVE_LDFLAGS"
+       LIBS="$SAVE_LIBS"
 fi
 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
                test "x$c_cv_have_broken_perl_load_module" = "xyes")
@@ -3211,9 +3211,9 @@ AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
 if test "x$with_libperl" = "xyes"
 then
        SAVE_CFLAGS="$CFLAGS"
-       SAVE_LDFLAGS="$LDFLAGS"
+       SAVE_LIBS="$LIBS"
        CFLAGS="$CFLAGS $PERL_CFLAGS"
-       LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
+       LIBS="$LIBS $PERL_LIBS"
 
        AC_CHECK_MEMBER(
                [struct mgvtbl.svt_local],
@@ -3232,7 +3232,7 @@ then
        fi
 
        CFLAGS="$SAVE_CFLAGS"
-       LDFLAGS="$SAVE_LDFLAGS"
+       LIBS="$SAVE_LIBS"
 fi
 # }}}
 
index 0bec7ab7c83494056f093797d4342e78e0253dfe..23c3a3b0fabbb3dec7d6474c963e15d5a2e4d9b2 100644 (file)
@@ -891,6 +891,7 @@ perl_la_CFLAGS += -Wno-nonnull
 endif
 perl_la_LDFLAGS = -module -avoid-version \
                $(PERL_LDFLAGS)
+perl_la_LIBS = $(PERL_LIBS)
 collectd_LDADD += "-dlopen" perl.la
 collectd_DEPENDENCIES += perl.la
 endif