Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 1 | dnl Process this file with autoconf to create configure. |
| 2 | |
| 3 | AC_PREREQ(2.59) |
| 4 | |
| 5 | dnl Versioning |
| 6 | dnl Make version number available to autoconf and configure |
| 7 | m4_define(mesa_major, 7) |
| 8 | m4_define(mesa_minor, 1) |
| 9 | m4_define(mesa_tiny, 0) |
| 10 | m4_define(mesa_version, [mesa_major().mesa_minor().mesa_tiny()]) |
| 11 | |
| 12 | AC_INIT(Mesa, mesa_version(), mesa3d@sourceforge.net) |
| 13 | AC_CONFIG_AUX_DIR(bin) |
| 14 | AC_CANONICAL_HOST |
| 15 | |
| 16 | dnl Substitute the version number into shell variables |
| 17 | MESA_MAJOR=mesa_major() |
| 18 | MESA_MINOR=mesa_minor() |
| 19 | MESA_TINY=mesa_tiny() |
| 20 | AC_SUBST(MESA_MAJOR) |
| 21 | AC_SUBST(MESA_MINOR) |
| 22 | AC_SUBST(MESA_TINY) |
| 23 | |
| 24 | dnl Check for progs |
| 25 | AC_PROG_CPP |
| 26 | AC_PROG_CC |
| 27 | AC_PROG_CXX |
| 28 | AC_PATH_PROG(MAKE, make) |
| 29 | AC_PATH_PROG(MKDEP, makedepend) |
| 30 | AC_PATH_PROG(SED, sed) |
| 31 | PKG_PROG_PKG_CONFIG() |
| 32 | |
| 33 | dnl LIB_DIR - library basename |
| 34 | LIB_DIR=`echo $libdir | $SED 's%.*/%%'` |
| 35 | AC_SUBST(LIB_DIR) |
| 36 | |
| 37 | dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later |
| 38 | _SAVE_LDFLAGS="$LDFLAGS" |
| 39 | AC_ARG_VAR(EXTRA_LIB_PATH,[Extra -L paths for the linker]) |
| 40 | AC_SUBST(EXTRA_LIB_PATH) |
| 41 | |
| 42 | dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later |
| 43 | _SAVE_CPPFLAGS="$CPPFLAGS" |
| 44 | AC_ARG_VAR(X11_INCLUDES,[Extra -I paths for X11 headers]) |
| 45 | AC_SUBST(X11_INCLUDES) |
| 46 | |
| 47 | dnl Compiler macros |
| 48 | DEFINES="" |
| 49 | AC_SUBST(DEFINES) |
| 50 | if test "x$GCC" = xyes; then |
| 51 | DEFINES="-D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE" |
| 52 | fi |
| 53 | case "$host_os" in |
| 54 | linux*) |
| 55 | DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN" |
| 56 | ;; |
| 57 | esac |
| 58 | |
| 59 | dnl Add flags for gcc and g++ |
| 60 | if test "x$GCC" = xyes; then |
| 61 | CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math" |
| 62 | fi |
| 63 | if test "x$GXX" = xyes; then |
| 64 | CXXFLAGS="$CXXFLAGS -Wall" |
| 65 | fi |
| 66 | |
| 67 | dnl These should be unnecessary, but let the user set them if they want |
| 68 | AC_ARG_VAR(OPT_FLAGS, [Additional optimization flags for the compiler. |
| 69 | Default is to use CFLAGS.]) |
| 70 | AC_ARG_VAR(ARCH_FLAGS, [Additional architecture specific flags for the |
| 71 | compiler. Default is to use CFLAGS.]) |
| 72 | AC_SUBST(OPT_FLAGS) |
| 73 | AC_SUBST(ARCH_FLAGS) |
| 74 | |
| 75 | dnl |
Dan Nicholson | 8858633 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 76 | dnl shared/static libraries, mimic libtool options |
| 77 | dnl |
| 78 | AC_ARG_ENABLE(static, |
| 79 | [AS_HELP_STRING([--enable-static], |
| 80 | [build static libraries @<:@default=no@:>@])], |
| 81 | enable_static="$enableval", |
| 82 | enable_static=no |
| 83 | ) |
| 84 | case "x$enable_static" in |
| 85 | xyes|xno ) ;; |
| 86 | x ) enable_static=no ;; |
| 87 | * ) |
| 88 | AC_MSG_ERROR([Static library option '$enable_static' is not a valid]) |
| 89 | ;; |
| 90 | esac |
| 91 | AC_ARG_ENABLE(shared, |
| 92 | [AS_HELP_STRING([--disable-shared], |
| 93 | [build shared libraries @<:@default=yes@:>@])], |
| 94 | enable_shared="$enableval", |
| 95 | enable_shared=yes |
| 96 | ) |
| 97 | case "x$enable_shared" in |
| 98 | xyes|xno ) ;; |
| 99 | x ) enable_shared=yes ;; |
| 100 | * ) |
| 101 | AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid]) |
| 102 | ;; |
| 103 | esac |
| 104 | |
| 105 | dnl Can't have static and shared libraries, default to static if user |
| 106 | dnl explicitly requested. If both disabled, set to static since shared |
| 107 | dnl was explicitly requirested. |
| 108 | case "x$enable_static$enable_shared" in |
| 109 | xyesyes ) |
| 110 | AC_MSG_WARN([Can't build static and shared libraries, disabling shared]) |
| 111 | enable_shared=no |
| 112 | ;; |
| 113 | xnono ) |
| 114 | AC_MSG_WARN([Can't disable both static and shared libraries, enabling static]) |
| 115 | enable_static=yes |
| 116 | ;; |
| 117 | esac |
| 118 | |
| 119 | dnl |
| 120 | dnl mklib options |
| 121 | dnl |
| 122 | AC_ARG_VAR(MKLIB_OPTIONS,[Options for the Mesa library script, mklib]) |
| 123 | if test "$enable_static" = yes; then |
| 124 | MKLIB_OPTIONS="$MKLIB_OPTIONS -static" |
| 125 | fi |
| 126 | AC_SUBST(MKLIB_OPTIONS) |
| 127 | |
| 128 | |
| 129 | dnl |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 130 | dnl library names |
| 131 | dnl |
Dan Nicholson | 8858633 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 132 | if test "$enable_static" = yes; then |
| 133 | GL_LIB_NAME='lib$(GL_LIB).a' |
| 134 | GLU_LIB_NAME='lib$(GLU_LIB).a' |
| 135 | GLUT_LIB_NAME='lib$(GLUT_LIB).a' |
| 136 | GLW_LIB_NAME='lib$(GLW_LIB).a' |
| 137 | OSMESA_LIB_NAME='lib$(OSMESA_LIB).a' |
| 138 | else |
| 139 | GL_LIB_NAME='lib$(GL_LIB).so' |
| 140 | GLU_LIB_NAME='lib$(GLU_LIB).so' |
| 141 | GLUT_LIB_NAME='lib$(GLUT_LIB).so' |
| 142 | GLW_LIB_NAME='lib$(GLW_LIB).so' |
| 143 | OSMESA_LIB_NAME='lib$(OSMESA_LIB).so' |
| 144 | fi |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 145 | AC_SUBST(GL_LIB_NAME) |
| 146 | AC_SUBST(GLU_LIB_NAME) |
| 147 | AC_SUBST(GLUT_LIB_NAME) |
| 148 | AC_SUBST(GLW_LIB_NAME) |
| 149 | AC_SUBST(OSMESA_LIB_NAME) |
| 150 | |
| 151 | dnl |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 152 | dnl Driver configuration. Options are x11 (Xlib), dri and osmesa right now. |
| 153 | dnl More later: directfb, fbdev, ... |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 154 | dnl |
| 155 | AC_ARG_WITH(driver, |
| 156 | [AS_HELP_STRING([--with-driver=DRIVER], |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 157 | [driver for Mesa: x11,dri,osmesa @<:@default=x11@:>@])], |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 158 | mesa_driver="$withval", |
| 159 | mesa_driver="x11") |
| 160 | dnl Check for valid option |
| 161 | case "x$mesa_driver" in |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 162 | xx11|xdri|xosmesa) |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 163 | ;; |
| 164 | *) |
| 165 | AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option]) |
| 166 | ;; |
| 167 | esac |
| 168 | |
| 169 | dnl |
| 170 | dnl Driver specific build directories |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 171 | dnl |
| 172 | SRC_DIRS="mesa" |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 173 | GLU_DIRS="sgi" |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 174 | DRI_DIRS="" |
| 175 | WINDOW_SYSTEM="" |
| 176 | case "$mesa_driver" in |
| 177 | x11) |
| 178 | DRIVER_DIRS="x11" |
| 179 | ;; |
| 180 | dri) |
| 181 | SRC_DIRS="glx/x11 $SRC_DIRS" |
| 182 | DRIVER_DIRS="dri" |
| 183 | WINDOW_SYSTEM="dri" |
| 184 | ;; |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 185 | osmesa) |
| 186 | DRIVER_DIRS="osmesa" |
| 187 | ;; |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 188 | esac |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 189 | AC_SUBST(SRC_DIRS) |
| 190 | AC_SUBST(GLU_DIRS) |
| 191 | AC_SUBST(DRIVER_DIRS) |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 192 | AC_SUBST(WINDOW_SYSTEM) |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 193 | |
| 194 | dnl |
Dan Nicholson | 8e4d147 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 195 | dnl User supplied program configuration |
| 196 | dnl |
| 197 | if test -d "$srcdir/progs/demos"; then |
| 198 | default_demos=yes |
| 199 | else |
| 200 | default_demos=no |
| 201 | fi |
| 202 | AC_ARG_WITH(demos, |
| 203 | [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@], |
| 204 | [optional comma delimited demo directories to build |
| 205 | @<:@default=yes if source available@:>@])], |
| 206 | with_demos="$withval", |
| 207 | with_demos="$default_demos") |
| 208 | if test "x$with_demos" = x; then |
| 209 | with_demos=no |
| 210 | fi |
| 211 | |
| 212 | dnl If $with_demos is yes, directories will be added as libs available |
| 213 | PROGRAM_DIRS="" |
| 214 | case "$with_demos" in |
| 215 | no|yes) ;; |
| 216 | *) |
| 217 | # verify the requested demos directories exist |
| 218 | demos=`IFS=,; echo $with_demos` |
| 219 | for demo in $demos; do |
| 220 | test -d "$srcdir/progs/$demo" || \ |
| 221 | AC_MSG_ERROR([Program directory '$demo' doesn't exist]) |
| 222 | done |
| 223 | PROGRAM_DIRS="$demos" |
| 224 | ;; |
| 225 | esac |
| 226 | |
| 227 | dnl |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 228 | dnl Find out if X is available. The variables have_x or no_x will be |
| 229 | dnl set and used later in the driver setups |
| 230 | dnl |
| 231 | if test -n "$PKG_CONFIG"; then |
| 232 | AC_MSG_CHECKING([pkg-config files for X11 are available]) |
| 233 | if $PKG_CONFIG --exists x11; then |
| 234 | x11_pkgconfig=yes |
| 235 | have_x=yes |
| 236 | AC_MSG_RESULT(yes) |
| 237 | else |
| 238 | x11_pkgconfig=no |
| 239 | no_x=yes |
| 240 | AC_MSG_RESULT(no) |
| 241 | fi |
| 242 | else |
| 243 | x11_pkgconfig=no |
| 244 | fi |
| 245 | dnl Use the autoconf macro if no pkg-config files |
| 246 | if test "$x11_pkgconfig" = no; then |
| 247 | AC_PATH_XTRA |
| 248 | fi |
| 249 | |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 250 | dnl We need X for xlib and dri, so bomb now if it's not found |
| 251 | case "$mesa_driver" in |
| 252 | x11|dri) |
| 253 | if test "$no_x" = yes; then |
| 254 | AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver]) |
| 255 | fi |
| 256 | ;; |
| 257 | esac |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 258 | |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 259 | dnl |
| 260 | dnl libGL configuration per driver |
| 261 | dnl |
| 262 | case "$mesa_driver" in |
| 263 | x11) |
| 264 | if test "$x11_pkgconfig" = yes; then |
| 265 | PKG_CHECK_MODULES(X11GL, x11 xext) |
| 266 | X11_INCLUDES="$X11_INCLUDES $X11GL_CFLAGS" |
| 267 | GL_LIB_DEPS="$X11GL_LIBS" |
| 268 | else |
| 269 | # should check these... |
| 270 | X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" |
| 271 | GL_LIB_DEPS="$X_LIBS -lX11 -lXext" |
| 272 | fi |
| 273 | GL_LIB_DEPS="$GL_LIB_DEPS -lm -lpthread" |
Dan Nicholson | 8858633 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 274 | |
| 275 | # if static, move the external libraries to the programs |
| 276 | # and empty the libraries for libGL |
| 277 | if test "$enable_static" = yes; then |
| 278 | APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS" |
| 279 | GL_LIB_DEPS="" |
| 280 | fi |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 281 | ;; |
| 282 | dri) |
Dan Nicholson | 8858633 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 283 | # DRI must be shared, I think |
| 284 | if test "$enable_static" = yes; then |
| 285 | AC_MSG_ERROR([Can't use static libraries for DRI drivers]) |
| 286 | fi |
| 287 | |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 288 | # Check for libdrm |
| 289 | PKG_CHECK_MODULES(LIBDRM, libdrm) |
| 290 | |
| 291 | # find the DRI deps for libGL |
| 292 | if test "$x11_pkgconfig" = yes; then |
| 293 | PKG_CHECK_MODULES(DRIGL, x11 xext xxf86vm xdamage xfixes) |
| 294 | X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS" |
| 295 | GL_LIB_DEPS="$DRIGL_LIBS" |
| 296 | else |
| 297 | # should check these... |
| 298 | X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" |
| 299 | GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes" |
| 300 | fi |
| 301 | |
| 302 | # need DRM libs, -lpthread, etc. |
| 303 | GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread -ldl" |
| 304 | ;; |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 305 | osmesa) |
| 306 | # No libGL for osmesa |
| 307 | GL_LIB_DEPS="" |
| 308 | ;; |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 309 | esac |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 310 | AC_SUBST(GL_LIB_DEPS) |
| 311 | |
| 312 | dnl |
| 313 | dnl More X11 setup |
| 314 | dnl |
| 315 | if test "$mesa_driver" = x11; then |
| 316 | DEFINES="$DEFINES -DUSE_XSHM" |
| 317 | fi |
| 318 | |
| 319 | dnl |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 320 | dnl More DRI setup |
| 321 | dnl |
| 322 | AC_ARG_ENABLE(glx-tls, |
| 323 | [AS_HELP_STRING([--enable-glx-tls], |
| 324 | [enable TLS support in GLX @<:@default=no@:>@])], |
| 325 | GLX_USE_TLS="$enableval", |
| 326 | GLX_USE_TLS=no) |
| 327 | dnl Directory for DRI drivers |
Dan Nicholson | af3d2f2 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 328 | AC_ARG_WITH(dri-driverdir, |
| 329 | [AS_HELP_STRING([--with-dri-driverdir=DIR], |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 330 | [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])], |
| 331 | DRI_DRIVER_INSTALL_DIR="$withval", |
| 332 | DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri') |
| 333 | AC_SUBST(DRI_DRIVER_INSTALL_DIR) |
| 334 | dnl Direct rendering or just indirect rendering |
| 335 | AC_ARG_ENABLE(driglx-direct, |
| 336 | [AS_HELP_STRING([--enable-driglx-direct], |
| 337 | [enable direct rendering in GLX for DRI @<:@default=yes@:>@])], |
| 338 | driglx_direct="$enableval", |
| 339 | driglx_direct="yes") |
| 340 | |
Dan Nicholson | af3d2f2 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 341 | dnl Which drivers to build - default is chosen by platform |
| 342 | AC_ARG_WITH(dri-drivers, |
| 343 | [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@], |
| 344 | [comma delimited DRI drivers to build @<:@default=auto by platform@:>@])], |
| 345 | with_dri_drivers="$withval", |
| 346 | with_dri_drivers=yes) |
| 347 | if test "x$with_dri_drivers" = x; then |
| 348 | with_dri_drivers=no |
| 349 | fi |
| 350 | |
| 351 | dnl If $with_dri_drivers is yes, directories will be added through |
| 352 | dnl platform checks |
| 353 | DRI_DIRS="" |
| 354 | case "$with_dri_drivers" in |
| 355 | no|yes) ;; |
| 356 | *) |
| 357 | # verify the requested driver directories exist |
| 358 | dri_drivers=`IFS=,; echo $with_dri_drivers` |
| 359 | for driver in $dri_drivers; do |
| 360 | test -d "$srcdir/src/mesa/drivers/dri/$driver" || \ |
| 361 | AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist]) |
| 362 | done |
| 363 | DRI_DIRS="$dri_drivers" |
| 364 | ;; |
| 365 | esac |
| 366 | |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 367 | dnl Just default to no EGL for now |
| 368 | USING_EGL=0 |
| 369 | AC_SUBST(USING_EGL) |
| 370 | |
| 371 | dnl Set DRI_DIRS, DEFINES and LIB_DEPS |
| 372 | if test "$mesa_driver" = dri; then |
| 373 | # Use TLS in GLX? |
| 374 | if test "x$GLX_USE_TLS" = xyes; then |
| 375 | DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS" |
| 376 | fi |
| 377 | |
| 378 | if test "x$USING_EGL" = x1; then |
| 379 | PROGRAM_DIRS="egl" |
| 380 | fi |
| 381 | |
| 382 | # Platform specific settings and drivers to build |
| 383 | case "$host_os" in |
| 384 | linux*) |
| 385 | DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" |
| 386 | DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS" |
| 387 | if test "x$driglx_direct" = xyes; then |
| 388 | DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" |
| 389 | fi |
| 390 | |
| 391 | case "$host_cpu" in |
| 392 | i*86) |
Dan Nicholson | af3d2f2 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 393 | if test "x$DRI_DIRS" = x; then |
| 394 | DRI_DIRS="i810 i915tex i915 i965 mach64 mga r128 r200 r300 \ |
| 395 | radeon s3v savage sis tdfx trident unichrome ffb" |
| 396 | fi |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 397 | ;; |
| 398 | x86_64) |
Dan Nicholson | af3d2f2 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 399 | if test "x$DRI_DIRS" = x; then |
| 400 | DRI_DIRS="i915tex i915 i965 mach64 mga r128 r200 radeon tdfx \ |
| 401 | unichrome savage r300" |
| 402 | fi |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 403 | ;; |
| 404 | powerpc*) |
Dan Nicholson | af3d2f2 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 405 | if test "x$DRI_DIRS" = x; then |
| 406 | DRI_DIRS="mach64 r128 r200 r300 radeon tdfx" |
| 407 | fi |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 408 | ;; |
| 409 | esac |
| 410 | ;; |
| 411 | freebsd*) |
| 412 | DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1" |
| 413 | DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS" |
| 414 | DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" |
| 415 | if test "x$driglx_direct" = xyes; then |
| 416 | DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" |
| 417 | fi |
| 418 | if test "x$GXX" = xyes; then |
| 419 | CXXFLAGS="$CXXFLAGS -ansi -pedantic" |
| 420 | fi |
| 421 | |
Dan Nicholson | af3d2f2 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 422 | if test "x$DRI_DIRS" = x; then |
| 423 | DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \ |
| 424 | unichrome savage sis" |
| 425 | fi |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 426 | ;; |
| 427 | esac |
| 428 | DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'` |
| 429 | |
| 430 | # Check for expat |
| 431 | EXPAT_INCLUDES="" |
| 432 | EXPAT_LIB=-lexpat |
| 433 | AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR], |
| 434 | [expat install directory]),[ |
| 435 | EXPAT_INCLUDES="-I$withval/include" |
| 436 | CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES" |
| 437 | LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR" |
| 438 | EXPAT_LIB="-L$withval/$LIB_DIR -lexpat" |
| 439 | ]) |
| 440 | AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.])) |
| 441 | AC_CHECK_LIB(expat, XML_ParserCreate,, |
| 442 | AC_MSG_ERROR([Expat required for DRI.])) |
| 443 | |
| 444 | # put all the necessary libs together |
| 445 | DRI_LIB_DEPS="$LIBDRM_LIBS $EXPAT_LIB -lm -lpthread -ldl" |
| 446 | fi |
| 447 | AC_SUBST(DRI_DIRS) |
| 448 | AC_SUBST(EXPAT_INCLUDES) |
| 449 | AC_SUBST(DRI_LIB_DEPS) |
| 450 | |
| 451 | dnl |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 452 | dnl OSMesa configuration |
| 453 | dnl |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 454 | if test "$mesa_driver" = x11; then |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 455 | default_x11_osmesa=yes |
| 456 | else |
| 457 | default_x11_osmesa=no |
Dan Nicholson | 44d9914 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 458 | fi |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 459 | AC_ARG_ENABLE(x11-osmesa, |
| 460 | [AS_HELP_STRING([--enable-x11-osmesa], |
| 461 | [enable OSMesa on X11 libGL @<:@default=yes for x11 driver@:>@])], |
| 462 | x11_osmesa="$enableval", |
| 463 | x11_osmesa="$default_x11_osmesa") |
| 464 | if test "x$x11_osmesa" = xyes; then |
| 465 | if test "$mesa_driver" = x11; then |
| 466 | DRIVER_DIRS="$DRIVER_DIRS osmesa" |
| 467 | else |
| 468 | AC_MSG_ERROR([Can only enable OSMesa on libGL for X11]) |
| 469 | fi |
| 470 | fi |
| 471 | |
Dan Nicholson | 6689f9e | 2007-12-05 21:04:15 -0800 | [diff] [blame] | 472 | dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...) |
| 473 | AC_ARG_WITH(osmesa-bits, |
| 474 | [AS_HELP_STRING([--with-osmesa-bits=BITS], |
| 475 | [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])], |
| 476 | osmesa_bits="$withval", |
| 477 | osmesa_bits=8) |
| 478 | if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then |
| 479 | AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver]) |
| 480 | osmesa_bits=8 |
| 481 | fi |
| 482 | case "x$osmesa_bits" in |
| 483 | x8) |
| 484 | OSMESA_LIB=OSMesa |
| 485 | ;; |
| 486 | x16|x32) |
| 487 | OSMESA_LIB="OSMesa$osmesa_bits" |
| 488 | DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31" |
| 489 | ;; |
| 490 | *) |
| 491 | AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option]) |
| 492 | ;; |
| 493 | esac |
| 494 | AC_SUBST(OSMESA_LIB) |
| 495 | |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 496 | case "$mesa_driver" in |
| 497 | osmesa) |
Dan Nicholson | 8858633 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 498 | # only link librararies with osmesa if shared |
| 499 | if test "$enable_static" = no; then |
| 500 | OSMESA_LIB_DEPS="-lm -lpthread" |
| 501 | else |
| 502 | OSMESA_LIB_DEPS="" |
| 503 | fi |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 504 | OSMESA_MESA_DEPS="" |
| 505 | ;; |
| 506 | *) |
| 507 | # Link OSMesa to libGL otherwise |
| 508 | OSMESA_LIB_DEPS="" |
Dan Nicholson | 8858633 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 509 | # only link librararies with osmesa if shared |
| 510 | if test "$enable_static" = no; then |
| 511 | OSMESA_MESA_DEPS='-l$(GL_LIB)' |
| 512 | else |
| 513 | OSMESA_MESA_DEPS="" |
| 514 | fi |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 515 | ;; |
| 516 | esac |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 517 | AC_SUBST(OSMESA_LIB_DEPS) |
| 518 | AC_SUBST(OSMESA_MESA_DEPS) |
| 519 | |
| 520 | dnl |
| 521 | dnl GLU configuration |
| 522 | dnl |
| 523 | AC_ARG_ENABLE(glu, |
| 524 | [AS_HELP_STRING([--enable-glu], |
| 525 | [enable OpenGL Utility library @<:@default=yes@:>@])], |
| 526 | enable_glu="$enableval", |
| 527 | enable_glu=yes) |
| 528 | if test "x$enable_glu" = xyes; then |
| 529 | SRC_DIRS="$SRC_DIRS glu" |
| 530 | |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 531 | case "$mesa_driver" in |
| 532 | osmesa) |
Dan Nicholson | 6689f9e | 2007-12-05 21:04:15 -0800 | [diff] [blame] | 533 | # If GLU is available and we have libOSMesa (not 16 or 32), |
| 534 | # we can build the osdemos |
Dan Nicholson | 8e4d147 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 535 | if test "$with_demos" = yes && test "$osmesa_bits" = 8; then |
Dan Nicholson | 6689f9e | 2007-12-05 21:04:15 -0800 | [diff] [blame] | 536 | PROGRAM_DIRS="$PROGRAM_DIRS osdemos" |
| 537 | fi |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 538 | |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 539 | # Link libGLU to libOSMesa instead of libGL |
| 540 | GLU_LIB_DEPS="" |
Dan Nicholson | 8858633 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 541 | if test "$enable_static" = no; then |
| 542 | GLU_MESA_DEPS='-l$(OSMESA_LIB)' |
| 543 | else |
| 544 | GLU_MESA_DEPS="" |
| 545 | fi |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 546 | ;; |
| 547 | *) |
| 548 | # If GLU is available, we can build the xdemos |
Dan Nicholson | 8e4d147 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 549 | if test "$with_demos" = yes; then |
| 550 | PROGRAM_DIRS="$PROGRAM_DIRS xdemos" |
| 551 | fi |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 552 | |
Dan Nicholson | 8858633 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 553 | # If static, empty GLU_LIB_DEPS and add libs for programs to link |
| 554 | if test "$enable_static" = no; then |
| 555 | GLU_LIB_DEPS="-lm" |
| 556 | GLU_MESA_DEPS='-l$(GL_LIB)' |
| 557 | else |
| 558 | GLU_LIB_DEPS="" |
| 559 | GLU_MESA_DEPS="" |
| 560 | APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++" |
| 561 | fi |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 562 | ;; |
| 563 | esac |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 564 | fi |
| 565 | AC_SUBST(GLU_LIB_DEPS) |
| 566 | AC_SUBST(GLU_MESA_DEPS) |
| 567 | |
| 568 | dnl |
| 569 | dnl GLw configuration |
| 570 | dnl |
| 571 | AC_ARG_ENABLE(glw, |
| 572 | [AS_HELP_STRING([--enable-glw], |
| 573 | [enable Xt/Motif widget library @<:@default=yes@:>@])], |
| 574 | enable_glw="$enableval", |
| 575 | enable_glw=yes) |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 576 | dnl Don't build GLw on osmesa |
| 577 | if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then |
| 578 | AC_MSG_WARN([Disabling GLw since the driver is OSMesa]) |
| 579 | enable_glw=no |
| 580 | fi |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 581 | if test "x$enable_glw" = xyes; then |
| 582 | SRC_DIRS="$SRC_DIRS glw" |
| 583 | if test "$x11_pkgconfig" = yes; then |
| 584 | PKG_CHECK_MODULES(GLW, x11 xt) |
| 585 | GLW_LIB_DEPS="$GLW_LIBS" |
| 586 | else |
| 587 | # should check these... |
| 588 | GLW_LIB_DEPS="$X_LIBS -lX11 -lXt" |
| 589 | fi |
| 590 | |
Dan Nicholson | 8858633 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 591 | # If static, empty GLW_LIB_DEPS and add libs for programs to link |
| 592 | if test "$enable_static" = no; then |
| 593 | GLW_MESA_DEPS='-l$(GL_LIB)' |
| 594 | else |
| 595 | APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS" |
| 596 | GLW_LIB_DEPS="" |
| 597 | GLW_MESA_DEPS="" |
| 598 | fi |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 599 | fi |
| 600 | AC_SUBST(GLW_LIB_DEPS) |
| 601 | AC_SUBST(GLW_MESA_DEPS) |
| 602 | |
| 603 | dnl |
| 604 | dnl GLUT configuration |
| 605 | dnl |
| 606 | if test -f "$srcdir/include/GL/glut.h"; then |
| 607 | default_glut=yes |
| 608 | else |
| 609 | default_glut=no |
| 610 | fi |
| 611 | AC_ARG_ENABLE(glut, |
| 612 | [AS_HELP_STRING([--enable-glut], |
| 613 | [enable GLUT library @<:@default=yes if source available@:>@])], |
| 614 | enable_glut="$enableval", |
| 615 | enable_glut="$default_glut") |
| 616 | |
| 617 | dnl Can't build glut if GLU not available |
| 618 | if test "x$enable_glu$enable_glut" = xnoyes; then |
| 619 | AC_MSG_WARN([Disabling glut since GLU is disabled]) |
| 620 | enable_glut=no |
| 621 | fi |
Dan Nicholson | 979ff51 | 2007-12-05 18:47:01 -0800 | [diff] [blame] | 622 | dnl Don't build glut on osmesa |
| 623 | if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then |
| 624 | AC_MSG_WARN([Disabling glut since the driver is OSMesa]) |
| 625 | enable_glut=no |
| 626 | fi |
| 627 | |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 628 | if test "x$enable_glut" = xyes; then |
| 629 | SRC_DIRS="$SRC_DIRS glut/glx" |
| 630 | GLUT_CFLAGS="" |
| 631 | if test "x$GCC" = xyes; then |
| 632 | GLUT_CFLAGS="-fexceptions" |
| 633 | fi |
| 634 | if test "$x11_pkgconfig" = yes; then |
Dan Nicholson | 70d0c83 | 2007-12-07 11:12:20 -0800 | [diff] [blame^] | 635 | PKG_CHECK_MODULES(GLUT, x11 xmu xi) |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 636 | GLUT_LIB_DEPS="$GLUT_LIBS" |
| 637 | else |
| 638 | # should check these... |
Dan Nicholson | 70d0c83 | 2007-12-07 11:12:20 -0800 | [diff] [blame^] | 639 | GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi" |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 640 | fi |
| 641 | GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm" |
| 642 | |
| 643 | # If glut is available, we can build most programs |
Dan Nicholson | 8e4d147 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 644 | if test "$with_demos" = yes; then |
| 645 | PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl" |
| 646 | fi |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 647 | |
Dan Nicholson | 8858633 | 2007-11-15 08:59:57 -0800 | [diff] [blame] | 648 | # If static, empty GLUT_LIB_DEPS and add libs for programs to link |
| 649 | if test "$enable_static" = no; then |
| 650 | GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)' |
| 651 | else |
| 652 | APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS" |
| 653 | GLUT_LIB_DEPS="" |
| 654 | GLUT_MESA_DEPS="" |
| 655 | fi |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 656 | fi |
| 657 | AC_SUBST(GLUT_LIB_DEPS) |
| 658 | AC_SUBST(GLUT_MESA_DEPS) |
| 659 | AC_SUBST(GLUT_CFLAGS) |
| 660 | |
| 661 | dnl |
| 662 | dnl Program library dependencies |
| 663 | dnl Only libm is added here if necessary as the libraries should |
| 664 | dnl be pulled in by the linker |
| 665 | dnl |
| 666 | if test "x$APP_LIB_DEPS" = x; then |
| 667 | APP_LIB_DEPS="-lm" |
| 668 | fi |
| 669 | AC_SUBST(APP_LIB_DEPS) |
| 670 | AC_SUBST(PROGRAM_DIRS) |
| 671 | |
| 672 | dnl Arch/platform-specific settings |
| 673 | PIC_FLAGS="" |
| 674 | ASM_FLAGS="" |
| 675 | ASM_SOURCES="" |
| 676 | ASM_API="" |
| 677 | AC_SUBST(PIC_FLAGS) |
| 678 | AC_SUBST(ASM_FLAGS) |
| 679 | AC_SUBST(ASM_SOURCES) |
| 680 | AC_SUBST(ASM_API) |
| 681 | case "$host_os" in |
| 682 | linux*) |
| 683 | PIC_FLAGS="-fPIC" |
| 684 | case "$host_cpu" in |
| 685 | i*86) |
| 686 | ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM" |
| 687 | ASM_SOURCES='$(X86_SOURCES)' |
| 688 | ASM_API='$(X86_API)' |
| 689 | ;; |
| 690 | x86_64) |
| 691 | ASM_FLAGS="-DUSE_X86_64_ASM" |
| 692 | ASM_SOURCES='$(X86-64_SOURCES)' |
| 693 | ASM_API='$(X86-64_API)' |
| 694 | ;; |
| 695 | powerpc) |
| 696 | ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM" |
| 697 | ASM_SOURCES='$(PPC_SOURCES)' |
| 698 | ;; |
| 699 | esac |
| 700 | ;; |
| 701 | freebsd*) |
| 702 | PIC_FLAGS="-fPIC" |
| 703 | case "$host_os" in |
| 704 | i*86) |
| 705 | PIC_FLAGS="" |
| 706 | ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM" |
| 707 | ASM_SOURCES='$(X86_SOURCES)' |
| 708 | ASM_API='$(X86_API)' |
| 709 | ;; |
| 710 | x86_64) |
| 711 | ASM_FLAGS="-DUSE_X86_64_ASM" |
| 712 | ASM_SOURCES='$(X86-64_SOURCES)' |
| 713 | ASM_API='$(X86-64_API)' |
| 714 | ;; |
| 715 | esac |
| 716 | ;; |
| 717 | esac |
| 718 | |
| 719 | dnl Restore LDFLAGS and CPPFLAGS |
| 720 | LDFLAGS="$_SAVE_LDFLAGS" |
| 721 | CPPFLAGS="$_SAVE_CPPFLAGS" |
| 722 | |
| 723 | dnl Substitute the config |
| 724 | AC_OUTPUT([configs/autoconf]) |
| 725 | |
Dan Nicholson | 9cad8e3 | 2007-11-30 08:49:57 -0800 | [diff] [blame] | 726 | dnl |
| 727 | dnl Output some configuration info for the user |
| 728 | dnl |
| 729 | echo "" |
| 730 | echo " prefix: $prefix" |
| 731 | echo " exec_prefix: $exec_prefix" |
| 732 | echo " libdir: $libdir" |
| 733 | |
| 734 | dnl Driver info |
| 735 | echo "" |
| 736 | echo " Driver: $mesa_driver" |
| 737 | case "$mesa_driver" in |
| 738 | x11|osmesa) |
| 739 | if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then |
| 740 | echo " OSMesa: lib$OSMESA_LIB" |
| 741 | else |
| 742 | echo " OSMesa: no" |
| 743 | fi |
| 744 | ;; |
| 745 | dri) |
| 746 | # cleanup the drivers var |
| 747 | dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'` |
| 748 | echo " DRI drivers: $dri_dirs" |
| 749 | echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR" |
| 750 | ;; |
| 751 | esac |
| 752 | |
| 753 | dnl Libraries |
| 754 | echo "" |
| 755 | echo " Shared libs: $enable_shared" |
| 756 | echo " Static libs: $enable_static" |
| 757 | echo " GLU: $enable_glu" |
| 758 | echo " GLw: $enable_glw" |
| 759 | echo " glut: $enable_glut" |
| 760 | |
| 761 | dnl Programs |
| 762 | # cleanup the programs var for display |
| 763 | program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'` |
| 764 | if test "x$program_dirs" = x; then |
| 765 | echo " Demos: no" |
| 766 | else |
| 767 | echo " Demos: $program_dirs" |
| 768 | fi |
| 769 | |
Dan Nicholson | dca1b79 | 2007-10-23 09:25:58 -0700 | [diff] [blame] | 770 | echo "" |
| 771 | echo " Run 'make autoconf' to build Mesa" |
| 772 | echo "" |