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.
ulab-next-nosound
Pavel Roskin 9 years ago
parent 334eeb970a
commit 00e70a5c54

@ -199,16 +199,26 @@ else
fi fi
fi fi
# checking for Xlib, Xfixes AC_PATH_XTRA
AC_CHECK_HEADER([X11/Xlib.h], [], if test "x$no_x" == "xyes"; then
[AC_MSG_ERROR([please install libx11-dev or libX11-devel])]) 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_CHECK_HEADER([X11/extensions/Xfixes.h], [],
[AC_MSG_ERROR([please install libx11-dev and libxfixes-dev or libXfixes-devel])], [AC_MSG_ERROR([please install libx11-dev and libxfixes-dev or libXfixes-devel])],
[#include <X11/Xlib.h>]) [#include <X11/Xlib.h>])
# checking for Xrandr
AC_CHECK_HEADER([X11/extensions/Xrandr.h], [], AC_CHECK_HEADER([X11/extensions/Xrandr.h], [],
[AC_MSG_ERROR([please install libxrandr-dev or libXrandr-devel])], [AC_MSG_ERROR([please install libxrandr-dev or libXrandr-devel])],
[#include <X11/Xlib.h>]) [#include <X11/Xlib.h>])
CFLAGS="$save_CFLAGS"
libdir="${libdir}/xrdp"; libdir="${libdir}/xrdp";
if test "x${prefix}" = "xNONE" ; then if test "x${prefix}" = "xNONE" ; then
sysconfdir="/etc"; sysconfdir="/etc";

@ -1,9 +1,12 @@
AM_CFLAGS = $(X_CFLAGS)
bin_PROGRAMS = \ bin_PROGRAMS = \
xrdp-genkeymap xrdp-genkeymap
xrdp_genkeymap_SOURCES = genkeymap.c evdev-map.c xrdp_genkeymap_SOURCES = genkeymap.c evdev-map.c
xrdp_genkeymap_LDFLAGS = \
$(X_LIBS)
xrdp_genkeymap_LDADD = \ xrdp_genkeymap_LDADD = \
-L/usr/X11R6/lib \ $(X_PRE_LIBS) -lX11 $(X_EXTRA_LIBS)
-lX11

@ -40,6 +40,8 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/common \ -I$(top_srcdir)/common \
$(EXTRA_INCLUDES) $(EXTRA_INCLUDES)
AM_CFLAGS = $(X_CFLAGS)
sbin_PROGRAMS = \ sbin_PROGRAMS = \
xrdp-chansrv xrdp-chansrv
@ -60,10 +62,10 @@ xrdp_chansrv_SOURCES = \
chansrv_common.c chansrv_common.c
xrdp_chansrv_LDFLAGS = \ xrdp_chansrv_LDFLAGS = \
$(X_LIBS) \
$(EXTRA_FLAGS) $(EXTRA_FLAGS)
xrdp_chansrv_LDADD = \ xrdp_chansrv_LDADD = \
-L/usr/X11R6/lib \
$(top_builddir)/common/libcommon.la \ $(top_builddir)/common/libcommon.la \
-lX11 -lXfixes -lXrandr \ $(X_PRE_LIBS) -lXfixes -lXrandr -lX11 $(X_EXTRA_LIBS) \
$(EXTRA_LIBS) $(EXTRA_LIBS)

@ -9,6 +9,8 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/sesman/libscp \ -I$(top_srcdir)/sesman/libscp \
-I$(top_srcdir)/sesman -I$(top_srcdir)/sesman
AM_CFLAGS = $(X_CFLAGS)
bin_PROGRAMS = \ bin_PROGRAMS = \
xrdp-sesrun \ xrdp-sesrun \
xrdp-sesadmin \ xrdp-sesadmin \
@ -46,6 +48,8 @@ xrdp_sesadmin_LDADD = \
$(top_builddir)/common/libcommon.la \ $(top_builddir)/common/libcommon.la \
$(top_builddir)/sesman/libscp/libscp.la $(top_builddir)/sesman/libscp/libscp.la
xrdp_xcon_LDFLAGS = \
$(X_LIBS)
xrdp_xcon_LDADD = \ xrdp_xcon_LDADD = \
-L/usr/X11R6/lib \ $(X_PRE_LIBS) -lX11 $(X_EXTRA_LIBS)
-lX11

Loading…
Cancel
Save