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