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