Home | History | Annotate | Line # | Download | only in dist
      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
     25 AC_PREREQ([2.70])
     26 AC_INIT([libXt], [1.3.1],
     27 	[https://gitlab.freedesktop.org/xorg/lib/libxt/-/issues/], [libXt])
     28 AC_CONFIG_SRCDIR([Makefile.am])
     29 AC_CONFIG_HEADERS([config.h])
     30 AC_CONFIG_MACRO_DIR([m4])
     31 
     32 # Set common system defines for POSIX extensions, such as _GNU_SOURCE
     33 # Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL)
     34 # to avoid autoconf errors.
     35 AC_USE_SYSTEM_EXTENSIONS
     36 
     37 # Initialize Automake
     38 AM_INIT_AUTOMAKE([foreign dist-xz])
     39 
     40 # Initialize libtool
     41 LT_INIT
     42 
     43 # Require X.Org macros 1.16 or later for XORG_MEMORY_CHECK_FLAGS
     44 m4_ifndef([XORG_MACROS_VERSION],
     45 	  [m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])])
     46 XORG_MACROS_VERSION(1.16)
     47 XORG_DEFAULT_OPTIONS
     48 XORG_CHECK_MALLOC_ZERO
     49 XORG_ENABLE_SPECS
     50 XORG_WITH_XMLTO(0.0.20)
     51 XORG_WITH_FOP
     52 XORG_WITH_XSLTPROC
     53 XORG_CHECK_SGML_DOCTOOLS(1.01)
     54 XORG_PROG_RAWCPP
     55 XORG_WITH_PERL
     56 
     57 
     58 # Checks for header files.
     59 AC_CHECK_HEADER([alloca.h], AC_DEFINE(INCLUDE_ALLOCA_H, 1, [Define to 1 if Xalloca.h should include <alloca.h>]))
     60 
     61 # Checks for library functions.
     62 AC_CHECK_FUNCS([reallocarray])
     63 
     64 # Obtain compiler/linker options for dependencies
     65 PKG_CHECK_MODULES(XT, sm ice x11 xproto kbproto)
     66 
     67 # Set-up variables to use build machine compiler when cross-compiling
     68 if test x"$CC_FOR_BUILD" = x; then
     69 	if test x"$cross_compiling" = xyes; then
     70 		AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
     71 	else
     72 		CC_FOR_BUILD="$CC"
     73 	fi
     74 fi
     75 if test x"$cross_compiling" != xyes; then
     76        : ${CFLAGS_FOR_BUILD=${CFLAGS}}
     77        : ${LDFLAGS_FOR_BUILD=${LDFLAGS}}
     78 fi
     79 AC_SUBST([CC_FOR_BUILD])
     80 DEFAULT_CPPFLAGS_FOR_BUILD="${CPPFLAGS}"
     81 AC_CHECK_FUNC(asprintf,
     82   [DEFAULT_CPPFLAGS_FOR_BUILD="${DEFAULT_CPPFLAGS_FOR_BUILD} -DHAVE_ASPRINTF -D_GNU_SOURCE"])
     83 CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${DEFAULT_CPPFLAGS_FOR_BUILD}}
     84 AC_SUBST(CPPFLAGS_FOR_BUILD)
     85 DEFAULT_CFLAGS_FOR_BUILD="${CFLAGS} ${CWARNFLAGS}"
     86 AC_SUBST(CFLAGS_FOR_BUILD)
     87 AC_SUBST(LDFLAGS_FOR_BUILD)
     88 
     89 # Map function checks to old Imake #defines
     90 case $host_os in
     91 	# darwin through Snow Leopard has poll() but can't be used to poll character devices.
     92 	darwin@<:@789@:>@*|darwin10*) ;;
     93 	darwin*)
     94 		_ac_xorg_macosx_version_min=""
     95 		if echo $CPPFLAGS $CFLAGS | grep -q mmacosx-version-min ; then
     96 			_ac_xorg_macosx_version_min=`echo $CPPFLAGS $CFLAGS | sed 's/^.*-mmacosx-version-min=\(@<:@^ @:>@*\).*$/\1/'`
     97 		else
     98 			_ac_xorg_macosx_version_min=$MACOSX_DEPLOYMENT_TARGET
     99 		fi
    100 		case $_ac_xorg_macosx_version_min in
    101 			10.@<:@0123456@:>@|10.@<:@0123456@:>@.*) ;;
    102 			*)
    103 				AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
    104 			;;
    105 		esac
    106 		unset _ac_xorg_macosx_version_min
    107 		;;
    108 	*)
    109 		AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
    110 	;;
    111 esac
    112 
    113 # Link with winsock if mingw target
    114 case $host_os in
    115 	*mingw*)
    116 		AC_CHECK_LIB([ws2_32],[main])
    117 	;;
    118 	*)
    119 	;;
    120 esac
    121 
    122 # Options
    123 AC_MSG_CHECKING(if XKB support is wanted)
    124 AC_ARG_ENABLE(xkb, AS_HELP_STRING([--disable-xkb], [Disable XKB support]),
    125 	XKB="$enableval", XKB="yes")
    126 AC_MSG_RESULT($XKB)
    127 if test "x$XKB" = "xyes" ; then
    128 	AC_DEFINE(XKB, 1, [Define to 1 to use XKB for keysym resolution.])
    129 fi
    130 
    131 AC_MSG_CHECKING(if C const-support is wanted)
    132 AC_ARG_ENABLE(const, AS_HELP_STRING([--disable-const], [Disable const-support]),
    133 	USE_CONST="$enableval", USE_CONST="yes")
    134 AC_MSG_RESULT($USE_CONST)
    135 if test "x$USE_CONST" = "xyes" ; then
    136 	AC_DEFINE(_CONST_X_STRING, 1, [Define to 1 to use standard C const feature.])
    137 fi
    138 
    139 AC_MSG_CHECKING(if geo-tattler traces are wanted)
    140 AC_ARG_ENABLE(geo-tattler, AS_HELP_STRING([--enable-geo-tattler], [Enable geo-tattler traces]),
    141 	GEO_TATTLER="$enableval", GEO_TATTLER="no")
    142 AC_MSG_RESULT($GEO_TATTLER)
    143 if test "x$GEO_TATTLER" = "xyes" ; then
    144 	AC_DEFINE(XT_GEO_TATTLER, 1, [Define to 1 to enable geo-tattler traces.])
    145 fi
    146 
    147 # --enable-unit-tests
    148 XORG_ENABLE_UNIT_TESTS
    149 XORG_WITH_GLIB([2.40])
    150 XORG_MEMORY_CHECK_FLAGS
    151 if test "x$enable_unit_tests" != "xno" ; then
    152 	AC_CHECK_FUNCS([malloc_usable_size])
    153 	AC_CHECK_HEADERS([malloc.h])
    154 fi
    155 
    156 # Replaces XFileSearchPathDefault from Imake configs
    157 XFILESEARCHPATHDEFAULT='$(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'
    158 
    159 AC_MSG_CHECKING(for X files search path)
    160 AC_ARG_WITH(xfile-search-path,
    161 	AS_HELP_STRING([--with-xfile-search-path=<path>],
    162 		       [Set path to search for app-defaults and other files]),
    163 	[XFILESEARCHPATHDEFAULT="$withval"], [])
    164 AC_MSG_RESULT(${XFILESEARCHPATHDEFAULT:-none})
    165 AC_SUBST([XFILESEARCHPATHDEFAULT])
    166 
    167 AC_MSG_CHECKING(for X app-defaults directory)
    168 AC_ARG_WITH(appdefaultdir,
    169 	AS_HELP_STRING([--with-appdefaultdir=<path>],
    170 		       [Set app-default directory (default: ${datadir}/X11/app-defaults)]),
    171 	[appdefaultdir="$withval"],
    172 	[appdefaultdir=${datadir}/X11/app-defaults])
    173 AC_MSG_RESULT($appdefaultdir)
    174 AX_DEFINE_DIR([appdefaultdir], [appdefaultdir], [app default data directory])
    175 
    176 # Replacement for Imake ToolkitStringsABIOptions, controls string tables
    177 # generated by util/string.list in StringDefs.h & Shell.h
    178 AC_MSG_CHECKING(for ABI options)
    179 case $host_os in
    180 	solaris*)
    181 		# Solaris uses -intelabi even on SPARC
    182 		STRINGSABIOPTIONS="-intelabi -solarisabinames"
    183 		;;
    184 	sco* | svr4*)
    185 		case $host_cpu in
    186 		    i*86) STRINGSABIOPTIONS="-intelabi" ;;
    187 		       *) STRINGSABIOPTIONS="" ;;
    188 		esac
    189 		;;
    190 esac
    191 AC_MSG_RESULT(${STRINGSABIOPTIONS:-none})
    192 AC_SUBST(STRINGSABIOPTIONS)
    193 
    194 ERRORDBDIR=${datadir}/X11
    195 AC_SUBST(ERRORDBDIR)
    196 
    197 AC_CONFIG_FILES([Makefile
    198 		src/Makefile
    199 		util/Makefile
    200 		include/Makefile
    201 		man/Makefile
    202 		specs/Makefile
    203 		specs/libXt.ent
    204 		test/Makefile
    205 		xt.pc])
    206 AC_OUTPUT
    207