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