diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/autoconf/configure.in AfterStep-2.2.7/autoconf/configure.in
--- AfterStep-2.2.7-old/autoconf/configure.in	2007-08-21 00:27:41.000000000 +0200
+++ AfterStep-2.2.7/autoconf/configure.in	2008-01-09 12:20:52.027325836 +0100
@@ -137,14 +137,14 @@
   fi
 fi
 
-dnl# Add -fPIC for IA64 compilation
-AC_CYGWIN
-if test "x$CYGWIN" != "xyes" -a "x$GCC" = "xyes" ; then
-  if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
-    CFLAGS="$CFLAGS -fPIC"
-  fi
-  LDFLAGS="$LDFLAGS -rdynamic"
-fi
+#debian# dnl# Add -fPIC for IA64 compilation
+#debian# AC_CYGWIN
+#debian# if test "x$CYGWIN" != "xyes" -a "x$GCC" = "xyes" ; then
+#debian#   if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
+#debian#     CFLAGS="$CFLAGS -fPIC"
+#debian#   fi
+#debian#   LDFLAGS="$LDFLAGS -rdynamic"
+#debian# fi
 
 dnl# Add -g
 STRIP_BINARIES=
@@ -156,14 +156,14 @@
 	LDFLAGS="$LDFLAGS -g"
   fi
 else
-  STRIP_BINARIES="-s"
-  DIRTY_CFLAGS="$CFLAGS"
-  CFLAGS="-DNO_DEBUG_OUTPUT"
-  for f in $DIRTY_CFLAGS; do 
-        if test "x$f" != "x-g"; then
-	   CFLAGS="$CFLAGS $f"
-	fi	 
-  done
+#debian#   STRIP_BINARIES="-s"
+#debian#   DIRTY_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -DNO_DEBUG_OUTPUT"
+#debian#   for f in $DIRTY_CFLAGS; do 
+#debian#         if test "x$f" != "x-g"; then
+#debian# 	   CFLAGS="$CFLAGS $f"
+#debian# 	fi	 
+#debian#   done
 fi
 
 dnl# Add -pg
@@ -543,7 +543,7 @@
 
     if fltk-config --libs >/dev/null  ;then
 		present_libs="$LDFLAGS $LIBS $x_libs $AFTERIMAGE_LIBS";
-		for l in `fltk-config --ldstaticflags`; do
+		for l in `fltk-config --ldflags`; do
 	  	  lib_found=no
 	  	  for p in `echo "$present_libs"` ; do
 			  if test "x$l" = "x$p" ; then
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/autoconf/configure.libs.in AfterStep-2.2.7/autoconf/configure.libs.in
--- AfterStep-2.2.7-old/autoconf/configure.libs.in	2005-03-22 17:10:50.000000000 +0100
+++ AfterStep-2.2.7/autoconf/configure.libs.in	2008-01-09 12:20:52.027325836 +0100
@@ -91,13 +91,13 @@
   fi
 fi
 
-dnl# Add -fPIC for IA64 compilation
-AC_CYGWIN
-if test "x$CYGWIN" = "x" -a "x$GCC" = "xyes" ; then
-  if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
-    CFLAGS="$CFLAGS -fPIC"
-  fi
-fi
+#debian# dnl# Add -fPIC for IA64 compilation
+#debian# AC_CYGWIN
+#debian# if test "x$CYGWIN" = "x" -a "x$GCC" = "xyes" ; then
+#debian#   if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
+#debian#     CFLAGS="$CFLAGS -fPIC"
+#debian#   fi
+#debian# fi
 
 dnl# Add -g
 if test "x$enable_gdb" = "xyes"; then
@@ -116,9 +116,9 @@
   CFLAGS="$CFLAGS -Wuninitialized -Wwrite-strings -Wcast-qual -Wbad-function-cast -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wconversion -Wcomment -Wcast-align -Winline -Wshadow -Wredundant-decls -Wid-clash-31"
 fi
 
-if test "x$GCC" = "xyes"; then
-   LDFLAGS="$LDFLAGS -rdynamic"
-fi
+#debian# if test "x$GCC" = "xyes"; then
+#debian#    LDFLAGS="$LDFLAGS -rdynamic"
+#debian# fi
 
 dnl# done with flags - lets export those for our children to use :
 export CFLAGS
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/autoconf/Makefile.common.lib.in AfterStep-2.2.7/autoconf/Makefile.common.lib.in
--- AfterStep-2.2.7-old/autoconf/Makefile.common.lib.in	2007-04-21 00:10:45.000000000 +0200
+++ AfterStep-2.2.7/autoconf/Makefile.common.lib.in	2008-01-09 12:20:52.027325836 +0100
@@ -22,20 +22,6 @@
 		if test -d $(LIBDIR) && test -w $(LIBDIR); then \
 		    echo "$(INSTALL_LIB) $(LIB_STATIC) $(LIBDIR)"; \
 		    $(INSTALL_LIB) $(LIB_STATIC) $(LIBDIR); \
-		    if test `uname` = "Linux"; then \
-			if test $(LIBDIR) = "/lib" || test $(LIBDIR) = "/usr/lib"; then \
-		    	    echo "" > /dev/null; \
-			elif grep -q $(LIBDIR) /etc/ld.so.conf > /dev/null 2>&1; then \
-		    	    echo "" > /dev/null; \
-			else \
-		    	    echo "Unable to find $(LIBDIR) in ld.so.conf. In order to use "; \
-		    	    echo "$(LIB_STATIC), you may need to add it or set LD_LIBRARY_PATH."; \
-			fi; \
-			if test -w /etc; then \
-			    echo "$(LDCONFIG)"; \
-			    $(LDCONFIG); \
-			fi; \
-		    fi ;\
 		fi \
 		)
 
@@ -48,18 +34,6 @@
 		$(INSTALL_LIB) $(LIB_SHARED).$(LIBVER) $(LIBDIR); \
 		$(LN_S) -f $(LIB_SHARED).$(LIBVER) $(LIBDIR)/$(LIB_SHARED).$(LIBVERMAJOR); \
 		$(LN_S) -f $(LIB_SHARED).$(LIBVERMAJOR) $(LIBDIR)/$(LIB_SHARED); \
-		 if test `uname` = "Linux"; then \
-		   if test $(LIBDIR) = "/lib" || test $(LIBDIR) = "/usr/lib"; then \
-		     echo "" > /dev/null; \
-		   elif grep -q $(LIBDIR) /etc/ld.so.conf > /dev/null 2>&1; then \
-		     echo "" > /dev/null; \
-		   else \
-		     echo "Unable to find $(LIBDIR) in ld.so.conf. In order to use "; \
-		     echo "$(LIB_SHARED), you may need to add it or set LD_LIBRARY_PATH."; \
-		   fi; \
-		   echo "$(LDCONFIG)"; \
-		   $(LDCONFIG); \
-		 fi \
 		)
 
 install.cyg:	uninstall.cyg
@@ -217,10 +191,10 @@
 		$(RANLIB) $(LIB_STATIC)
 
 .c.o:
-		$(CC) $(CCFLAGS) $(EXTRA_DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) -c $*.c
+		$(CC) $(CCFLAGS) $(DEBCCFLAGS) $(EXTRA_DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) -c $*.c
 
 .c.s:
-		$(CC) $(CCFLAGS) $(EXTRA_DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) -S $*.c
+		$(CC) $(CCFLAGS) $(DEBCCFLAGS) $(EXTRA_DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) -S $*.c
 
 #
 # include dependency files if they exist
@@ -245,8 +219,8 @@
 	$(LN_S) -f $(LIB_SHARED).$(LIBVER) $(LIB_SHARED).$(LIBVERMAJOR)
 
 $(LIB_SHARED).$(LIBVER): $(LIB_OBJS) $(LIB_INCS)
-	$(CC) -shared -Wl,-soname,$(LIB_SHARED).$(LIBVERMAJOR) -o $(LIB_SHARED).$(LIBVER) \
-	 $(LIB_OBJS)
+	$(CC) -shared $(DEBLDFLAGS) -Wl,-soname,$(LIB_SHARED).$(LIBVERMAJOR)  -o $(LIB_SHARED).$(LIBVER) \
+	 $(LIB_OBJS) $(DEB_EXTRA_LIBS)
 
 install:	install.lib install.bin
 
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/configure AfterStep-2.2.7/configure
--- AfterStep-2.2.7-old/configure	2007-08-21 00:27:41.000000000 +0200
+++ AfterStep-2.2.7/configure	2008-01-09 12:20:52.031325456 +0100
@@ -3185,12 +3185,12 @@
 	 * ) CYGWIN=no;;
 esac
 
-if test "x$CYGWIN" != "xyes" -a "x$GCC" = "xyes" ; then
-  if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
-    CFLAGS="$CFLAGS -fPIC"
-  fi
-  LDFLAGS="$LDFLAGS -rdynamic"
-fi
+#debian# if test "x$CYGWIN" != "xyes" -a "x$GCC" = "xyes" ; then
+#debian#   if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
+#debian#     CFLAGS="$CFLAGS -fPIC"
+#debian#   fi
+#debian#   LDFLAGS="$LDFLAGS -rdynamic"
+#debian# fi
 
 STRIP_BINARIES=
 if test "x$enable_gdb" = "xyes"; then
@@ -3201,14 +3201,14 @@
 	LDFLAGS="$LDFLAGS -g"
   fi
 else
-  STRIP_BINARIES="-s"
-  DIRTY_CFLAGS="$CFLAGS"
-  CFLAGS="-DNO_DEBUG_OUTPUT"
-  for f in $DIRTY_CFLAGS; do
-        if test "x$f" != "x-g"; then
-	   CFLAGS="$CFLAGS $f"
-	fi
-  done
+#debian#   STRIP_BINARIES="-s"
+#debian#   DIRTY_CFLAGS="$CFLAGS"
+   CFLAGS="$CFLAGS -DNO_DEBUG_OUTPUT"
+#debian#   for f in $DIRTY_CFLAGS; do
+#debian#         if test "x$f" != "x-g"; then
+#debian# 	   CFLAGS="$CFLAGS $f"
+#debian# 	fi
+#debian#   done
 fi
 
 if test "x$enable_gprof" = "xyes"; then
@@ -8231,7 +8231,7 @@
 
     if fltk-config --libs >/dev/null  ;then
 		present_libs="$LDFLAGS $LIBS $x_libs $AFTERIMAGE_LIBS";
-		for l in `fltk-config --ldstaticflags`; do
+		for l in `fltk-config --ldflags`; do
 	  	  lib_found=no
 	  	  for p in `echo "$present_libs"` ; do
 			  if test "x$l" = "x$p" ; then
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/configure.h.in AfterStep-2.2.7/configure.h.in
--- AfterStep-2.2.7-old/configure.h.in	2006-11-14 02:43:39.000000000 +0100
+++ AfterStep-2.2.7/configure.h.in	2008-01-09 12:20:52.035325355 +0100
@@ -47,7 +47,7 @@
 #define CANONICAL_BUILD_VENDOR	"@build_vendor@"
 #define AFTER_BIN_DIR	"@bindir@"
 #define AFTER_MAN_DIR	"@mandir@/man1"
-#define AFTER_DOC_DIR	"@datadir@/afterstep/doc"
+#define AFTER_DOC_DIR	"@datadir@/doc/afterstep"
 #define DEFAULT_ICON_DIR "@x_includes@/X11/bitmaps"
 #define DEFAULT_PIXMAP_DIR "@x_includes@/X11/pixmaps"
 #define DEFAULT_TTF_DIR "@x_libraries@/X11/fonts/TTF"
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/libAfterBase/configure AfterStep-2.2.7/libAfterBase/configure
--- AfterStep-2.2.7-old/libAfterBase/configure	2007-07-13 00:39:55.000000000 +0200
+++ AfterStep-2.2.7/libAfterBase/configure	2008-01-09 12:20:52.039324975 +0100
@@ -2464,12 +2464,13 @@
 
 
 
-	if test "x$GCC" = "xyes" -a "x$CYGWIN" = "xno" ; then
-      if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
-		CFLAGS="$CFLAGS -fPIC"
-	  fi
-	  LDFLAGS="$LDFLAGS -rdynamic"
-	fi
+#debian# 	if test "x$GCC" = "xyes" -a "x$CYGWIN" = "xno" ; then
+#debian#       if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
+#debian# 		CFLAGS="$CFLAGS -fPIC"
+#debian# 	  fi
+#debian# 	  LDFLAGS="$LDFLAGS -rdynamic"
+#debian# 	fi
+		/bin/true  #debian #
 
 else
 
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/libAfterBase/configure.in AfterStep-2.2.7/libAfterBase/configure.in
--- AfterStep-2.2.7-old/libAfterBase/configure.in	2007-07-13 00:39:55.000000000 +0200
+++ AfterStep-2.2.7/libAfterBase/configure.in	2008-01-09 12:20:52.039324975 +0100
@@ -70,12 +70,13 @@
     AC_SUBST(LEX)
     AC_SUBST(LEXLIB)
     AC_SUBST(YACC)
-	if test "x$GCC" = "xyes" -a "x$CYGWIN" = "xno" ; then
-      if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
-		CFLAGS="$CFLAGS -fPIC"
-	  fi
-	  LDFLAGS="$LDFLAGS -rdynamic"
-	fi
+#debian# 	if test "x$GCC" = "xyes" -a "x$CYGWIN" = "xno" ; then
+#debian#       if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
+#debian# 		CFLAGS="$CFLAGS -fPIC"
+#debian# 	  fi
+#debian# 	  LDFLAGS="$LDFLAGS -rdynamic"
+#debian# 	fi
+		/bin/true
 
 else
 
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/libAfterBase/Makefile.in AfterStep-2.2.7/libAfterBase/Makefile.in
--- AfterStep-2.2.7-old/libAfterBase/Makefile.in	2007-04-21 00:10:45.000000000 +0200
+++ AfterStep-2.2.7/libAfterBase/Makefile.in	2008-01-09 12:20:52.039324975 +0100
@@ -35,6 +35,7 @@
 
 # end specifics
 ################################################################
+
 # generic makefile stuff :
 
 LIB_DIR_NAME	= libAfterBase
@@ -78,8 +79,9 @@
 INCS_X		= @X_CFLAGS@
 INCLUDES	= $(INCS_X) $(INCS_PRIVATE)
 
-USER_LD_FLAGS	= @user_ldflags@
-LIBS_X		= @x_libs@
+
+USER_LD_FLAGS	= @user_ldflags@ -Wl,--no-as-needed
+LIBS_X		= @x_libs@ -lXext
 
 
 LIBDIR		= $(DESTDIR)@libdir@
@@ -297,10 +299,10 @@
 		$(RANLIB) $(LIB_STATIC)
 
 .c.o:
-		$(CC) $(CCFLAGS) $(EXTRA_DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) -c $*.c
+		$(CC) $(CCFLAGS) $(DEBCCFLAGS) $(EXTRA_DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) -c $*.c
 
 .c.s:
-		$(CC) $(CCFLAGS) $(EXTRA_DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) -S $*.c
+		$(CC) $(CCFLAGS) $(DEBCCFLAGS) $(EXTRA_DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) -S $*.c
 
 #
 # include dependency files if they exist
@@ -325,7 +327,7 @@
 	$(LN_S) -f $(LIB_SHARED).$(LIBVER) $(LIB_SHARED).$(LIBVERMAJOR)
 
 $(LIB_SHARED).$(LIBVER): $(LIB_OBJS) $(LIB_INCS)
-	$(CC) -shared -Wl,-soname,$(LIB_SHARED).$(LIBVERMAJOR) -o $(LIB_SHARED).$(LIBVER) \
+	$(CC) -shared  -Wl,-soname,$(LIB_SHARED).$(LIBVERMAJOR) -o $(LIB_SHARED).$(LIBVER) \
 	 $(USER_LD_FLAGS) $(LIBS_X) $(LIB_OBJS)
 
 install:	install.lib
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/libAfterConf/Makefile.in AfterStep-2.2.7/libAfterConf/Makefile.in
--- AfterStep-2.2.7-old/libAfterConf/Makefile.in	2005-09-01 00:56:44.000000000 +0200
+++ AfterStep-2.2.7/libAfterConf/Makefile.in	2008-01-09 12:20:52.039324975 +0100
@@ -23,6 +23,10 @@
 LIBVER          = @libafterconf_version@
 LIBVERMAJOR     = @libafterconf_version_major@
 
+# Debian Additions
+DEB_EXTRA_LIBS		= -lXinerama -lX11  -g -rdynamic  -L/usr/X11R6/lib   -lSM -lICE -lXext -lgdk_pixbuf-2.0 -L../libAfterBase -lAfterBase -L../libAfterImage -lAfterImage -L../libAfterStep -lAfterStep
+
+
 CONFIG_SCRIPT=afterconf-config 
 
 
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/libAfterImage/apps/Makefile.in AfterStep-2.2.7/libAfterImage/apps/Makefile.in
--- AfterStep-2.2.7-old/libAfterImage/apps/Makefile.in	2007-08-02 07:09:02.000000000 +0200
+++ AfterStep-2.2.7/libAfterImage/apps/Makefile.in	2008-01-09 12:20:52.039324975 +0100
@@ -39,10 +39,15 @@
 MAN_DIR		= $(DESTDIR)@mandir@/man1
 AFTER_DIR	= @with_afterdir@
 
+ifdef ORIGINAL_BUILD
 # need this for dependancies :
 LIBAFTERIMAGE_PATH =..
 LIB_STATIC      = $(LIBAFTERIMAGE_PATH)/libAfterImage.a
 LIB_SHARED      = $(LIBAFTERIMAGE_PATH)/libAfterImage.so
+else
+# build from libafterimage-dev  examples directory
+LIBAFTERIMAGE_PATH = /usr/lib
+ endif
 
 
 all:    $(PROGS)
@@ -177,6 +182,7 @@
 
 uninstall:	uninstall.bin
 
+ifdef ORIGINAL_BUILD
 include .depend
 
 @LIBAFTERIMAGEFILES@
@@ -186,3 +192,4 @@
 
 $(LIBAFTERIMAGE_PATH)/libAfterImage.so: $(LIBAFTERIMAGE_OBJS) $(LIBAFTERIMAGE_INCS)
 		cd $(LIBAFTERIMAGE_PATH)/; ${MAKE} libAfterImage.so
+endif
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/libAfterImage/configure AfterStep-2.2.7/libAfterImage/configure
--- AfterStep-2.2.7-old/libAfterImage/configure	2007-08-02 00:47:07.000000000 +0200
+++ AfterStep-2.2.7/libAfterImage/configure	2008-01-09 12:20:52.043325433 +0100
@@ -2651,12 +2651,12 @@
 	 * ) CYGWIN=no;;
 esac
 
-if test "x$CYGWIN" = "xno" -a "x$GCC" = "xyes" ; then
-  if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
-  	CFLAGS="$CFLAGS -fPIC"
-  fi
-  LDFLAGS="$LDFLAGS -rdynamic"
-fi
+#debian# if test "x$CYGWIN" = "xno" -a "x$GCC" = "xyes" ; then
+#debian#   if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
+#debian#   	CFLAGS="$CFLAGS -fPIC"
+#debian#   fi
+#debian#   LDFLAGS="$LDFLAGS -rdynamic"
+#debian# fi
 
 
 if test "x$FROM_AFTERSTEP_CONFIGURE" = "xyes"; then
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/libAfterImage/configure.in AfterStep-2.2.7/libAfterImage/configure.in
--- AfterStep-2.2.7-old/libAfterImage/configure.in	2007-08-02 00:47:08.000000000 +0200
+++ AfterStep-2.2.7/libAfterImage/configure.in	2008-01-09 12:20:52.047324495 +0100
@@ -74,12 +74,12 @@
 dnl# AC_SUBST(GCC)
 
 AC_CYGWIN
-if test "x$CYGWIN" = "xno" -a "x$GCC" = "xyes" ; then
-  if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
-  	CFLAGS="$CFLAGS -fPIC"
-  fi
-  LDFLAGS="$LDFLAGS -rdynamic"
-fi
+#debian# if test "x$CYGWIN" = "xno" -a "x$GCC" = "xyes" ; then
+#debian#   if test -z "`echo $CFLAGS | grep '\-fPIC' 2> /dev/null`" ; then
+#debian#   	CFLAGS="$CFLAGS -fPIC"
+#debian#   fi
+#debian#   LDFLAGS="$LDFLAGS -rdynamic"
+#debian# fi
 
 
 if test "x$FROM_AFTERSTEP_CONFIGURE" = "xyes"; then
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/libAfterImage/Makefile.in AfterStep-2.2.7/libAfterImage/Makefile.in
--- AfterStep-2.2.7-old/libAfterImage/Makefile.in	2007-08-02 07:36:22.000000000 +0200
+++ AfterStep-2.2.7/libAfterImage/Makefile.in	2008-01-09 12:42:44.864323269 +0100
@@ -55,8 +55,13 @@
 
 APPS_INCS=apps/common.h
 
+
 # end specifics
 ################################################################
+# Debian Addition
+DEB_EXTRA_LIBS		= -lXinerama -lX11   -L/usr/X11R6/lib   -lSM -lICE -lXext -lrsvg-2 -lgdk_pixbuf-2.0 -lfreetype -lz -ltiff -ljpeg -lpng -lgif -lm -lGL -L../libAfterBase -lAfterBase
+export ORIGINAL_BUILD = 1
+
 # generic makefile stuff :
 
 LIB_DIR_NAME    = libAfterImage
@@ -365,10 +370,10 @@
 
 
 .c.o:
-		$(CC) $(CCFLAGS) $(EXTRA_DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) -c $*.c -o $@
+		$(CC) $(CCFLAGS) $(DEBCCFLAGS) $(EXTRA_DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) -c $*.c -o $@
 
 .c.s:
-		$(CC) $(CCFLAGS) $(EXTRA_DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) -S $*.c
+		$(CC) $(CCFLAGS) $(DEBCCFLAGS) $(EXTRA_DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) -S $*.c
 
 #
 # include dependency files if they exist
@@ -393,8 +398,8 @@
 	$(LN_S) -f $(LIB_SHARED).$(LIBVER) $(LIB_SHARED).$(LIBVERMAJOR)
 
 $(LIB_SHARED).$(LIBVER): $(LIB_OBJS) $(LIB_INCS) config.h
-	$(CC) -shared -Wl,-soname,$(LIB_SHARED).$(LIBVERMAJOR) -o $(LIB_SHARED).$(LIBVER) \
-	 $(LIB_OBJS)
+	$(CC) -shared $(DEBLDFLAGS) -Wl,-soname,$(LIB_SHARED).$(LIBVERMAJOR) -o $(LIB_SHARED).$(LIBVER) \
+	 $(LIB_OBJS) $(DEB_EXTRA_LIBS)
 
 install.man:
 		@if [ -d doc/man ] ; then \
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/libAfterStep/Makefile.in AfterStep-2.2.7/libAfterStep/Makefile.in
--- AfterStep-2.2.7-old/libAfterStep/Makefile.in	2006-01-24 00:52:02.000000000 +0100
+++ AfterStep-2.2.7/libAfterStep/Makefile.in	2008-01-09 12:20:52.047324495 +0100
@@ -38,6 +38,8 @@
 LIBVER          = @libafterstep_version@
 LIBVERMAJOR     = @libafterstep_version_major@
 
+# Debian Additions
+DEB_EXTRA_LIBS		= $(LIBRARIES) -L../libAfterBase -lAfterBase -L../libAfterImage -lAfterImage
 LIBS_PRIVATE      = ../src/afterstep/$(LIB_AFTERIMAGE) ../src/afterstep/$(LIB_AFTERBASE)  $(LIBS_AFTERIMAGE)
 
 @MAKEFILECOMMONLIB@
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/libASGTK/Makefile.in AfterStep-2.2.7/libASGTK/Makefile.in
--- AfterStep-2.2.7-old/libASGTK/Makefile.in	2007-03-08 16:07:04.000000000 +0100
+++ AfterStep-2.2.7/libASGTK/Makefile.in	2008-01-09 12:20:52.047324495 +0100
@@ -23,10 +23,13 @@
 
 INCS_PRIVATE	= @GTK_INCLUDES@
 
-LIBS_PRIVATE      = ../src/afterstep/$(LIB_ASGTK) ../src/afterstep/$(LIB_AFTERCONF) ../src/afterstep/$(LIB_AFTERSTEP) \
+LIBS_PRIVATE      = ../src/afterstep/$(LIB_AFTERCONF) ../src/afterstep/$(LIB_AFTERSTEP) \
 		    ../src/afterstep/$(LIB_AFTERIMAGE) ../src/afterstep/$(LIB_AFTERBASE) \
 		    @GTK_LIBS@ $(LIBS_AFTERIMAGE)
 
+DEB_EXTRA_LIBS		= $(LIBRARIES) -L../libAfterBase -lAfterBase -L../libAfterImage -lAfterImage \
+			  -L../libAfterConf -lAfterConf -L../libAfterStep -lAfterStep
+
 @MAKEFILECOMMONLIB@
 
 
diff -ruN -x config.guess -x config.sub AfterStep-2.2.7-old/Makefile.in AfterStep-2.2.7/Makefile.in
--- AfterStep-2.2.7-old/Makefile.in	2007-05-06 06:02:34.000000000 +0200
+++ AfterStep-2.2.7/Makefile.in	2008-01-09 12:20:52.047324495 +0100
@@ -70,7 +70,7 @@
 
 module.clean:
  
-install:  install.alternative install.desktop install.wmprops mkdir
+install:  install.desktop install.wmprops mkdir
 	@for I in ${subdirs} ; do if [ -d $$I ]; then (cd $$I; ${MAKE} install || exit 1); fi; done
 
 install.bin: mkdir.bin
