configure.ac revision 2d67cb4f
1
2# Initialize Autoconf
3AC_PREREQ([2.60])
4AC_INIT([libX11], [1.6.4],
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])
18
19# Initialize libtool
20AC_PROG_LIBTOOL
21
22# Require xorg-macros minimum of 1.15 for fop minimum version
23m4_ifndef([XORG_MACROS_VERSION],
24          [m4_fatal([must install xorg-macros 1.15 or later before running autoconf/autogen])])
25XORG_MACROS_VERSION(1.15)
26XORG_DEFAULT_OPTIONS
27XORG_ENABLE_SPECS
28XORG_WITH_XMLTO(0.0.22)
29XORG_WITH_FOP([],[no])
30XORG_WITH_XSLTPROC
31XORG_CHECK_SGML_DOCTOOLS(1.10)
32XORG_PROG_RAWCPP
33XORG_WITH_PERL
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# Checks for pkg-config packages
69
70# Always required
71X11_REQUIRES='xproto >= 7.0.17 xextproto xtrans xcb >= 1.11.1'
72X11_EXTRA_DEPS="xcb >= 1.11.1"
73
74PKG_PROG_PKG_CONFIG()
75
76AC_SUBST(X11_EXTRA_DEPS)
77
78# Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
79# was not expanded, since libX11 with no transport types is rather useless.
80#
81# If you're seeing an error here, be sure you installed the lib/xtrans module
82# first and if it's not in the default location, that you set the ACLOCAL
83# environment variable to find it, such as:
84#	ACLOCAL="aclocal -I ${PREFIX}/share/aclocal"
85m4_pattern_forbid([^XTRANS_CONNECTION_FLAGS$])
86
87# Transport selection macro from xtrans.m4
88XTRANS_CONNECTION_FLAGS
89
90# Check for dlopen
91AC_MSG_CHECKING([if run-time linking is supported])
92AC_SEARCH_LIBS(dlopen,[dl svld])
93if test "x$ac_cv_search_dlopen" = xno; then
94	AC_SEARCH_LIBS(shl_load,[dld])
95	if test "x$ac_cv_search_shl_load" != xno; then
96		AC_DEFINE(HAVE_SHL_LOAD,1,
97			  [Use shl_load to load shared libraries])
98		AC_CHECK_HEADERS([dl.h])
99	fi
100else
101	AC_DEFINE(HAVE_DLOPEN,1,[Use dlopen to load shared libraries])
102	AC_CHECK_HEADERS([dlfcn.h])
103fi
104if test "x$ac_cv_header_dlfcn_h" = xyes -o "x$ac_cv_header_dl_h" = xyes; then
105	HAVE_LOADABLE_MODULES=yes
106else
107	HAVE_LOADABLE_MODULES=no
108fi
109AC_MSG_RESULT($HAVE_LOADABLE_MODULES)
110
111AC_MSG_CHECKING([if loadable i18n module support should be enabled])
112AC_ARG_ENABLE(loadable-i18n,
113	      AS_HELP_STRING([--enable-loadable-i18n],
114	       [Controls loadable i18n module support]),
115	       [XLIB_LOADABLE_I18N=$enableval],
116	       [XLIB_LOADABLE_I18N="no"])
117if test x$XLIB_LOADABLE_I18N = xyes; then
118	if test x$HAVE_LOADABLE_MODULES = xno; then
119		AC_MSG_ERROR([Loadable module support is required to enable loadable i18n module support])
120	fi
121	AC_DEFINE(USE_DYNAMIC_LC,1,
122		  [Split some i18n functions into loadable modules])
123	AC_SUBST(I18N_MODULE_LIBS,'${top_builddir}/src/libX11.la')
124fi
125AC_MSG_RESULT($XLIB_LOADABLE_I18N)
126
127AM_CONDITIONAL(XLIB_LOADABLE_I18N, test x$XLIB_LOADABLE_I18N = xyes)
128
129AC_MSG_CHECKING([if loadable Xcursor library support should be enabled])
130AC_ARG_ENABLE(loadable-xcursor,
131	      AS_HELP_STRING([--disable-loadable-xcursor],
132	       [Controls loadable xcursor library support]),
133	       [XLIB_LOADABLE_XCURSOR=$enableval],
134	       [XLIB_LOADABLE_XCURSOR=$HAVE_LOADABLE_MODULES])
135if test x$XLIB_LOADABLE_XCURSOR = xyes; then
136	AC_DEFINE(USE_DYNAMIC_XCURSOR,1,
137		  [Use the X cursor library to load cursors])
138fi
139AC_MSG_RESULT($XLIB_LOADABLE_XCURSOR)
140
141# Checks for header files.
142AC_CHECK_HEADERS([sys/select.h])
143
144# Checks for typedefs, structures, and compiler characteristics.
145
146# Checks for library functions.
147AC_CHECK_FUNCS([strtol seteuid])
148# Used in lcFile.c (see also --enable-xlocaledir settings below)
149XLOCALEDIR_IS_SAFE="no"
150AC_CHECK_DECL([issetugid])
151AC_CHECK_FUNC([issetugid])
152if test "$ac_cv_have_decl_issetugid" = yes && test "$ac_cv_func_issetugid" = yes; then
153    XLOCALEDIR_IS_SAFE="yes"
154    AC_DEFINE(HASSETUGID,1,[Has issetugid() function])
155fi
156AC_CHECK_FUNC([getresuid], [XLOCALEDIR_IS_SAFE="yes"]
157	AC_DEFINE(HASGETRESUID,1,[Has getresuid() & getresgid() functions]))
158# Used in Font.c
159AC_CHECK_FUNC([shmat], AC_DEFINE(HAS_SHM,1,[Has shm*() functions]))
160
161# Checks for system services
162# AC_PATH_XTRA
163
164# arch specific things
165WCHAR32="1"
166case $host_os in
167  os2*) os2="true" ; WCHAR32="0" ;;
168  *) ;;
169esac
170AC_SUBST(WCHAR32)
171
172AM_CONDITIONAL(OS2, test x$os2 = xtrue)
173
174AC_ARG_WITH(launchd, AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto])
175if test "x$LAUNCHD" = xauto; then
176	unset LAUNCHD
177	AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no], [$PATH$PATH_SEPARATOR/sbin])
178fi
179
180if test "x$LAUNCHD" = xyes ; then
181	AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
182	AC_DEFINE(TRANS_REOPEN, 1, [launchd support available])
183fi
184
185AC_ARG_ENABLE(xthreads,
186              AS_HELP_STRING([--disable-xthreads],
187                [Disable Xlib support for Multithreading]),
188              [xthreads=$enableval],[xthreads=yes])
189
190AC_CHECK_LIB(c, getpwuid_r, [mtsafeapi="yes"], [mtsafeapi="no"])
191
192case x$xthreads in
193xyes)
194	AC_DEFINE(XTHREADS,1,[Whether libX11 is compiled with thread support])
195	if test x$mtsafeapi = xyes
196	then
197	AC_DEFINE(XUSE_MTSAFE_API,1,[Whether libX11 needs to use MT safe API's])
198	fi
199	;;
200*)
201	;;
202esac
203
204AC_CHECK_LIB(c, pthread_self, [thrstubs="no"], [thrstubs="yes"])
205AM_CONDITIONAL(THRSTUBS, test x$thrstubs = xyes)
206
207# XXX incomplete, please fill this in
208if test x$xthreads = xyes ; then
209    case $host_os in
210    linux*|gnu*|k*bsd*-gnu)
211        XTHREADLIB=-lpthread ;;
212    netbsd*)
213	XTHREAD_CFLAGS="-D_POSIX_THREAD_SAFE_FUNCTIONS"
214	XTHREADLIB="-lpthread" ;;
215    freebsd*)
216        XTHREAD_CFLAGS="-D_THREAD_SAFE"
217        XTHREADLIB="-pthread" ;;
218    dragonfly*|openbsd*)
219        XTHREADLIB="-pthread" ;;
220    solaris*)
221	XTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" ;;
222    esac
223fi
224AC_SUBST(XTHREADLIB)
225AC_SUBST(XTHREAD_CFLAGS)
226
227AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
228
229#
230# Find keysymdef.h
231#
232AC_MSG_CHECKING([keysym definitions])
233AC_ARG_WITH([keysymdefdir],
234        [AC_HELP_STRING([--with-keysymdefdir=DIR], [The location of keysymdef.h (defaults to xproto include dir)])],
235        [KEYSYMDEFDIR=$withval],
236        [KEYSYMDEFDIR=`$PKG_CONFIG --variable=includedir xproto`/X11])
237
238if test ! -d "$KEYSYMDEFDIR"; then
239	AC_MSG_ERROR([$KEYSYMDEFDIR doesn't exist or isn't a directory])
240fi
241
242FILES="keysymdef.h XF86keysym.h Sunkeysym.h DECkeysym.h HPkeysym.h"
243for i in $FILES; do
244    if test -f "$KEYSYMDEFDIR/$i"; then
245            KEYSYMDEFS="$KEYSYMDEFS $KEYSYMDEFDIR/$i"
246    elif test "x$i" = "xkeysymdef.h"; then
247	    AC_MSG_ERROR([Cannot find keysymdef.h])
248    fi
249done
250AC_MSG_RESULT([$KEYSYMDEFS])
251AC_SUBST(KEYSYMDEFS)
252
253AC_ARG_ENABLE(xcms,
254              AS_HELP_STRING([--disable-xcms],
255                [Disable Xlib support for CMS *EXPERIMENTAL*]),
256              [XCMS=$enableval],[XCMS=yes])
257AM_CONDITIONAL(XCMS, [test x$XCMS = xyes ])
258if test x"$XCMS" = "xyes"; then
259	AC_DEFINE(XCMS,1,[Include support for XCMS])
260fi
261
262AC_ARG_ENABLE(xlocale,
263              AS_HELP_STRING([--disable-xlocale],
264                [Disable Xlib locale implementation *EXPERIMENTAL*]),
265              [XLOCALE=$enableval],[XLOCALE=yes])
266
267AM_CONDITIONAL(XLOCALE, [ test x$XLOCALE = xyes ])
268if test x"$XLOCALE" = "xyes"; then
269	AC_DEFINE(XLOCALE,1,[support for X Locales])
270fi
271
272# This disables XLOCALEDIR.  Set it if you're using BuildLoadableXlibI18n,
273# don't have either issetugid() or getresuid(), and you need to protect
274# clients that are setgid or setuid to an id other than 0.
275AC_MSG_CHECKING([if XLOCALEDIR support should be enabled])
276AC_ARG_ENABLE(xlocaledir,
277	      AS_HELP_STRING([--enable-xlocaledir],
278		[Enable XLOCALEDIR environment variable support]),
279	      [ENABLE_XLOCALEDIR=$enableval],[ENABLE_XLOCALEDIR=$XLOCALEDIR_IS_SAFE])
280if test "x$ENABLE_XLOCALEDIR" = "xno"; then
281	AC_DEFINE(NO_XLOCALEDIR,1,[Disable XLOCALEDIR environment variable])
282fi
283AC_MSG_RESULT($ENABLE_XLOCALEDIR)
284
285AC_ARG_ENABLE(xf86bigfont,
286	      AS_HELP_STRING([--disable-xf86bigfont],
287		[Disable XF86BigFont extension support]),
288	      [XF86BIGFONT=$enableval],[XF86BIGFONT="yes"])
289if test "x$XF86BIGFONT" = "xyes"; then
290    PKG_CHECK_MODULES(BIGFONT, [xf86bigfontproto >= 1.2.0],
291         AC_DEFINE(XF86BIGFONT,1,[Enable XF86BIGFONT extension]),XF86BIGFONT="no")
292fi
293
294AC_ARG_ENABLE(xkb,
295              AS_HELP_STRING([--disable-xkb],
296                [Disable XKB support *EXPERIMENTAL*]),
297              [XKB=$enableval],[XKB=yes])
298
299AM_CONDITIONAL(XKB, [ test x$XKB = xyes ])
300if test x"$XKB" = "xyes"; then
301   XKBPROTO_REQUIRES="kbproto"
302   X11_REQUIRES="${X11_REQUIRES} kbproto inputproto"
303   AC_DEFINE(XKB,1,[Use XKB])
304else
305   XKBPROTO_REQUIRES=""
306fi
307AC_SUBST(XKBPROTO_REQUIRES)
308
309AC_FUNC_MMAP()
310composecache_default=$ac_cv_func_mmap_fixed_mapped
311AC_CHECK_FUNC(nl_langinfo, , [composecache_default=no])
312AC_ARG_ENABLE(composecache,
313              AS_HELP_STRING([--disable-composecache],
314                [Disable compose table cache support]),
315              [COMPOSECACHE=$enableval],[COMPOSECACHE=$composecache_default])
316if test x"$COMPOSECACHE" = "xyes"; then
317	AC_DEFINE(COMPOSECACHE,1,[Include compose table cache support])
318fi
319
320# Allow checking code with lint, sparse, etc.
321XORG_WITH_LINT
322XORG_LINT_LIBRARY([X11])
323
324X11_DATADIR="${datadir}/X11"
325AX_DEFINE_DIR(X11_DATADIR, X11_DATADIR, [Location of libX11 data])
326AC_SUBST(X11_DATADIR)
327
328X11_LIBDIR="${libdir}/X11"
329AX_DEFINE_DIR(X11_LIBDIR, X11_LIBDIR, [Location of libX11 library data])
330AC_SUBST(X11_LIBDIR)
331
332PKG_CHECK_MODULES(X11, [$X11_REQUIRES])
333X11_CFLAGS="$X11_CFLAGS $XTHREAD_CFLAGS"
334
335#
336# Yes, it would be nice to put the locale data in
337# /usr/share, but the locale stuff includes loadable
338# libraries which must be located in the same directory
339# as the other locale data, so for now, everything lives
340# in ${libdir}
341#
342
343X11_LOCALEDATADIR="${X11_DATADIR}/locale"
344AX_DEFINE_DIR(XLOCALEDATADIR, X11_LOCALEDATADIR, [Location of libX11 locale data])
345AC_SUBST(X11_LOCALEDATADIR)
346
347AC_ARG_WITH(locale-lib-dir,	AS_HELP_STRING([--with-locale-lib-dir=DIR],
348 [Directory where locale libraries files are installed (default: $libdir/X11/locale)]),
349				[ X11_LOCALELIBDIR="$withval" ],
350				[ X11_LOCALELIBDIR="${X11_LIBDIR}/locale" ])
351AX_DEFINE_DIR(XLOCALELIBDIR, X11_LOCALELIBDIR, [Location of libX11 locale libraries])
352AC_SUBST(X11_LOCALELIBDIR)
353
354X11_LOCALEDIR="${X11_LOCALEDATADIR}"
355AX_DEFINE_DIR(XLOCALEDIR, X11_LOCALEDIR, [Location of libX11 locale data])
356AC_SUBST(X11_LOCALEDIR)
357
358locales="\
359 am_ET.UTF-8  armscii-8   C           cs_CZ.UTF-8  el_GR.UTF-8  en_US.UTF-8 \
360 fi_FI.UTF-8  georgian-academy        georgian-ps  ibm-cp1133   iscii-dev \
361 isiri-3342   iso8859-1   iso8859-10  iso8859-11   iso8859-13   iso8859-14 \
362 iso8859-15   iso8859-2   iso8859-3   iso8859-4    iso8859-5    iso8859-6 \
363 iso8859-7    iso8859-8   iso8859-9   iso8859-9e   ja           ja.JIS \
364 ja_JP.UTF-8  ja.SJIS     km_KH.UTF-8 ko           koi8-c       koi8-r \
365 koi8-u       ko_KR.UTF-8 microsoft-cp1251         microsoft-cp1255 \
366 microsoft-cp1256         mulelao-1   nokhchi-1    pt_BR.UTF-8  pt_PT.UTF-8 \
367 ru_RU.UTF-8  sr_CS.UTF-8 tatar-cyr   th_TH        th_TH.UTF-8  tscii-0 \
368 vi_VN.tcvn   vi_VN.viscii            zh_CN        zh_CN.gb18030 \
369 zh_CN.gbk    zh_CN.UTF-8 zh_HK.big5  zh_HK.big5hkscs           zh_HK.UTF-8 \
370 zh_TW        zh_TW.big5  zh_TW.UTF-8"
371AC_SUBST(locales)
372
373XKEYSYMDB="${X11_DATADIR}/XKeysymDB"
374AX_DEFINE_DIR(XKEYSYMDB, XKEYSYMDB, [Location of keysym database])
375
376XERRORDB="${X11_DATADIR}/XErrorDB"
377AX_DEFINE_DIR(XERRORDB, XERRORDB, [Location of error message database])
378
379XORG_CHECK_MALLOC_ZERO
380
381AC_CONFIG_FILES([Makefile
382		include/Makefile
383		man/Makefile
384		man/xkb/Makefile
385		src/Makefile
386		src/util/Makefile
387		src/xcms/Makefile
388		src/xlibi18n/Makefile
389		modules/Makefile
390		modules/im/Makefile
391		modules/im/ximcp/Makefile
392		modules/lc/Makefile
393		modules/lc/def/Makefile
394		modules/lc/gen/Makefile
395		modules/lc/Utf8/Makefile
396		modules/om/Makefile
397		modules/om/generic/Makefile
398		src/xkb/Makefile
399		nls/Makefile
400		specs/Makefile
401		specs/i18n/Makefile
402		specs/i18n/compose/Makefile
403		specs/i18n/framework/Makefile
404		specs/i18n/localedb/Makefile
405		specs/i18n/trans/Makefile
406		specs/libX11/Makefile
407		specs/XIM/Makefile
408		specs/XKB/Makefile
409		x11.pc
410		x11-xcb.pc])
411AC_OUTPUT
412
413echo ""
414echo "X11 will be built with the following settings:"
415echo " Loadable i18n module support:            "$XLIB_LOADABLE_I18N
416echo " Loadable xcursor library support:        "$XLIB_LOADABLE_XCURSOR
417echo " Threading support:                       "$xthreads
418echo " Use Threads safe API:                    "$mtsafeapi
419echo " Threads stubs in libX11:                 "$thrstubs
420echo " XCMS:                                    "$XCMS
421echo " Internationalization support:            "$XLOCALE
422echo " XF86BigFont support:                     "$XF86BIGFONT
423echo " XKB support:                             "$XKB
424echo " XLOCALEDIR environment variable support: "$ENABLE_XLOCALEDIR
425echo " Compose table cache enabled:             "$COMPOSECACHE
426echo " Functional specs building enabled:       "$build_specs
427echo ""
428