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