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