configure.ac: Moved GLib initialization to m4.include/ac-glib.m4

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2011-03-04 16:00:45 +02:00
parent 7df04e95e2
commit 48d1f1f518
3 changed files with 56 additions and 50 deletions

View File

@ -6,7 +6,7 @@ m4_include([m4.include/mc-check-search-type.m4])
m4_include([m4.include/ac-get-fs-info.m4])
m4_include([m4.include/mc-use-termcap.m4])
m4_include([m4.include/mc-with-screen.m4])
m4_include([m4.include/ac-g-module-supported.m4])
m4_include([m4.include/ac-glib.m4])
m4_include([m4.include/mc-vfs.m4])
m4_include([m4.include/mc-version.m4])
m4_include([m4.include/mc-tests.m4])

View File

@ -43,22 +43,7 @@ DX_INIT_DOXYGEN(mc,doxygen.cfg,devel)
dnl PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
dnl
dnl First try glib 2.x.
dnl Keep this check close to the beginning, so that the users
dnl without any glib won't have their time wasted by other checks.
dnl
AC_ARG_WITH([glib_static],
[ --with-glib-static Link glib statically [[no]]])
glib_found=no
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.8], [glib_found=yes], [:])
if test x"$glib_found" = xno; then
AC_MSG_ERROR([glib-2.0 not found or version too old (must be >= 2.8)])
fi
AC_CHECK_GLIB
AC_HEADER_MAJOR
AC_C_CONST
@ -219,43 +204,11 @@ dnl
dnl X11 support.
dnl Used to read keyboard modifiers when running under X11.
AC_PATH_XTRA
dnl
dnl Check if the gmodule functionality supported on this system.
AC_G_MODULE_SUPPORTED
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 Sequent wants getprocessstats
dnl

View File

@ -42,4 +42,57 @@ AC_DEFUN([AC_G_MODULE_SUPPORTED], [
fi
AM_CONDITIONAL([HAVE_GMODULE], [test x"$g_module_supported" != x])
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
])
AC_DEFUN([AC_CHECK_GLIB], [
dnl
dnl First try glib 2.x.
dnl Keep this check close to the beginning, so that the users
dnl without any glib won't have their time wasted by other checks.
dnl
AC_ARG_WITH([glib_static],
AC_HELP_STRING([--with-glib-static],[Link glib statically [[no]]]))
glib_found=no
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.8], [glib_found=yes], [:])
if test x"$glib_found" = xno; then
AC_MSG_ERROR([glib-2.0 not found or version too old (must be >= 2.8)])
fi
])