configure.ac revision 57f47464
1
2# Initialize Autoconf
3AC_PREREQ([2.60])
4AC_INIT([libX11], [1.4.3],
5        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libX11])
6AC_CONFIG_SRCDIR([Makefile.am])
7AC_CONFIG_HEADERS([src/config.h include/X11/XlibConf.h])
8AC_CONFIG_MACRO_DIR([m4])
9AC_CANONICAL_BUILD
10AC_CANONICAL_HOST
11# Set common system defines for POSIX extensions, such as _GNU_SOURCE
12# Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL)
13# to avoid autoconf errors.
14AC_USE_SYSTEM_EXTENSIONS
15
16# Initialize Automake
17AM_INIT_AUTOMAKE([foreign dist-bzip2])
18AM_MAINTAINER_MODE
19
20# Initialize libtool
21AC_PROG_LIBTOOL
22
23# Require xorg-macros minimum of 1.12 for DocBook external references
24m4_ifndef([XORG_MACROS_VERSION],
25          [m4_fatal([must install xorg-macros 1.12 or later before running autoconf/autogen])])
26XORG_MACROS_VERSION(1.12)
27XORG_DEFAULT_OPTIONS
28XORG_ENABLE_SPECS
29XORG_WITH_XMLTO(0.0.22)
30XORG_WITH_FOP([no])
31XORG_WITH_XSLTPROC
32XORG_CHECK_SGML_DOCTOOLS(1.7)
33XORG_PROG_RAWCPP
34
35# Required when PKG_CHECK_MODULES called within an if statement
36PKG_PROG_PKG_CONFIG
37
38if test x"$CC_FOR_BUILD" = x; then
39	if test x"$cross_compiling" = xyes; then
40	       AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
41	else
42	       CC_FOR_BUILD="$CC"
43	fi
44fi
45AC_SUBST([CC_FOR_BUILD])
46
47if test x"$CPPFLAGS_FOR_BUILD" = x; then
48	if test ! x"$cross_compiling" = xyes; then
49		CPPFLAGS_FOR_BUILD=${CPPFLAGS}
50	fi
51fi
52AC_SUBST(CPPFLAGS_FOR_BUILD)
53
54if test x"$CFLAGS_FOR_BUILD" = x; then
55	if test ! x"$cross_compiling" = xyes; then
56		CFLAGS_FOR_BUILD=${CFLAGS}
57	fi
58fi
59AC_SUBST(CFLAGS_FOR_BUILD)
60
61if test x"$LDFLAGS_FOR_BUILD" = x; then
62	if test ! x"$cross_compiling" = xyes; then
63		LDFLAGS_FOR_BUILD=${LDFLAGS}
64	fi
65fi
66AC_SUBST(LDFLAGS_FOR_BUILD)
67
68# Find perl for "make check" tests in nls/Makefile.am
69AC_ARG_WITH(perl,
70	AS_HELP_STRING([--with-perl=<path>],
71			[path to perl interpreter for build-time tests]),
72	[PERL=$withval ; AC_MSG_CHECKING([perl]) ;
73	 AC_MSG_RESULT([(from --with-perl) $PERL])],
74	AC_CHECK_PROGS([PERL], [perl], [no]))
75AM_CONDITIONAL(HAVE_PERL, test x$PERL != xno)
76
77# Checks for pkg-config packages
78
79# Always required
80X11_REQUIRES='xproto >= 7.0.13 xextproto xtrans xcb >= 1.1.92'
81X11_EXTRA_DEPS="xcb >= 1.1.92"
82
83PKG_PROG_PKG_CONFIG()
84
85AC_SUBST(X11_EXTRA_DEPS)
86
87# Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
88# was not expanded, since libX11 with no transport types is rather useless.
89#
90# If you're seeing an error here, be sure you installed the lib/xtrans module
91# first and if it's not in the default location, that you set the ACLOCAL
92# environment variable to find it, such as:
93#	ACLOCAL="aclocal -I ${PREFIX}/share/aclocal"
94m4_pattern_forbid([^XTRANS_CONNECTION_FLAGS$])
95
96# Transport selection macro from xtrans.m4
97XTRANS_CONNECTION_FLAGS
98
99# Secure RPC detection macro from xtrans.m4
100XTRANS_SECURE_RPC_FLAGS
101
102# Preferred order to try transports for local connections
103AC_MSG_CHECKING([what order to try transports in for local connections])
104DEFAULT_LOCAL_TRANS=""
105case $host_os in
106	solaris*)
107		# On Solaris 2.6 through 9, named pipes (LOCAL_TRANS) were
108		# faster than Unix domain sockets, but on Solaris 10 & later,
109		# Unix domain sockets are faster now.
110		if test "$UNIXCONN" = "yes" ; then
111			if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then
112				DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS},"
113			fi
114			DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}UNIX_TRANS"
115		fi
116		if test "$LOCALCONN" = "yes" ; then
117			if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then
118				DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS},"
119			fi
120			DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}LOCAL_TRANS"
121		fi
122		if test "$TCPCONN" = "yes" ; then
123			if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then
124				DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS},"
125			fi
126			DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}TCP_TRANS"
127		fi
128		;;
129	linux*)
130		# LOCAL_TRANS is used for abstract sockets.
131		if test "$UNIXCONN" = "yes" ; then
132			if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then
133				DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS},"
134			fi
135			DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}LOCAL_TRANS,UNIX_TRANS"
136		fi
137		if test "$TCPCONN" = "yes" ; then
138			if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then
139				DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS},"
140			fi
141			DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}TCP_TRANS"
142		fi
143		;;
144	*)
145		if test "$LOCALCONN" = "yes" ; then
146			if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then
147				DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS},"
148			fi
149			DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}LOCAL_TRANS"
150		fi
151		if test "$UNIXCONN" = "yes" ; then
152			if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then
153				DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS},"
154			fi
155			DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}UNIX_TRANS"
156		fi
157		if test "$TCPCONN" = "yes" ; then
158			if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then
159				DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS},"
160			fi
161			DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}TCP_TRANS"
162		fi
163		;;
164esac
165
166AC_ARG_WITH(local-transport-order,
167	AS_HELP_STRING([--with-local-transport-order=LIST], [preference sorted list of transport types to try for local connections]),
168	[LOCAL_TRANSPORT_LIST=$withval],
169	[LOCAL_TRANSPORT_LIST=$DEFAULT_LOCAL_TRANS])
170AC_DEFINE_UNQUOTED([LOCAL_TRANSPORT_LIST], [$LOCAL_TRANSPORT_LIST],
171   [preference sorted list of transport types to try for local connections])
172AC_MSG_RESULT([$LOCAL_TRANSPORT_LIST])
173
174# Check for dlopen
175AC_MSG_CHECKING([if run-time linking is supported])
176AC_SEARCH_LIBS(dlopen,[dl svld])
177if test "x$ac_cv_search_dlopen" = xno; then
178	AC_SEARCH_LIBS(shl_load,[dld])
179	if test "x$ac_cv_search_shl_load" != xno; then
180		AC_DEFINE(HAVE_SHL_LOAD,1,
181			  [Use shl_load to load shared libraries])
182		AC_CHECK_HEADERS([dl.h])
183	fi
184else
185	AC_DEFINE(HAVE_DLOPEN,1,[Use dlopen to load shared libraries])
186	AC_CHECK_HEADERS([dlfcn.h])
187fi
188if test x$ac_cv_header_dlcfn_h -o x$ac_cv_header_dl_h; then
189	HAVE_LOADABLE_MODULES=yes
190else
191	HAVE_LOADABLE_MODULES=no
192fi
193AC_MSG_RESULT($HAVE_LOADABLE_MODULES)
194
195AC_MSG_CHECKING([if loadable i18n module support should be enabled])
196AC_ARG_ENABLE(loadable-i18n,
197	      AS_HELP_STRING([--enable-loadable-i18n],
198	       [Controls loadable i18n module support]),
199	       [XLIB_LOADABLE_I18N=$enableval],
200	       [XLIB_LOADABLE_I18N="no"])
201if test x$XLIB_LOADABLE_I18N = xyes; then
202	if test x$HAVE_LOADABLE_MODULES = xno; then
203		AC_MSG_ERROR([Loadable module support is required to enable loadable i18n module support])
204	fi
205	AC_DEFINE(USE_DYNAMIC_LC,1,
206		  [Split some i18n functions into loadable modules])
207	AC_SUBST(I18N_MODULE_LIBS,'${top_builddir}/src/libX11.la')
208fi
209AC_MSG_RESULT($XLIB_LOADABLE_I18N)
210
211AM_CONDITIONAL(XLIB_LOADABLE_I18N, test x$XLIB_LOADABLE_I18N = xyes)
212
213AC_MSG_CHECKING([if loadable Xcursor library support should be enabled])
214AC_ARG_ENABLE(loadable-xcursor,
215	      AS_HELP_STRING([--disable-loadable-xcursor],
216	       [Controls loadable xcursor library support]),
217	       [XLIB_LOADABLE_XCURSOR=$enableval],
218	       [XLIB_LOADABLE_XCURSOR=$HAVE_LOADABLE_MODULES])
219if test x$XLIB_LOADABLE_XCURSOR = xyes; then
220	AC_DEFINE(USE_DYNAMIC_XCURSOR,1,
221		  [Use the X cursor library to load cursors])
222fi
223AC_MSG_RESULT($XLIB_LOADABLE_XCURSOR)
224
225# Checks for header files.
226AC_CHECK_HEADERS([sys/select.h])
227
228# Checks for typedefs, structures, and compiler characteristics.
229
230# Checks for library functions.
231AC_CHECK_FUNCS([strtol])
232# Used in lcFile.c (see also --enable-xlocaledir settings below)
233XLOCALEDIR_IS_SAFE="no"
234AC_CHECK_FUNC([issetugid], [XLOCALEDIR_IS_SAFE="yes"]
235	AC_DEFINE(HASSETUGID,1,[Has issetugid() function]))
236AC_CHECK_FUNC([getresuid], [XLOCALEDIR_IS_SAFE="yes"]
237	AC_DEFINE(HASGETRESUID,1,[Has getresuid() & getresgid() functions]))
238# Used in Font.c
239AC_CHECK_FUNC([shmat], AC_DEFINE(HAS_SHM,1,[Has shm*() functions]))
240
241# Checks for system services
242# AC_PATH_XTRA
243
244# arch specific things
245WCHAR32="1"
246case $host_os in
247  os2*) os2="true" ; WCHAR32="0" ;;
248  *) ;;
249esac
250AC_SUBST(WCHAR32)
251
252AM_CONDITIONAL(OS2, test x$os2 = xtrue)
253
254AC_ARG_WITH(launchd, AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto])
255if test "x$LAUNCHD" = xauto; then
256	unset LAUNCHD
257	AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no], [$PATH$PATH_SEPARATOR/sbin])
258fi
259
260if test "x$LAUNCHD" = xyes ; then
261	AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
262	AC_DEFINE(TRANS_REOPEN, 1, [launchd support available])
263fi
264
265AC_ARG_ENABLE(xthreads,
266              AS_HELP_STRING([--disable-xthreads],
267                [Disable Xlib support for Multithreading]),
268              [xthreads=$enableval],[xthreads=yes])
269
270AC_CHECK_LIB(c, getpwuid_r, [mtsafeapi="yes"], [mtsafeapi="no"])
271
272case x$xthreads in
273xyes)
274	AC_DEFINE(XTHREADS,1,[Whether libX11 is compiled with thread support])
275	if test x$mtsafeapi = xyes
276	then
277	AC_DEFINE(XUSE_MTSAFE_API,1,[Whether libX11 needs to use MT safe API's])
278	fi
279	;;
280*)
281	;;
282esac
283
284AC_CHECK_LIB(c, pthread_self, [thrstubs="no"], [thrstubs="yes"])
285AM_CONDITIONAL(THRSTUBS, test x$thrstubs = xyes)
286
287# XXX incomplete, please fill this in
288if test x$xthreads = xyes ; then
289    case $host_os in
290    linux*|openbsd*|gnu*|k*bsd*-gnu)
291        XTHREADLIB=-lpthread ;;
292    netbsd*)
293	XTHREAD_CFLAGS="-D_POSIX_THREAD_SAFE_FUNCTIONS"
294	XTHREADLIB="-lpthread" ;;
295    freebsd*)
296        XTHREAD_CFLAGS="-D_THREAD_SAFE"
297        XTHREADLIB="-pthread" ;;
298    dragonfly*)
299        XTHREADLIB="-pthread" ;;
300    solaris*)
301	XTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" ;;
302    esac
303fi
304AC_SUBST(XTHREADLIB)
305AC_SUBST(XTHREAD_CFLAGS)
306
307AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
308
309#
310# Find keysymdef.h
311#
312AC_MSG_CHECKING([keysym definitions])
313KEYSYMDEFDIR=`$PKG_CONFIG --variable=includedir xproto`/X11
314FILES="keysymdef.h XF86keysym.h Sunkeysym.h DECkeysym.h HPkeysym.h"
315for i in $FILES; do
316    if test -f "$KEYSYMDEFDIR/$i"; then
317            KEYSYMDEFS="$KEYSYMDEFS $KEYSYMDEFDIR/$i"
318    elif test "x$i" = "xkeysymdef.h"; then
319	    AC_MSG_ERROR([Cannot find keysymdef.h])
320    fi
321done
322AC_MSG_RESULT([$KEYSYMDEFS])
323AC_SUBST(KEYSYMDEFS)
324
325AM_CONDITIONAL(UDC, test xfalse = xtrue)
326
327AC_ARG_ENABLE(xcms,
328              AS_HELP_STRING([--disable-xcms],
329                [Disable Xlib support for CMS *EXPERIMENTAL*]),
330              [XCMS=$enableval],[XCMS=yes])
331AM_CONDITIONAL(XCMS, [test x$XCMS = xyes ])
332if test x"$XCMS" = "xyes"; then
333	AC_DEFINE(XCMS,1,[Include support for XCMS])
334fi
335
336AC_ARG_ENABLE(xlocale,
337              AS_HELP_STRING([--disable-xlocale],
338                [Disable Xlib locale implementation *EXPERIMENTAL*]),
339              [XLOCALE=$enableval],[XLOCALE=yes])
340
341AM_CONDITIONAL(XLOCALE, [ test x$XLOCALE = xyes ])
342if test x"$XLOCALE" = "xyes"; then
343	AC_DEFINE(XLOCALE,1,[support for X Locales])
344fi
345
346# This disables XLOCALEDIR.  Set it if you're using BuildLoadableXlibI18n,
347# don't have either issetugid() or getresuid(), and you need to protect
348# clients that are setgid or setuid to an id other than 0.
349AC_MSG_CHECKING([if XLOCALEDIR support should be enabled])
350AC_ARG_ENABLE(xlocaledir,
351	      AS_HELP_STRING([--enable-xlocaledir],
352		[Enable XLOCALEDIR environment variable support]),
353	      [ENABLE_XLOCALEDIR=$enableval],[ENABLE_XLOCALEDIR=$XLOCALEDIR_IS_SAFE])
354if test "x$ENABLE_XLOCALEDIR" = "xno"; then
355	AC_DEFINE(NO_XLOCALEDIR,1,[Disable XLOCALEDIR environment variable])
356fi
357AC_MSG_RESULT($ENABLE_XLOCALEDIR)
358
359AC_ARG_ENABLE(xf86bigfont,
360	      AS_HELP_STRING([--disable-xf86bigfont],
361		[Disable XF86BigFont extension support]),
362	      [XF86BIGFONT=$enableval],[XF86BIGFONT="yes"])
363if test "x$XF86BIGFONT" = "xyes"; then
364    PKG_CHECK_MODULES(BIGFONT, [xf86bigfontproto >= 1.2.0],
365         AC_DEFINE(XF86BIGFONT,1,[Enable XF86BIGFONT extension]),XF86BIGFONT="no")
366fi
367
368AC_ARG_ENABLE(xkb,
369              AS_HELP_STRING([--disable-xkb],
370                [Disable XKB support *EXPERIMENTAL*]),
371              [XKB=$enableval],[XKB=yes])
372
373AM_CONDITIONAL(XKB, [ test x$XKB = xyes ])
374if test x"$XKB" = "xyes"; then
375   XKBPROTO_REQUIRES="kbproto"
376   X11_REQUIRES="${X11_REQUIRES} kbproto inputproto"
377   AC_DEFINE(XKB,1,[Use XKB])
378else
379   XKBPROTO_REQUIRES=""
380fi
381AC_SUBST(XKBPROTO_REQUIRES)
382
383AC_FUNC_MMAP()
384composecache_default=$ac_cv_func_mmap_fixed_mapped
385AC_CHECK_FUNC(nl_langinfo, , [composecache_default=no])
386AC_ARG_ENABLE(composecache,
387              AS_HELP_STRING([--disable-composecache],
388                [Disable compose table cache support]),
389              [COMPOSECACHE=$enableval],[COMPOSECACHE=$composecache_default])
390if test x"$COMPOSECACHE" = "xyes"; then
391	AC_DEFINE(COMPOSECACHE,1,[Include compose table cache support])
392fi
393
394# Allow checking code with lint, sparse, etc.
395XORG_WITH_LINT
396XORG_LINT_LIBRARY([X11])
397
398X11_DATADIR="${datadir}/X11"
399AX_DEFINE_DIR(X11_DATADIR, X11_DATADIR, [Location of libX11 data])
400AC_SUBST(X11_DATADIR)
401
402X11_LIBDIR="${libdir}/X11"
403AX_DEFINE_DIR(X11_LIBDIR, X11_LIBDIR, [Location of libX11 library data])
404AC_SUBST(X11_LIBDIR)
405
406PKG_CHECK_MODULES(X11, [$X11_REQUIRES])
407X11_CFLAGS="$X11_CFLAGS $XTHREAD_CFLAGS"
408
409#
410# Yes, it would be nice to put the locale data in
411# /usr/share, but the locale stuff includes loadable
412# libraries which must be located in the same directory
413# as the other locale data, so for now, everything lives
414# in ${libdir}
415#
416
417X11_LOCALEDATADIR="${X11_DATADIR}/locale"
418AX_DEFINE_DIR(XLOCALEDATADIR, X11_LOCALEDATADIR, [Location of libX11 locale data])
419AC_SUBST(X11_LOCALEDATADIR)
420
421AC_ARG_WITH(locale-lib-dir,	AS_HELP_STRING([--with-locale-lib-dir=DIR],
422 [Directory where locale libraries files are installed (default: $libdir/X11/locale)]),
423				[ X11_LOCALELIBDIR="$withval" ],
424				[ X11_LOCALELIBDIR="${X11_LIBDIR}/locale" ])
425AX_DEFINE_DIR(XLOCALELIBDIR, X11_LOCALELIBDIR, [Location of libX11 locale libraries])
426AC_SUBST(X11_LOCALELIBDIR)
427
428X11_LOCALEDIR="${X11_LOCALEDATADIR}"
429AX_DEFINE_DIR(XLOCALEDIR, X11_LOCALEDIR, [Location of libX11 locale data])
430AC_SUBST(X11_LOCALEDIR)
431
432XKEYSYMDB="${X11_DATADIR}/XKeysymDB"
433AX_DEFINE_DIR(XKEYSYMDB, XKEYSYMDB, [Location of keysym database])
434
435XERRORDB="${X11_DATADIR}/XErrorDB"
436AX_DEFINE_DIR(XERRORDB, XERRORDB, [Location of error message database])
437
438XORG_CHECK_MALLOC_ZERO
439
440AC_CONFIG_FILES([Makefile
441		include/Makefile
442		man/Makefile
443		man/xkb/Makefile
444		src/Makefile
445		src/util/Makefile
446		src/xcms/Makefile
447		src/xlibi18n/Makefile
448		modules/Makefile
449		modules/im/Makefile
450		modules/im/ximcp/Makefile
451		modules/lc/Makefile
452		modules/lc/def/Makefile
453		modules/lc/gen/Makefile
454		modules/lc/Utf8/Makefile
455		modules/lc/xlocale/Makefile
456		modules/om/Makefile
457		modules/om/generic/Makefile
458		src/xkb/Makefile
459		nls/Makefile
460		specs/Makefile
461		specs/i18n/Makefile
462		specs/i18n/framework/Makefile
463		specs/i18n/localedb/Makefile
464		specs/i18n/trans/Makefile
465		specs/libX11/Makefile
466		specs/XIM/Makefile
467		specs/XKB/Makefile
468		x11.pc
469		x11-xcb.pc])
470AC_OUTPUT
471
472echo ""
473echo "X11 will be built with the following settings:"
474echo " Loadable i18n module support:            "$XLIB_LOADABLE_I18N
475echo " Loadable xcursor library support:        "$XLIB_LOADABLE_XCURSOR
476echo " Threading support:                       "$xthreads
477echo " Use Threads safe API:                    "$mtsafeapi
478echo " Threads stubs in libX11:                 "$thrstubs
479echo " XCMS:                                    "$XCMS
480echo " Internationalization support:            "$XLOCALE
481echo " XF86BigFont support:                     "$XF86BIGFONT
482echo " XKB support:                             "$XKB
483echo " XLOCALEDIR environment variable support: "$ENABLE_XLOCALEDIR
484echo " Compose table cache enabled:             "$COMPOSECACHE
485echo " Functional specs building enabled:       "$build_specs
486echo ""
487