configure.ac revision 9e7bcd65
1# 2# Copyright © 2003 Keith Packard, Noah Levitt 3# 4# Permission to use, copy, modify, distribute, and sell this software and its 5# documentation for any purpose is hereby granted without fee, provided that 6# the above copyright notice appear in all copies and that both that 7# copyright notice and this permission notice appear in supporting 8# documentation, and that the name of Keith Packard not be used in 9# advertising or publicity pertaining to distribution of the software without 10# specific, written prior permission. Keith Packard makes no 11# representations about the suitability of this software for any purpose. It 12# is provided "as is" without express or implied warranty. 13# 14# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 15# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 16# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR 17# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 18# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 20# PERFORMANCE OF THIS SOFTWARE. 21# 22 23# Initialize Autoconf 24AC_PREREQ([2.60]) 25AC_INIT([libXt], [1.1.4], 26 [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXt]) 27AC_CONFIG_SRCDIR([Makefile.am]) 28AC_CONFIG_HEADERS([config.h]) 29AC_CONFIG_MACRO_DIR([m4]) 30 31# Initialize Automake 32AM_INIT_AUTOMAKE([foreign dist-bzip2]) 33 34# Initialize libtool 35AC_PROG_LIBTOOL 36 37# Require X.Org macros 1.13 or later for XORG_ENABLE_UNIT_TESTS 38m4_ifndef([XORG_MACROS_VERSION], 39 [m4_fatal([must install xorg-macros 1.13 or later before running autoconf/autogen])]) 40XORG_MACROS_VERSION(1.13) 41XORG_DEFAULT_OPTIONS 42XORG_CHECK_MALLOC_ZERO 43XORG_ENABLE_SPECS 44XORG_WITH_XMLTO(0.0.20) 45XORG_WITH_FOP 46XORG_WITH_XSLTPROC 47XORG_CHECK_SGML_DOCTOOLS(1.01) 48XORG_PROG_RAWCPP 49XORG_WITH_PERL 50 51 52# Checks for header files. 53AC_CHECK_HEADER([alloca.h], AC_DEFINE(INCLUDE_ALLOCA_H, 1, [Define to 1 if Xalloca.h should include <alloca.h>])) 54 55# Obtain compiler/linker options for depedencies 56PKG_CHECK_MODULES(XT, sm ice x11 xproto kbproto) 57 58# Set-up variables to use build machine compiler when cross-compiling 59if test x"$CC_FOR_BUILD" = x; then 60 if test x"$cross_compiling" = xyes; then 61 AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc) 62 else 63 CC_FOR_BUILD="$CC" 64 fi 65fi 66AC_SUBST([CC_FOR_BUILD]) 67CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}} 68AC_SUBST(CFLAGS_FOR_BUILD) 69LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}} 70AC_SUBST(LDFLAGS_FOR_BUILD) 71 72# Map function checks to old Imake #defines 73case $host_os in 74 # darwin through Snow Leopard has poll() but can't be used to poll character devices. 75 darwin@<:@789@:>@*|darwin10*) ;; 76 darwin*) 77 _ac_xorg_macosx_version_min="" 78 if echo $CPPFLAGS $CFLAGS | grep -q mmacosx-version-min ; then 79 _ac_xorg_macosx_version_min=`echo $CPPFLAGS $CFLAGS | sed 's/^.*-mmacosx-version-min=\(@<:@^ @:>@*\).*$/\1/'` 80 else 81 _ac_xorg_macosx_version_min=$MACOSX_DEPLOYMENT_TARGET 82 fi 83 case $_ac_xorg_macosx_version_min in 84 10.@<:@0123456@:>@|10.@<:@0123456@:>@.*) ;; 85 *) 86 AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], ) 87 ;; 88 esac 89 unset _ac_xorg_macosx_version_min 90 ;; 91 *) 92 AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], ) 93 ;; 94esac 95 96# Link with winsock if mingw target 97case $host_os in 98 *mingw*) 99 AC_HAVE_LIBRARY(ws2_32) 100 ;; 101 *) 102 ;; 103esac 104 105# Options 106AC_ARG_ENABLE(xkb, AS_HELP_STRING([--disable-xkb], [Disable XKB support]), 107 XKB="$enableval", XKB="yes") 108if test "x$XKB" = "xyes" ; then 109 AC_DEFINE(XKB, 1, [Define to 1 to use XKB for keysym resolution.]) 110fi 111 112# --enable-unit-tests 113XORG_ENABLE_UNIT_TESTS 114XORG_WITH_GLIB([2.16]) 115 116# Memory checking support 117case $host_os in 118 solaris*) 119 AC_CHECK_LIB([umem], [umem_alloc], 120 [MALLOC_DEBUG_ENV='LD_PRELOAD=libumem.so UMEM_DEBUG=default']) 121 ;; 122 *-gnu*) # GNU libc - Value is used as a single byte bit pattern, 123 # both directly and inverted, so should not be 0 or 255. 124 MALLOC_DEBUG_ENV='MALLOC_PERTURB_=15' 125 ;; 126 *bsd*|darwin*) 127 MALLOC_DEBUG_ENV='MallocPreScribble=1 MallocScribble=1' 128 ;; 129esac 130AC_SUBST([MALLOC_DEBUG_ENV]) 131 132# Replaces XFileSearchPathDefault from Imake configs 133XFILESEARCHPATHDEFAULT='$(sysconfdir)/X11/%L/%T/%N%C%S:$(sysconfdir)/X11/%l/%T/%N%C%S:$(sysconfdir)/X11/%T/%N%C%S:$(sysconfdir)/X11/%L/%T/%N%S:$(sysconfdir)/X11/%l/%T/%N%S:$(sysconfdir)/X11/%T/%N%S:$(datadir)/X11/%L/%T/%N%C%S:$(datadir)/X11/%l/%T/%N%C%S:$(datadir)/X11/%T/%N%C%S:$(datadir)/X11/%L/%T/%N%S:$(datadir)/X11/%l/%T/%N%S:$(datadir)/X11/%T/%N%S:$(libdir)/X11/%L/%T/%N%C%S:$(libdir)/X11/%l/%T/%N%C%S:$(libdir)/X11/%T/%N%C%S:$(libdir)/X11/%L/%T/%N%S:$(libdir)/X11/%l/%T/%N%S:$(libdir)/X11/%T/%N%S' 134 135AC_ARG_WITH(xfile-search-path, 136 AS_HELP_STRING([--with-xfile-search-path=<path>], 137 [Set path to search for app-defaults and other files]), 138 [XFILESEARCHPATHDEFAULT="$withval"], []) 139AC_SUBST([XFILESEARCHPATHDEFAULT]) 140 141AC_ARG_WITH(appdefaultdir, 142 AS_HELP_STRING([--with-appdefaultdir=<path>], 143 [Set app-default directory (default: ${datadir}/X11/app-defaults)]), 144 [appdefaultdir="$withval"], 145 [appdefaultdir=${datadir}/X11/app-defaults]) 146AX_DEFINE_DIR([appdefaultdir], [appdefaultdir], [app default data directory]) 147 148# Replacement for Imake ToolkitStringsABIOptions, controls string tables 149# generated by util/string.list in StringDefs.h & Shell.h 150case $host_os in 151 solaris*) 152 # Solaris uses -intelabi even on SPARC 153 STRINGSABIOPTIONS="-intelabi -solarisabinames" 154 ;; 155 sco* | svr4*) 156 case $host_cpu in 157 i*86) STRINGSABIOPTIONS="-intelabi" ;; 158 *) STRINGSABIOPTIONS="" ;; 159 esac 160 ;; 161esac 162AC_SUBST(STRINGSABIOPTIONS) 163 164ERRORDBDIR=${datadir}/X11 165AC_SUBST(ERRORDBDIR) 166 167case $host_os in 168 darwin*) 169 OS_CFLAGS="-Wl,-flat_namespace" 170 ;; 171 *) 172 OS_CFLAGS= 173 ;; 174esac 175 176XT_CFLAGS="$XT_CFLAGS $OS_CFLAGS" 177 178AC_CONFIG_FILES([Makefile 179 src/Makefile 180 util/Makefile 181 include/Makefile 182 man/Makefile 183 specs/Makefile 184 test/Makefile 185 xt.pc]) 186AC_OUTPUT 187