dri/nv10: Fake fast Z clears for pre-nv17 cards.
[mesa.git] / configure.ac
index f52c6db65a613378452735ab43c812e600aea74e..364ee0394703c38d5ef951f1915449a250a0340f 100644 (file)
@@ -33,6 +33,10 @@ AC_CHECK_PROGS([MAKE], [gmake make])
 AC_PATH_PROG([MKDEP], [makedepend])
 AC_PATH_PROG([SED], [sed])
 
 AC_PATH_PROG([MKDEP], [makedepend])
 AC_PATH_PROG([SED], [sed])
 
+if test "x$MKDEP" = "x"; then
+    AC_MSG_ERROR([makedepend is required to build Mesa])
+fi
+
 dnl Our fallback install-sh is a symlink to minstall. Use the existing
 dnl configuration in that case.
 AC_PROG_INSTALL
 dnl Our fallback install-sh is a symlink to minstall. Use the existing
 dnl configuration in that case.
 AC_PROG_INSTALL
@@ -48,9 +52,23 @@ solaris*)
     ;;
 esac
 
     ;;
 esac
 
+dnl clang is mostly GCC-compatible, but its version is much lower,
+dnl so we have to check for it.
+AC_MSG_CHECKING([if compiling with clang])
+
+AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([], [[
+#ifndef __clang__
+       not clang
+#endif
+]])],
+[CLANG=yes], [CLANG=no])
+
+AC_MSG_RESULT([$CLANG])
+
 dnl If we're using GCC, make sure that it is at least version 3.3.0.  Older
 dnl versions are explictly not supported.
 dnl If we're using GCC, make sure that it is at least version 3.3.0.  Older
 dnl versions are explictly not supported.
-if test "x$GCC" = xyes; then
+if test "x$GCC" = xyes -a "x$CLANG" = xno; then
     AC_MSG_CHECKING([whether gcc version is sufficient])
     major=0
     minor=0
     AC_MSG_CHECKING([whether gcc version is sufficient])
     major=0
     minor=0
@@ -123,7 +141,10 @@ esac
 
 dnl Add flags for gcc and g++
 if test "x$GCC" = xyes; then
 
 dnl Add flags for gcc and g++
 if test "x$GCC" = xyes; then
-    CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
+    CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99"
+    if test "x$CLANG" = "xno"; then
+       CFLAGS="$CFLAGS -ffast-math"
+    fi
 
     # Enable -fvisibility=hidden if using a gcc that supports it
     save_CFLAGS="$CFLAGS"
 
     # Enable -fvisibility=hidden if using a gcc that supports it
     save_CFLAGS="$CFLAGS"
@@ -138,6 +159,13 @@ fi
 if test "x$GXX" = xyes; then
     CXXFLAGS="$CXXFLAGS -Wall"
 
 if test "x$GXX" = xyes; then
     CXXFLAGS="$CXXFLAGS -Wall"
 
+    # Enable -fvisibility=hidden if using a gcc that supports it
+    save_CXXFLAGS="$CXXFLAGS"
+    AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
+    CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
+                  [CXXFLAGS="$save_CXXFLAGS" ; AC_MSG_RESULT([no])]);
+
     # Work around aliasing bugs - developers should comment this out
     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
 fi
     # Work around aliasing bugs - developers should comment this out
     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
 fi
@@ -258,6 +286,8 @@ fi
 dnl
 dnl library names
 dnl
 dnl
 dnl library names
 dnl
+LIB_PREFIX_GLOB='lib'
+LIB_VERSION_SEPARATOR='.'
 if test "$enable_static" = yes; then
     LIB_EXTENSION='a'
 else
 if test "$enable_static" = yes; then
     LIB_EXTENSION='a'
 else
@@ -265,7 +295,10 @@ else
     darwin* )
         LIB_EXTENSION='dylib' ;;
     cygwin* )
     darwin* )
         LIB_EXTENSION='dylib' ;;
     cygwin* )
-        LIB_EXTENSION='dll.a' ;;
+        dnl prefix can be 'cyg' or 'lib'
+        LIB_PREFIX_GLOB='???'
+        LIB_VERSION_SEPARATOR='-'
+        LIB_EXTENSION='dll' ;;
     aix* )
         LIB_EXTENSION='a' ;;
     * )
     aix* )
         LIB_EXTENSION='a' ;;
     * )
@@ -283,15 +316,16 @@ GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
 GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
 VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
 
 GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
 VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
 
-GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
-GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
-GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
-GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
-OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
-EGL_LIB_GLOB='lib$(EGL_LIB).*'${LIB_EXTENSION}'*'
-GLESv1_CM_LIB_GLOB='lib$(GLESv1_CM_LIB).*'${LIB_EXTENSION}'*'
-GLESv2_LIB_GLOB='lib$(GLESv2_LIB).*'${LIB_EXTENSION}'*'
-VG_LIB_GLOB='lib$(VG_LIB).*'${LIB_EXTENSION}'*'
+GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
+GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
+GLUT_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLUT_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
+GLW_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLW_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
+OSMESA_LIB_GLOB=${LIB_PREFIX_GLOB}'$(OSMESA_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
+EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
+EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
+GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
+GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
+VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
 
 AC_SUBST([GL_LIB_NAME])
 AC_SUBST([GLU_LIB_NAME])
 
 AC_SUBST([GL_LIB_NAME])
 AC_SUBST([GLU_LIB_NAME])
@@ -410,6 +444,7 @@ dnl Check to see if dlopen is in default libraries (like Solaris, which
 dnl has it in libc), or if libdl is needed to get it.
 AC_CHECK_FUNC([dlopen], [],
     [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
 dnl has it in libc), or if libdl is needed to get it.
 AC_CHECK_FUNC([dlopen], [],
     [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
+AC_SUBST([DLOPEN_LIBS])
 
 dnl See if posix_memalign is available
 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
 
 dnl See if posix_memalign is available
 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
@@ -462,6 +497,10 @@ xxlib|xdri|xosmesa)
     ;;
 esac
 
     ;;
 esac
 
+PKG_CHECK_MODULES([TALLOC], [talloc])
+AC_SUBST([TALLOC_LIBS])
+AC_SUBST([TALLOC_CFLAGS])
+
 dnl
 dnl Driver specific build directories
 dnl
 dnl
 dnl Driver specific build directories
 dnl
@@ -573,8 +612,8 @@ xlib)
         GL_PC_LIB_PRIV="$GL_LIB_DEPS"
         GL_PC_CFLAGS="$X11_INCLUDES"
     fi
         GL_PC_LIB_PRIV="$GL_LIB_DEPS"
         GL_PC_CFLAGS="$X11_INCLUDES"
     fi
-    GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
-    GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
+    GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $TALLOC_LIBS"
+    GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread $TALLOC_LIBS"
 
     # if static, move the external libraries to the programs
     # and empty the libraries for libGL
 
     # if static, move the external libraries to the programs
     # and empty the libraries for libGL
@@ -598,8 +637,15 @@ dri)
 
     # find the DRI deps for libGL
     if test "$x11_pkgconfig" = yes; then
 
     # find the DRI deps for libGL
     if test "$x11_pkgconfig" = yes; then
+        dri_modules="x11 xext xdamage xfixes"
+
+        # add xf86vidmode if available
+        PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
+        if test "$HAVE_XF86VIDMODE" = yes ; then
+            dri_modules="$dri_modules xxf86vm"
+        fi
+
         # add xcb modules if necessary
         # add xcb modules if necessary
-        dri_modules="x11 xext xxf86vm xdamage xfixes"
         if test "$enable_xcb" = yes; then
             dri_modules="$dri_modules x11-xcb xcb-glx"
         fi
         if test "$enable_xcb" = yes; then
             dri_modules="$dri_modules x11-xcb xcb-glx"
         fi
@@ -642,12 +688,19 @@ AC_SUBST([GL_PC_REQ_PRIV])
 AC_SUBST([GL_PC_LIB_PRIV])
 AC_SUBST([GL_PC_CFLAGS])
 AC_SUBST([DRI_PC_REQ_PRIV])
 AC_SUBST([GL_PC_LIB_PRIV])
 AC_SUBST([GL_PC_CFLAGS])
 AC_SUBST([DRI_PC_REQ_PRIV])
-AC_SUBST([GLESv1_LIB_DEPS])
+AC_SUBST([GLESv1_CM_LIB_DEPS])
 AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
 AC_SUBST([GLESv2_LIB_DEPS])
 AC_SUBST([GLESv2_PC_LIB_PRIV])
 
 
 AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
 AC_SUBST([GLESv2_LIB_DEPS])
 AC_SUBST([GLESv2_PC_LIB_PRIV])
 
 
+AC_SUBST([HAVE_XF86VIDMODE])
+
+PKG_CHECK_MODULES([LIBDRM_RADEON],
+                 [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
+                 HAVE_LIBDRM_RADEON=yes,
+                 HAVE_LIBDRM_RADEON=no)
+
 dnl
 dnl More X11 setup
 dnl
 dnl
 dnl More X11 setup
 dnl
@@ -852,7 +905,7 @@ if test "$mesa_driver" = dri; then
         [AC_MSG_ERROR([Expat required for DRI.])])
 
     # put all the necessary libs together
         [AC_MSG_ERROR([Expat required for DRI.])])
 
     # put all the necessary libs together
-    DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
+    DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS $TALLOC_LIBS"
 fi
 AC_SUBST([DRI_DIRS])
 AC_SUBST([EXPAT_INCLUDES])
 fi
 AC_SUBST([DRI_DIRS])
 AC_SUBST([EXPAT_INCLUDES])
@@ -866,12 +919,7 @@ esac
 
 case $DRI_DIRS in
 *radeon*|*r200*|*r300*|*r600*)
 
 case $DRI_DIRS in
 *radeon*|*r200*|*r300*|*r600*)
-    PKG_CHECK_MODULES([LIBDRM_RADEON],
-                     [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
-                     HAVE_LIBDRM_RADEON=yes,
-                     HAVE_LIBDRM_RADEON=no)
-
-    if test "$HAVE_LIBDRM_RADEON" = yes; then
+    if test "x$HAVE_LIBDRM_RADEON" = xyes; then
        RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
        RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
     fi
        RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
        RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
     fi
@@ -930,12 +978,12 @@ case "$DRIVER_DIRS" in
 *osmesa*)
     # only link libraries with osmesa if shared
     if test "$enable_static" = no; then
 *osmesa*)
     # only link libraries with osmesa if shared
     if test "$enable_static" = no; then
-        OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
+        OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS"
     else
         OSMESA_LIB_DEPS=""
     fi
     OSMESA_MESA_DEPS=""
     else
         OSMESA_LIB_DEPS=""
     fi
     OSMESA_MESA_DEPS=""
-    OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
+    OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS"
     ;;
 esac
 AC_SUBST([OSMESA_LIB_DEPS])
     ;;
 esac
 AC_SUBST([OSMESA_LIB_DEPS])
@@ -961,21 +1009,21 @@ if test "x$enable_egl" = xyes; then
             EGL_DRIVERS_DIRS="glx"
         fi
 
             EGL_DRIVERS_DIRS="glx"
         fi
 
-        # build egl_dri2 when xcb-dri2 is available
-        PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
-                         [have_xcb_dri2=yes],[have_xcb_dri2=no])
-       PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
-                         [have_libudev=yes],[have_libudev=no])
-
-        if test "$have_xcb_dri2" = yes; then
-           EGL_DRIVER_DRI2=dri2
-            DEFINES="$DEFINES -DHAVE_XCB_DRI2"
-        fi
-
-        if test "$have_libudev" = yes; then
-           EGL_DRIVER_DRI2=dri2
-            DEFINES="$DEFINES -DHAVE_LIBUDEV"
-        fi
+        if test "$mesa_driver" = dri; then
+            # build egl_dri2 when xcb-dri2 is available
+            PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
+                         [have_xcb_dri2=yes],[have_xcb_dri2=no])
+            PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
+                         [have_libudev=yes],[have_libudev=no])
+            
+            if test "$have_xcb_dri2" = yes; then
+                EGL_DRIVER_DRI2=dri2
+                DEFINES="$DEFINES -DHAVE_XCB_DRI2"
+                if test "$have_libudev" = yes; then
+                    DEFINES="$DEFINES -DHAVE_LIBUDEV"
+                fi
+            fi
+       fi
 
         EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2"
     fi
 
         EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2"
     fi
@@ -1319,7 +1367,7 @@ fi
 AC_ARG_WITH([egl-platforms],
     [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
         [comma delimited native platforms libEGL supports, e.g.
 AC_ARG_WITH([egl-platforms],
     [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
         [comma delimited native platforms libEGL supports, e.g.
-        "x11,kms" @<:@default=auto@:>@])],
+        "x11,drm" @<:@default=auto@:>@])],
     [with_egl_platforms="$withval"],
     [with_egl_platforms=yes])
 AC_ARG_WITH([egl-displays],
     [with_egl_platforms="$withval"],
     [with_egl_platforms=yes])
 AC_ARG_WITH([egl-displays],
@@ -1332,6 +1380,9 @@ case "$with_egl_platforms" in
 yes)
     if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
         EGL_PLATFORMS="x11"
 yes)
     if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
         EGL_PLATFORMS="x11"
+        if test "$mesa_driver" = dri; then
+            EGL_PLATFORMS="$EGL_PLATFORMS drm"
+        fi
     fi
     ;;
 *)
     fi
     ;;
 *)
@@ -1474,18 +1525,28 @@ elif test "x$enable_gallium_i965" = xauto; then
 fi
 
 dnl
 fi
 
 dnl
-dnl Gallium Radeon configuration
+dnl Gallium Radeon r300g configuration
 dnl
 AC_ARG_ENABLE([gallium-radeon],
     [AS_HELP_STRING([--enable-gallium-radeon],
         [build gallium radeon @<:@default=disabled@:>@])],
     [enable_gallium_radeon="$enableval"],
     [enable_gallium_radeon=auto])
 dnl
 AC_ARG_ENABLE([gallium-radeon],
     [AS_HELP_STRING([--enable-gallium-radeon],
         [build gallium radeon @<:@default=disabled@:>@])],
     [enable_gallium_radeon="$enableval"],
     [enable_gallium_radeon=auto])
+if test "x$enable_gallium_radeon" = xauto; then
+    if test "x$HAVE_LIBDRM_RADEON" = xyes; then
+       GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
+       gallium_check_st "radeon/drm" "dri-r300"
+    else
+       AC_MSG_WARN([libdrm_radeon is missing, not building gallium-radeon (r300)])
+    fi
+fi
 if test "x$enable_gallium_radeon" = xyes; then
 if test "x$enable_gallium_radeon" = xyes; then
-    GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
-    gallium_check_st "radeon/drm" "dri-radeong" "xorg-radeon"
-elif test "x$enable_gallium_radeon" = xauto; then
-    GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
+    if test "x$HAVE_LIBDRM_RADEON" = xyes; then
+       GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
+       gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
+    else
+       AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-radeon (r300)])
+    fi
 fi
 
 dnl
 fi
 
 dnl
@@ -1497,8 +1558,12 @@ AC_ARG_ENABLE([gallium-r600],
     [enable_gallium_r600="$enableval"],
     [enable_gallium_r600=auto])
 if test "x$enable_gallium_r600" = xyes; then
     [enable_gallium_r600="$enableval"],
     [enable_gallium_r600=auto])
 if test "x$enable_gallium_r600" = xyes; then
-    GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
-    gallium_check_st "r600/drm" "dri-r600"
+    if test "x$HAVE_LIBDRM_RADEON" = xyes; then
+       GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
+       gallium_check_st "r600/drm" "dri-r600"
+    else
+       AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-r600])
+    fi
 fi
 
 dnl
 fi
 
 dnl