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