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