configure.ac revision 15885c33
1
2# Initialize Autoconf
3AC_PREREQ([2.70])
4AC_INIT([libX11], [1.8.6],
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 LT_INIT)
13# to avoid autoconf errors.
14AC_USE_SYSTEM_EXTENSIONS
15
16# Initialize Automake
17AM_INIT_AUTOMAKE([foreign dist-xz])
18
19# Initialize libtool
20LT_INIT
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.25 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
151AC_ARG_ENABLE(thread-safety-constructor,
152              AS_HELP_STRING([--disable-thread-safety-constructor],
153                             [Controls mandatory thread safety support]),
154              [USE_THREAD_SAFETY_CONSTRUCTOR=$enableval],
155              [USE_THREAD_SAFETY_CONSTRUCTOR="yes"])
156if test "x$USE_THREAD_SAFETY_CONSTRUCTOR" = "xyes"; then
157        AC_DEFINE(USE_THREAD_SAFETY_CONSTRUCTOR,1,[Call XInitThreads() from the library constructor])
158fi
159
160# Checks for header files.
161AC_CHECK_HEADERS([sys/filio.h sys/select.h sys/ioctl.h sys/socket.h])
162
163# Checks for typedefs, structures, and compiler characteristics.
164AX_GCC_BUILTIN([__builtin_popcountl])
165
166# Checks for library functions.
167AC_CHECK_FUNCS([strtol seteuid])
168AC_REPLACE_FUNCS([reallocarray])
169# Used in lcFile.c (see also --enable-xlocaledir settings below)
170XLOCALEDIR_IS_SAFE="no"
171AC_CHECK_DECL([issetugid])
172AC_CHECK_FUNC([issetugid])
173if test "$ac_cv_have_decl_issetugid" = yes && test "$ac_cv_func_issetugid" = yes; then
174    XLOCALEDIR_IS_SAFE="yes"
175    AC_DEFINE(HASSETUGID,1,[Has issetugid() function])
176fi
177AC_CHECK_FUNC([getresuid], [XLOCALEDIR_IS_SAFE="yes"]
178	AC_DEFINE(HASGETRESUID,1,[Has getresuid() & getresgid() functions]))
179# Used in Font.c
180AC_CHECK_FUNC([shmat], AC_DEFINE(HAS_SHM,1,[Has shm*() functions]))
181
182# Checks for system services
183# AC_PATH_XTRA
184
185# arch specific things
186WCHAR32="1"
187case $host_os in
188  os2*) os2="true" ; WCHAR32="0" ;;
189  *) ;;
190esac
191AC_SUBST(WCHAR32)
192
193AM_CONDITIONAL(OS2, test x$os2 = xtrue)
194
195AC_ARG_WITH(launchd, AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto])
196if test "x$LAUNCHD" = xauto; then
197	unset LAUNCHD
198	AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no], [$PATH$PATH_SEPARATOR/sbin])
199fi
200
201if test "x$LAUNCHD" = xyes ; then
202	AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
203	AC_DEFINE(TRANS_REOPEN, 1, [launchd support available])
204fi
205
206AC_ARG_ENABLE(xthreads,
207              AS_HELP_STRING([--disable-xthreads],
208                [Disable Xlib support for Multithreading]),
209              [xthreads=$enableval],[xthreads=yes])
210
211AC_CHECK_LIB(c, getpwuid_r, [mtsafeapi="yes"], [mtsafeapi="no"])
212
213case x$xthreads in
214xyes)
215	AC_DEFINE(XTHREADS,1,[Whether libX11 is compiled with thread support])
216	if test x$mtsafeapi = xyes
217	then
218	AC_DEFINE(XUSE_MTSAFE_API,1,[Whether libX11 needs to use MT safe API's])
219	fi
220	;;
221*)
222	;;
223esac
224
225# XXX incomplete, please fill this in
226if test x$xthreads = xyes ; then
227    case $host_os in
228    linux*|gnu*|k*bsd*-gnu)
229        XTHREADLIB=-lpthread ;;
230    netbsd*)
231	XTHREAD_CFLAGS="-D_POSIX_THREAD_SAFE_FUNCTIONS"
232	XTHREADLIB="-lpthread" ;;
233    freebsd*)
234        XTHREAD_CFLAGS="-D_THREAD_SAFE"
235        XTHREADLIB="-pthread" ;;
236    dragonfly*|openbsd*)
237        XTHREADLIB="-pthread" ;;
238    solaris*)
239	XTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" ;;
240    esac
241fi
242AC_SUBST(XTHREADLIB)
243AC_SUBST(XTHREAD_CFLAGS)
244
245if test "x$USE_THREAD_SAFETY_CONSTRUCTOR" = "xyes"; then
246    USE_THREAD_LIBS="$XTHREADLIB"
247else
248    # This should be kept in sync with libxcb
249    case $host_os in
250    linux*|darwin*|solaris*) ;;
251         *) X11_REQUIRES="$X11_REQUIRES pthread-stubs" ;;
252    esac
253fi
254AC_SUBST(USE_THREAD_LIBS)
255
256AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
257
258#
259# Find keysymdef.h
260#
261AC_MSG_CHECKING([keysym definitions])
262AC_ARG_WITH([keysymdefdir],
263        [AS_HELP_STRING([--with-keysymdefdir=DIR], [The location of keysymdef.h (defaults to xproto include dir)])],
264        [KEYSYMDEFDIR=$withval],
265        [KEYSYMDEFDIR=`$PKG_CONFIG --variable=includedir xproto`/X11])
266
267if test ! -d "$KEYSYMDEFDIR"; then
268	AC_MSG_ERROR([$KEYSYMDEFDIR doesn't exist or isn't a directory])
269fi
270
271FILES="keysymdef.h XF86keysym.h Sunkeysym.h DECkeysym.h HPkeysym.h"
272for i in $FILES; do
273    if test -f "$KEYSYMDEFDIR/$i"; then
274            KEYSYMDEFS="$KEYSYMDEFS $KEYSYMDEFDIR/$i"
275    elif test "x$i" = "xkeysymdef.h"; then
276	    AC_MSG_ERROR([Cannot find keysymdef.h])
277    fi
278done
279AC_MSG_RESULT([$KEYSYMDEFS])
280AC_SUBST(KEYSYMDEFS)
281
282AC_ARG_ENABLE(xcms,
283              AS_HELP_STRING([--disable-xcms],
284                [Disable Xlib support for CMS *EXPERIMENTAL*]),
285              [XCMS=$enableval],[XCMS=yes])
286AM_CONDITIONAL(XCMS, [test x$XCMS = xyes ])
287if test x"$XCMS" = "xyes"; then
288	AC_DEFINE(XCMS,1,[Include support for XCMS])
289fi
290
291AC_ARG_ENABLE(xlocale,
292              AS_HELP_STRING([--disable-xlocale],
293                [Disable Xlib locale implementation *EXPERIMENTAL*]),
294              [XLOCALE=$enableval],[XLOCALE=yes])
295
296AM_CONDITIONAL(XLOCALE, [ test x$XLOCALE = xyes ])
297if test x"$XLOCALE" = "xyes"; then
298	AC_DEFINE(XLOCALE,1,[support for X Locales])
299fi
300
301# This disables XLOCALEDIR.  Set it if you're using BuildLoadableXlibI18n,
302# don't have either issetugid() or getresuid(), and you need to protect
303# clients that are setgid or setuid to an id other than 0.
304AC_MSG_CHECKING([if XLOCALEDIR support should be enabled])
305AC_ARG_ENABLE(xlocaledir,
306	      AS_HELP_STRING([--enable-xlocaledir],
307		[Enable XLOCALEDIR environment variable support]),
308	      [ENABLE_XLOCALEDIR=$enableval],[ENABLE_XLOCALEDIR=$XLOCALEDIR_IS_SAFE])
309if test "x$ENABLE_XLOCALEDIR" = "xno"; then
310	AC_DEFINE(NO_XLOCALEDIR,1,[Disable XLOCALEDIR environment variable])
311fi
312AC_MSG_RESULT($ENABLE_XLOCALEDIR)
313
314AC_ARG_ENABLE(xf86bigfont,
315	      AS_HELP_STRING([--disable-xf86bigfont],
316		[Disable XF86BigFont extension support]),
317	      [XF86BIGFONT=$enableval],[XF86BIGFONT="yes"])
318if test "x$XF86BIGFONT" = "xyes"; then
319    PKG_CHECK_MODULES(BIGFONT, [xf86bigfontproto >= 1.2.0],
320         AC_DEFINE(XF86BIGFONT,1,[Enable XF86BIGFONT extension]),XF86BIGFONT="no")
321fi
322
323AC_ARG_ENABLE(xkb,
324              AS_HELP_STRING([--disable-xkb],
325                [Disable XKB support *EXPERIMENTAL*]),
326              [XKB=$enableval],[XKB=yes])
327
328AM_CONDITIONAL(XKB, [ test x$XKB = xyes ])
329if test x"$XKB" = "xyes"; then
330   XKBPROTO_REQUIRES="kbproto"
331   X11_REQUIRES="${X11_REQUIRES} kbproto inputproto"
332   AC_DEFINE(XKB,1,[Use XKB])
333else
334   XKBPROTO_REQUIRES=""
335fi
336AC_SUBST(XKBPROTO_REQUIRES)
337
338AC_FUNC_MMAP()
339composecache_default=$ac_cv_func_mmap_fixed_mapped
340AC_CHECK_FUNC(nl_langinfo, , [composecache_default=no])
341AC_ARG_ENABLE(composecache,
342              AS_HELP_STRING([--disable-composecache],
343                [Disable compose table cache support]),
344              [COMPOSECACHE=$enableval],[COMPOSECACHE=$composecache_default])
345if test x"$COMPOSECACHE" = "xyes"; then
346	AC_DEFINE(COMPOSECACHE,1,[Include compose table cache support])
347fi
348
349# Allow checking code with lint, sparse, etc.
350XORG_WITH_LINT
351XORG_LINT_LIBRARY([X11])
352
353X11_DATADIR="${datadir}/X11"
354AX_DEFINE_DIR(X11_DATADIR, X11_DATADIR, [Location of libX11 data])
355AC_SUBST(X11_DATADIR)
356
357X11_LIBDIR="${libdir}/X11"
358AX_DEFINE_DIR(X11_LIBDIR, X11_LIBDIR, [Location of libX11 library data])
359AC_SUBST(X11_LIBDIR)
360
361PKG_CHECK_MODULES(X11, [$X11_REQUIRES])
362X11_CFLAGS="$X11_CFLAGS $XTHREAD_CFLAGS"
363
364#
365# Yes, it would be nice to put the locale data in
366# /usr/share, but the locale stuff includes loadable
367# libraries which must be located in the same directory
368# as the other locale data, so for now, everything lives
369# in ${libdir}
370#
371
372X11_LOCALEDATADIR="${X11_DATADIR}/locale"
373AX_DEFINE_DIR(XLOCALEDATADIR, X11_LOCALEDATADIR, [Location of libX11 locale data])
374AC_SUBST(X11_LOCALEDATADIR)
375
376AC_ARG_WITH(locale-lib-dir,	AS_HELP_STRING([--with-locale-lib-dir=DIR],
377 [Directory where locale libraries files are installed (default: $libdir/X11/locale)]),
378				[ X11_LOCALELIBDIR="$withval" ],
379				[ X11_LOCALELIBDIR="${X11_LIBDIR}/locale" ])
380AX_DEFINE_DIR(XLOCALELIBDIR, X11_LOCALELIBDIR, [Location of libX11 locale libraries])
381AC_SUBST(X11_LOCALELIBDIR)
382
383X11_LOCALEDIR="${X11_LOCALEDATADIR}"
384AX_DEFINE_DIR(XLOCALEDIR, X11_LOCALEDIR, [Location of libX11 locale data])
385AC_SUBST(X11_LOCALEDIR)
386
387locales="\
388 am_ET.UTF-8  armscii-8   C           cs_CZ.UTF-8  el_GR.UTF-8  en_US.UTF-8 \
389 fi_FI.UTF-8  georgian-academy        georgian-ps  ibm-cp1133   iscii-dev \
390 isiri-3342   iso8859-1   iso8859-10  iso8859-11   iso8859-13   iso8859-14 \
391 iso8859-15   iso8859-2   iso8859-3   iso8859-4    iso8859-5    iso8859-6 \
392 iso8859-7    iso8859-8   iso8859-9   iso8859-9e   ja           ja.JIS \
393 ja_JP.UTF-8  ja.SJIS     km_KH.UTF-8 ko           koi8-c       koi8-r \
394 koi8-u       ko_KR.UTF-8 microsoft-cp1251         microsoft-cp1255 \
395 microsoft-cp1256         mulelao-1   nokhchi-1    pt_BR.UTF-8  pt_PT.UTF-8 \
396 ru_RU.UTF-8  sr_RS.UTF-8 tatar-cyr   th_TH        th_TH.UTF-8  tscii-0 \
397 vi_VN.tcvn   vi_VN.viscii            zh_CN        zh_CN.gb18030 \
398 zh_CN.gbk    zh_CN.UTF-8 zh_HK.big5  zh_HK.big5hkscs           zh_HK.UTF-8 \
399 zh_TW        zh_TW.big5  zh_TW.UTF-8"
400AC_SUBST(locales)
401
402XKEYSYMDB="${X11_DATADIR}/XKeysymDB"
403AX_DEFINE_DIR(XKEYSYMDB, XKEYSYMDB, [Location of keysym database])
404
405XERRORDB="${X11_DATADIR}/XErrorDB"
406AX_DEFINE_DIR(XERRORDB, XERRORDB, [Location of error message database])
407
408XORG_CHECK_MALLOC_ZERO
409
410AC_CONFIG_FILES([Makefile
411		include/Makefile
412		man/Makefile
413		man/xkb/Makefile
414		src/Makefile
415		src/util/Makefile
416		src/xcms/Makefile
417		src/xlibi18n/Makefile
418		modules/Makefile
419		modules/im/Makefile
420		modules/im/ximcp/Makefile
421		modules/lc/Makefile
422		modules/lc/def/Makefile
423		modules/lc/gen/Makefile
424		modules/lc/Utf8/Makefile
425		modules/om/Makefile
426		modules/om/generic/Makefile
427		src/xkb/Makefile
428		nls/Makefile
429		specs/Makefile
430		specs/i18n/Makefile
431		specs/i18n/compose/Makefile
432		specs/i18n/framework/Makefile
433		specs/i18n/localedb/Makefile
434		specs/i18n/trans/Makefile
435		specs/libX11/Makefile
436		specs/XIM/Makefile
437		specs/XKB/Makefile
438		x11.pc
439		x11-xcb.pc])
440AC_OUTPUT
441
442echo ""
443echo "$PACKAGE_STRING will be built with the following settings:"
444echo " Loadable i18n module support:            "$XLIB_LOADABLE_I18N
445echo " Loadable xcursor library support:        "$XLIB_LOADABLE_XCURSOR
446echo " Threading support:                       "$xthreads
447echo " Use Threads safe API:                    "$mtsafeapi
448echo " Use thread safety constructor:           "$USE_THREAD_SAFETY_CONSTRUCTOR
449echo " XCMS:                                    "$XCMS
450echo " Internationalization support:            "$XLOCALE
451echo " XF86BigFont support:                     "$XF86BIGFONT
452echo " XKB support:                             "$XKB
453echo " XLOCALEDIR environment variable support: "$ENABLE_XLOCALEDIR
454echo " Compose table cache enabled:             "$COMPOSECACHE
455echo " Functional specs building enabled:       "$build_specs
456echo ""
457