From: Jan Djärv Date: Mon, 3 Jun 2013 18:47:35 +0000 (+0200) Subject: Add HAVE_GLIB check instead of checking individual libraries that use GLib. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~85^2~3 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=55a87246bae97514b6e927b9401b2b79592b8b91;p=emacs.git Add HAVE_GLIB check instead of checking individual libraries that use GLib. * configure.ac (HAVE_GLIB): Add GLib check. Set XGSELOBJ if GLib is used. Remove xgselect.o from XOBJ. * src/Makefile.in (XGSELOBJ): New, xgselect.o if GLib is used, or empty. * src/process.c (wait_reading_process_output): Call xg_select if HAVE_GLIB. * src/xgselect.c: Replace #if defined ... with #ifdef HAVE_GLIB. --- diff --git a/ChangeLog b/ChangeLog index 22607d59529..d8474483f1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-06-03 Jan Djärv + + * configure.ac (HAVE_GLIB): Add GLib check. Set XGSELOBJ if GLib is + used. Remove xgselect.o from XOBJ. + 2013-06-03 Michael Albinus * configure.ac (file-notification): New option, replaces inotify option. diff --git a/configure.ac b/configure.ac index b0859ca8dec..c13f9d977e6 100644 --- a/configure.ac +++ b/configure.ac @@ -3612,6 +3612,23 @@ AC_FUNC_FORK AC_CHECK_FUNCS(snprintf) +dnl Check this late. It depends on what other libraries (lrsvg, Gtk+ etc) +dnl Emacs uses. +XGSELOBJ= +AC_MSG_CHECKING([whether GLib is linked in]) +AC_LINK_IFELSE([AC_LANG_PROGRAM( + [[#include + ]], + [[g_print ("Hello world");]])], + [links_glib=yes], + [links_glib=no]) +AC_MSG_RESULT([$links_glib]) +if test "${links_glib}" = "yes"; then + AC_DEFINE(HAVE_GLIB, 1, [Define to 1 if GLib is linked in.]) + XGSELOBJ=xgselect.o +fi +AC_SUBST(XGSELOBJ) + dnl Adapted from Haible's version. AC_CACHE_CHECK([for nl_langinfo and CODESET], emacs_cv_langinfo_codeset, [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], @@ -4398,7 +4415,7 @@ if test "${HAVE_X_WINDOWS}" = "yes" ; then AC_DEFINE(HAVE_X_WINDOWS, 1, [Define to 1 if you want to use the X window system.]) XMENU_OBJ=xmenu.o - XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o xgselect.o" + XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o" FONT_OBJ=xfont.o if test "$HAVE_XFT" = "yes"; then FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o" diff --git a/src/ChangeLog b/src/ChangeLog index b3b6f4730f0..aeca77b2ba3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2013-06-03 Jan Djärv + + * xgselect.c: Replace #if defined ... with #ifdef HAVE_GLIB. + + * process.c (wait_reading_process_output): Call xg_select if HAVE_GLIB. + + * Makefile.in (XGSELOBJ): New, xgselect.o if GLib is used, or empty. + 2013-06-03 Paul Eggert Fix minor problems found by static checking. diff --git a/src/Makefile.in b/src/Makefile.in index 0556bae1ecd..0e42f0ee6a0 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -205,10 +205,13 @@ LIBXMENU=@LIBXMENU@ ## xmenu.o if HAVE_X_WINDOWS, else empty. XMENU_OBJ=@XMENU_OBJ@ -## xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o xgselect.o if +## xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o if ## HAVE_X_WINDOWS, else empty. XOBJ=@XOBJ@ +# xgselect.o if linking with GLib, else empty +XGSELOBJ=@XGSELOBJ@ + TOOLKIT_LIBW=@TOOLKIT_LIBW@ ## Only used if HAVE_X11, in LIBX_OTHER. @@ -371,7 +374,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ doprnt.o intervals.o textprop.o composite.o xml.o $(NOTIFY_OBJ) \ profiler.o \ $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ - $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) + $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ) obj = $(base_obj) $(NS_OBJC_OBJ) ## Object files used on some machine or other. diff --git a/src/process.c b/src/process.c index 8c4199e5eed..33035078df9 100644 --- a/src/process.c +++ b/src/process.c @@ -4528,7 +4528,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, } #endif -#if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS) +#if defined (HAVE_GLIB) nfds = xg_select #elif defined (HAVE_NS) nfds = ns_select diff --git a/src/xgselect.c b/src/xgselect.c index 0b5ad6ae70d..38b9705e976 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -21,7 +21,7 @@ along with GNU Emacs. If not, see . */ #include "xgselect.h" -#if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS) +#ifdef HAVE_GLIB #include #include @@ -140,4 +140,4 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, return retval; } -#endif /* USE_GTK || HAVE_GCONF || HAVE_GSETTINGS */ +#endif /* HAVE_GLIB */