configure.ac revision e9628295
1 2# Initialize Autoconf 3AC_PREREQ([2.60]) 4AC_INIT([libX11], [1.8.1], 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-xz]) 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.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 225AC_CHECK_LIB(c, pthread_self, [thrstubs="no"], [thrstubs="yes"]) 226AM_CONDITIONAL(THRSTUBS, test x$thrstubs = xyes) 227 228# XXX incomplete, please fill this in 229if test x$xthreads = xyes ; then 230 case $host_os in 231 linux*|gnu*|k*bsd*-gnu) 232 XTHREADLIB=-lpthread ;; 233 netbsd*) 234 XTHREAD_CFLAGS="-D_POSIX_THREAD_SAFE_FUNCTIONS" 235 XTHREADLIB="-lpthread" ;; 236 freebsd*) 237 XTHREAD_CFLAGS="-D_THREAD_SAFE" 238 XTHREADLIB="-pthread" ;; 239 dragonfly*|openbsd*) 240 XTHREADLIB="-pthread" ;; 241 solaris*) 242 XTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" ;; 243 esac 244fi 245AC_SUBST(XTHREADLIB) 246AC_SUBST(XTHREAD_CFLAGS) 247 248AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], ) 249 250# 251# Find keysymdef.h 252# 253AC_MSG_CHECKING([keysym definitions]) 254AC_ARG_WITH([keysymdefdir], 255 [AC_HELP_STRING([--with-keysymdefdir=DIR], [The location of keysymdef.h (defaults to xproto include dir)])], 256 [KEYSYMDEFDIR=$withval], 257 [KEYSYMDEFDIR=`$PKG_CONFIG --variable=includedir xproto`/X11]) 258 259if test ! -d "$KEYSYMDEFDIR"; then 260 AC_MSG_ERROR([$KEYSYMDEFDIR doesn't exist or isn't a directory]) 261fi 262 263FILES="keysymdef.h XF86keysym.h Sunkeysym.h DECkeysym.h HPkeysym.h" 264for i in $FILES; do 265 if test -f "$KEYSYMDEFDIR/$i"; then 266 KEYSYMDEFS="$KEYSYMDEFS $KEYSYMDEFDIR/$i" 267 elif test "x$i" = "xkeysymdef.h"; then 268 AC_MSG_ERROR([Cannot find keysymdef.h]) 269 fi 270done 271AC_MSG_RESULT([$KEYSYMDEFS]) 272AC_SUBST(KEYSYMDEFS) 273 274AC_ARG_ENABLE(xcms, 275 AS_HELP_STRING([--disable-xcms], 276 [Disable Xlib support for CMS *EXPERIMENTAL*]), 277 [XCMS=$enableval],[XCMS=yes]) 278AM_CONDITIONAL(XCMS, [test x$XCMS = xyes ]) 279if test x"$XCMS" = "xyes"; then 280 AC_DEFINE(XCMS,1,[Include support for XCMS]) 281fi 282 283AC_ARG_ENABLE(xlocale, 284 AS_HELP_STRING([--disable-xlocale], 285 [Disable Xlib locale implementation *EXPERIMENTAL*]), 286 [XLOCALE=$enableval],[XLOCALE=yes]) 287 288AM_CONDITIONAL(XLOCALE, [ test x$XLOCALE = xyes ]) 289if test x"$XLOCALE" = "xyes"; then 290 AC_DEFINE(XLOCALE,1,[support for X Locales]) 291fi 292 293# This disables XLOCALEDIR. Set it if you're using BuildLoadableXlibI18n, 294# don't have either issetugid() or getresuid(), and you need to protect 295# clients that are setgid or setuid to an id other than 0. 296AC_MSG_CHECKING([if XLOCALEDIR support should be enabled]) 297AC_ARG_ENABLE(xlocaledir, 298 AS_HELP_STRING([--enable-xlocaledir], 299 [Enable XLOCALEDIR environment variable support]), 300 [ENABLE_XLOCALEDIR=$enableval],[ENABLE_XLOCALEDIR=$XLOCALEDIR_IS_SAFE]) 301if test "x$ENABLE_XLOCALEDIR" = "xno"; then 302 AC_DEFINE(NO_XLOCALEDIR,1,[Disable XLOCALEDIR environment variable]) 303fi 304AC_MSG_RESULT($ENABLE_XLOCALEDIR) 305 306AC_ARG_ENABLE(xf86bigfont, 307 AS_HELP_STRING([--disable-xf86bigfont], 308 [Disable XF86BigFont extension support]), 309 [XF86BIGFONT=$enableval],[XF86BIGFONT="yes"]) 310if test "x$XF86BIGFONT" = "xyes"; then 311 PKG_CHECK_MODULES(BIGFONT, [xf86bigfontproto >= 1.2.0], 312 AC_DEFINE(XF86BIGFONT,1,[Enable XF86BIGFONT extension]),XF86BIGFONT="no") 313fi 314 315AC_ARG_ENABLE(xkb, 316 AS_HELP_STRING([--disable-xkb], 317 [Disable XKB support *EXPERIMENTAL*]), 318 [XKB=$enableval],[XKB=yes]) 319 320AM_CONDITIONAL(XKB, [ test x$XKB = xyes ]) 321if test x"$XKB" = "xyes"; then 322 XKBPROTO_REQUIRES="kbproto" 323 X11_REQUIRES="${X11_REQUIRES} kbproto inputproto" 324 AC_DEFINE(XKB,1,[Use XKB]) 325else 326 XKBPROTO_REQUIRES="" 327fi 328AC_SUBST(XKBPROTO_REQUIRES) 329 330AC_FUNC_MMAP() 331composecache_default=$ac_cv_func_mmap_fixed_mapped 332AC_CHECK_FUNC(nl_langinfo, , [composecache_default=no]) 333AC_ARG_ENABLE(composecache, 334 AS_HELP_STRING([--disable-composecache], 335 [Disable compose table cache support]), 336 [COMPOSECACHE=$enableval],[COMPOSECACHE=$composecache_default]) 337if test x"$COMPOSECACHE" = "xyes"; then 338 AC_DEFINE(COMPOSECACHE,1,[Include compose table cache support]) 339fi 340 341# Allow checking code with lint, sparse, etc. 342XORG_WITH_LINT 343XORG_LINT_LIBRARY([X11]) 344 345X11_DATADIR="${datadir}/X11" 346AX_DEFINE_DIR(X11_DATADIR, X11_DATADIR, [Location of libX11 data]) 347AC_SUBST(X11_DATADIR) 348 349X11_LIBDIR="${libdir}/X11" 350AX_DEFINE_DIR(X11_LIBDIR, X11_LIBDIR, [Location of libX11 library data]) 351AC_SUBST(X11_LIBDIR) 352 353PKG_CHECK_MODULES(X11, [$X11_REQUIRES]) 354X11_CFLAGS="$X11_CFLAGS $XTHREAD_CFLAGS" 355 356# 357# Yes, it would be nice to put the locale data in 358# /usr/share, but the locale stuff includes loadable 359# libraries which must be located in the same directory 360# as the other locale data, so for now, everything lives 361# in ${libdir} 362# 363 364X11_LOCALEDATADIR="${X11_DATADIR}/locale" 365AX_DEFINE_DIR(XLOCALEDATADIR, X11_LOCALEDATADIR, [Location of libX11 locale data]) 366AC_SUBST(X11_LOCALEDATADIR) 367 368AC_ARG_WITH(locale-lib-dir, AS_HELP_STRING([--with-locale-lib-dir=DIR], 369 [Directory where locale libraries files are installed (default: $libdir/X11/locale)]), 370 [ X11_LOCALELIBDIR="$withval" ], 371 [ X11_LOCALELIBDIR="${X11_LIBDIR}/locale" ]) 372AX_DEFINE_DIR(XLOCALELIBDIR, X11_LOCALELIBDIR, [Location of libX11 locale libraries]) 373AC_SUBST(X11_LOCALELIBDIR) 374 375X11_LOCALEDIR="${X11_LOCALEDATADIR}" 376AX_DEFINE_DIR(XLOCALEDIR, X11_LOCALEDIR, [Location of libX11 locale data]) 377AC_SUBST(X11_LOCALEDIR) 378 379locales="\ 380 am_ET.UTF-8 armscii-8 C cs_CZ.UTF-8 el_GR.UTF-8 en_US.UTF-8 \ 381 fi_FI.UTF-8 georgian-academy georgian-ps ibm-cp1133 iscii-dev \ 382 isiri-3342 iso8859-1 iso8859-10 iso8859-11 iso8859-13 iso8859-14 \ 383 iso8859-15 iso8859-2 iso8859-3 iso8859-4 iso8859-5 iso8859-6 \ 384 iso8859-7 iso8859-8 iso8859-9 iso8859-9e ja ja.JIS \ 385 ja_JP.UTF-8 ja.SJIS km_KH.UTF-8 ko koi8-c koi8-r \ 386 koi8-u ko_KR.UTF-8 microsoft-cp1251 microsoft-cp1255 \ 387 microsoft-cp1256 mulelao-1 nokhchi-1 pt_BR.UTF-8 pt_PT.UTF-8 \ 388 ru_RU.UTF-8 sr_RS.UTF-8 tatar-cyr th_TH th_TH.UTF-8 tscii-0 \ 389 vi_VN.tcvn vi_VN.viscii zh_CN zh_CN.gb18030 \ 390 zh_CN.gbk zh_CN.UTF-8 zh_HK.big5 zh_HK.big5hkscs zh_HK.UTF-8 \ 391 zh_TW zh_TW.big5 zh_TW.UTF-8" 392AC_SUBST(locales) 393 394XKEYSYMDB="${X11_DATADIR}/XKeysymDB" 395AX_DEFINE_DIR(XKEYSYMDB, XKEYSYMDB, [Location of keysym database]) 396 397XERRORDB="${X11_DATADIR}/XErrorDB" 398AX_DEFINE_DIR(XERRORDB, XERRORDB, [Location of error message database]) 399 400XORG_CHECK_MALLOC_ZERO 401 402AC_CONFIG_FILES([Makefile 403 include/Makefile 404 man/Makefile 405 man/xkb/Makefile 406 src/Makefile 407 src/util/Makefile 408 src/xcms/Makefile 409 src/xlibi18n/Makefile 410 modules/Makefile 411 modules/im/Makefile 412 modules/im/ximcp/Makefile 413 modules/lc/Makefile 414 modules/lc/def/Makefile 415 modules/lc/gen/Makefile 416 modules/lc/Utf8/Makefile 417 modules/om/Makefile 418 modules/om/generic/Makefile 419 src/xkb/Makefile 420 nls/Makefile 421 specs/Makefile 422 specs/i18n/Makefile 423 specs/i18n/compose/Makefile 424 specs/i18n/framework/Makefile 425 specs/i18n/localedb/Makefile 426 specs/i18n/trans/Makefile 427 specs/libX11/Makefile 428 specs/XIM/Makefile 429 specs/XKB/Makefile 430 x11.pc 431 x11-xcb.pc]) 432AC_OUTPUT 433 434echo "" 435echo "X11 will be built with the following settings:" 436echo " Loadable i18n module support: "$XLIB_LOADABLE_I18N 437echo " Loadable xcursor library support: "$XLIB_LOADABLE_XCURSOR 438echo " Threading support: "$xthreads 439echo " Use Threads safe API: "$mtsafeapi 440echo " Threads stubs in libX11: "$thrstubs 441echo " XCMS: "$XCMS 442echo " Internationalization support: "$XLOCALE 443echo " XF86BigFont support: "$XF86BIGFONT 444echo " XKB support: "$XKB 445echo " XLOCALEDIR environment variable support: "$ENABLE_XLOCALEDIR 446echo " Compose table cache enabled: "$COMPOSECACHE 447echo " Functional specs building enabled: "$build_specs 448echo "" 449