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