1AC_INIT([Haskell X11 package], [1.4.6], [dons@galois.com], [X11]) 2 3FP_ARG_X11 4 5if test "$enable_x11" = no; then 6 X11_BUILD_PACKAGE=no 7 BUILD_PACKAGE_BOOL=False 8else 9# Safety check: Ensure that we are in the correct source directory. 10AC_CONFIG_SRCDIR([include/HsXlib.h]) 11 12AC_CONFIG_HEADERS([include/HsX11Config.h include/X11_extras_config.h]) 13 14# Check for X11 include paths and libraries 15AC_PATH_XTRA 16 17# AC_PATH_XTRA doesn't actually check that the C compiler can 18# really include the X headers, so double-check here. In particular, 19# this will catch the case of using a mingw32 gcc on a Cygwin system: 20# Cygwin has the X headers & libs installed, but the mingw32 gcc can't 21# use them, and we want to disable the package in this case. 22CPPFLAGS="$CPPFLAGS $X_CFLAGS" 23AC_TRY_CPP([#include <X11/Xlib.h>],,[no_x=yes]) 24 25# If there's some oddball X11 include path, we need it to check there for 26# Xinerama headers. 27if test -n "$x_includes"; then 28 CPPFLAGS="$CPPFLAGS -I$x_includes" 29fi 30 31# Build the package if we found X11 stuff 32if test "$no_x" = yes; then 33 AC_MSG_FAILURE([X11 libraries not found, so X11 package cannot be built]) 34else 35 X11_BUILD_PACKAGE=yes 36 BUILD_PACKAGE_BOOL=True 37fi 38fi 39AC_SUBST([X11_BUILD_PACKAGE]) 40AC_SUBST([BUILD_PACKAGE_BOOL]) 41 42 43# Define CPP variables used in package.conf.in 44if test "$X11_BUILD_PACKAGE" = yes; then 45 46 AC_DEFINE_UNQUOTED(X_CFLAGS, 47 [`echo '' $X_CFLAGS | sed -e 's/-[[^ ]]*/,"&"/g' -e 's/^ *,//'`], 48 [C flags for X11, as a list of string literals.]) 49 50 AC_DEFINE_UNQUOTED(X_LIBS, 51 [`echo '' $X_LIBS | sed -e 's/-[[^ ]]*/,"&"/g' -e 's/^ *,//'`], 52 [Library flags for X11, as a list of string literals.]) 53fi 54 55 56AC_MSG_CHECKING([whether to build Xinerama]) 57AC_ARG_WITH(xinerama, 58 AS_HELP_STRING([--without-xinerama], [do not build Xinerama support]), 59 [], 60 [with_xinerama=yes]) 61AC_MSG_RESULT([$with_xinerama]) 62 63if test "$with_xinerama" = yes; then 64 AC_CHECK_HEADERS([X11/extensions/Xinerama.h], [have_xinerama=yes]) 65 if test "$have_xinerama" = yes; then 66 EXTRA_LIBRARIES="Xinerama Xext" 67 else 68 echo "WARNING: Xinerama headers not found. Building without Xinerama support" 69 fi 70else 71 echo "WARNING: Building without Xinerama support per user request" 72fi 73 74AC_CHECK_HEADERS([X11/extensions/Xrandr.h], [have_xrandr=yes]) 75if ! test "$have_xrandr" = yes; then 76 AC_MSG_ERROR([X11/extensions/Xrandr.h (from libXrandr) is required]) 77fi 78 79AC_CHECK_HEADERS([X11/extensions/scrnsaver.h], [have_xscreensaver=yes]) 80if ! test "$have_xscreensaver" = yes; then 81 AC_MSG_ERROR([X11/extensions/scrnsaver.h (from libXss) is required]) 82fi 83EXTRA_LIBRARIES="Xss $EXTRA_LIBRARIES" 84 85AC_MSG_CHECKING([whether to include X.org keysyms]) 86AC_ARG_WITH(xorg-keysym, 87 AS_HELP_STRING([--without-xorg-keysym], [do not build X.org keysym support]), 88 [], 89 [with_xorg_keysym=yes]) 90AC_MSG_RESULT([$with_xorg_keysym]) 91 92if test "$with_xorg_keysym" = yes; then 93 AC_CHECK_HEADERS([X11/keysym.h], [have_keysym=yes]) 94 if ! test "$have_keysym" = yes; then 95 echo "WARNING: Couldn't find <X11/keysym.h> for X.org keysyms" 96 fi 97 98 AC_CHECK_HEADERS([X11/DECkeysym.h], [have_dec_keysym=yes]) 99 if ! test "$have_dec_keysym" = yes; then 100 echo "WARNING: Couldn't find <X11/DECkeysym.h> for X.org keysyms" 101 fi 102 103 AC_CHECK_HEADERS([X11/Sunkeysym.h], [have_sun_keysym=yes]) 104 if ! test "$have_sun_keysym" = yes; then 105 echo "WARNING: Couldn't find <X11/Sunkeysym.h> for X.org keysyms" 106 fi 107 108 AC_CHECK_HEADERS([X11/ap_keysym.h], [have_ap_keysym=yes]) 109 if ! test "$have_ap_keysym" = yes; then 110 echo "WARNING: Couldn't find <X11/ap_keysym.h> for X.org keysyms" 111 fi 112 113 AC_CHECK_HEADERS([X11/HPkeysym.h], [have_hp_keysym=yes]) 114 if ! test "$have_hp_keysym" = yes; then 115 echo "WARNING: Couldn't find <X11/HPkeysym.h> for X.org keysyms" 116 fi 117 118 AC_CHECK_HEADERS([X11/XF86keysym.h], [have_xf86_keysym=yes]) 119 if ! test "$have_xf86_keysym" = yes; then 120 echo "WARNING: Couldn't find <X11/XF86keysym.h> for X.org keysyms" 121 fi 122 123 AC_CHECK_HEADERS([X11/keysymdef.h], [have_keysymdef=yes]) 124 if ! test "$have_keysymdef" = yes; then 125 echo "WARNING: Couldn't find <X11/keysymdef.h> for X.org keysyms" 126 fi 127 128 AC_CHECK_HEADERS([X11/cursorfont.h], [have_cursorfont=yes]) 129 if ! test "$have_cursorfont" = yes; then 130 AC_MSG_ERROR([X11/cursorfont.h (from libx11) is required]) 131 fi 132fi 133 134 135 136AC_SUBST([EXTRA_LIBRARIES]) 137 138AC_CONFIG_FILES([config.mk X11.buildinfo]) 139AC_OUTPUT 140