| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 
 | Description: Propagate CPPFLAGS, CCFLAGS and LDFLAGS for ipdiscover compilation
 ipdiscover is built during "configure" step (perl Makefile.PL). Makefile.PL
 ignores CC flags for this binary compilation. Bug reported upstream.
Bug: https://github.com/OCSInventory-NG/UnixAgent/issues/140
Forwarded: https://github.com/OCSInventory-NG/UnixAgent/issues/140
Author: Xavier Guimard <x.guimard@free.fr>
Reviewed-by: gregor herrmann <gregoa@debian.org>
Last-Update: 2023-01-29
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -86,8 +86,8 @@
 #Ugly hack to include ipdiscover binary compilation and install for Linux systems
 if ($^O =~ /^linux$/i && can_cc()) {
     my $cc=$Config::Config{cc};
-    my $ld=$Config::Config{ldflags};
-    my $cf=$Config::Config{ccflags};
+    my $ld="$Config::Config{ldflags} $ENV{LDFLAGS}";
+    my $cf="$Config::Config{ccflags} $ENV{CFLAGS} $ENV{CPPFLAGS}";
     my $op=$Config::Config{optimize};
     system("$cc $cf $ld $op resources/ipdiscover/ipdiscover.c -o ipdiscover");
     if (-f 'ipdiscover') {
 |