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