configure.ac revision 249c3046
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.60])
25
26dnl
27dnl
28AC_INIT([libXt], [1.0.9],
29        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXt])
30AC_CONFIG_MACRO_DIR([m4])
31AM_INIT_AUTOMAKE([foreign dist-bzip2])
32AM_MAINTAINER_MODE
33
34# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
35m4_ifndef([XORG_MACROS_VERSION],
36          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
37XORG_MACROS_VERSION(1.8)
38XORG_DEFAULT_OPTIONS
39AM_CONFIG_HEADER(config.h)
40
41# Check for progs
42AC_PROG_CC
43AC_PROG_LIBTOOL
44AM_PROG_CC_C_O
45
46if test x"$CC_FOR_BUILD" = x; then
47	if test x"$cross_compiling" = xyes; then
48		AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
49	else
50	        CC_FOR_BUILD="$CC"
51	fi
52fi
53AC_SUBST([CC_FOR_BUILD])
54CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
55AC_SUBST(CFLAGS_FOR_BUILD)
56LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
57AC_SUBST(LDFLAGS_FOR_BUILD)
58
59PKG_CHECK_MODULES(XT, sm ice x11 xproto kbproto)
60
61# Needed for including Xalloca.h
62AC_CHECK_HEADER([alloca.h], AC_DEFINE(INCLUDE_ALLOCA_H, 1, [Define to 1 if Xalloca.h should include <alloca.h>]))
63
64# Map function checks to old Imake #defines
65case $host_os in
66	# darwin has poll() but can't be used to poll character devices (atleast through SnowLeopard)
67	darwin*) ;;
68	*)
69		AC_CHECK_FUNC(poll, AC_DEFINE(USE_POLL,1,
70	        	[Define to 1 if you have the "poll" function.]))
71	;;
72esac
73AC_CHECK_FUNC(snprintf, AC_DEFINE(USE_SNPRINTF,1,
74        [Define to 1 if you have the "snprintf" function.]))
75
76AC_HAVE_LIBRARY(ws2_32)
77
78# Options
79AC_ARG_ENABLE(xkb, AC_HELP_STRING([--disable-xkb], [Disable XKB support]),
80	XKB="$enableval", XKB="yes")
81if test "x$XKB" = "xyes" ; then
82	AC_DEFINE(XKB, 1, [Define to 1 to use XKB for keysym resolution.])
83fi
84
85# Replaces XFileSearchPathDefault from Imake configs
86XFILESEARCHPATHDEFAULT='$(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'
87
88AC_ARG_WITH(xfile-search-path,
89	AC_HELP_STRING([--with-xfile-search-path=<path>],
90		       [Set path to search for app-defaults and other files]),
91	[XFILESEARCHPATHDEFAULT="$withval"], [])
92AC_SUBST([XFILESEARCHPATHDEFAULT])
93
94AC_ARG_WITH(appdefaultdir,
95	AC_HELP_STRING([--with-appdefaultdir=<path>],
96		       [Set app-default directory (default: ${datadir}/X11/app-defaults)]),
97	[appdefaultdir="$withval"],
98	[appdefaultdir=${datadir}/X11/app-defaults])
99AX_DEFINE_DIR([appdefaultdir], [appdefaultdir], [app default data directory])
100
101# Replacement for Imake ToolkitStringsABIOptions, controls string tables
102# generated by util/string.list in StringDefs.h & Shell.h
103case $host_os in
104	solaris*)
105		# Solaris uses -intelabi even on SPARC
106  		STRINGSABIOPTIONS="-intelabi -solarisabinames"
107		;;
108	sco* | svr4*)
109		case $host_cpu in
110		    i*86) STRINGSABIOPTIONS="-intelabi" ;;
111		       *) STRINGSABIOPTIONS="" ;;
112		esac
113		;;
114esac
115AC_SUBST(STRINGSABIOPTIONS)
116
117case $host_os in
118    darwin*)
119        OS_CFLAGS="-Wl,-flat_namespace"
120	;;
121    *)
122        OS_CFLAGS=
123        ;;
124esac
125
126XT_CFLAGS="$XT_CFLAGS $OS_CFLAGS"
127
128XORG_CHECK_MALLOC_ZERO
129
130AC_OUTPUT([Makefile
131	   src/Makefile
132	   util/Makefile
133	   include/Makefile
134	   man/Makefile
135	   specs/Makefile
136           xt.pc])
137