configure.ac revision e9fcaa8a
1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3 4AC_PREREQ(2.60) 5AC_INIT([libX11], 6 [1.4.1], 7 [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], 8 libX11) 9AC_CONFIG_SRCDIR([Makefile.am]) 10AC_CONFIG_MACRO_DIR([m4]) 11AC_CANONICAL_BUILD 12AC_CANONICAL_HOST 13 14AM_INIT_AUTOMAKE([foreign dist-bzip2]) 15AM_MAINTAINER_MODE 16AM_CONFIG_HEADER([src/config.h]) 17AC_CONFIG_HEADER([include/X11/XlibConf.h]) 18 19# Set common system defines for POSIX extensions, such as _GNU_SOURCE 20# Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL) 21# to avoid autoconf errors. 22AC_USE_SYSTEM_EXTENSIONS 23 24# Require xorg-macros minimum of 1.11 for disabling fop by default 25m4_ifndef([XORG_MACROS_VERSION], 26 [m4_fatal([must install xorg-macros 1.11 or later before running autoconf/autogen])]) 27XORG_MACROS_VERSION(1.11) 28XORG_DEFAULT_OPTIONS 29XORG_ENABLE_SPECS 30XORG_WITH_XMLTO(0.0.20) 31XORG_WITH_FOP([no]) 32XORG_CHECK_SGML_DOCTOOLS(1.5) 33XORG_PROG_RAWCPP 34 35# Checks for programs. 36AC_PROG_LIBTOOL 37AC_PROG_CC 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 70# Find perl for "make check" tests in nls/Makefile.am 71AC_ARG_WITH(perl, 72 AC_HELP_STRING([--with-perl=<path>], 73 [path to perl interpreter for build-time tests]), 74 [PERL=$withval ; AC_MSG_CHECKING([perl]) ; 75 AC_MSG_RESULT([(from --with-perl) $PERL])], 76 AC_CHECK_PROGS([PERL], [perl], [no])) 77AM_CONDITIONAL(HAVE_PERL, test x$PERL != xno) 78 79# Checks for pkg-config packages 80 81# Always required 82X11_REQUIRES='xproto >= 7.0.13 xextproto xtrans xcb >= 1.1.92' 83X11_EXTRA_DEPS="xcb >= 1.1.92" 84 85PKG_PROG_PKG_CONFIG() 86 87AC_SUBST(X11_EXTRA_DEPS) 88 89dnl Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro 90dnl was not expanded, since libX11 with no transport types is rather useless. 91dnl 92dnl If you're seeing an error here, be sure you installed the lib/xtrans module 93dnl first and if it's not in the default location, that you set the ACLOCAL 94dnl environment variable to find it, such as: 95dnl ACLOCAL="aclocal -I ${PREFIX}/share/aclocal" 96m4_pattern_forbid([^XTRANS_CONNECTION_FLAGS$]) 97 98# Transport selection macro from xtrans.m4 99XTRANS_CONNECTION_FLAGS 100 101# Secure RPC detection macro from xtrans.m4 102XTRANS_SECURE_RPC_FLAGS 103 104# Preferred order to try transports for local connections 105AC_MSG_CHECKING([what order to try transports in for local connections]) 106DEFAULT_LOCAL_TRANS="" 107case $host_os in 108 solaris*) 109 # On Solaris 2.6 through 9, named pipes (LOCAL_TRANS) were 110 # faster than Unix domain sockets, but on Solaris 10 & later, 111 # Unix domain sockets are faster now. 112 if test "$UNIXCONN" = "yes" ; then 113 if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then 114 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}," 115 fi 116 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}UNIX_TRANS" 117 fi 118 if test "$LOCALCONN" = "yes" ; then 119 if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then 120 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}," 121 fi 122 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}LOCAL_TRANS" 123 fi 124 if test "$TCPCONN" = "yes" ; then 125 if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then 126 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}," 127 fi 128 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}TCP_TRANS" 129 fi 130 ;; 131 linux*) 132 # LOCAL_TRANS is used for abstract sockets. 133 if test "$UNIXCONN" = "yes" ; then 134 if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then 135 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}," 136 fi 137 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}LOCAL_TRANS,UNIX_TRANS" 138 fi 139 if test "$TCPCONN" = "yes" ; then 140 if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then 141 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}," 142 fi 143 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}TCP_TRANS" 144 fi 145 ;; 146 *) 147 if test "$LOCALCONN" = "yes" ; then 148 if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then 149 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}," 150 fi 151 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}LOCAL_TRANS" 152 fi 153 if test "$UNIXCONN" = "yes" ; then 154 if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then 155 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}," 156 fi 157 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}UNIX_TRANS" 158 fi 159 if test "$TCPCONN" = "yes" ; then 160 if test ! "x$DEFAULT_LOCAL_TRANS" = "x" ; then 161 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}," 162 fi 163 DEFAULT_LOCAL_TRANS="${DEFAULT_LOCAL_TRANS}TCP_TRANS" 164 fi 165 ;; 166esac 167 168AC_ARG_WITH(local-transport-order, 169 AC_HELP_STRING([--with-local-transport-order=LIST], [preference sorted list of transport types to try for local connections]), 170 [LOCAL_TRANSPORT_LIST=$withval], 171 [LOCAL_TRANSPORT_LIST=$DEFAULT_LOCAL_TRANS]) 172AC_DEFINE_UNQUOTED([LOCAL_TRANSPORT_LIST], [$LOCAL_TRANSPORT_LIST], 173 [preference sorted list of transport types to try for local connections]) 174AC_MSG_RESULT([$LOCAL_TRANSPORT_LIST]) 175 176# Check for dlopen 177AC_MSG_CHECKING([if run-time linking is supported]) 178AC_SEARCH_LIBS(dlopen,[dl svld]) 179if test "x$ac_cv_search_dlopen" = xno; then 180 AC_SEARCH_LIBS(shl_load,[dld]) 181 if test "x$ac_cv_search_shl_load" != xno; then 182 AC_DEFINE(HAVE_SHL_LOAD,1, 183 [Use shl_load to load shared libraries]) 184 AC_CHECK_HEADERS([dl.h]) 185 fi 186else 187 AC_DEFINE(HAVE_DLOPEN,1,[Use dlopen to load shared libraries]) 188 AC_CHECK_HEADERS([dlfcn.h]) 189fi 190if test x$ac_cv_header_dlcfn_h -o x$ac_cv_header_dl_h; then 191 HAVE_LOADABLE_MODULES=yes 192else 193 HAVE_LOADABLE_MODULES=no 194fi 195AC_MSG_RESULT($HAVE_LOADABLE_MODULES) 196 197AC_MSG_CHECKING([if loadable i18n module support should be enabled]) 198AC_ARG_ENABLE(loadable-i18n, 199 AC_HELP_STRING([--enable-loadable-i18n], 200 [Controls loadable i18n module support]), 201 [XLIB_LOADABLE_I18N=$enableval], 202 [XLIB_LOADABLE_I18N="no"]) 203if test x$XLIB_LOADABLE_I18N = xyes; then 204 if test x$HAVE_LOADABLE_MODULES = xno; then 205 AC_MSG_ERROR([Loadable module support is required to enable loadable i18n module support]) 206 fi 207 AC_DEFINE(USE_DYNAMIC_LC,1, 208 [Split some i18n functions into loadable modules]) 209 AC_SUBST(I18N_MODULE_LIBS,'${top_builddir}/src/libX11.la') 210fi 211AC_MSG_RESULT($XLIB_LOADABLE_I18N) 212 213AM_CONDITIONAL(XLIB_LOADABLE_I18N, test x$XLIB_LOADABLE_I18N = xyes) 214 215AC_MSG_CHECKING([if loadable Xcursor library support should be enabled]) 216AC_ARG_ENABLE(loadable-xcursor, 217 AC_HELP_STRING([--disable-loadable-xcursor], 218 [Controls loadable xcursor library support]), 219 [XLIB_LOADABLE_XCURSOR=$enableval], 220 [XLIB_LOADABLE_XCURSOR=$HAVE_LOADABLE_MODULES]) 221if test x$XLIB_LOADABLE_XCURSOR = xyes; then 222 AC_DEFINE(USE_DYNAMIC_XCURSOR,1, 223 [Use the X cursor library to load cursors]) 224fi 225AC_MSG_RESULT($XLIB_LOADABLE_XCURSOR) 226 227# Checks for header files. 228AC_HEADER_STDC 229AC_CHECK_HEADERS([sys/select.h]) 230 231# Checks for typedefs, structures, and compiler characteristics. 232 233# Checks for library functions. 234AC_CHECK_FUNCS([strtol]) 235# Used in lcFile.c (see also --enable-xlocaledir settings below) 236XLOCALEDIR_IS_SAFE="no" 237AC_CHECK_FUNC([issetugid], [XLOCALEDIR_IS_SAFE="yes"] 238 AC_DEFINE(HASSETUGID,1,[Has issetugid() function])) 239AC_CHECK_FUNC([getresuid], [XLOCALEDIR_IS_SAFE="yes"] 240 AC_DEFINE(HASGETRESUID,1,[Has getresuid() & getresgid() functions])) 241# Used in Font.c 242AC_CHECK_FUNC([shmat], AC_DEFINE(HAS_SHM,1,[Has shm*() functions])) 243 244# Checks for system services 245dnl AC_PATH_XTRA 246 247# arch specific things 248WCHAR32="1" 249case $host_os in 250 os2*) os2="true" ; WCHAR32="0" ;; 251 *) ;; 252esac 253AC_SUBST(WCHAR32) 254 255AM_CONDITIONAL(OS2, test x$os2 = xtrue) 256 257AC_ARG_WITH(launchd, AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto]) 258if test "x$LAUNCHD" = xauto; then 259 unset LAUNCHD 260 AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no], [$PATH$PATH_SEPARATOR/sbin]) 261fi 262 263if test "x$LAUNCHD" = xyes ; then 264 AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available]) 265 AC_DEFINE(TRANS_REOPEN, 1, [launchd support available]) 266fi 267 268AC_ARG_ENABLE(xthreads, 269 AC_HELP_STRING([--disable-xthreads], 270 [Disable Xlib support for Multithreading]), 271 [xthreads=$enableval],[xthreads=yes]) 272 273AC_CHECK_LIB(c, getpwuid_r, [mtsafeapi="yes"], [mtsafeapi="no"]) 274 275case x$xthreads in 276xyes) 277 AC_DEFINE(XTHREADS,1,[Whether libX11 is compiled with thread support]) 278 if test x$mtsafeapi = xyes 279 then 280 AC_DEFINE(XUSE_MTSAFE_API,1,[Whether libX11 needs to use MT safe API's]) 281 fi 282 ;; 283*) 284 ;; 285esac 286 287AC_CHECK_LIB(c, pthread_self, [thrstubs="no"], [thrstubs="yes"]) 288AM_CONDITIONAL(THRSTUBS, test x$thrstubs = xyes) 289 290dnl XXX incomplete, please fill this in 291if test x$xthreads = xyes ; then 292 case $host_os in 293 linux*|openbsd*|gnu*|k*bsd*-gnu) 294 XTHREADLIB=-lpthread ;; 295 netbsd*) 296 XTHREAD_CFLAGS="-D_POSIX_THREAD_SAFE_FUNCTIONS" 297 XTHREADLIB="-lpthread" ;; 298 freebsd*) 299 XTHREAD_CFLAGS="-D_THREAD_SAFE" 300 XTHREADLIB="-pthread" ;; 301 dragonfly*) 302 XTHREADLIB="-pthread" ;; 303 solaris*) 304 XTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" ;; 305 esac 306fi 307AC_SUBST(XTHREADLIB) 308AC_SUBST(XTHREAD_CFLAGS) 309 310AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], ) 311 312# 313# Find keysymdef.h 314# 315AC_MSG_CHECKING([keysym definitions]) 316KEYSYMDEFDIR=`$PKG_CONFIG --variable=includedir xproto`/X11 317FILES="keysymdef.h XF86keysym.h Sunkeysym.h DECkeysym.h HPkeysym.h" 318for i in $FILES; do 319 if test -f "$KEYSYMDEFDIR/$i"; then 320 KEYSYMDEFS="$KEYSYMDEFS $KEYSYMDEFDIR/$i" 321 elif test "x$i" = "xkeysymdef.h"; then 322 AC_MSG_ERROR([Cannot find keysymdef.h]) 323 fi 324done 325AC_MSG_RESULT([$KEYSYMDEFS]) 326AC_SUBST(KEYSYMDEFS) 327 328AM_CONDITIONAL(UDC, test xfalse = xtrue) 329 330AC_ARG_ENABLE(xcms, 331 AC_HELP_STRING([--disable-xcms], 332 [Disable Xlib support for CMS *EXPERIMENTAL*]), 333 [XCMS=$enableval],[XCMS=yes]) 334AM_CONDITIONAL(XCMS, [test x$XCMS = xyes ]) 335if test x"$XCMS" = "xyes"; then 336 AC_DEFINE(XCMS,1,[Include support for XCMS]) 337fi 338 339AC_ARG_ENABLE(xlocale, 340 AC_HELP_STRING([--disable-xlocale], 341 [Disable Xlib locale implementation *EXPERIMENTAL*]), 342 [XLOCALE=$enableval],[XLOCALE=yes]) 343 344AM_CONDITIONAL(XLOCALE, [ test x$XLOCALE = xyes ]) 345if test x"$XLOCALE" = "xyes"; then 346 AC_DEFINE(XLOCALE,1,[support for X Locales]) 347fi 348 349# This disables XLOCALEDIR. Set it if you're using BuildLoadableXlibI18n, 350# don't have either issetugid() or getresuid(), and you need to protect 351# clients that are setgid or setuid to an id other than 0. 352AC_MSG_CHECKING([if XLOCALEDIR support should be enabled]) 353AC_ARG_ENABLE(xlocaledir, 354 AC_HELP_STRING([--enable-xlocaledir], 355 [Enable XLOCALEDIR environment variable support]), 356 [ENABLE_XLOCALEDIR=$enableval],[ENABLE_XLOCALEDIR=$XLOCALEDIR_IS_SAFE]) 357if test "x$ENABLE_XLOCALEDIR" = "xno"; then 358 AC_DEFINE(NO_XLOCALEDIR,1,[Disable XLOCALEDIR environment variable]) 359fi 360AC_MSG_RESULT($ENABLE_XLOCALEDIR) 361 362AC_ARG_ENABLE(xf86bigfont, 363 AC_HELP_STRING([--disable-xf86bigfont], 364 [Disable XF86BigFont extension support]), 365 [XF86BIGFONT=$enableval],[XF86BIGFONT="yes"]) 366if test "x$XF86BIGFONT" = "xyes"; then 367 PKG_CHECK_MODULES(BIGFONT, xf86bigfontproto, 368 AC_DEFINE(XF86BIGFONT,1,[Enable XF86BIGFONT extension]),XF86BIGFONT="no") 369 AC_SUBST(BIGFONT_CFLAGS) 370 AC_SUBST(BIGFONT_LIBS) 371fi 372 373AC_ARG_ENABLE(xkb, 374 AC_HELP_STRING([--disable-xkb], 375 [Disable XKB support *EXPERIMENTAL*]), 376 [XKB=$enableval],[XKB=yes]) 377 378AM_CONDITIONAL(XKB, [ test x$XKB = xyes ]) 379if test x"$XKB" = "xyes"; then 380 XKBPROTO_REQUIRES="kbproto" 381 X11_REQUIRES="${X11_REQUIRES} kbproto inputproto" 382 AC_DEFINE(XKB,1,[Use XKB]) 383else 384 XKBPROTO_REQUIRES="" 385fi 386AC_SUBST(XKBPROTO_REQUIRES) 387 388AC_FUNC_MMAP() 389composecache_default=$ac_cv_func_mmap_fixed_mapped 390AC_CHECK_FUNC(nl_langinfo, , [composecache_default=no]) 391AC_ARG_ENABLE(composecache, 392 AC_HELP_STRING([--disable-composecache], 393 [Disable compose table cache support]), 394 [COMPOSECACHE=$enableval],[COMPOSECACHE=$composecache_default]) 395if test x"$COMPOSECACHE" = "xyes"; then 396 AC_DEFINE(COMPOSECACHE,1,[Include compose table cache support]) 397fi 398 399dnl Allow checking code with lint, sparse, etc. 400XORG_WITH_LINT 401XORG_LINT_LIBRARY([X11]) 402 403X11_DATADIR="${datadir}/X11" 404AX_DEFINE_DIR(X11_DATADIR, X11_DATADIR, [Location of libX11 data]) 405AC_SUBST(X11_DATADIR) 406 407X11_LIBDIR="${libdir}/X11" 408AX_DEFINE_DIR(X11_LIBDIR, X11_LIBDIR, [Location of libX11 library data]) 409AC_SUBST(X11_LIBDIR) 410 411PKG_CHECK_MODULES(X11, [$X11_REQUIRES]) 412X11_CFLAGS="$X11_CFLAGS $XTHREAD_CFLAGS" 413 414# 415# Yes, it would be nice to put the locale data in 416# /usr/share, but the locale stuff includes loadable 417# libraries which must be located in the same directory 418# as the other locale data, so for now, everything lives 419# in ${libdir} 420# 421 422X11_LOCALEDATADIR="${X11_DATADIR}/locale" 423AX_DEFINE_DIR(XLOCALEDATADIR, X11_LOCALEDATADIR, [Location of libX11 locale data]) 424AC_SUBST(X11_LOCALEDATADIR) 425 426AC_ARG_WITH(locale-lib-dir, AS_HELP_STRING([--with-locale-lib-dir=DIR], 427 [Directory where locale libraries files are installed (default: $libdir/X11/locale)]), 428 [ X11_LOCALELIBDIR="$withval" ], 429 [ X11_LOCALELIBDIR="${X11_LIBDIR}/locale" ]) 430AX_DEFINE_DIR(XLOCALELIBDIR, X11_LOCALELIBDIR, [Location of libX11 locale libraries]) 431AC_SUBST(X11_LOCALELIBDIR) 432 433X11_LOCALEDIR="${X11_LOCALEDATADIR}" 434AX_DEFINE_DIR(XLOCALEDIR, X11_LOCALEDIR, [Location of libX11 locale data]) 435AC_SUBST(X11_LOCALEDIR) 436 437XKEYSYMDB="${X11_DATADIR}/XKeysymDB" 438AX_DEFINE_DIR(XKEYSYMDB, XKEYSYMDB, [Location of keysym database]) 439 440XERRORDB="${X11_DATADIR}/XErrorDB" 441AX_DEFINE_DIR(XERRORDB, XERRORDB, [Location of error message database]) 442 443XORG_CHECK_MALLOC_ZERO 444 445AC_OUTPUT([Makefile 446 include/Makefile 447 man/Makefile 448 man/xkb/Makefile 449 src/Makefile 450 src/util/Makefile 451 src/xcms/Makefile 452 src/xlibi18n/Makefile 453 modules/Makefile 454 modules/im/Makefile 455 modules/im/ximcp/Makefile 456 modules/lc/Makefile 457 modules/lc/def/Makefile 458 modules/lc/gen/Makefile 459 modules/lc/Utf8/Makefile 460 modules/lc/xlocale/Makefile 461 modules/om/Makefile 462 modules/om/generic/Makefile 463 src/xkb/Makefile 464 nls/Makefile 465 specs/Makefile 466 specs/i18n/Makefile 467 specs/i18n/framework/Makefile 468 specs/i18n/localedb/Makefile 469 specs/i18n/trans/Makefile 470 specs/libX11/Makefile 471 specs/XIM/Makefile 472 specs/XKB/Makefile 473 x11.pc 474 x11-xcb.pc]) 475 476echo "" 477echo "X11 will be built with the following settings:" 478echo " Loadable i18n module support: "$XLIB_LOADABLE_I18N 479echo " Loadable xcursor library support: "$XLIB_LOADABLE_XCURSOR 480echo " Threading support: "$xthreads 481echo " Use Threads safe API: "$mtsafeapi 482echo " Threads stubs in libX11: "$thrstubs 483echo " XCMS: "$XCMS 484echo " Internationalization support: "$XLOCALE 485echo " XF86BigFont support: "$XF86BIGFONT 486echo " XKB support: "$XKB 487echo " XLOCALEDIR environment variable support: "$ENABLE_XLOCALEDIR 488echo " Compose table cache enabled: "$COMPOSECACHE 489echo " Functional specs building enabled: "$build_specs 490echo "" 491