glapi: glX_proto_recv.py: use argparse instead of getopt
[mesa.git] / configure.ac
index beb7a7d1cfdde32fd59f0c42704121f50ba0f430..5594548ddfd174103f5c793a06504d25ea744d1b 100644 (file)
@@ -46,6 +46,13 @@ AC_CONFIG_MACRO_DIR([m4])
 AC_CANONICAL_SYSTEM
 AM_INIT_AUTOMAKE([foreign tar-ustar dist-xz])
 
+dnl We only support native Windows builds (MinGW/MSVC) through SCons.
+case "$host_os" in
+mingw*)
+    AC_MSG_ERROR([MinGW build not supported through autoconf/automake, use SCons instead])
+    ;;
+esac
+
 # Support silent build rules, requires at least automake-1.11. Disable
 # by either passing --disable-silent-rules to configure or passing V=1
 # to make
@@ -61,7 +68,7 @@ AC_SUBST([OSMESA_VERSION])
 dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.4.38
 LIBDRM_RADEON_REQUIRED=2.4.56
-LIBDRM_INTEL_REQUIRED=2.4.52
+LIBDRM_INTEL_REQUIRED=2.4.60
 LIBDRM_NVVIEUX_REQUIRED=2.4.33
 LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41"
 LIBDRM_FREEDRENO_REQUIRED=2.4.57
@@ -79,6 +86,7 @@ XCBDRI2_REQUIRED=1.8
 XCBGLX_REQUIRED=1.8.1
 XSHMFENCE_REQUIRED=1.1
 XVMC_REQUIRED=1.0.6
+PYTHON_MAKO_REQUIRED=0.3.4
 
 dnl Check for progs
 AC_PROG_CPP
@@ -114,7 +122,19 @@ if test "x$INDENT" != "xcat"; then
     fi
 fi
 
-AX_CHECK_PYTHON_MAKO_MODULE(0.3.4)
+AX_CHECK_PYTHON_MAKO_MODULE($PYTHON_MAKO_REQUIRED)
+
+if test -z "$PYTHON2"; then
+    if test ! -f "$srcdir/src/util/format_srgb.c"; then
+        AC_MSG_ERROR([Python not found - unable to generate sources])
+    fi
+else
+    if test "x$acv_mako_found" = xno; then
+        if test ! -f "$srcdir/src/mesa/main/format_unpack.c"; then
+            AC_MSG_ERROR([Python mako module v$PYTHON_MAKO_REQUIRED or higher not found])
+        fi
+    fi
+fi
 
 AC_PROG_INSTALL
 
@@ -189,6 +209,7 @@ AX_GCC_FUNC_ATTRIBUTE([flatten])
 AX_GCC_FUNC_ATTRIBUTE([format])
 AX_GCC_FUNC_ATTRIBUTE([malloc])
 AX_GCC_FUNC_ATTRIBUTE([packed])
+AX_GCC_FUNC_ATTRIBUTE([unused])
 
 AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes)
 
@@ -209,7 +230,7 @@ _SAVE_LDFLAGS="$LDFLAGS"
 _SAVE_CPPFLAGS="$CPPFLAGS"
 
 dnl Compiler macros
-DEFINES="-DUSE_EXTERNAL_DXTN_LIB=1"
+DEFINES=""
 AC_SUBST([DEFINES])
 case "$host_os" in
 linux*|*-gnu*|gnu*)
@@ -263,6 +284,30 @@ if test "x$GCC" = xyes; then
     # gcc's builtin memcmp is slower than glibc's
     # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
     CFLAGS="$CFLAGS -fno-builtin-memcmp"
+
+    # Flags to help ensure that certain portions of the code -- and only those
+    # portions -- can be built with MSVC:
+    # - src/util, src/gallium/auxiliary, and src/gallium/drivers/llvmpipe needs
+    #   to build with Windows SDK 7.0.7600, which bundles MSVC 2008
+    # - non-Linux/Posix OpenGL portions needs to build on MSVC 2013 (which
+    #   supports most of C99)
+    # - the rest has no compiler compiler restrictions
+    MSVC2013_COMPAT_CFLAGS="-Werror=pointer-arith"
+    MSVC2013_COMPAT_CXXFLAGS="-Werror=pointer-arith"
+
+    # Enable -Werror=vla if compiler supports it
+    save_CFLAGS="$CFLAGS"
+    AC_MSG_CHECKING([whether $CC supports -Werror=vla])
+    CFLAGS="$CFLAGS -Werror=vla"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+                  [MSVC2013_COMPAT_CFLAGS="$MSVC2013_COMPAT_CFLAGS -Werror=vla";
+                   MSVC2013_COMPAT_CXXFLAGS="$MSVC2013_COMPAT_CXXFLAGS -Werror=vla";
+                   AC_MSG_RESULT([yes])],
+                   AC_MSG_RESULT([no]));
+    CFLAGS="$save_CFLAGS"
+
+    MSVC2008_COMPAT_CFLAGS="$MSVC2013_COMPAT_CFLAGS -Werror=declaration-after-statement"
+    MSVC2008_COMPAT_CXXFLAGS="$MSVC2013_COMPAT_CXXFLAGS"
 fi
 if test "x$GXX" = xyes; then
     CXXFLAGS="$CXXFLAGS -Wall"
@@ -288,6 +333,11 @@ if test "x$GXX" = xyes; then
     CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp"
 fi
 
+AC_SUBST([MSVC2013_COMPAT_CFLAGS])
+AC_SUBST([MSVC2013_COMPAT_CXXFLAGS])
+AC_SUBST([MSVC2008_COMPAT_CFLAGS])
+AC_SUBST([MSVC2008_COMPAT_CXXFLAGS])
+
 dnl even if the compiler appears to support it, using visibility attributes isn't
 dnl going to do anything useful currently on cygwin apart from emit lots of warnings
 case "$host_os" in
@@ -370,6 +420,8 @@ if test "x$enable_debug" = xyes; then
             CXXFLAGS="$CXXFLAGS -O0"
         fi
     fi
+else
+   DEFINES="$DEFINES -DNDEBUG"
 fi
 
 dnl
@@ -597,6 +649,7 @@ if test "x$enable_asm" = xyes; then
 fi
 
 AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"])
+AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"])
 AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"])
 
 dnl Check to see if dlopen is in default libraries (like Solaris, which
@@ -613,7 +666,7 @@ AC_CHECK_FUNCS([dladdr])
 LIBS="$save_LIBS"
 
 case "$host_os" in
-darwin*|mingw*)
+darwin*)
     ;;
 *)
     AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
@@ -627,13 +680,10 @@ dnl See if posix_memalign is available
 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
 
 dnl Check for pthreads
-case "$host_os" in
-mingw*)
-    ;;
-*)
-    AX_PTHREAD
-    ;;
-esac
+AX_PTHREAD
+if test "x$ax_pthread_ok" = xno; then
+    AC_MSG_ERROR([Building mesa on this platform requires pthreads])
+fi
 dnl AX_PTHREADS leaves PTHREAD_LIBS empty for gcc and sets PTHREAD_CFLAGS
 dnl to -pthread, which causes problems if we need -lpthread to appear in
 dnl pkgconfig files.
@@ -673,11 +723,6 @@ AC_ARG_ENABLE([gles2],
         [enable support for OpenGL ES 2.x API @<:@default=disabled@:>@])],
     [enable_gles2="$enableval"],
     [enable_gles2=no])
-AC_ARG_ENABLE([openvg],
-    [AS_HELP_STRING([--enable-openvg],
-        [enable support for OpenVG API @<:@default=disabled@:>@])],
-    [enable_openvg="$enableval"],
-    [enable_openvg=no])
 
 AC_ARG_ENABLE([dri],
     [AS_HELP_STRING([--enable-dri],
@@ -808,7 +853,6 @@ if test "x$enable_opengl" = xno -a \
         "x$enable_gles1" = xno -a \
         "x$enable_gles2" = xno -a \
         "x$enable_nine" = xno -a \
-        "x$enable_openvg" = xno -a \
         "x$enable_xa" = xno -a \
         "x$enable_xvmc" = xno -a \
         "x$enable_vdpau" = xno -a \
@@ -870,7 +914,7 @@ AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xyes -a \
 case "$host_os" in
 darwin*)
     dri_platform='apple' ;;
-gnu*|mingw*|cygwin*)
+gnu*|cygwin*)
     dri_platform='none' ;;
 *)
     dri_platform='drm' ;;
@@ -1528,29 +1572,6 @@ if test "x$enable_xa" = xyes; then
 fi
 AM_CONDITIONAL(HAVE_ST_XA, test "x$enable_xa" = xyes)
 
-dnl
-dnl OpenVG configuration
-dnl
-VG_LIB_DEPS=""
-
-if test "x$enable_openvg" = xyes; then
-    if test "x$enable_egl" = xno; then
-        AC_MSG_ERROR([cannot enable OpenVG without EGL])
-    fi
-    if test -z "$with_gallium_drivers"; then
-        AC_MSG_ERROR([cannot enable OpenVG without Gallium])
-    fi
-
-    AC_MSG_ERROR([Cannot enable OpenVG, because egl_gallium has been removed and
-                  OpenVG has not been integrated into standard libEGL yet])
-
-    EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
-    VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS $PTHREAD_LIBS"
-    VG_PC_LIB_PRIV="-lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS"
-    AC_SUBST([VG_PC_LIB_PRIV])
-fi
-AM_CONDITIONAL(HAVE_OPENVG, test "x$enable_openvg" = xyes)
-
 dnl
 dnl Gallium G3DVL configuration
 dnl
@@ -1621,7 +1642,7 @@ if test "x$enable_nine" = xyes; then
     if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
         AC_MSG_ERROR([nine requires the gallium swrast driver])
     fi
-    if test "x$with_gallium_drivers" == xswrast; then
+    if test "x$with_gallium_drivers" = xswrast; then
         AC_MSG_ERROR([nine requires at least one non-swrast gallium driver])
     fi
     if test "x$enable_dri3" = xno; then
@@ -1636,19 +1657,6 @@ dnl
 dnl OpenCL configuration
 dnl
 
-AC_ARG_WITH([libclc-path],
-   [AS_HELP_STRING([--with-libclc-path],
-         [DEPRECATED: See http://dri.freedesktop.org/wiki/GalliumCompute#How_to_Install])],
-   [LIBCLC_PATH="$withval"],
-   [LIBCLC_PATH=''])
-
-if test -n "$LIBCLC_PATH"; then
-   AC_MSG_ERROR([The --with-libclc-path option has been deprecated.
-                  Please review the updated build instructions for clover:
-                 http://dri.freedesktop.org/wiki/GalliumCompute])
-fi
-
-
 AC_ARG_WITH([clang-libdir],
    [AS_HELP_STRING([--with-clang-libdir],
          [Path to Clang libraries @<:@default=llvm-config --libdir@:>@])],
@@ -1769,7 +1777,7 @@ for plat in $egl_platforms; do
                        AC_MSG_ERROR([EGL platform drm requires libdrm >= $LIBDRM_REQUIRED])
                ;;
 
-       android|fbdev|gdi|null)
+       android|gdi|null)
                ;;
 
        *)
@@ -1798,7 +1806,6 @@ fi
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep -q 'x11')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep -q 'wayland')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep -q 'drm')
-AM_CONDITIONAL(HAVE_EGL_PLATFORM_FBDEV, echo "$egl_platforms" | grep -q 'fbdev')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep -q 'null')
 
 AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
@@ -1813,21 +1820,6 @@ if ! echo "$egl_platforms" | grep -q 'x11'; then
     GL_PC_CFLAGS="$GL_PC_CFLAGS -DMESA_EGL_NO_X11_HEADERS"
 fi
 
-AC_ARG_WITH([max-width],
-    [AS_HELP_STRING([--with-max-width=N],
-                    [Maximum framebuffer width (4096)])],
-    [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
-     AS_IF([test "${withval}" -gt "4096"],
-           [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
-)
-AC_ARG_WITH([max-height],
-    [AS_HELP_STRING([--with-max-height=N],
-                    [Maximum framebuffer height (4096)])],
-    [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
-     AS_IF([test "${withval}" -gt "4096"],
-           [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
-)
-
 dnl
 dnl Gallium LLVM
 dnl
@@ -1874,6 +1866,13 @@ strip_unwanted_llvm_flags() {
        -e 's/-fstack-protector-strong\>//g'
 }
 
+llvm_check_version_for() {
+    if test "${LLVM_VERSION_INT}${LLVM_VERSION_PATCH}" -lt "${1}0${2}${3}"; then
+        AC_MSG_ERROR([LLVM $1.$2.$3 or newer is required for $4])
+    fi
+}
+
+
 
 if test -z "$with_gallium_drivers"; then
     enable_gallium_llvm=no
@@ -1928,22 +1927,10 @@ if test "x$enable_gallium_llvm" = xyes; then
         fi
 
         if test "x$enable_opencl" = xyes; then
+            llvm_check_version_for "3" "5" "0" "opencl"
+
             LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets ipo linker instrumentation"
-            # LLVM 3.3 >= 177971 requires IRReader
-            if $LLVM_CONFIG --components | grep -qw 'irreader'; then
-                LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader"
-            fi
-            # LLVM 3.4 requires Option
-            if $LLVM_CONFIG --components | grep -qw 'option'; then
-                LLVM_COMPONENTS="${LLVM_COMPONENTS} option"
-            fi
-            # Current OpenCL/Clover and LLVM 3.5 require ObjCARCOpts and ProfileData
-            if $LLVM_CONFIG --components | grep -qw 'objcarcopts'; then
-                LLVM_COMPONENTS="${LLVM_COMPONENTS} objcarcopts"
-            fi
-            if $LLVM_CONFIG --components | grep -qw 'profiledata'; then
-                LLVM_COMPONENTS="${LLVM_COMPONENTS} profiledata"
-            fi
+            LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader option objcarcopts profiledata"
         fi
         DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DLLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
         MESA_LLVM=1
@@ -2067,12 +2054,7 @@ radeon_llvm_check() {
     if test "x$enable_gallium_llvm" != "xyes"; then
         AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
     fi
-    LLVM_REQUIRED_VERSION_MAJOR="3"
-    LLVM_REQUIRED_VERSION_MINOR="4"
-    LLVM_REQUIRED_VERSION_PATCH="2"
-    if test "${LLVM_VERSION_INT}${LLVM_VERSION_PATCH}" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}${LLVM_REQUIRED_VERSION_PATCH}"; then
-        AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR.$LLVM_REQUIRED_VERSION_PATCH or newer is required for $1])
-    fi
+    llvm_check_version_for "3" "4" "2" $1 
     if test true && $LLVM_CONFIG --targets-built | grep -qvw 'R600' ; then
         AC_MSG_ERROR([LLVM R600 Target not enabled.  You can enable it when building the LLVM
                       sources with the --enable-experimental-targets=R600
@@ -2357,9 +2339,7 @@ AC_CONFIG_FILES([Makefile
                src/gallium/auxiliary/Makefile
                src/gallium/auxiliary/pipe-loader/Makefile
                src/gallium/drivers/freedreno/Makefile
-               src/gallium/drivers/galahad/Makefile
                src/gallium/drivers/i915/Makefile
-               src/gallium/drivers/identity/Makefile
                src/gallium/drivers/ilo/Makefile
                src/gallium/drivers/llvmpipe/Makefile
                src/gallium/drivers/noop/Makefile
@@ -2382,7 +2362,6 @@ AC_CONFIG_FILES([Makefile
                src/gallium/state_trackers/osmesa/Makefile
                src/gallium/state_trackers/va/Makefile
                src/gallium/state_trackers/vdpau/Makefile
-               src/gallium/state_trackers/vega/Makefile
                src/gallium/state_trackers/xa/Makefile
                src/gallium/state_trackers/xvmc/Makefile
                src/gallium/targets/d3dadapter9/Makefile
@@ -2408,10 +2387,8 @@ AC_CONFIG_FILES([Makefile
                src/gallium/winsys/radeon/drm/Makefile
                src/gallium/winsys/svga/drm/Makefile
                src/gallium/winsys/sw/dri/Makefile
-               src/gallium/winsys/sw/fbdev/Makefile
                src/gallium/winsys/sw/kms-dri/Makefile
                src/gallium/winsys/sw/null/Makefile
-               src/gallium/winsys/sw/wayland/Makefile
                src/gallium/winsys/sw/wrapper/Makefile
                src/gallium/winsys/sw/xlib/Makefile
                src/gallium/winsys/vc4/drm/Makefile
@@ -2460,7 +2437,6 @@ echo "        includedir:      $includedir"
 dnl API info
 echo ""
 echo "        OpenGL:          $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
-echo "        OpenVG:          $enable_openvg"
 
 dnl Driver info
 echo ""
@@ -2558,6 +2534,7 @@ if test "x$MESA_LLVM" = x1; then
     echo "        LLVM_CFLAGS:     $LLVM_CFLAGS"
     echo "        LLVM_CXXFLAGS:   $LLVM_CXXFLAGS"
     echo "        LLVM_CPPFLAGS:   $LLVM_CPPFLAGS"
+    echo "        LLVM_LDFLAGS:    $LLVM_LDFLAGS"
     echo ""
 fi
 echo "        PYTHON2:         $PYTHON2"