diff --git a/acinclude.m4 b/acinclude.m4 index 2a800371b..222661877 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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]) diff --git a/configure.ac b/configure.ac index 24a297ec4..64b39f28b 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/m4.include/ac-g-module-supported.m4 b/m4.include/ac-glib.m4 similarity index 52% rename from m4.include/ac-g-module-supported.m4 rename to m4.include/ac-glib.m4 index 359b6cf41..b3079ecc8 100644 --- a/m4.include/ac-g-module-supported.m4 +++ b/m4.include/ac-glib.m4 @@ -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 + +]) +