configure.ac revision 0568f49b
1bdf0f55dSmrg# 20568f49bSmrg# Copyright © 2019 Thomas Dickey 3bdf0f55dSmrg# Copyright © 2003 Keith Packard, Noah Levitt 4bdf0f55dSmrg# 5bdf0f55dSmrg# Permission to use, copy, modify, distribute, and sell this software and its 6bdf0f55dSmrg# documentation for any purpose is hereby granted without fee, provided that 7bdf0f55dSmrg# the above copyright notice appear in all copies and that both that 8bdf0f55dSmrg# copyright notice and this permission notice appear in supporting 9bdf0f55dSmrg# documentation, and that the name of Keith Packard not be used in 10bdf0f55dSmrg# advertising or publicity pertaining to distribution of the software without 11bdf0f55dSmrg# specific, written prior permission. Keith Packard makes no 12bdf0f55dSmrg# representations about the suitability of this software for any purpose. It 13bdf0f55dSmrg# is provided "as is" without express or implied warranty. 14bdf0f55dSmrg# 15bdf0f55dSmrg# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 16bdf0f55dSmrg# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 17bdf0f55dSmrg# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR 18bdf0f55dSmrg# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 19bdf0f55dSmrg# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 20bdf0f55dSmrg# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 21bdf0f55dSmrg# PERFORMANCE OF THIS SOFTWARE. 22bdf0f55dSmrg# 23bdf0f55dSmrg 24bdf0f55dSmrg# Initialize Autoconf 25249c3046SmrgAC_PREREQ([2.60]) 260568f49bSmrgAC_INIT([libXt], [1.2.0], 270568f49bSmrg [https://gitlab.freedesktop.org/xorg/lib/libXt/issues], [libXt]) 28bdf0f55dSmrgAC_CONFIG_SRCDIR([Makefile.am]) 29bdf0f55dSmrgAC_CONFIG_HEADERS([config.h]) 30249c3046SmrgAC_CONFIG_MACRO_DIR([m4]) 31bdf0f55dSmrg 32bdf0f55dSmrg# Initialize Automake 331477040fSmrgAM_INIT_AUTOMAKE([foreign dist-bzip2]) 34444c061aSmrg 35bdf0f55dSmrg# Initialize libtool 36bdf0f55dSmrgAC_PROG_LIBTOOL 37bdf0f55dSmrg 389e7bcd65Smrg# Require X.Org macros 1.13 or later for XORG_ENABLE_UNIT_TESTS 391477040fSmrgm4_ifndef([XORG_MACROS_VERSION], 400568f49bSmrg [m4_fatal([must install xorg-macros 1.13 or later before running autoconf/autogen])]) 419e7bcd65SmrgXORG_MACROS_VERSION(1.13) 421477040fSmrgXORG_DEFAULT_OPTIONS 43bdf0f55dSmrgXORG_CHECK_MALLOC_ZERO 449e7bcd65SmrgXORG_ENABLE_SPECS 459e7bcd65SmrgXORG_WITH_XMLTO(0.0.20) 469e7bcd65SmrgXORG_WITH_FOP 479e7bcd65SmrgXORG_WITH_XSLTPROC 489e7bcd65SmrgXORG_CHECK_SGML_DOCTOOLS(1.01) 499e7bcd65SmrgXORG_PROG_RAWCPP 509e7bcd65SmrgXORG_WITH_PERL 519e7bcd65Smrg 52444c061aSmrg 53bdf0f55dSmrg# Checks for header files. 54bdf0f55dSmrgAC_CHECK_HEADER([alloca.h], AC_DEFINE(INCLUDE_ALLOCA_H, 1, [Define to 1 if Xalloca.h should include <alloca.h>])) 55bdf0f55dSmrg 56bdf0f55dSmrg# Obtain compiler/linker options for depedencies 57bdf0f55dSmrgPKG_CHECK_MODULES(XT, sm ice x11 xproto kbproto) 582265a131Smrg 59bdf0f55dSmrg# Set-up variables to use build machine compiler when cross-compiling 602265a131Smrgif test x"$CC_FOR_BUILD" = x; then 612265a131Smrg if test x"$cross_compiling" = xyes; then 622265a131Smrg AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc) 632265a131Smrg else 640568f49bSmrg CC_FOR_BUILD="$CC" 652265a131Smrg fi 662265a131Smrgfi 670568f49bSmrgif test x"$cross_compiling" != xyes; then 680568f49bSmrg : ${CFLAGS_FOR_BUILD=${CFLAGS}} 690568f49bSmrg : ${LDFLAGS_FOR_BUILD=${LDFLAGS}} 700568f49bSmrgfi 712265a131SmrgAC_SUBST([CC_FOR_BUILD]) 72339a7c43SmrgDEFAULT_CPPFLAGS_FOR_BUILD="${CPPFLAGS}" 73339a7c43SmrgAC_CHECK_FUNC(asprintf, 74339a7c43Smrg [DEFAULT_CPPFLAGS_FOR_BUILD="${DEFAULT_CPPFLAGS_FOR_BUILD} -DHAVE_ASPRINTF -D_GNU_SOURCE"]) 75339a7c43SmrgCPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${DEFAULT_CPPFLAGS_FOR_BUILD}} 76339a7c43SmrgAC_SUBST(CPPFLAGS_FOR_BUILD) 77339a7c43SmrgDEFAULT_CFLAGS_FOR_BUILD="${CFLAGS} ${CWARNFLAGS}" 782ae83157SmrgAC_SUBST(CFLAGS_FOR_BUILD) 792ae83157SmrgAC_SUBST(LDFLAGS_FOR_BUILD) 80444c061aSmrg 81444c061aSmrg# Map function checks to old Imake #defines 822265a131Smrgcase $host_os in 83bdf0f55dSmrg # darwin through Snow Leopard has poll() but can't be used to poll character devices. 84bdf0f55dSmrg darwin@<:@789@:>@*|darwin10*) ;; 85bdf0f55dSmrg darwin*) 86bdf0f55dSmrg _ac_xorg_macosx_version_min="" 87bdf0f55dSmrg if echo $CPPFLAGS $CFLAGS | grep -q mmacosx-version-min ; then 88bdf0f55dSmrg _ac_xorg_macosx_version_min=`echo $CPPFLAGS $CFLAGS | sed 's/^.*-mmacosx-version-min=\(@<:@^ @:>@*\).*$/\1/'` 89bdf0f55dSmrg else 90bdf0f55dSmrg _ac_xorg_macosx_version_min=$MACOSX_DEPLOYMENT_TARGET 91bdf0f55dSmrg fi 92bdf0f55dSmrg case $_ac_xorg_macosx_version_min in 93bdf0f55dSmrg 10.@<:@0123456@:>@|10.@<:@0123456@:>@.*) ;; 94bdf0f55dSmrg *) 95bdf0f55dSmrg AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], ) 96bdf0f55dSmrg ;; 97bdf0f55dSmrg esac 98bdf0f55dSmrg unset _ac_xorg_macosx_version_min 99bdf0f55dSmrg ;; 1002265a131Smrg *) 101bdf0f55dSmrg AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], ) 1022265a131Smrg ;; 1032265a131Smrgesac 1042265a131Smrg 1059e7bcd65Smrg# Link with winsock if mingw target 1069e7bcd65Smrgcase $host_os in 1079e7bcd65Smrg *mingw*) 1089e7bcd65Smrg AC_HAVE_LIBRARY(ws2_32) 1099e7bcd65Smrg ;; 1109e7bcd65Smrg *) 1119e7bcd65Smrg ;; 1129e7bcd65Smrgesac 113444c061aSmrg 114444c061aSmrg# Options 1150568f49bSmrgAC_MSG_CHECKING(if XKB support is wanted) 116bdf0f55dSmrgAC_ARG_ENABLE(xkb, AS_HELP_STRING([--disable-xkb], [Disable XKB support]), 117444c061aSmrg XKB="$enableval", XKB="yes") 1180568f49bSmrgAC_MSG_RESULT($XKB) 119444c061aSmrgif test "x$XKB" = "xyes" ; then 120444c061aSmrg AC_DEFINE(XKB, 1, [Define to 1 to use XKB for keysym resolution.]) 121444c061aSmrgfi 122444c061aSmrg 1230568f49bSmrgAC_MSG_CHECKING(if C const-support is wanted) 1240568f49bSmrgAC_ARG_ENABLE(const, AS_HELP_STRING([--disable-const], [Disable const-support]), 1250568f49bSmrg USE_CONST="$enableval", USE_CONST="yes") 1260568f49bSmrgAC_MSG_RESULT($USE_CONST) 1270568f49bSmrgif test "x$USE_CONST" = "xyes" ; then 1280568f49bSmrg AC_DEFINE(_CONST_X_STRING, 1, [Define to 1 to use standard C const feature.]) 1290568f49bSmrgfi 1300568f49bSmrg 1310568f49bSmrgAC_MSG_CHECKING(if geo-tattler traces are wanted) 1320568f49bSmrgAC_ARG_ENABLE(geo-tattler, AS_HELP_STRING([--enable-geo-tattler], [Enable geo-tattler traces]), 1330568f49bSmrg GEO_TATTLER="$enableval", GEO_TATTLER="no") 1340568f49bSmrgAC_MSG_RESULT($GEO_TATTLER) 1350568f49bSmrgif test "x$GEO_TATTLER" = "xyes" ; then 1360568f49bSmrg AC_DEFINE(XT_GEO_TATTLER, 1, [Define to 1 to enable geo-tattler traces.]) 1370568f49bSmrgfi 1380568f49bSmrg 1399e7bcd65Smrg# --enable-unit-tests 1409e7bcd65SmrgXORG_ENABLE_UNIT_TESTS 1419e7bcd65SmrgXORG_WITH_GLIB([2.16]) 1429e7bcd65Smrg 1439e7bcd65Smrg# Memory checking support 1449e7bcd65Smrgcase $host_os in 1450568f49bSmrg solaris*) 1460568f49bSmrg AC_CHECK_LIB([umem], [umem_alloc], 1470568f49bSmrg [MALLOC_DEBUG_ENV='LD_PRELOAD=libumem.so UMEM_DEBUG=default']) 1480568f49bSmrg ;; 1490568f49bSmrg *-gnu*) # GNU libc - Value is used as a single byte bit pattern, 1500568f49bSmrg # both directly and inverted, so should not be 0 or 255. 1510568f49bSmrg MALLOC_DEBUG_ENV='MALLOC_PERTURB_=15' 1520568f49bSmrg ;; 1530568f49bSmrg *bsd*|darwin*) 1540568f49bSmrg MALLOC_DEBUG_ENV='MallocPreScribble=1 MallocScribble=1' 1550568f49bSmrg ;; 1569e7bcd65Smrgesac 1570568f49bSmrgAC_MSG_CHECKING(for definitions to enable memory-checking support) 1580568f49bSmrgAC_MSG_RESULT(${MALLOC_DEBUG_ENV:-none}) 1599e7bcd65SmrgAC_SUBST([MALLOC_DEBUG_ENV]) 1609e7bcd65Smrg 161444c061aSmrg# Replaces XFileSearchPathDefault from Imake configs 162444c061aSmrgXFILESEARCHPATHDEFAULT='$(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' 163444c061aSmrg 1640568f49bSmrgAC_MSG_CHECKING(for X files search path) 165444c061aSmrgAC_ARG_WITH(xfile-search-path, 166bdf0f55dSmrg AS_HELP_STRING([--with-xfile-search-path=<path>], 167444c061aSmrg [Set path to search for app-defaults and other files]), 168444c061aSmrg [XFILESEARCHPATHDEFAULT="$withval"], []) 1690568f49bSmrgAC_MSG_RESULT(${XFILESEARCHPATHDEFAULT:-none}) 170444c061aSmrgAC_SUBST([XFILESEARCHPATHDEFAULT]) 171444c061aSmrg 1720568f49bSmrgAC_MSG_CHECKING(for X app-defaults directory) 173444c061aSmrgAC_ARG_WITH(appdefaultdir, 174bdf0f55dSmrg AS_HELP_STRING([--with-appdefaultdir=<path>], 175444c061aSmrg [Set app-default directory (default: ${datadir}/X11/app-defaults)]), 176444c061aSmrg [appdefaultdir="$withval"], 177444c061aSmrg [appdefaultdir=${datadir}/X11/app-defaults]) 1780568f49bSmrgAC_MSG_RESULT($appdefaultdir) 1792ae83157SmrgAX_DEFINE_DIR([appdefaultdir], [appdefaultdir], [app default data directory]) 180444c061aSmrg 181444c061aSmrg# Replacement for Imake ToolkitStringsABIOptions, controls string tables 182444c061aSmrg# generated by util/string.list in StringDefs.h & Shell.h 1830568f49bSmrgAC_MSG_CHECKING(for ABI options) 184444c061aSmrgcase $host_os in 185444c061aSmrg solaris*) 1862265a131Smrg # Solaris uses -intelabi even on SPARC 1870568f49bSmrg STRINGSABIOPTIONS="-intelabi -solarisabinames" 188444c061aSmrg ;; 189444c061aSmrg sco* | svr4*) 190444c061aSmrg case $host_cpu in 191444c061aSmrg i*86) STRINGSABIOPTIONS="-intelabi" ;; 192444c061aSmrg *) STRINGSABIOPTIONS="" ;; 193444c061aSmrg esac 194444c061aSmrg ;; 195444c061aSmrgesac 1960568f49bSmrgAC_MSG_RESULT(${STRINGSABIOPTIONS:-none}) 197444c061aSmrgAC_SUBST(STRINGSABIOPTIONS) 198444c061aSmrg 1999e7bcd65SmrgERRORDBDIR=${datadir}/X11 2009e7bcd65SmrgAC_SUBST(ERRORDBDIR) 2019e7bcd65Smrg 202bdf0f55dSmrgAC_CONFIG_FILES([Makefile 203bdf0f55dSmrg src/Makefile 204bdf0f55dSmrg util/Makefile 205bdf0f55dSmrg include/Makefile 206bdf0f55dSmrg man/Makefile 207bdf0f55dSmrg specs/Makefile 2080568f49bSmrg specs/libXt.ent 2099e7bcd65Smrg test/Makefile 210bdf0f55dSmrg xt.pc]) 211bdf0f55dSmrgAC_OUTPUT 212