--- configure	2018-07-31 14:02:19.000000000 -0400
+++ configure.after	2019-11-12 21:07:10.000000000 -0500
@@ -6,11 +6,11 @@
 my $prefix      = "/usr/local";
 my $package     = "eboard";
 my $version     = "1.1.3";
-my $cxx         = "g++";
-my @cxxflags    = ("-O6");
+my $cxx         = "$ENV{CXX}";
 my @cxxflagsdbg = ("-ggdb");
-my @ldflags     = ("-lpthread -ldl");
-my @libs        = ();
+my @cxxflags    = map { split } join(" ",$ENV{CXXFLAGS}," ",$ENV{CPPFLAGS});
+my @ldflags     = map { split } join($ENV{LDFLAGS});
+my @libs        = ("-lpthread -ldl");
 my $configh     = "config.h";
 my $configmake  = "config.make";
 my $nls         = 1;
@@ -643,9 +643,8 @@
 chomp($x);
 @x = split(/ /,$x);
 for(@x) {
-    push @ldflags, $_;
-}
-push @ldflags, @libs;
+    push @libs, $_;
+ }
 
 if (!header_check("gtk/gtk.h","gdk/gdkkeysyms.h"))
 {
@@ -701,6 +700,7 @@
 print CONFIGMAKE "CXXFLAGS      = @cxxflags\n";
 print CONFIGMAKE "CXXFLAGS_DBG  = @cxxflagsdbg\n";
 print CONFIGMAKE "LDFLAGS       = @ldflags\n";
+print CONFIGMAKE "LIBS          = @libs\n";
 
 print CONFIGMAKE "prefix    = \${DESTDIR}$prefix\n";
 print CONFIGMAKE "bindir    = \${DESTDIR}$prefix/bin\n";
