Re: [gtk-list] Re: static link w/gtk




I don't quite understand why some people fail to see the need for a way to
link statically using the same methods you use to link dynamically w/o
needing to recompile the entire package.  Here are a couple of patches
against glib 1.1.5 & gtk+ 1.1.5 that allow you to link statically by
using --static-libs instead of --libs with either glib-config or
gtk-config.

Regards,
Christopher

--- glib-1.1.5/glib-config.in.cls	Tue Sep 15 12:08:07 1998
+++ glib-1.1.5/glib-config.in	Tue Nov 24 18:01:29 1998
@@ -13,6 +13,7 @@
 	[--exec-prefix[=DIR]]
 	[--version]
 	[--libs]
+	[--static-libs]
 	[--cflags]
 Libraries:
 	glib
@@ -63,6 +64,9 @@
     --libs)
       echo_libs=yes
       ;;
+    --static-libs)
+      echo_static_libs=yes
+      ;;
     glib)
       lib_glib=yes
       ;;
@@ -94,4 +98,14 @@
 		libs="@G_MODULE_LDFLAGS@ -lgmodule $libs @G_MODULE_LIBS@"
 	fi
 	echo "-L@libdir@ $libs"
+fi
+if test "$echo_static_libs" = "yes"; then
+	libs=""
+	if test "$lib_glib" = "yes"; then
+		libs="$libs @libdir@/libglib.a"
+	fi
+	if test "$lib_gmodule" = "yes"; then
+		libs="@libdir@/libgmodule.a $libs"
+	fi
+	echo "$libs"
 fi
--- gtk+-1.1.5/gtk-config.in.cls	Tue Nov 24 18:10:47 1998
+++ gtk+-1.1.5/gtk-config.in	Tue Nov 24 18:14:18 1998
@@ -2,13 +2,14 @@
 
 glib_libs="@glib_libs@"
 glib_cflags="@glib_cflags@"
+glib_config="@GLIB_CONFIG@"
 
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 exec_prefix_set=no
 
 usage="\
-Usage: gtk-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]"
+Usage: gtk-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--static-libs] [--cflags]"
 
 if test $# -eq 0; then
       echo "${usage}" 1>&2
@@ -65,6 +66,10 @@
         fi
       done
       echo $libdirs @x_ldflags@ -lgtk -lgdk $my_glib_libs @x_libs@ @GDK_WLIBS@ -lm
+      ;;
+    --static-libs)
+      my_glib_libs=`$glib_config --static-libs gmodule`
+      echo @x_ldflags@ @libdir@/libgtk.a @libdir@/libgdk.a $my_glib_libs @x_libs@ @GDK_WLIBS@ -lm
       ;;
     *)
       echo "${usage}" 1>&2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]