configure.ac revision bdf0f55d
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.1],
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])
33AM_MAINTAINER_MODE
34
35# Initialize libtool
36AC_PROG_LIBTOOL
37
38# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
39m4_ifndef([XORG_MACROS_VERSION],
40          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
41XORG_MACROS_VERSION(1.8)
42XORG_DEFAULT_OPTIONS
43XORG_CHECK_MALLOC_ZERO
44
45# Checks for header files.
46AC_CHECK_HEADER([alloca.h], AC_DEFINE(INCLUDE_ALLOCA_H, 1, [Define to 1 if Xalloca.h should include <alloca.h>]))
47
48# Obtain compiler/linker options for depedencies
49PKG_CHECK_MODULES(XT, sm ice x11 xproto kbproto)
50
51# Set-up variables to use build machine compiler when cross-compiling
52if test x"$CC_FOR_BUILD" = x; then
53	if test x"$cross_compiling" = xyes; then
54		AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
55	else
56	        CC_FOR_BUILD="$CC"
57	fi
58fi
59AC_SUBST([CC_FOR_BUILD])
60CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
61AC_SUBST(CFLAGS_FOR_BUILD)
62LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
63AC_SUBST(LDFLAGS_FOR_BUILD)
64
65# Map function checks to old Imake #defines
66case $host_os in
67	# darwin through Snow Leopard has poll() but can't be used to poll character devices.
68	darwin@<:@789@:>@*|darwin10*) ;;
69	darwin*)
70		_ac_xorg_macosx_version_min=""
71		if echo $CPPFLAGS $CFLAGS | grep -q mmacosx-version-min ; then
72			_ac_xorg_macosx_version_min=`echo $CPPFLAGS $CFLAGS | sed 's/^.*-mmacosx-version-min=\(@<:@^ @:>@*\).*$/\1/'`
73		else
74			_ac_xorg_macosx_version_min=$MACOSX_DEPLOYMENT_TARGET
75		fi
76		case $_ac_xorg_macosx_version_min in
77			10.@<:@0123456@:>@|10.@<:@0123456@:>@.*) ;;
78			*)
79				AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
80			;;
81		esac
82		unset _ac_xorg_macosx_version_min
83		;;
84	*)
85		AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
86	;;
87esac
88
89AC_HAVE_LIBRARY(ws2_32)
90
91# Options
92AC_ARG_ENABLE(xkb, AS_HELP_STRING([--disable-xkb], [Disable XKB support]),
93	XKB="$enableval", XKB="yes")
94if test "x$XKB" = "xyes" ; then
95	AC_DEFINE(XKB, 1, [Define to 1 to use XKB for keysym resolution.])
96fi
97
98# Replaces XFileSearchPathDefault from Imake configs
99XFILESEARCHPATHDEFAULT='$(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'
100
101AC_ARG_WITH(xfile-search-path,
102	AS_HELP_STRING([--with-xfile-search-path=<path>],
103		       [Set path to search for app-defaults and other files]),
104	[XFILESEARCHPATHDEFAULT="$withval"], [])
105AC_SUBST([XFILESEARCHPATHDEFAULT])
106
107AC_ARG_WITH(appdefaultdir,
108	AS_HELP_STRING([--with-appdefaultdir=<path>],
109		       [Set app-default directory (default: ${datadir}/X11/app-defaults)]),
110	[appdefaultdir="$withval"],
111	[appdefaultdir=${datadir}/X11/app-defaults])
112AX_DEFINE_DIR([appdefaultdir], [appdefaultdir], [app default data directory])
113
114# Replacement for Imake ToolkitStringsABIOptions, controls string tables
115# generated by util/string.list in StringDefs.h & Shell.h
116case $host_os in
117	solaris*)
118		# Solaris uses -intelabi even on SPARC
119  		STRINGSABIOPTIONS="-intelabi -solarisabinames"
120		;;
121	sco* | svr4*)
122		case $host_cpu in
123		    i*86) STRINGSABIOPTIONS="-intelabi" ;;
124		       *) STRINGSABIOPTIONS="" ;;
125		esac
126		;;
127esac
128AC_SUBST(STRINGSABIOPTIONS)
129
130case $host_os in
131    darwin*)
132        OS_CFLAGS="-Wl,-flat_namespace"
133	;;
134    *)
135        OS_CFLAGS=
136        ;;
137esac
138
139XT_CFLAGS="$XT_CFLAGS $OS_CFLAGS"
140
141AC_CONFIG_FILES([Makefile
142		src/Makefile
143		util/Makefile
144		include/Makefile
145		man/Makefile
146		specs/Makefile
147		xt.pc])
148AC_OUTPUT
149