Commit Graph

361 Commits

Author SHA1 Message Date
Eric Engestrom bb66af95a7 scons: use python3-compatible exceptions
These changes were generated using python's `2to3` tool.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-09-25 12:05:47 +01:00
Eric Engestrom e361047568 scons: use python3-compatible lists
These changes were generated using python's `2to3` tool.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2017-09-25 12:05:44 +01:00
Eric Engestrom 29c8d755ea scons: use python3-compatible list-key check
These changes were generated using python's `2to3` tool.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-09-25 11:58:53 +01:00
Eric Engestrom 7d48219b3a scons: use python3-compatible print()
These changes were generated using python's `2to3` tool.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102852
Reported-by: Alex Granni <liviuprodea@yahoo.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2017-09-25 11:57:12 +01:00
Alexandru-Liviu Prodea c1b0137048 Scons: Add LLVM 5.0 support
1 new required library - LLVMBinaryFormat

Cc: "17.2" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org=/show_bug.cgi?id=3D102318
Signed-off-by: Alexandru-Liviu Prodea <liviuprodea@yahoo.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-09-19 12:08:13 +01:00
Eric Engestrom 49b428470e util: improve compiler guard
Glibc 2.26 has dropped xlocale.h, but the functions needed (strtod_l()
and strdof_l()) can be found in stdlib.h.
Improve the detection method to allow newer builds to still make use of
the locale-setting.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102454
Cc: Laurent Carlier <lordheavym@gmail.com>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Laurent Carlier <lordheavym@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2017-09-03 09:05:23 +01:00
Eric Engestrom b50b4b6f84 scons: split out check_header() helper
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-07-14 13:23:54 +01:00
Vinson Lee c5d0dc7fa5 scons: Check for xlocale.h before defining HAVE_XLOCALE_H.
Don't assume the header is present on some platforms - use the more
robust CheckHeader() instead.

glibc 2.26 removed xlocale.h.
https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27

Fix this build error with glibc 2.26.

  Compiling src/util/strtod.c ...
src/util/strtod.c:32:10: fatal error: xlocale.h: No such file or directory
 #include <xlocale.h>
          ^~~~~~~~~~~

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101657
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Tested-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-07-06 09:51:28 -07:00
Tim Rowley 8b66d18a3b scons: allow .inl file extension
Intended for header files which are not meant to be included directly.

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
2017-06-30 13:26:19 -05:00
Ben Boeckel 58f51f0754 scons: update for LLVM 4.0
LLVMDemangle, LLVMGlobalISel, and LLVMDebugInfoMSF are new.

Also update the comment to add irreader to the list of components.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Chuck Atkins <chuck.atkins@kitware.com>
Signed-off-by: Ben Boeckel <ben.boeckel@kitware.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2017-05-04 18:05:04 +01:00
Emil Velikov 2c72e78ff5 autoconf/scons: bump libdrm to 2.4.75
We'll be using the drmGetDevice[s]2 API in src/loader with next patch.

v2: Rebase.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> (v1)
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-15 11:37:39 +00:00
Emil Velikov 87f485e957 scons: check for libXdamage 1.1 or later
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2017-02-13 10:14:23 +00:00
Emil Velikov cd1ebd8aba scons: add missing dri2proto requirement
Noticed while skimming through, although admittedly there's many other
dependencies that are not tracked by the scons build.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2017-02-13 10:13:24 +00:00
Emil Velikov d68ffa9446 scons: always set __STDC_*_MACROS for C++ sources
Analogous to previous commit - just set the lot once throughout.

Cc: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2017-01-27 17:56:57 +00:00
Emil Velikov dfc84c2296 mesa: make use of HAVE_FUNC_ATTRIBUTE_ALIAS macro
We must make sure that xserver has an equivalent one-line
change to its configure.ac as the glx/glapi headers get copied over.

Then again, xserver does _not_ seem to set HAVE_ALIAS to begin with so
one might want to look into that first.

Cc: Adam Jackson <ajax@redhat.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-18 16:01:14 +00:00
Vinson Lee f07da5aa5e scons: Recognize LLVM_CONFIG environment variable.
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2016-11-24 13:37:33 -08:00
George Kyriazis 30ae2cbf82 scons: add llvm 3.9 support.
v2: reworded commit message

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-11-21 12:44:46 -06:00
George Kyriazis 2da28dbd11 scons: ignore .hpp files in parse_source_list()
Drivers that contain C++ .hpp files need to ignore them too, along
with .h files, when building source file lists.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-11-21 12:44:46 -06:00
Vinson Lee f2770fb3d5 scons: Require libdrm >= 2.4.66 for DRM.
configure.ac already requires 2.4.66.

Fix SCons build. drmDevicePtr is not available until libdrm 2.4.65.

  Compiling src/loader/loader.c ...
src/loader/loader.c:111:40: error: unknown type name ‘drmDevicePtr’
 static char *drm_construct_id_path_tag(drmDevicePtr device)
                                        ^

Fixes: 4a183f4d06 ("scons: loader: use libdrm when available")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98421
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Vedran Miletić <vedran@miletic.net>
2016-10-25 15:48:12 -07:00
Emil Velikov cb23fba3f3 scons: remove all libudev references
Analogous to previous automake/autoconf commit.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-10-18 17:06:21 +01:00
Jose Fonseca b12606b693 scons: Fix the Python dependency scanner.
modulefinder wasn't searching for dependencies in the script dir.

It's not capable of detecting the sys.path manipulations scripts do
internally neither.

This change fixes the first issue, and hacks around the second.

Honestly, I've come to the conclusion that automatic Python dependency it will always be
too brittle.   I think we should start manually typing the dependencies
like we do in automake.  At very least it will enable any person to
eyeball and spot/fix missing dependencies, without dig into SCons internals.
2016-10-14 16:52:13 +01:00
Charmaine Lee a5fd54f8bf svga: add opt to the list of valid build types
For opt build, add VMX86_STATS to the list of cpp defines.

Reviewed-by: Brian Paul <brianp@vmware.com>
2016-08-26 06:19:51 -06:00
Giuseppe Bilotta 1b62b47f6f scons: support 2.5.0
The get_implicit_deps changed in SCons 2.5, expecting a callable rather
than a path as third argument. Detect the SCons versions and set the
argument appropriately to support both 2.5 and earlier versions.

This closes #95211.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95211
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
Acked-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2016-05-25 12:23:12 -06:00
Jose Fonseca c521f2d737 scons: Improve Python module dependency discovery.
Several NIR scripts were using `from ... import ...` syntax, which wasn't
supported.

Using Python standard libary's modulefinder solves the problem with less
effort and hacks.

Reviewed-by: Brian Paul <brianp@vmware.com>
2016-05-09 14:19:24 +01:00
Jose Fonseca a2fe35bcdf scons: Support Clang on Windows.
- Introduce 'gcc_compat' env flag, for all compilers that define __GNUC__,
  (which includes Clang when it's not emulating MSVC.)

- Clang doesn't support whole program optimization

- Disable enumerator value warnings (not sure why Clang warns about them,
  as my understanding is that MSVC promotes enums to unsigned ints
  automatically.)

This is not enough to build with Clang + AddressSanitizer though.  More
follow up changes will be required for that.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2016-04-26 17:17:00 +01:00
Jose Fonseca c068610a7d scons: Move fallback HAVE_* definitions to headers.
These were being defined in SCons, but it's not practical:

- we actually need to include Gallium headers from external source trees, with
completely disjoint build infrastructure, and it's unsustainable to
replicate the HAVE_xxx checks or even hard-coded defines across
everywhere.

- checking compiler version via command line doesn't really work due to
  Clang essentially being like a cameleon which can fake either GCC or
  MSVC

There's no change for autoconf.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2016-04-26 17:17:00 +01:00
Jose Fonseca 7d2151b6ea scons: Show the unit test full path.
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2016-04-19 11:31:11 +01:00
Jose Fonseca 50ddf03ada scons: Add a "check" target to run all unit tests.
Except:
- u_cache_test -- too long
- translate_test -- unreliable (it's probably testing corner cases that
  translate module doesn't care about.)

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2016-04-14 07:19:04 +01:00
Jose Fonseca fa46848e51 scons: Allow building with Address Sanitizer.
libasan is never linked to shared objects (which doesn't go well with
-z,defs).  It must either be linked to the main executable, or (more
practically for OpenGL drivers) be pre-loaded via LD_PRELOAD.

Otherwise works.

I didn't find anything with llvmpipe.  I suspect the fact that the
JIT compiled code isn't instrumented means there are lots of errors it
can't catch.

But for non-JIT drivers, the Address/Leak Sanitizers seem like a faster
alternative to Valgrind.

Usage (Ubuntu 15.10):

   scons asan=1 libgl-xlib
   export LD_LIBRARY_PATH=$PWD/build/linux-x86_64-debug/gallium/targets/libgl-xlib
   LD_PRELOAD=libasan.so.2 any-opengl-application

Acked-by: Roland Scheidegger <sroland@vmware.com>
2016-04-13 06:54:32 +01:00
Jose Fonseca a97a955b92 scons: Eliminate MSVC2008 compatibility.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2016-02-11 21:36:00 +00:00
Oded Gabbay 647d8e95d1 configure.ac: always define __STDC_CONSTANT_MACROS
The ISO C99 standard (7.18.4) specifies that C++
implementations should define UINT64_C only when
__STDC_CONSTANT_MACROS is defined.

Because we now use UINT64_C in our cpp files (since commit
208bfc493d), we need to add this define.

This also solves compilation errors with GCC 4.8.x on ppc64le machines.

v2: add this define to SCons build system

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2016-01-11 23:28:23 +02:00
Olivier Pena a5256012ef scons: support for LLVM 3.7.
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2015-12-08 13:53:31 +00:00
Vinson Lee ee113bbbc5 scons: Always define __STDC_LIMIT_MACROS.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91591
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2015-08-15 01:44:33 -07:00
Jose Fonseca 0db4ef9df1 gallivm: Use the LLVM's C disassembly interface.
It doesn't do everything we want.  In particular it doesn't allow to
detect jumps or return opcodes.  Currently we detect the x86's RET
opcode.

Even though it's worse for LLVM 3.3, it's an improvement for LLVM 3.7,
which was totally busted.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2015-05-29 11:20:58 +01:00
Olivier Pena b94a4e8498 scons: Support LLVM 3.5 and 3.6 on windows.
llvm/Config/llvm-config.h is parsed instead of llvm/Config/config.h for
detecting LLVM version
(http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-June/073707.html).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2015-04-27 21:47:27 +01:00
Jose Fonseca 28c54400af scons: Disable MSVC warnings about inconsistent function annotation.
Somehow, merely including any of the *intrin.h headers causes dozens of
this warnings (when compiling pretty much every source file).  MSVC does
not always complain the same -- so it's possible we're doing something
weird --, but silence these warnings in the meanwhile.

Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-25 10:42:45 +00:00
Jose Fonseca 06ac717810 scons: Silence conversion from 'size_t' to 'type', possible loss of data on MSVC.
Most cases seem harmless, though that might not always be the case.  Maybe
one day we can get gcc to complain about these and fix them throughout
the code, but until then let's silence them.

Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-22 08:23:24 +00:00
Jose Fonseca 15c5595bb1 scons: Ensure inttypes.h is always pre-included on MSVC.
It's a bit hackish couldn't find another solution.  See code comment
for details.   The warning is useful, so universally disabling doesn't
sound a good idea.

Fixes

   warning C4005: 'xxx' : macro redefinition

Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-22 08:23:24 +00:00
Jose Fonseca e4d95982ee scons: Silence MSVC C4351 warning.
It warns about change in MSVC behavior -- array initialisation used to
be non-standard, but is standard now, assuming I understand correctly
http://en.cppreference.com/w/cpp/language/zero_initialization .

Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-22 08:23:24 +00:00
Jose Fonseca e518d97d7e scons: Match some of LLVM warning options.
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-22 08:23:24 +00:00
Jose Fonseca 9c1c657e19 scons: Prefer winflexbison, and use --wincompat when available.
This avoids MSVC the warning

  warning C4013: 'isatty' undefined; assuming extern returning int

with certain versions of flex.

Reviewed-by: Brian Paul <brianp@vmware.com>

v2: Add win flex-bison link to docs/install.html.
2015-03-22 08:23:24 +00:00
Jose Fonseca 015e8b6384 scons: Define YY_USE_CONST on MSVC.
This prevents the MSVC from

  warning C4090: 'function' : different 'const' qualifiers

when compiling flex generated lexers.

Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-22 08:23:24 +00:00
Jose Fonseca 357d1fc81a scons: Tell MSVC STL library to not use exceptions.
MSVC defaults to no exceptions unless /EH option is passed (which we don't), while
MSVC's STL defaults to use exceptions unless _HAS_EXCEPTIONS=0 is defined,
which we didn't.

This fixes

  warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc

Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-22 08:23:24 +00:00
Jose Fonseca 1d30fd85dd scons: Silence MSVC warnings about overflows in constant arithmetic.
These get triggered even when using the standard C99 INFINITY/NAN
constants.

Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-18 21:51:40 +00:00
José Fonseca bbac03ecca scons: Disable MSVC signed/unsigned mismatch warnings.
By default gcc ignores the issue, and as result code that mixes
signed/unsigned is so widespread through the code base that it ends up
being little more than noise, potentially obscuring more pertinent
warnings.

Maybe one day we enable the corresponding gcc warnings and cleanup, but
until then, this change disables them.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2015-03-18 21:51:40 +00:00
Vinson Lee 5f759836ad Add macro for unused function attribute.
Suggested-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-09 17:28:39 -07:00
Jose Fonseca 6e836d2c86 scons: Update for the fact that we require GCC 4.2
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-04 15:12:22 +00:00
Jose Fonseca 00faf9f000 scons: Use -Werror MSVC compatibility flags per-directory.
Matching what we already do with autotools builds.

Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-04 15:12:06 +00:00
Vinson Lee b77576edc1 scons: Define _DEFAULT_SOURCE.
Fix GCC cpp warnings with glibc >= 2.19.

/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-03 17:23:48 -08:00
Jose Fonseca fa5140bb18 scons: Fix HAVE___* definition.
These definitions must be moved before `cppdefines` is used to have effect.

Trivial.
2015-03-02 14:23:51 +00:00
Jose Fonseca 5b941ce857 scons: Fix Windows builds with LLVM 3.5.
LLVMBitReader dependency was introduced, as pointed out by Rob Conde.
2015-02-03 10:18:51 +00:00
Vinson Lee 9db7b12cb2 scons: Add X11 include path if X11 is available.
Mac OS X XQuartz places X11 headers at /opt/X11/include.

This patch fixes this Mac OS X SCons build error.

  Compiling src/gallium/state_trackers/glx/xlib/glx_api.c ...
In file included from src/gallium/state_trackers/glx/xlib/glx_api.c:34:
include/GL/glx.h:30:10: fatal error: 'X11/Xlib.h' file not found
         ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-01-22 21:29:43 +00:00
José Fonseca aef3a01d57 scons: Generate SSE2 floating-point arithmetic.
- SSE2 is available on all x86 processors we care about.

- It's recommended by Intel:

  https://software.intel.com/en-us/blogs/2012/09/26/gcc-x86-performance-hints

- And has been the default since MSVC 2012:

  http://msdn.microsoft.com/en-us/library/7t5yh4fd(v=vs.110).aspx

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-11-26 20:25:12 +00:00
José Fonseca 0473577f91 scons: Remove dead code/comments.
- Remove no-op if-clause.

- -mstackrealign has been enabled again on MinGW for quite some time and
  appears to work alright nowadays.

- Drop -mmmx option as it is implied my -msse, and we don't use MMX
  intrinsics anyway.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-11-26 20:25:12 +00:00
Vinson Lee 876c53375e scons: Require glproto >= 1.4.13 for X11.
GLXBadProfileARB and X_GLXCreateContextAtrribsARB require glproto >=
1.4.13. These symbols were added in commit
d5d41112cb "st/xlib: Generate errors as
specified."

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2014-11-16 13:26:26 -08:00
Chia-I Wu b039dbfffd configure: check for xlocale.h and strtof
With the assumptions that xlocale.h implies newlocale and strtof_l.  SCons is
updated to define HAVE_XLOCALE_H on linux and darwin.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-10-30 02:26:19 -07:00
José Fonseca 013ff2fae1 gallivm,llvmpipe,clover: Bump required LLVM version to 3.3.
We'll need to update gallivm for the interface changes in LLVM 3.6, and
the fewer the number of older LLVM versions we support the less hairy that
will be.

As consequence HAVE_AVX define can disappear.  (Note HAVE_AVX meant
whether LLVM version supports AVX or not.  Runtime support for AVX is
always checked and enforced independently.)

Verified llvmpipe builds and runs with with LLVM 3.3, 3.4, and 3.5.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-10-23 10:18:56 +01:00
Matt Turner 976464c210 mesa: Replace a priori knowledge of gcc attributes with configure tests.
Note that I had to add support for testing the packed attribute to
m4/ax_gcc_func_attribute.m4.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> [C bits]
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-09-25 13:52:55 -07:00
Matt Turner 4a96df73e7 mesa: Replace a priori knowledge of gcc builtins with configure tests.
Presumbly this will let clang and other compilers use the built-ins as
well.

Notice two changes specifically:
   - in _mesa_next_pow_two_64(), always use __builtin_clzll and add a
     static assertion that this is safe.
   - in macros.h, remove the clang-specific definition since it should
     be able to detect __builtin_unreachable in configure.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> [C bits]
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-09-25 13:52:55 -07:00
José Fonseca 771ab951a8 scons: add /dynamicbase and /nxcompat to MinGW linkflags
Just like b26503b196d51dc46c815e241343e42ab30e8d66 for MSVC.
2014-09-11 11:59:28 +01:00
Brian Paul 4860e98972 scons: add /dynamicbase and /nxcompat to MSVC linkflags
This builds the opengl DLLs with address layout space randomization
(ASLR) and data execution prevention (DEP) for better security.

Reviewed-by: Kurt Daverman <krd@vmware.com>
2014-09-11 11:59:28 +01:00
Jose Fonseca d4a1f3fd27 scons: do not include headers from the sources lists
The SCons documentation is not explicit on the topic yet building mesa
with SCons and MSVC is known to have problems when headers are listed.
So be safe just drop them for now.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82534
Tested-by: Vinson Lee <vlee@freedesktop.org>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-08-14 15:38:04 +01:00
José Fonseca 7889469663 scons: Link libGL.so against xcb-dri2.
Fixing undefined xcb_dri2_* symbols.

Trivial.
2014-06-16 11:24:21 +01:00
Emil Velikov c21fca8bf2 scons: remove dri-i915 build target
Unmaintained and broken.

Cc: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Jakob Bornecrantz <jakob@vmware.com>
2014-06-09 22:46:17 +01:00
José Fonseca b6956aef74 scons: Search only for mingw-w64 cross-compilers.
Some distros still ship the non-mingw-w64 cross-compilers, but they are
can't build Mesa properly, as Jakob pointed out.
2014-06-06 13:15:37 +01:00
José Fonseca 2c02f34fcc gallivm: Support MCJIT on Windows.
It works fine, though it requires using ELF objects.

With this change there is nothing preventing us to switch exclusively
to MCJIT, everywhere.  It's still off though.
2014-05-23 11:37:47 +01:00
José Fonseca c0ef9a67d3 scons: Require LLVM 3.1
Support for prior versions will be removed in the following change.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-05-14 11:04:59 +01:00
José Fonseca 979692a52a scons: Don't use bundled C99 headers for VS 2013.
Use the ones provided by the compiler instead.

NOTE: External trees should be updated to not include '#include/c99'
directory directly, but rather rely on scons/gallium.py to do the right
thing.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-05-02 22:04:46 +01:00
José Fonseca 42b9f8590d scons: Adjust the warnings for VS.
Silence insignificant warnings so significant warnings have a chance to
stand out.

The only abundant warning that's not silenced here is "C4018:
signed/unsigned mismatch", as it could hide security issues, so it's better
to actually fix the code.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-05-02 22:04:46 +01:00
José Fonseca 97fa9cd220 scons: Enable building through Clang Static Analyzer.
Same intent as commit a45a50a482,
but this the C compiler is detected via C-preprocessor macros,
similar to how autotools do it, as that seems to be the most
reliable method.

Reviewed-by: Brian Paul <brianp@vmware.com>
2014-04-17 09:56:48 +01:00
José Fonseca e3c58cdfd9 Revert "scons: Enable building through Clang Static Analyzer."
This reverts commit a45a50a482.

Unfortunately gcc dumps argv[0] as the first word of --version, so it is
unreliable for detecting gcc.

In particular `cc --version` and `i686-w64-mingw32-gcc --version` give
wrong results.

A better solution needs to be found -- most likely using C-preprocessing
like autotools does.  Revert for now.
2014-04-16 13:18:06 +01:00
José Fonseca d3c0e236f2 scons: Add an analyze option.
For Clang static code analyzer, the scan-build script will produce more
comprehensive output.  Nevertheless you can invoke it as

  CC=clang CXX=clang++ scons analyze=1

For MSVC this is the best way to use its static code analysis.  Simply
invoke as

  scons analyze=1

Reviewed-by: Brian Paul <brianp@vmware.com>
2014-04-16 11:44:21 +01:00
José Fonseca a45a50a482 scons: Enable building through Clang Static Analyzer.
By accurately detecting gcc/clang through --version option instead
of executable name.

Clang Static Analyzer reports many issues, most false positives, but it
found at least one real and subtle use-after-free issue
in st_texture_get_sampler_view():

  http://people.freedesktop.org/~jrfonseca/scan-build-2014-04-14-1/report-869047.html#EndPath

Reviewed-by: Brian Paul <brianp@vmware.com>
2014-04-16 11:44:06 +01:00
Alexander von Gluck IV 7683fce878 haiku: Fix build through scons corrections and viewport fixes
* Add HAVE_PTHREAD, we do have pthread support wrappers now for
  non-native Haiku threaded applications.
* Viewport changed behavior recently breaking the build.
  We fix this by looking at the gl_context ViewportArray
  (Thanks Brian for the idea)

Acked-by: Brian Paul <brianp@vmware.com>
2014-03-24 19:01:53 -05:00
Vinson Lee f2d724c686 scons: Build with C++11 with LLVM >= 3.5.
Starting with llvm-3.5svn r202574, LLVM expects C+11 mode.

commit f8bc17fadc8f170c1126328d203f0dab78960137
Author: Chandler Carruth <chandlerc@gmail.com>
Date:   Sat Mar 1 06:31:00 2014 +0000

    [C++11] Turn off compiler-based detection of R-value references, relying
    on the fact that we now build in C++11 mode with modern compilers. This
    should flush out any issues. If the build bots are happy with this, I'll
    GC all the code for coping without R-value references.

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202574 91177308-0d34-0410-b5e6-96231b3b80d8

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
2014-03-04 10:12:20 -08:00
Emil Velikov 4b3a4c799a scons: sync package requirements
xorg-server and libkms is no longer required since the removal
of the xorg state-tracker.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-02-18 00:04:07 +00:00
José Fonseca 8771285054 s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008.  Leaving the
old copyright name is creating unnecessary confusion, hence this change.

This was the sed script I used:

    $ cat tg2vmw.sed
    # Run as:
    #
    #   git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
    #

    # Rename copyrights
    s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
    /Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
    s/TUNGSTEN GRAPHICS/VMWARE/g

    # Rename emails
    s/alanh@tungstengraphics.com/alanh@vmware.com/
    s/jens@tungstengraphics.com/jowen@vmware.com/g
    s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
    s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
    s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
    s/michel@tungstengraphics.com/daenzer@vmware.com/g
    s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
    s/zack@tungstengraphics.com/zackr@vmware.com/

    # Remove dead links
    s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g

    # C string src/gallium/state_trackers/vega/api_misc.c
    s/"Tungsten Graphics, Inc"/"VMware, Inc"/

Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 20:00:32 +00:00
Vinson Lee 35a3414302 scons: Add system library linker flags on LLVM 3.5.
llvn-3.5svn r197664 split out the linker flags from ldflags to
system-libs.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
2013-12-23 11:33:29 -08:00
Alexander von Gluck IV 1c7605685d mesa: Remove last BEOS checks
* Goodbye BeOS, we hardly knew thee
* As BeOS was gcc2 only, there was little chance
  of this being useful.
* Doesn't effect Haiku in any meaningful way

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-11-05 09:37:58 -06:00
Alexander von Gluck IV 50370e483b scons: Fix Haiku missing library
* The softpipe add-on needs libtranslation
  due to the use of BTranslatorRoster

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-10-20 19:20:59 -05:00
Alexander von Gluck IV 9aad1ba70f scons: Simplified fix of llvm cxxflags for rtti
* Based on ideas of Jose Fonseca
* A rework of ce8eadb6e8

Tested-by: Vinson Lee <vlee@freedesktop.org>
2013-10-17 20:33:05 -05:00
José Fonseca 40ddd8b659 Revert "scons: Fix build when rtti is disabled"
This reverts commit 94d05bf87a as it has a
few problems:

- it breaks windows builds becuase env[LLVM_CXXFLAGS] is never set there

- it is merging not only rtti, but the whole cxxflags (defines etc)
  which has proven to be a source of troubles (breaks debugging etc.)
2013-10-16 15:05:51 -07:00
Alexander von Gluck IV 94d05bf87a scons: Fix build when rtti is disabled
* The rtti fix actually dug up a bug in the scons build scripts.
* Autotools took the LLVM cpp and cxx flags, while scons only took
  the cpp flags.
* This grabs the cxx flags and applies them where needed. We may
  want to make the same change for the llvm cpp flags in scons.
* The only linux platform I can find with LLVM no-rtti is Ubuntu.
* Fixes bug #70471

Tested-by: Vinson Lee <vlee@freedesktop.org>
2013-10-15 22:12:18 -05:00
Alexander von Gluck IV ce8eadb6e8 build: remove forced -fno-rtti
* As discussed on the mailing list,
  forced no-rtti breaks C++ public
  API's such as the Haiku C++ libGL.so
* -fno-rtti *can* be still set however
  instead of blindly forcing -fno-rtti,
  we can rely on the llvm-config
  --cppflags output.
  If the system llvm is built without
  rtti (default), the no-rtti flag will be
  present in llvm-config --cppflags
  (which we pick up on)
  If llvm is built with rtti
  (REQUIRES_RTTI=1), then -fno-rtti is
  removed from llvm-config --cppflags.
* We could selectively add / remove rtti
  from various components, however mixing
  rtti and non-rtti code is tricky and
  could introduce missing symbols.
* This needs impact tested.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2013-10-14 23:00:55 -05:00
Alexander von Gluck IV 765baec8f7 haiku: Ensure correct libraries are referenced. 2013-10-04 18:20:09 -05:00
José Fonseca 0aca2c6b60 scons: Fix implicit python dependency discovery on Windows.
Probably due to CRLF endings, the discovery of python import statements
was not working on Windows builds, causing incremental builds to often
fail unless one wiped out the build directory.

NOTE: This is a candidate for stable branches.
2013-06-08 08:55:06 +01:00
José Fonseca 8cabc7be1d scons: Don't force stabs debug format for Mingw.
- recent gdb handles DWARF fine (tested both with version
  7.1.90.20100730 from mingw-w64 project, and 7.5-1 from mingw project)

- http://people.freedesktop.org/~jrfonseca/bfdhelp/ was updated to
  handle DWARF

- stabs requires ugly hacks to prevent compilation failures

- mixing stabs/dwarf prevents proper backtraces (which is inevitable,
  given that the MinGW C runtime is pre-built with DWARF)

For example, without this change I get:

  (gdb) bt
  #0  _wassert (_Message=0xf925060 L"Num < NumOperands && \"Invalid child # of SDNode!\"",
      _File=0xf60b488 L"llvm/include/llvm/CodeGen/SelectionDAGNodes.h", _Line=534)
      at ../../../../mingw-w64-crt/misc/wassert.c:51
  #1  0x0368996b in _assert (_Message=0x39d7ee4 "Num < NumOperands && \"Invalid child # of SDNode!\"",
      _File=0x39d7e94 "llvm/include/llvm/CodeGen/SelectionDAGNodes.h", _Line=534)
      at ../../../../mingw-w64-crt/misc/wassert.c:44
  #2  0x00000004 in ?? ()
  #3  0x00000004 in ?? ()
  #4  0x0f60b488 in ?? ()
  #5  0x00000000 in ?? ()

While with this change I get:

  (gdb) bt
  #0  _wassert (_Message=0xfb982e8 L"Num < NumOperands && \"Invalid child # of SDNode!\"",
      _File=0xefbcb40 L"llvm/include/llvm/CodeGen/SelectionDAGNodes.h", _Line=534)
      at ../../../../mingw-w64-crt/misc/wassert.c:51
  #1  0x039c996b in _assert (_Message=0x3d17f24 "Num < NumOperands && \"Invalid child # of SDNode!\"",
      _File=0x3d17ed4 "llvm/include/llvm/CodeGen/SelectionDAGNodes.h", _Line=534)
      at ../../../../mingw-w64-crt/misc/wassert.c:44
  #2  0x033111cc in getOperand (Num=4, this=<optimized out>)
      at llvm/include/llvm/CodeGen/SelectionDAGNodes.h:534
  #3  getOperand (i=4, this=<optimized out>)
      at llvm/include/llvm/CodeGen/SelectionDAGNodes.h:779
  #4  llvm::SelectionDAG::getNode (this=0xf00cb08, Opcode=79, DL=..., VT=..., N1=..., N2=...)
      at llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2859
  #5  0x03377b20 in llvm::SelectionDAGBuilder::visitExtractElement (this=0xfb45028, I=...)
      at llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:2803
  [...]

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-05-21 12:34:19 +01:00
Andreas Boll 4ca44f2c5e scons: remove radeon build
One build system for linux/unix only drivers should be enough.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48694

Acked-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-03 18:44:43 +02:00
José Fonseca 1687932d2b scons: Support clang.
clang is supports most gcc options / extensions, with a some exceptions.

The biggest advantage of using clang is that compilation times are much
short.

One can tell scons to use clang when building by invoking it as

   CC=clang CXX=clang++ scons libgl-xlib
2013-04-25 11:59:01 +01:00
Brian Paul 3804d67723 scons: check for existance of 'MSVC_VERSION' in env
Evidently, MSVC_VERSION isn't always defined so check for it before
checking the MSVC version.

Suggested by Jose.
2013-03-21 09:24:40 -06:00
José Fonseca 49ae9b08d4 scons: Warn when using MSVS versions prior to 2012.
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-03-15 19:55:54 +00:00
José Fonseca a35a19a6ea scons: Define _ALLOW_KEYWORD_MACROS on MSVC builds.
scons/llvm.py defines inline globally to workaround issues with LLVM C
binding headers, so the only way to is to avoid
aggravating xkeycheck.h errors is to set _ALLOW_KEYWORD_MACROS.

This fixes MSVC 2012 build with LLVM.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-03-14 19:01:10 +00:00
José Fonseca 3950953f93 scons: Fix llvm-config not found error message.
"% llvm_version" is bogus copy'n'past cruft.
2013-03-05 23:06:13 +00:00
Keith Kriewall efd8311a54 scons: Fix Windows build with LLVM 3.2
Fixes fdo bug 61299

NOTE: This is a candidate for the stable branches.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
2013-02-28 15:40:02 +00:00
Michel Dänzer 02a423b239 Require libdrm_radeon 2.4.42 for radeonsi.
It has new PCI IDs and an important tiled surface layout fix.
2013-02-05 15:12:14 +01:00
José Fonseca 0642437606 scons: Fix source lists parsing on Windows.
/ vs \ mismatch was causing .objs to be put in the source tree, causing
breakeage when doing different build types in the same tree (eg., debug
vs release).

Fix this by normalizing everything to / slashes.

It's probably a good idea to purge all .objs from source tree to prevent
issues completely.
2013-01-23 12:11:53 +00:00
José Fonseca 9a0973044e scons: Disable frame pointer omission for all build types except release.
In particular for checked builds, where debug_backtrace_capture relies
on it.
2013-01-22 20:19:28 +00:00
Alexander von Gluck IV 23595aa427 mesa: Drop mmx optimizations on Haiku
* Prevents compatibility problems. As Haiku
  doesn't use rtasm anymore, it's kind of
  pointless.
2013-01-07 17:39:49 -06:00
José Fonseca d296326e06 gallium/os: Cleanup up os_time_get/os_time_get_nano.
- Re-implement os_time_get in terms of os_time_get_nano() for consistency
- Use CLOCK_MONOTONIC as recommended
- Only use clock_gettime on Linux for now.

Reviewed-by: Brian Paul <brianp@vmware.com>
2012-12-06 17:12:31 +00:00
José Fonseca ed4dfaa164 scons: Link against librt
Fixes missing clock_gettime symbol.
2012-12-04 19:37:21 +00:00