Description: Reorder libraries when linking sp2sp, test_read & gwave to fix
 FTBFS with ld --as-needed
Forwarded: https://sourceforge.net/p/gwave/patches/_discuss/thread/171781db/b94b/attachment/fix_as-needed_linking.diff
Author: أحمد المحمودي (Ahmed El-Mahmoudy) <aelmahmoudy@users.sourceforge.net>
Author: Matthias Klose <doko@ubuntu.com>
Bug: https://sourceforge.net/p/gwave/patches/2/
Bug-Debian: http://bugs.debian.org/641725
Bug-Ubuntu: https://launchpad.net/bugs/770956
Last-Update: 2011-09-15

Index: gwave/spicefile/Makefile.am
===================================================================
--- gwave.orig/spicefile/Makefile.am	2019-04-01 04:29:10.077213849 +0200
+++ gwave/spicefile/Makefile.am	2019-04-01 04:29:10.073213832 +0200
@@ -10,11 +10,9 @@
 
 noinst_PROGRAMS = test_read
 test_read_SOURCES =  test_read.c
-test_read_LDFLAGS = @GTK_LIBS@
-test_read_LDADD = libspicefile.a
+test_read_LDADD = libspicefile.a @GTK_LIBS@
 
 bin_PROGRAMS=sp2sp
 sp2sp_SOURCES=sp2sp.c
-sp2sp_LDFLAGS= @GTK_LIBS@
-sp2sp_LDADD= libspicefile.a
+sp2sp_LDADD= libspicefile.a @GTK_LIBS@
 
Index: gwave/src/Makefile.in
===================================================================
--- gwave.orig/src/Makefile.in	2019-04-01 04:29:10.077213849 +0200
+++ gwave/src/Makefile.in	2019-04-01 04:31:59.369900681 +0200
@@ -113,7 +113,7 @@
 	GtkTable_indel.$(OBJEXT)
 gwave_OBJECTS = $(am_gwave_OBJECTS)
 gwave_DEPENDENCIES = ../spicefile/libspicefile.a
-gwave_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(gwave_LDFLAGS) \
+gwave_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -338,7 +338,7 @@
 	rgeval.c xgserver.c measurebtn.c measurebtn.h \
 	GtkTable_indel.c GtkTable_indel.h  xsnarf.h
 
-gwave_LDADD = ../spicefile/libspicefile.a @GTK_LIBS@ -lm
+gwave_LDADD = ../spicefile/libspicefile.a @GTK_LIBS@ @GUILE_LDFLAGS@ -lm
 gwave_LDFLAGS = @GUILE_LDFLAGS@
 AM_CFLAGS = @GTK_CFLAGS@ @GUILE_CFLAGS@ \
 	-DDATADIR=\"$(datadir)\" -DBINGWAVE=\"$(bindir)/gwave\"
Index: gwave/spicefile/Makefile.in
===================================================================
--- gwave.orig/spicefile/Makefile.in	2019-04-01 04:29:10.077213849 +0200
+++ gwave/spicefile/Makefile.in	2019-04-01 04:29:10.073213832 +0200
@@ -307,11 +307,9 @@
 libspicefile_a_SOURCES = spicestream.c ss_cazm.c ss_hspice.c ss_spice3.c ss_spice2.c ss_nsout.c spicestream.h wavefile.c wavefile.h spice2.h ssintern.h
 AM_CFLAGS = @GTK_CFLAGS@
 test_read_SOURCES = test_read.c
-test_read_LDFLAGS = @GTK_LIBS@
-test_read_LDADD = libspicefile.a
+test_read_LDADD = libspicefile.a @GTK_LIBS@
 sp2sp_SOURCES = sp2sp.c
-sp2sp_LDFLAGS = @GTK_LIBS@
-sp2sp_LDADD = libspicefile.a
+sp2sp_LDADD = @GTK_LIBS@ libspicefile.a
 all: all-am
 
 .SUFFIXES:
Index: gwave/src/Makefile.am
===================================================================
--- gwave.orig/src/Makefile.am	2019-01-26 03:10:06.000000000 +0100
+++ gwave/src/Makefile.am	2019-04-01 04:30:35.969562319 +0200
@@ -15,7 +15,7 @@
 	rgeval.c xgserver.c measurebtn.c measurebtn.h \
 	GtkTable_indel.c GtkTable_indel.h  xsnarf.h
 
-gwave_LDADD = ../spicefile/libspicefile.a @GTK_LIBS@ -lm
+gwave_LDADD = ../spicefile/libspicefile.a @GTK_LIBS@ @GUILE_LDFLAGS@ -lm
 gwave_LDFLAGS =  @GUILE_LDFLAGS@
 
 AM_CFLAGS = @GTK_CFLAGS@ @GUILE_CFLAGS@ \
