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.
This commit is contained in:
Jan Djärv 2013-06-03 20:47:35 +02:00
parent 3d5ee10aa2
commit 55a87246ba
6 changed files with 39 additions and 6 deletions

View file

@ -1,3 +1,8 @@
2013-06-03 Jan Djärv <jan.h.d@swipnet.se>
* configure.ac (HAVE_GLIB): Add GLib check. Set XGSELOBJ if GLib is
used. Remove xgselect.o from XOBJ.
2013-06-03 Michael Albinus <michael.albinus@gmx.de>
* configure.ac (file-notification): New option, replaces inotify option.

View file

@ -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 <glib.h>
]],
[[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 <langinfo.h>]],
@ -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"

View file

@ -1,3 +1,11 @@
2013-06-03 Jan Djärv <jan.h.d@swipnet.se>
* 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 <eggert@cs.ucla.edu>
Fix minor problems found by static checking.

View file

@ -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.

View file

@ -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

View file

@ -21,7 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "xgselect.h"
#if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS)
#ifdef HAVE_GLIB
#include <glib.h>
#include <errno.h>
@ -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 */