From 00e70a5c5450579145ef077340d8148a1ba3338c Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sat, 30 Jan 2016 11:42:39 -0800 Subject: [PATCH] Use standard autotools means to detect X11 Use AC_PATH_XTRA to search for X11 in configure.ac. In Makefiles, add X_CFLAGS to AM_CFLAGS for the source compilation. Add X_LIBS to LDFLAGS. Add X_PRE_LIBS and X_EXTRA_LIBS to LDADD. With this patch, X Windows system is correctly detected on Mac OS X. --- configure.ac | 16 +++++++++++++--- genkeymap/Makefile.am | 7 +++++-- sesman/chansrv/Makefile.am | 6 ++++-- sesman/tools/Makefile.am | 8 ++++++-- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 79e38d0d..cd873a68 100644 --- a/configure.ac +++ b/configure.ac @@ -199,16 +199,26 @@ else fi fi -# checking for Xlib, Xfixes -AC_CHECK_HEADER([X11/Xlib.h], [], - [AC_MSG_ERROR([please install libx11-dev or libX11-devel])]) +AC_PATH_XTRA +if test "x$no_x" == "xyes"; then + AC_MSG_ERROR([please install libx11-dev or libX11-devel]) +fi + +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $X_CFLAGS" + +# checking for Xfixes AC_CHECK_HEADER([X11/extensions/Xfixes.h], [], [AC_MSG_ERROR([please install libx11-dev and libxfixes-dev or libXfixes-devel])], [#include ]) + +# checking for Xrandr AC_CHECK_HEADER([X11/extensions/Xrandr.h], [], [AC_MSG_ERROR([please install libxrandr-dev or libXrandr-devel])], [#include ]) +CFLAGS="$save_CFLAGS" + libdir="${libdir}/xrdp"; if test "x${prefix}" = "xNONE" ; then sysconfdir="/etc"; diff --git a/genkeymap/Makefile.am b/genkeymap/Makefile.am index aed72512..25767395 100644 --- a/genkeymap/Makefile.am +++ b/genkeymap/Makefile.am @@ -1,9 +1,12 @@ +AM_CFLAGS = $(X_CFLAGS) bin_PROGRAMS = \ xrdp-genkeymap xrdp_genkeymap_SOURCES = genkeymap.c evdev-map.c +xrdp_genkeymap_LDFLAGS = \ + $(X_LIBS) + xrdp_genkeymap_LDADD = \ - -L/usr/X11R6/lib \ - -lX11 + $(X_PRE_LIBS) -lX11 $(X_EXTRA_LIBS) diff --git a/sesman/chansrv/Makefile.am b/sesman/chansrv/Makefile.am index 1a0be24c..45397b73 100644 --- a/sesman/chansrv/Makefile.am +++ b/sesman/chansrv/Makefile.am @@ -40,6 +40,8 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/common \ $(EXTRA_INCLUDES) +AM_CFLAGS = $(X_CFLAGS) + sbin_PROGRAMS = \ xrdp-chansrv @@ -60,10 +62,10 @@ xrdp_chansrv_SOURCES = \ chansrv_common.c xrdp_chansrv_LDFLAGS = \ + $(X_LIBS) \ $(EXTRA_FLAGS) xrdp_chansrv_LDADD = \ - -L/usr/X11R6/lib \ $(top_builddir)/common/libcommon.la \ - -lX11 -lXfixes -lXrandr \ + $(X_PRE_LIBS) -lXfixes -lXrandr -lX11 $(X_EXTRA_LIBS) \ $(EXTRA_LIBS) diff --git a/sesman/tools/Makefile.am b/sesman/tools/Makefile.am index fa4568ef..066039b0 100644 --- a/sesman/tools/Makefile.am +++ b/sesman/tools/Makefile.am @@ -9,6 +9,8 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/sesman/libscp \ -I$(top_srcdir)/sesman +AM_CFLAGS = $(X_CFLAGS) + bin_PROGRAMS = \ xrdp-sesrun \ xrdp-sesadmin \ @@ -46,6 +48,8 @@ xrdp_sesadmin_LDADD = \ $(top_builddir)/common/libcommon.la \ $(top_builddir)/sesman/libscp/libscp.la +xrdp_xcon_LDFLAGS = \ + $(X_LIBS) + xrdp_xcon_LDADD = \ - -L/usr/X11R6/lib \ - -lX11 + $(X_PRE_LIBS) -lX11 $(X_EXTRA_LIBS)