-AC_PATH_X
-AC_CHECK_HEADERS([X11/Xlib.h], [], [X11_MISSING=yes])
-AC_CHECK_LIB([X11], [XOpenDisplay], [X11_LIBS="-lX11"], [], [[-L$x_libraries]])
-AC_CHECK_LIB([Xext], [XdbeQueryExtension], [
- X11_LIBS="$X11_LIBS -lXext"
- AC_DEFINE(HAVE_LIBXEXT, 1, [Define if you have libXext])
- ], [], [[-L$x_libraries $X11_LIBS]])
- if test "x$X11_MISSING" = xyes; then
- AC_MSG_ERROR([something went wrong when checking for X11, you're probably missing headers or it's not installed, either re-run configure with --disable-x11, or fix this])
- fi
- AC_DEFINE(X11, 1, [Define if you want to use X11])
- AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
-fi
-dnl AC_PATH_X if test $have_x != "yes"; then
-dnl echo "Sorry, X is very much needed"
-dnl exit 1
-dnl fi
-dnl AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
-
-AC_CHECK_LIB([X11], [XOpenDisplay], [X11_LIBS="-lX11"], [], [[-L$x_libraries]])
-AC_CHECK_LIB([Xext], [XdbeQueryExtension], [
- X11_LIBS="$X11_LIBS -lXext"
- AC_DEFINE(HAVE_LIBXEXT, 1, [Define if you have libXext])
- ], [], [[-L$x_libraries $X11_LIBS]])
-
-if test "$x_libraries" != ""; then
- LDFLAGS="$LDFLAGS -L$x_libraries"
+ AC_PATH_X
+ AC_PATH_XTRA
+ CFLAGS="$CFLAGS $X_CFLAGS"
+ LIBS="$LIBS $X_LIBS $X11_LIBS"
+ LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
+ if test "x$X_DISPLAY_MISSING" = xyes; then
+ AC_MSG_ERROR([something went wrong when checking for X11, you're probably missing headers or it's not installed, either re-run configure with --disable-x11, or fix this])
+ fi
+ AC_DEFINE(X11, 1, [Define if you want to use X11])
+ AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
+ if test $dah != "no"; then
+ AC_DEFINE(DOUBLE_BUFFER, 1, [Define if you want support for the DBE extension])
+ AC_CHECK_LIB(Xext, XdbeQueryExtension, [AC_DEFINE([HAVE_XDBE], 1, [Xdbe]) LIBS="$LIBS -lXext"],
+ [AC_MSG_ERROR([something went wrong when checking for Xdbe (double buffer extension)])])
+ fi