summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in59
1 files changed, 39 insertions, 20 deletions
diff --git a/configure.in b/configure.in
index 927fe7c..eae4ac3 100644
--- a/configure.in
+++ b/configure.in
@@ -42,23 +42,36 @@ AC_ARG_WITH(xterm, [ --with-xterm=PROG set the x terminal emulator used b
term_prog=$withval, term_prog="xterm")
AC_DEFINE_UNQUOTED(TERM_PROG, "$term_prog", X terminal emulator to use)
-dnl Configure Xft. If it's found then use it unless explicitely disabled
-PKG_CHECK_MODULES([XFT], [xft],,[noop=noop])
-
-if test -z "$XFT_PKG_ERRORS"; then
+XFT_CFLAGS=
+XFT_LIBS=
+AC_ARG_WITH(xft, AC_HELP_STRING([--without-xft], [Don't use the Xft library even if available]),
+ xft=$withval, xft=default)
+if test "x$xft" != "xno"; then
+ dnl Configure Xft.
+ PKG_CHECK_MODULES([XFT], [xft],,[noop=noop])
AC_MSG_CHECKING(whether to use Xft)
- AC_ARG_WITH(xft, AC_HELP_STRING([--without-xft], [Don't use the Xft library even if available]),
- xft=$withval, xft=yes)
-
- if test "x$xft" != "xno"; then
+ echo "pkg_failed is $pkg_failed" >&5
+dnl pkg_failed can be yes, no or untried (if there is no pkg-config or that does not work).
+ if test "$pkg_failed" = "no" ; then
AC_DEFINE_UNQUOTED(USE_XFT_FONT, 1, [Define this to use Xft])
- CFLAGS="$CFLAGS $XFT_CFLAGS"
- LDFLAGS="$LDFLAGS $XFT_LIBS"
AC_MSG_RESULT(yes)
+ elif test "x$xft" != "xdefault" ; then
+dnl if explicitly requested but not found, bail out:
+ AC_MSG_RESULT(no)
+ if test "$pkg_failed" = "untried" ; then
+ AC_MSG_ERROR([Not Xft library found (this needs a working pkg-config)!])
+ else
+ AC_MSG_ERROR([No Xft library found!])
+ fi
else
- AC_MSG_RESULT(no)
+ AC_MSG_RESULT(no)
fi
+else
+ AC_MSG_CHECKING(whether to use Xft)
+ AC_MSG_RESULT(no)
fi
+AC_SUBST(XFT_CFLAGS)
+AC_SUBST(XFT_LIBS)
dnl Checks for programs.
AC_CHECK_TOOL(CC, gcc)
@@ -91,28 +104,34 @@ AC_ARG_ENABLE(history,
check_for_libhistory=no
fi],[check_for_libhistory=yes])
+HISTORY_LIBS=""
if test x$check_for_libhistory = xyes ; then
AC_CHECK_HEADERS([readline/history.h],
AC_CHECK_LIB(history, add_history,
- [LIBS="$LIBS -lhistory"
+ [HISTORY_LIBS="-lhistory"
AC_DEFINE_UNQUOTED(HAVE_HISTORY, 1, Define this to enable history)],
AC_MSG_WARN([*** Can't find History lib. Install readline dev libs for history.])),
AC_MSG_WARN([*** Can't find History header. Install readline dev libs for history.]))
fi
+AC_SUBST(HISTORY_LIBS)
-LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS $X_EXTRA_LIBS"
-CFLAGS="$CFLAGS $X_CFLAGS"
-
-AC_CHECK_LIB(X11, XOpenDisplay,,
- AC_MSG_ERROR([*** Can't find libX11]))
+AC_CHECK_LIB(X11, XOpenDisplay, [X_LIBS="-lX11 $X_LIBS"],
+ AC_MSG_ERROR([*** Can't find libX11]),$X_LIBS $X_EXTRA_LIBS)
+mysavedCPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $X_CFLAGS"
AC_CHECK_HEADERS([X11/extensions/Xinerama.h], [], [], [
#include <X11/Xlib.h>
])
-AC_CHECK_LIB(Xext, XMissingExtension, [LIBS="-lXext $LIBS"],, $CFLAGS $LDFLAGS)
-AC_CHECK_LIB(Xinerama, XineramaQueryScreens, [LIBS="-lXinerama $LIBS"; AC_DEFINE(HAVE_LIBXINERAMA,1,[Xinerama])],, $CFLAGS $LDFLAGS)
-AC_CHECK_LIB(Xtst, XTestFakeButtonEvent, [LIBS="-lXtst $LIBS"; AC_DEFINE(HAVE_LIBXTST,1,[Xtst])],, $CFLAGS $LDFLAGS)
+CPPFLAGS="$mysavedCPPFLAGS"
+
+AC_CHECK_LIB(Xext, XMissingExtension, [X_LIBS="-lXext $X_LIBS"],,$X_LIBS $X_EXTRA_LIBS)
+AC_CHECK_LIB(Xinerama, XineramaQueryScreens, [X_LIBS="-lXinerama $X_LIBS"; AC_DEFINE(HAVE_LIBXINERAMA,1,[Xinerama])],,$X_LIBS $X_EXTRA_LIBS)
+AC_CHECK_LIB(Xtst, XTestFakeButtonEvent, [X_LIBS="-lXtst $X_LIBS"; AC_DEFINE(HAVE_LIBXTST,1,[Xtst])],,$X_LIBS $X_EXTRA_LIBS)
+AC_SUBST(X_LIBS)
+AC_SUBST(X_EXTRA_LIBS)
+AC_SUBST(X_CFLAGS)
dnl Check for electric fence library
dnl AC_CHECK_LIB(efence,malloc,,)