* acinclude.m4 [AC_G_MODULE_SUPPORTED]: New macro.

* configure.in: Test for gmodule.  Don't link mc with libX11 if
gmodule is supported.
This commit is contained in:
Pavel Roskin 2003-02-23 04:38:24 +00:00
parent ea299013c3
commit 509020b6b5
3 changed files with 67 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2003-02-22 Pavel Tsekov <ptsekov@gmx.net>
* acinclude.m4 [AC_G_MODULE_SUPPORTED]: New macro.
* configure.in: Test for gmodule. Don't link mc with libX11 if
gmodule is supported.
2003-02-22 Pavel Roskin <proski@gnu.org>
* configure.in: Add --with-glib12 option to confugure to force

View File

@ -858,3 +858,36 @@ AC_DEFUN([AC_EXT2_UNDEL], [
dnl The next line is for compatibility with gettext 0.10.x
AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
dnl
dnl Check whether the g_module_* family of functions works
dnl on this system. We need to know that at the compile time to
dnl decide whether to link with X11.
dnl
AC_DEFUN([AC_G_MODULE_SUPPORTED], [
AC_CACHE_CHECK([if gmodule functionality is supported], mc_cv_g_module_supported, [
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GMODULE_CFLAGS"
LIBS="$GMODULE_LIBS $LIBS"
AC_TRY_RUN([
#include <gmodule.h>
int main ()
{
int ret = (g_module_supported () == TRUE) ? 0 : 1;
return ret;
}
],
[mc_cv_g_module_supported=yes],
[mc_cv_g_module_supported=no],
[mc_cv_g_module_supported=no]
)
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
])
if test "$mc_cv_g_module_supported" = yes; then
AC_DEFINE(HAVE_GMODULE, 1,
[Define if gmodule functionality is supported])
fi
])

View File

@ -44,8 +44,26 @@ if test "x$glib_found" != "xyes" ; then
AC_ARG_VAR([GLIB_CONFIG], [Path to glib-config (version 1.2.x only)])
AM_PATH_GLIB(1.2.6, , [AC_MSG_ERROR([Test for glib failed.
GNU Midnight Commander requires glib 1.2.6 or above.])])
dnl Save GLIB_CFLAGS and GLIB_LIBS, since the following call to
dnl AM_PATH_GLIB will overwrite them.
save_GLIB_CFLAGS="$GLIB_CFLAGS"
save_GLIB_LIBS="$GLIB_LIBS"
dnl Check for gmodule. Store the flags necessary to compile and
dnl link programs using gmodule functionality in GMODULE_CFLAGS
dnl and GMODULE_LIBS.
AM_PATH_GLIB(1.2.6, [gmodule_found=yes], , [gmodule])
GMODULE_CFLAGS="$GLIB_CFLAGS"
GMODULE_LIBS="$GLIB_LIBS"
GLIB_CFLAGS="$save_GLIB_CFLAGS"
GLIB_LIBS="$save_GLIB_LIBS"
else
PKG_CHECK_MODULES(GMODULE, [gmodule-2.0], [gmodule_found=yes])
fi
if test "x$gmodule_found" = "xyes" ; then
dnl Check if the gmodule functionality supported on this system.
AC_G_MODULE_SUPPORTED
fi
AC_HEADER_MAJOR
AC_C_CONST
@ -221,7 +239,16 @@ if test "x$no_x" = xyes; then
textmode_x11_support="no"
else
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
if test "x$mc_cv_g_module_supported" = "xyes" ; then
dnl Replace the contents of GLIB_CFLAGS and GLIB_LIBS with those of
dnl GMODULE_CFLAGS and GMODULE_LIBS, only if X is available and gmodule
dnl functionality is supported on the system. This way, mc will be
dnl linked against the gmodule library only when it's really required.
GLIB_CFLAGS="$GMODULE_CFLAGS"
GLIB_LIBS="$GMODULE_LIBS"
else
MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
fi
AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT, 1,
[Define to enable getting events from X Window System])
textmode_x11_support="yes"