configure.ac revision b5095ab97f4cf4d2d0e5b99b7813a2e466c2459c
1dnl Process this file with autoconf to create configure. 2 3AC_PREREQ([2.59]) 4 5dnl Versioning - scrape the version from configs/default 6m4_define([mesa_version], 7 [m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n'])]) 8m4_ifval(mesa_version,[],[ 9 m4_errprint([Error: Failed to get the Mesa version from the output of 10 running `make -f bin/version.mk version' 11]) 12 m4_exit([1]) 13]) 14 15dnl Tell the user about autoconf.html in the --help output 16m4_divert_once([HELP_END], [ 17See docs/autoconf.html for more details on the options for Mesa.]) 18 19AC_INIT([Mesa],[mesa_version], 20 [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa]) 21AC_CONFIG_AUX_DIR([bin]) 22AC_CANONICAL_HOST 23 24dnl Versions for external dependencies 25LIBDRM_REQUIRED=2.3.1 26DRI2PROTO_REQUIRED=1.1 27 28dnl Check for progs 29AC_PROG_CPP 30AC_PROG_CC 31AC_PROG_CXX 32AC_CHECK_PROGS([MAKE], [gmake make]) 33AC_PATH_PROG([MKDEP], [makedepend]) 34AC_PATH_PROG([SED], [sed]) 35 36dnl We need a POSIX shell for parts of the build. Assume we have one 37dnl in most cases. 38case "$host_os" in 39solaris*) 40 # Solaris /bin/sh is too old/non-POSIX compliant 41 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh]) 42 SHELL="$POSIX_SHELL" 43 ;; 44esac 45 46MKDEP_OPTIONS=-fdepend 47dnl Ask gcc where it's keeping its secret headers 48if test "x$GCC" = xyes; then 49 GCC_INCLUDES=`$CC -print-file-name=include` 50 if test "x$GCC_INCLUDES" != x; then 51 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES" 52 fi 53fi 54AC_SUBST([MKDEP_OPTIONS]) 55 56dnl Make sure the pkg-config macros are defined 57m4_ifdef([PKG_PROG_PKG_CONFIG],[],[ 58 m4_errprint([Error: Could not locate the pkg-config autoconf macros. 59 These are usually located in /usr/share/aclocal/pkg.m4. If your 60 macros are in a different location, try setting the environment 61 variable ACLOCAL="aclocal -I/other/macro/dir" before running 62 autoreconf. 63]) 64 m4_exit([1]) 65]) 66PKG_PROG_PKG_CONFIG() 67 68dnl LIB_DIR - library basename 69LIB_DIR=`echo $libdir | $SED 's%.*/%%'` 70AC_SUBST([LIB_DIR]) 71 72dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later 73_SAVE_LDFLAGS="$LDFLAGS" 74AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker]) 75AC_SUBST([EXTRA_LIB_PATH]) 76 77dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later 78_SAVE_CPPFLAGS="$CPPFLAGS" 79AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers]) 80AC_SUBST([X11_INCLUDES]) 81 82dnl Compiler macros 83DEFINES="" 84AC_SUBST([DEFINES]) 85case "$host_os" in 86linux*) 87if test "x$GCC" = xyes; then 88 DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE" 89fi 90 DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS" 91 ;; 92solaris*) 93 DEFINES="$DEFINES -DPTHREADS -DSVR4" 94 ;; 95esac 96 97dnl Add flags for gcc and g++ 98if test "x$GCC" = xyes; then 99 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math" 100 101 # Work around aliasing bugs - developers should comment this out 102 CFLAGS="$CFLAGS -fno-strict-aliasing" 103fi 104if test "x$GXX" = xyes; then 105 CXXFLAGS="$CXXFLAGS -Wall" 106 107 # Work around aliasing bugs - developers should comment this out 108 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" 109fi 110 111dnl These should be unnecessary, but let the user set them if they want 112AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler. 113 Default is to use CFLAGS.]) 114AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the 115 compiler. Default is to use CFLAGS.]) 116AC_SUBST([OPT_FLAGS]) 117AC_SUBST([ARCH_FLAGS]) 118 119dnl 120dnl Hacks to enable 32 or 64 bit build 121dnl 122AC_ARG_ENABLE([32-bit], 123 [AS_HELP_STRING([--enable-32-bit], 124 [build 32-bit libraries @<:@default=auto@:>@])], 125 [enable_32bit="$enableval"], 126 [enable_32bit=auto] 127) 128if test "x$enable_32bit" = xyes; then 129 if test "x$GCC" = xyes; then 130 CFLAGS="$CFLAGS -m32" 131 fi 132 if test "x$GXX" = xyes; then 133 CXXFLAGS="$CXXFLAGS -m32" 134 fi 135fi 136AC_ARG_ENABLE([64-bit], 137 [AS_HELP_STRING([--enable-64-bit], 138 [build 64-bit libraries @<:@default=auto@:>@])], 139 [enable_64bit="$enableval"], 140 [enable_64bit=auto] 141) 142if test "x$enable_64bit" = xyes; then 143 if test "x$GCC" = xyes; then 144 CFLAGS="$CFLAGS -m64" 145 fi 146 if test "x$GXX" = xyes; then 147 CXXFLAGS="$CXXFLAGS -m64" 148 fi 149fi 150 151dnl 152dnl shared/static libraries, mimic libtool options 153dnl 154AC_ARG_ENABLE([static], 155 [AS_HELP_STRING([--enable-static], 156 [build static libraries @<:@default=disabled@:>@])], 157 [enable_static="$enableval"], 158 [enable_static=no] 159) 160case "x$enable_static" in 161xyes|xno ) ;; 162x ) enable_static=no ;; 163* ) 164 AC_MSG_ERROR([Static library option '$enable_static' is not a valid]) 165 ;; 166esac 167AC_ARG_ENABLE([shared], 168 [AS_HELP_STRING([--disable-shared], 169 [build shared libraries @<:@default=enabled@:>@])], 170 [enable_shared="$enableval"], 171 [enable_shared=yes] 172) 173case "x$enable_shared" in 174xyes|xno ) ;; 175x ) enable_shared=yes ;; 176* ) 177 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid]) 178 ;; 179esac 180 181dnl Can't have static and shared libraries, default to static if user 182dnl explicitly requested. If both disabled, set to static since shared 183dnl was explicitly requirested. 184case "x$enable_static$enable_shared" in 185xyesyes ) 186 AC_MSG_WARN([Can't build static and shared libraries, disabling shared]) 187 enable_shared=no 188 ;; 189xnono ) 190 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static]) 191 enable_static=yes 192 ;; 193esac 194 195dnl 196dnl mklib options 197dnl 198AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib]) 199if test "$enable_static" = yes; then 200 MKLIB_OPTIONS="$MKLIB_OPTIONS -static" 201fi 202AC_SUBST([MKLIB_OPTIONS]) 203 204dnl 205dnl other compiler options 206dnl 207AC_ARG_ENABLE([debug], 208 [AS_HELP_STRING([--enable-debug], 209 [use debug compiler flags and macros @<:@default=disabled@:>@])], 210 [enable_debug="$enableval"], 211 [enable_debug=no] 212) 213if test "x$enable_debug" = xyes; then 214 DEFINES="$DEFINES -DDEBUG" 215 if test "x$GCC" = xyes; then 216 CFLAGS="$CFLAGS -g" 217 fi 218 if test "x$GXX" = xyes; then 219 CXXFLAGS="$CXXFLAGS -g" 220 fi 221fi 222 223dnl 224dnl library names 225dnl 226if test "$enable_static" = yes; then 227 GL_LIB_NAME='lib$(GL_LIB).a' 228 GLU_LIB_NAME='lib$(GLU_LIB).a' 229 GLUT_LIB_NAME='lib$(GLUT_LIB).a' 230 GLW_LIB_NAME='lib$(GLW_LIB).a' 231 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a' 232else 233 GL_LIB_NAME='lib$(GL_LIB).so' 234 GLU_LIB_NAME='lib$(GLU_LIB).so' 235 GLUT_LIB_NAME='lib$(GLUT_LIB).so' 236 GLW_LIB_NAME='lib$(GLW_LIB).so' 237 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so' 238fi 239AC_SUBST([GL_LIB_NAME]) 240AC_SUBST([GLU_LIB_NAME]) 241AC_SUBST([GLUT_LIB_NAME]) 242AC_SUBST([GLW_LIB_NAME]) 243AC_SUBST([OSMESA_LIB_NAME]) 244 245dnl 246dnl Arch/platform-specific settings 247dnl 248AC_ARG_ENABLE([asm], 249 [AS_HELP_STRING([--disable-asm], 250 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])], 251 [enable_asm="$enableval"], 252 [enable_asm=yes] 253) 254asm_arch="" 255ASM_FLAGS="" 256ASM_SOURCES="" 257ASM_API="" 258AC_MSG_CHECKING([whether to enable assembly]) 259test "x$enable_asm" = xno && AC_MSG_RESULT([no]) 260# disable if cross compiling on x86/x86_64 since we must run gen_matypes 261if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then 262 case "$host_cpu" in 263 i?86 | x86_64) 264 enable_asm=no 265 AC_MSG_RESULT([no, cross compiling]) 266 ;; 267 esac 268fi 269# check for supported arches 270if test "x$enable_asm" = xyes; then 271 case "$host_cpu" in 272 i?86) 273 case "$host_os" in 274 linux* | freebsd* | dragonfly*) 275 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86 276 ;; 277 esac 278 ;; 279 x86_64) 280 case "$host_os" in 281 linux* | freebsd* | dragonfly*) 282 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64 283 ;; 284 esac 285 ;; 286 powerpc) 287 case "$host_os" in 288 linux*) 289 asm_arch=ppc 290 ;; 291 esac 292 ;; 293 esac 294 295 case "$asm_arch" in 296 x86) 297 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM" 298 ASM_SOURCES='$(X86_SOURCES)' 299 ASM_API='$(X86_API)' 300 AC_MSG_RESULT([yes, x86]) 301 ;; 302 x86_64) 303 ASM_FLAGS="-DUSE_X86_64_ASM" 304 ASM_SOURCES='$(X86-64_SOURCES)' 305 ASM_API='$(X86-64_API)' 306 AC_MSG_RESULT([yes, x86_64]) 307 ;; 308 ppc) 309 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM" 310 ASM_SOURCES='$(PPC_SOURCES)' 311 AC_MSG_RESULT([yes, ppc]) 312 ;; 313 *) 314 AC_MSG_RESULT([no, platform not supported]) 315 ;; 316 esac 317fi 318AC_SUBST([ASM_FLAGS]) 319AC_SUBST([ASM_SOURCES]) 320AC_SUBST([ASM_API]) 321 322dnl PIC code macro 323MESA_PIC_FLAGS 324 325dnl Check to see if dlopen is in default libraries (like Solaris, which 326dnl has it in libc), or if libdl is needed to get it. 327AC_CHECK_FUNC([dlopen], [], 328 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])]) 329 330dnl See if posix_memalign is available 331AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"]) 332 333dnl SELinux awareness. 334AC_ARG_ENABLE([selinux], 335 [AS_HELP_STRING([--enable-selinux], 336 [Build SELinux-aware Mesa @<:@default=disabled@:>@])], 337 [MESA_SELINUX="$enableval"], 338 [MESA_SELINUX=no]) 339if test "x$enable_selinux" = "xyes"; then 340 AC_CHECK_HEADER([selinux/selinux.h],[], 341 [AC_MSG_ERROR([SELinux headers not found])]) 342 AC_CHECK_LIB([selinux],[is_selinux_enabled],[], 343 [AC_MSG_ERROR([SELinux library not found])]) 344 SELINUX_LIBS="-lselinux" 345 DEFINES="$DEFINES -DMESA_SELINUX" 346fi 347 348dnl OS-specific libraries 349OS_LIBS="" 350case "$host_os" in 351solaris*) 352 OS_LIBS="-lc" 353 if test "x$GXX" != xyes; then 354 OS_CPLUSPLUS_LIBS="-lCrun $OS_LIBS" 355 fi 356 ;; 357esac 358 359dnl 360dnl Driver configuration. Options are xlib, dri and osmesa right now. 361dnl More later: directfb, fbdev, ... 362dnl 363default_driver="xlib" 364 365case "$host_os" in 366linux*) 367 case "$host_cpu" in 368 i*86|x86_64|powerpc*) default_driver="dri";; 369 esac 370 ;; 371freebsd* | dragonfly*) 372 case "$host_cpu" in 373 i*86|x86_64) default_driver="dri";; 374 esac 375 ;; 376esac 377 378AC_ARG_WITH([driver], 379 [AS_HELP_STRING([--with-driver=DRIVER], 380 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])], 381 [mesa_driver="$withval"], 382 [mesa_driver="$default_driver"]) 383dnl Check for valid option 384case "x$mesa_driver" in 385xxlib|xdri|xosmesa) 386 ;; 387*) 388 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option]) 389 ;; 390esac 391 392dnl 393dnl Driver specific build directories 394dnl 395SRC_DIRS="mesa" 396GLU_DIRS="sgi" 397WINDOW_SYSTEM="" 398case "$mesa_driver" in 399xlib) 400 DRIVER_DIRS="x11" 401 ;; 402dri) 403 SRC_DIRS="glx/x11 $SRC_DIRS" 404 DRIVER_DIRS="dri" 405 WINDOW_SYSTEM="dri" 406 ;; 407osmesa) 408 DRIVER_DIRS="osmesa" 409 ;; 410esac 411AC_SUBST([SRC_DIRS]) 412AC_SUBST([GLU_DIRS]) 413AC_SUBST([DRIVER_DIRS]) 414AC_SUBST([WINDOW_SYSTEM]) 415 416dnl 417dnl User supplied program configuration 418dnl 419if test -d "$srcdir/progs/demos"; then 420 default_demos=yes 421else 422 default_demos=no 423fi 424AC_ARG_WITH([demos], 425 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@], 426 [optional comma delimited demo directories to build 427 @<:@default=auto if source available@:>@])], 428 [with_demos="$withval"], 429 [with_demos="$default_demos"]) 430if test "x$with_demos" = x; then 431 with_demos=no 432fi 433 434dnl If $with_demos is yes, directories will be added as libs available 435PROGRAM_DIRS="" 436case "$with_demos" in 437no) ;; 438yes) 439 # If the driver isn't osmesa, we have libGL and can build xdemos 440 if test "$mesa_driver" != osmesa; then 441 PROGRAM_DIRS="xdemos" 442 fi 443 ;; 444*) 445 # verify the requested demos directories exist 446 demos=`IFS=,; echo $with_demos` 447 for demo in $demos; do 448 test -d "$srcdir/progs/$demo" || \ 449 AC_MSG_ERROR([Program directory '$demo' doesn't exist]) 450 done 451 PROGRAM_DIRS="$demos" 452 ;; 453esac 454 455dnl 456dnl Find out if X is available. The variable have_x is set if libX11 is 457dnl found to mimic AC_PATH_XTRA. 458dnl 459if test -n "$PKG_CONFIG"; then 460 AC_MSG_CHECKING([pkg-config files for X11 are available]) 461 PKG_CHECK_EXISTS([x11],[ 462 x11_pkgconfig=yes 463 have_x=yes 464 ],[ 465 x11_pkgconfig=no 466 ]) 467 AC_MSG_RESULT([$x11_pkgconfig]) 468else 469 x11_pkgconfig=no 470fi 471dnl Use the autoconf macro if no pkg-config files 472if test "$x11_pkgconfig" = no; then 473 AC_PATH_XTRA 474fi 475 476dnl Try to tell the user that the --x-* options are only used when 477dnl pkg-config is not available. This must be right after AC_PATH_XTRA. 478m4_divert_once([HELP_BEGIN], 479[These options are only used when the X libraries cannot be found by the 480pkg-config utility.]) 481 482dnl We need X for xlib and dri, so bomb now if it's not found 483case "$mesa_driver" in 484xlib|dri) 485 if test "$no_x" = yes; then 486 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver]) 487 fi 488 ;; 489esac 490 491dnl XCB - this is only used for GLX right now 492AC_ARG_ENABLE([xcb], 493 [AS_HELP_STRING([--enable-xcb], 494 [use XCB for GLX @<:@default=disabled@:>@])], 495 [enable_xcb="$enableval"], 496 [enable_xcb=no]) 497if test "x$enable_xcb" = xyes; then 498 DEFINES="$DEFINES -DUSE_XCB" 499else 500 enable_xcb=no 501fi 502 503dnl 504dnl libGL configuration per driver 505dnl 506case "$mesa_driver" in 507xlib) 508 if test "$x11_pkgconfig" = yes; then 509 PKG_CHECK_MODULES([XLIBGL], [x11 xext]) 510 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS" 511 GL_LIB_DEPS="$XLIBGL_LIBS" 512 else 513 # should check these... 514 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" 515 GL_LIB_DEPS="$X_LIBS -lX11 -lXext" 516 fi 517 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $OS_LIBS" 518 519 # if static, move the external libraries to the programs 520 # and empty the libraries for libGL 521 if test "$enable_static" = yes; then 522 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS" 523 GL_LIB_DEPS="" 524 fi 525 ;; 526dri) 527 # DRI must be shared, I think 528 if test "$enable_static" = yes; then 529 AC_MSG_ERROR([Can't use static libraries for DRI drivers]) 530 fi 531 532 # Check for libdrm 533 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED]) 534 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED]) 535 536 # find the DRI deps for libGL 537 if test "$x11_pkgconfig" = yes; then 538 # add xcb modules if necessary 539 dri_modules="x11 xext xxf86vm xdamage xfixes" 540 if test "$enable_xcb" = yes; then 541 dri_modules="$dri_modules x11-xcb xcb-glx" 542 fi 543 544 PKG_CHECK_MODULES([DRIGL], [$dri_modules]) 545 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS" 546 GL_LIB_DEPS="$DRIGL_LIBS" 547 else 548 # should check these... 549 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" 550 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes" 551 552 # XCB can only be used from pkg-config 553 if test "$enable_xcb" = yes; then 554 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx]) 555 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS" 556 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS" 557 fi 558 fi 559 560 # need DRM libs, -lpthread, etc. 561 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS $OS_LIBS" 562 ;; 563osmesa) 564 # No libGL for osmesa 565 GL_LIB_DEPS="$OS_LIBS" 566 ;; 567esac 568AC_SUBST([GL_LIB_DEPS]) 569 570dnl 571dnl More X11 setup 572dnl 573if test "$mesa_driver" = xlib; then 574 DEFINES="$DEFINES -DUSE_XSHM" 575fi 576 577dnl 578dnl More DRI setup 579dnl 580AC_ARG_ENABLE([glx-tls], 581 [AS_HELP_STRING([--enable-glx-tls], 582 [enable TLS support in GLX @<:@default=disabled@:>@])], 583 [GLX_USE_TLS="$enableval"], 584 [GLX_USE_TLS=no]) 585dnl Directory for DRI drivers 586AC_ARG_WITH([dri-driverdir], 587 [AS_HELP_STRING([--with-dri-driverdir=DIR], 588 [directory for the DRI drivers @<:@${libdir}/dri@:>@])], 589 [DRI_DRIVER_INSTALL_DIR="$withval"], 590 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri']) 591AC_SUBST([DRI_DRIVER_INSTALL_DIR]) 592dnl Direct rendering or just indirect rendering 593AC_ARG_ENABLE([driglx-direct], 594 [AS_HELP_STRING([--disable-driglx-direct], 595 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])], 596 [driglx_direct="$enableval"], 597 [driglx_direct="yes"]) 598dnl ttm support 599AC_ARG_ENABLE([ttm-api], 600 [AS_HELP_STRING([--enable-ttm-api], 601 [enable TTM API users @<:@default=disabled@:>@])], 602 [ttmapi="$enableval"], 603 [ttmapi="no"]) 604 605if test "x$ttmapi" = "xyes"; then 606 save_CFLAGS=$CFLAGS 607 CFLAGS=$LIBDRM_CFLAGS 608 AC_CHECK_HEADERS([xf86mm.h],[],[AC_MSG_ERROR([xf86mm.h required for TTM.])],[#include "stdint.h"\n#include "drm.h"]) 609 CFLAGS=$save_CFLAGS 610fi 611 612dnl Which drivers to build - default is chosen by platform 613AC_ARG_WITH([dri-drivers], 614 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@], 615 [comma delimited DRI drivers list, e.g. 616 "swrast,i965,radeon,nouveau" @<:@default=auto@:>@])], 617 [with_dri_drivers="$withval"], 618 [with_dri_drivers=yes]) 619if test "x$with_dri_drivers" = x; then 620 with_dri_drivers=no 621fi 622 623dnl If $with_dri_drivers is yes, directories will be added through 624dnl platform checks 625DRI_DIRS="" 626case "$with_dri_drivers" in 627no) ;; 628yes) 629 DRI_DIRS="yes" 630 ;; 631*) 632 # verify the requested driver directories exist 633 dri_drivers=`IFS=', '; echo $with_dri_drivers` 634 for driver in $dri_drivers; do 635 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \ 636 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist]) 637 done 638 DRI_DIRS="$dri_drivers" 639 ;; 640esac 641 642dnl Just default to no EGL for now 643USING_EGL=0 644AC_SUBST([USING_EGL]) 645 646dnl Set DRI_DIRS, DEFINES and LIB_DEPS 647if test "$mesa_driver" = dri; then 648 # Use TLS in GLX? 649 if test "x$GLX_USE_TLS" = xyes; then 650 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS" 651 fi 652 653 if test "x$ttmapi" = xyes; then 654 DEFINES="$DEFINES -DTTM_API" 655 fi 656 657 if test "x$USING_EGL" = x1; then 658 PROGRAM_DIRS="egl" 659 fi 660 661 # Platform specific settings and drivers to build 662 case "$host_os" in 663 linux*) 664 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" 665 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS" 666 if test "x$driglx_direct" = xyes; then 667 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" 668 fi 669 670 case "$host_cpu" in 671 x86_64) 672 # ffb, gamma, and sis are missing because they have not be 673 # converted to use the new interface. i810 are missing 674 # because there is no x86-64 system where they could *ever* 675 # be used. 676 if test "x$DRI_DIRS" = "xyes"; then 677 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \ 678 savage tdfx unichrome swrast" 679 fi 680 ;; 681 powerpc*) 682 # Build only the drivers for cards that exist on PowerPC. 683 # At some point MGA will be added, but not yet. 684 if test "x$DRI_DIRS" = "xyes"; then 685 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast" 686 fi 687 ;; 688 sparc*) 689 # Build only the drivers for cards that exist on sparc` 690 if test "x$DRI_DIRS" = "xyes"; then 691 DRI_DIRS="mach64 r128 r200 r300 radeon ffb swrast" 692 fi 693 ;; 694 esac 695 ;; 696 freebsd* | dragonfly*) 697 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1" 698 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS" 699 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" 700 if test "x$driglx_direct" = xyes; then 701 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" 702 fi 703 if test "x$GXX" = xyes; then 704 CXXFLAGS="$CXXFLAGS -ansi -pedantic" 705 fi 706 707 # ffb and gamma are missing because they have not been converted 708 # to use the new interface. 709 if test "x$DRI_DIRS" = "xyes"; then 710 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \ 711 unichrome savage sis swrast" 712 fi 713 ;; 714 solaris*) 715 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" 716 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" 717 if test "x$driglx_direct" = xyes; then 718 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" 719 fi 720 ;; 721 esac 722 723 # default drivers 724 if test "x$DRI_DIRS" = "xyes"; then 725 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \ 726 savage sis tdfx trident unichrome ffb swrast" 727 fi 728 729 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'` 730 731 # Check for expat 732 EXPAT_INCLUDES="" 733 EXPAT_LIB=-lexpat 734 AC_ARG_WITH([expat], 735 [AS_HELP_STRING([--with-expat=DIR], 736 [expat install directory])],[ 737 EXPAT_INCLUDES="-I$withval/include" 738 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES" 739 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR" 740 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat" 741 ]) 742 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])]) 743 AC_CHECK_LIB([expat],[XML_ParserCreate],[], 744 [AC_MSG_ERROR([Expat required for DRI.])]) 745 746 # put all the necessary libs together 747 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS" 748fi 749AC_SUBST([DRI_DIRS]) 750AC_SUBST([EXPAT_INCLUDES]) 751AC_SUBST([DRI_LIB_DEPS]) 752 753dnl 754dnl OSMesa configuration 755dnl 756if test "$mesa_driver" = xlib; then 757 default_gl_osmesa=yes 758else 759 default_gl_osmesa=no 760fi 761AC_ARG_ENABLE([gl-osmesa], 762 [AS_HELP_STRING([--enable-gl-osmesa], 763 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])], 764 [gl_osmesa="$enableval"], 765 [gl_osmesa="$default_gl_osmesa"]) 766if test "x$gl_osmesa" = xyes; then 767 if test "$mesa_driver" = osmesa; then 768 AC_MSG_ERROR([libGL is not available for OSMesa driver]) 769 else 770 DRIVER_DIRS="$DRIVER_DIRS osmesa" 771 fi 772fi 773 774dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...) 775AC_ARG_WITH([osmesa-bits], 776 [AS_HELP_STRING([--with-osmesa-bits=BITS], 777 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])], 778 [osmesa_bits="$withval"], 779 [osmesa_bits=8]) 780if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then 781 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver]) 782 osmesa_bits=8 783fi 784case "x$osmesa_bits" in 785x8) 786 OSMESA_LIB=OSMesa 787 ;; 788x16|x32) 789 OSMESA_LIB="OSMesa$osmesa_bits" 790 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31" 791 ;; 792*) 793 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option]) 794 ;; 795esac 796AC_SUBST([OSMESA_LIB]) 797 798case "$mesa_driver" in 799osmesa) 800 # only link libraries with osmesa if shared 801 if test "$enable_static" = no; then 802 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS" 803 else 804 OSMESA_LIB_DEPS="" 805 fi 806 OSMESA_MESA_DEPS="" 807 ;; 808*) 809 # Link OSMesa to libGL otherwise 810 OSMESA_LIB_DEPS="" 811 # only link libraries with osmesa if shared 812 if test "$enable_static" = no; then 813 OSMESA_MESA_DEPS='-l$(GL_LIB)' 814 else 815 OSMESA_MESA_DEPS="" 816 fi 817 ;; 818esac 819if test "$enable_static" = no; then 820 OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS $OS_LIBS" 821fi 822AC_SUBST([OSMESA_LIB_DEPS]) 823AC_SUBST([OSMESA_MESA_DEPS]) 824 825dnl 826dnl GLU configuration 827dnl 828AC_ARG_ENABLE([glu], 829 [AS_HELP_STRING([--disable-glu], 830 [enable OpenGL Utility library @<:@default=enabled@:>@])], 831 [enable_glu="$enableval"], 832 [enable_glu=yes]) 833if test "x$enable_glu" = xyes; then 834 SRC_DIRS="$SRC_DIRS glu" 835 836 case "$mesa_driver" in 837 osmesa) 838 # If GLU is available and we have libOSMesa (not 16 or 32), 839 # we can build the osdemos 840 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then 841 PROGRAM_DIRS="$PROGRAM_DIRS osdemos" 842 fi 843 844 # Link libGLU to libOSMesa instead of libGL 845 GLU_LIB_DEPS="" 846 if test "$enable_static" = no; then 847 GLU_MESA_DEPS='-l$(OSMESA_LIB)' 848 else 849 GLU_MESA_DEPS="" 850 fi 851 ;; 852 *) 853 # If static, empty GLU_LIB_DEPS and add libs for programs to link 854 if test "$enable_static" = no; then 855 GLU_LIB_DEPS="-lm" 856 GLU_MESA_DEPS='-l$(GL_LIB)' 857 else 858 GLU_LIB_DEPS="" 859 GLU_MESA_DEPS="" 860 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++" 861 fi 862 ;; 863 esac 864fi 865if test "$enable_static" = no; then 866 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS" 867fi 868AC_SUBST([GLU_LIB_DEPS]) 869AC_SUBST([GLU_MESA_DEPS]) 870 871dnl 872dnl GLw configuration 873dnl 874AC_ARG_ENABLE([glw], 875 [AS_HELP_STRING([--disable-glw], 876 [enable Xt/Motif widget library @<:@default=enabled@:>@])], 877 [enable_glw="$enableval"], 878 [enable_glw=yes]) 879dnl Don't build GLw on osmesa 880if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then 881 AC_MSG_WARN([Disabling GLw since the driver is OSMesa]) 882 enable_glw=no 883fi 884AC_ARG_ENABLE([motif], 885 [AS_HELP_STRING([--enable-motif], 886 [use Motif widgets in GLw @<:@default=disabled@:>@])], 887 [enable_motif="$enableval"], 888 [enable_motif=no]) 889 890if test "x$enable_glw" = xyes; then 891 SRC_DIRS="$SRC_DIRS glw" 892 if test "$x11_pkgconfig" = yes; then 893 PKG_CHECK_MODULES([GLW],[x11 xt]) 894 GLW_LIB_DEPS="$GLW_LIBS" 895 else 896 # should check these... 897 GLW_LIB_DEPS="$X_LIBS -lXt -lX11" 898 fi 899 900 GLW_SOURCES="GLwDrawA.c" 901 MOTIF_CFLAGS= 902 if test "x$enable_motif" = xyes; then 903 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c" 904 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no]) 905 if test "x$MOTIF_CONFIG" != xno; then 906 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags` 907 MOTIF_LIBS=`$MOTIF_CONFIG --libs` 908 else 909 AC_CHECK_HEADER([Xm/PrimitiveP.h], [], 910 [AC_MSG_ERROR([Can't locate Motif headers])]) 911 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"], 912 [AC_MSG_ERROR([Can't locate Motif Xm library])]) 913 fi 914 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11 915 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS" 916 fi 917 918 # If static, empty GLW_LIB_DEPS and add libs for programs to link 919 if test "$enable_static" = no; then 920 GLW_MESA_DEPS='-l$(GL_LIB)' 921 GLW_LIB_DEPS="$GLW_LIB_DEPS $OS_LIBS" 922 else 923 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS" 924 GLW_LIB_DEPS="" 925 GLW_MESA_DEPS="" 926 fi 927fi 928AC_SUBST([GLW_LIB_DEPS]) 929AC_SUBST([GLW_MESA_DEPS]) 930AC_SUBST([GLW_SOURCES]) 931AC_SUBST([MOTIF_CFLAGS]) 932 933dnl 934dnl GLUT configuration 935dnl 936if test -f "$srcdir/include/GL/glut.h"; then 937 default_glut=yes 938else 939 default_glut=no 940fi 941AC_ARG_ENABLE([glut], 942 [AS_HELP_STRING([--disable-glut], 943 [enable GLUT library @<:@default=enabled if source available@:>@])], 944 [enable_glut="$enableval"], 945 [enable_glut="$default_glut"]) 946 947dnl Can't build glut if GLU not available 948if test "x$enable_glu$enable_glut" = xnoyes; then 949 AC_MSG_WARN([Disabling glut since GLU is disabled]) 950 enable_glut=no 951fi 952dnl Don't build glut on osmesa 953if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then 954 AC_MSG_WARN([Disabling glut since the driver is OSMesa]) 955 enable_glut=no 956fi 957 958if test "x$enable_glut" = xyes; then 959 SRC_DIRS="$SRC_DIRS glut/glx" 960 GLUT_CFLAGS="" 961 if test "x$GCC" = xyes; then 962 GLUT_CFLAGS="-fexceptions" 963 fi 964 if test "$x11_pkgconfig" = yes; then 965 PKG_CHECK_MODULES([GLUT],[x11 xmu xi]) 966 GLUT_LIB_DEPS="$GLUT_LIBS" 967 else 968 # should check these... 969 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi" 970 fi 971 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm $OS_LIBS" 972 973 # If glut is available, we can build most programs 974 if test "$with_demos" = yes; then 975 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl" 976 fi 977 978 # If static, empty GLUT_LIB_DEPS and add libs for programs to link 979 if test "$enable_static" = no; then 980 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)' 981 else 982 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS" 983 GLUT_LIB_DEPS="" 984 GLUT_MESA_DEPS="" 985 fi 986fi 987AC_SUBST([GLUT_LIB_DEPS]) 988AC_SUBST([GLUT_MESA_DEPS]) 989AC_SUBST([GLUT_CFLAGS]) 990 991dnl 992dnl Program library dependencies 993dnl Only libm is added here if necessary as the libraries should 994dnl be pulled in by the linker 995dnl 996if test "x$APP_LIB_DEPS" = x; then 997 case "$host_os" in 998 solaris*) 999 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm" 1000 ;; 1001 *) 1002 APP_LIB_DEPS="-lm" 1003 ;; 1004 esac 1005fi 1006AC_SUBST([APP_LIB_DEPS]) 1007AC_SUBST([PROGRAM_DIRS]) 1008 1009 1010dnl Restore LDFLAGS and CPPFLAGS 1011LDFLAGS="$_SAVE_LDFLAGS" 1012CPPFLAGS="$_SAVE_CPPFLAGS" 1013 1014dnl Substitute the config 1015AC_CONFIG_FILES([configs/autoconf]) 1016 1017dnl Replace the configs/current symlink 1018AC_CONFIG_COMMANDS([configs],[ 1019if test -f configs/current || test -L configs/current; then 1020 rm -f configs/current 1021fi 1022ln -s autoconf configs/current 1023]) 1024 1025AC_OUTPUT 1026 1027dnl 1028dnl Output some configuration info for the user 1029dnl 1030echo "" 1031echo " prefix: $prefix" 1032echo " exec_prefix: $exec_prefix" 1033echo " libdir: $libdir" 1034echo " includedir: $includedir" 1035 1036dnl Driver info 1037echo "" 1038echo " Driver: $mesa_driver" 1039if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then 1040 echo " OSMesa: lib$OSMESA_LIB" 1041else 1042 echo " OSMesa: no" 1043fi 1044if test "$mesa_driver" = dri; then 1045 # cleanup the drivers var 1046 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'` 1047if test "x$DRI_DIRS" = x; then 1048 echo " DRI drivers: no" 1049else 1050 echo " DRI drivers: $dri_dirs" 1051fi 1052 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR" 1053 echo " TTM API support: $ttmapi" 1054fi 1055 1056dnl Libraries 1057echo "" 1058echo " Shared libs: $enable_shared" 1059echo " Static libs: $enable_static" 1060echo " GLU: $enable_glu" 1061echo " GLw: $enable_glw (Motif: $enable_motif)" 1062echo " glut: $enable_glut" 1063 1064dnl Programs 1065# cleanup the programs var for display 1066program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'` 1067if test "x$program_dirs" = x; then 1068 echo " Demos: no" 1069else 1070 echo " Demos: $program_dirs" 1071fi 1072 1073dnl Compiler options 1074# cleanup the CFLAGS/CXXFLAGS/DEFINES vars 1075cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \ 1076 $SED 's/^ *//;s/ */ /;s/ *$//'` 1077cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \ 1078 $SED 's/^ *//;s/ */ /;s/ *$//'` 1079defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'` 1080echo "" 1081echo " CFLAGS: $cflags" 1082echo " CXXFLAGS: $cxxflags" 1083echo " Macros: $defines" 1084 1085echo "" 1086echo " Run '${MAKE-make}' to build Mesa" 1087echo "" 1088