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