diff --git a/ChangeLog b/ChangeLog index a86761ed8..2ca3ec5bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-03-07 Pavel Roskin + + * configure.in: Add --with-glib-static option. + 2003-03-06 Pavel Roskin * syntax/spec.syntax: Add BuildArch. diff --git a/INSTALL b/INSTALL index d627d7efa..8b2767e67 100644 --- a/INSTALL +++ b/INSTALL @@ -89,6 +89,11 @@ incomplete, use `configure --help' to get the full list): flag for testing or if you want to use the binary on systems that don't have glib 2.0.x installed. +`--with-glib-static' + Force linking against glib statically. This option is intended for + building binaries for distribution purposes and may not work on + some operating systems. + `--with-mmap', `--without-mmap' Force using or not using the mmap function. It is currently used in the internal viewer. `--with-mmap' may be useful on some diff --git a/configure.in b/configure.in index a7229a5d2..73593f3f6 100644 --- a/configure.in +++ b/configure.in @@ -28,6 +28,9 @@ dnl AC_ARG_WITH(glib12, [ --with-glib12 Force using glib 1.2.x [[no]]]) +AC_ARG_WITH([glib_static], + [ --with-glib-static Link glib statically [[no]]]) + glib_found=no if test "x$with_glib12" != "xyes"; then PKG_CHECK_MODULES(GLIB, [glib-2.0], [glib_found=yes], [:]) @@ -56,8 +59,10 @@ GNU Midnight Commander requires glib 1.2.6 or above.])]) GMODULE_LIBS="$GLIB_LIBS" GLIB_CFLAGS="$save_GLIB_CFLAGS" GLIB_LIBS="$save_GLIB_LIBS" + GLIB_LIBDIR="`$GLIB_CONFIG --exec-prefix`/lib" else PKG_CHECK_MODULES(GMODULE, [gmodule-2.0], [gmodule_found=yes]) + GLIB_LIBDIR="`$PKG_CONFIG --variable=libdir glib-2.0`" fi if test "x$gmodule_found" = "xyes" ; then @@ -254,6 +259,40 @@ else textmode_x11_support="yes" fi +dnl +dnl Try to find static libraries for glib and gmodule. +dnl +if test x$with_glib_static = xyes; then + new_GLIB_LIBS= + for i in $GLIB_LIBS; do + case x$i in + x-lglib*) + lib=glib ;; + x-lgmodule*) + lib=gmodule ;; + *) + lib= + add="$i" ;; + esac + + if test -n "$lib"; then + lib1=`echo $i | sed 's/^-l//'` + if test -f "$GLIB_LIBDIR/lib${lib1}.a"; then + add="$GLIB_LIBDIR/lib${lib1}.a" + else + if test -f "$GLIB_LIBDIR/lib${lib}.a"; then + add="$GLIB_LIBDIR/lib${lib}.a" + else + AC_MSG_ERROR([Cannot find static $lib]) + fi + fi + fi + new_GLIB_LIBS="$new_GLIB_LIBS $add" + done + GLIB_LIBS="$new_GLIB_LIBS" +fi + + dnl dnl Network related functions dnl