configure.ac revision 1477040f
1dnl 
2dnl  Copyright © 2003 Keith Packard, Noah Levitt
3dnl 
4dnl  Permission to use, copy, modify, distribute, and sell this software and its
5dnl  documentation for any purpose is hereby granted without fee, provided that
6dnl  the above copyright notice appear in all copies and that both that
7dnl  copyright notice and this permission notice appear in supporting
8dnl  documentation, and that the name of Keith Packard not be used in
9dnl  advertising or publicity pertaining to distribution of the software without
10dnl  specific, written prior permission.  Keith Packard makes no
11dnl  representations about the suitability of this software for any purpose.  It
12dnl  is provided "as is" without express or implied warranty.
13dnl 
14dnl  KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16dnl  EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17dnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18dnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19dnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20dnl  PERFORMANCE OF THIS SOFTWARE.
21dnl
22dnl Process this file with autoconf to create configure.
23
24AC_PREREQ([2.57])
25
26dnl
27dnl
28AC_INIT(libXt, 1.0.8, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXt)
29AM_INIT_AUTOMAKE([foreign dist-bzip2])
30AM_MAINTAINER_MODE
31
32# Require xorg-macros: XORG_DEFAULT_OPTIONS
33m4_ifndef([XORG_MACROS_VERSION],
34          [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
35XORG_MACROS_VERSION(1.3)
36XORG_DEFAULT_OPTIONS
37AM_CONFIG_HEADER(config.h)
38
39# Check for progs
40AC_PROG_CC
41AC_PROG_LIBTOOL
42AM_PROG_CC_C_O
43
44if test x"$CC_FOR_BUILD" = x; then
45	if test x"$cross_compiling" = xyes; then
46		AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
47	else
48	        CC_FOR_BUILD="$CC"
49	fi
50fi
51AC_SUBST([CC_FOR_BUILD])
52CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
53AC_SUBST(CFLAGS_FOR_BUILD)
54LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
55AC_SUBST(LDFLAGS_FOR_BUILD)
56
57PKG_CHECK_MODULES(XT, sm ice x11 xproto kbproto)
58
59# Needed for including Xalloca.h
60AC_CHECK_HEADER([alloca.h], AC_DEFINE(INCLUDE_ALLOCA_H, 1, [Define to 1 if Xalloca.h should include <alloca.h>]))
61
62# Map function checks to old Imake #defines
63case $host_os in
64	# darwin has poll() but can't be used to poll character devices (atleast through SnowLeopard)
65	darwin*) ;;
66	*)
67		AC_CHECK_FUNC(poll, AC_DEFINE(USE_POLL,1,
68	        	[Define to 1 if you have the "poll" function.]))
69	;;
70esac
71AC_CHECK_FUNC(snprintf, AC_DEFINE(USE_SNPRINTF,1,
72        [Define to 1 if you have the "snprintf" function.]))
73
74AC_HAVE_LIBRARY(ws2_32)
75
76# Options
77AC_ARG_ENABLE(xkb, AC_HELP_STRING([--disable-xkb], [Disable XKB support]),
78	XKB="$enableval", XKB="yes")
79if test "x$XKB" = "xyes" ; then
80	AC_DEFINE(XKB, 1, [Define to 1 to use XKB for keysym resolution.])
81fi
82
83# Replaces XFileSearchPathDefault from Imake configs
84XFILESEARCHPATHDEFAULT='$(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'
85
86AC_ARG_WITH(xfile-search-path,
87	AC_HELP_STRING([--with-xfile-search-path=<path>],
88		       [Set path to search for app-defaults and other files]),
89	[XFILESEARCHPATHDEFAULT="$withval"], [])
90AC_SUBST([XFILESEARCHPATHDEFAULT])
91
92AC_ARG_WITH(appdefaultdir,
93	AC_HELP_STRING([--with-appdefaultdir=<path>],
94		       [Set app-default directory (default: ${datadir}/X11/app-defaults)]),
95	[appdefaultdir="$withval"],
96	[appdefaultdir=${datadir}/X11/app-defaults])
97AX_DEFINE_DIR([appdefaultdir], [appdefaultdir], [app default data directory])
98
99# Replacement for Imake ToolkitStringsABIOptions, controls string tables
100# generated by util/string.list in StringDefs.h & Shell.h
101case $host_os in
102	solaris*)
103		# Solaris uses -intelabi even on SPARC
104  		STRINGSABIOPTIONS="-intelabi -solarisabinames"
105		;;
106	sco* | svr4*)
107		case $host_cpu in
108		    i*86) STRINGSABIOPTIONS="-intelabi" ;;
109		       *) STRINGSABIOPTIONS="" ;;
110		esac
111		;;
112esac
113AC_SUBST(STRINGSABIOPTIONS)
114
115case $host_os in
116    darwin*)
117        OS_CFLAGS="-Wl,-flat_namespace"
118	;;
119    *)
120        OS_CFLAGS=
121        ;;
122esac
123
124XT_CFLAGS="$XT_CFLAGS $OS_CFLAGS"
125
126# Man page processing requirements
127XORG_PROG_RAWCPP
128
129XORG_CHECK_MALLOC_ZERO
130
131AC_OUTPUT([Makefile
132	   src/Makefile
133	   util/Makefile
134	   include/Makefile
135	   man/Makefile
136           xt.pc])
137