Bug 89762 - xf86-video-intel-2.99.917 should check for <alloca.h> being needed
Summary: xf86-video-intel-2.99.917 should check for <alloca.h> being needed
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: 7.7 (2012.06)
Hardware: Other Solaris
: medium normal
Assignee: Chris Wilson
QA Contact: Intel GFX Bugs mailing list
Depends on:
Reported: 2015-03-25 13:08 UTC by Richard PALO
Modified: 2015-03-25 14:23 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Note You need to log in before you can comment on or make changes to this bug.
Description Richard PALO 2015-03-25 13:08:55 UTC
To get over errors compiling the latest intel driver on solaris with pkgsrc
I needed to do the following quick and dirty patch:

>--- src/sna/sna_display.c.orig	2014-12-20 13:45:31.000000000 +0000
>+++ src/sna/sna_display.c
>@@ -72,6 +72,9 @@
> #include <memcheck.h>
> #endif
>+#ifdef __sun
>+#include <alloca.h>
> /* Minor discrepancy between 32-bit/64-bit ABI in old kernels */
> union compat_mode_get_connector{
> 	struct drm_mode_get_connector conn;

perhaps adding a configure time check to allow 
>#include <alloca.h>

would be preferable.

At the same time I notice an error in configure using `pwd` with arguments.
Some shells, such as pdksh, balk at that thus:
./configure[24230]: pwd: too many arguments

>xf86-video-intel 2.99.917 will be compiled with:
>  Xorg Video ABI version: 12.1
>  Acceleration backends: none *sna uxa
>  Additional debugging support? none
>  Support for Kernel Mode Setting? yes
>  Support for legacy User Mode Setting (for i810)? yes
>  Support for Direct Rendering Infrastructure: DRI1 DRI2
>  Support for Xv motion compensation (XvMC and libXvMC): no
>  Build additional tools and utilities? none

this is the ugly line:
>24230 test -e `pwd $0`/README && cat `pwd $0`/README
Comment 1 Chris Wilson 2015-03-25 13:19:47 UTC
commit d85e68e2d310a5646e4e71a06edf2b21b1d18688
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Mar 25 13:16:56 2015 +0000

    sna: Add include <alloca.h> for compiling on Solaris
    Reported-by: Richard Palo <richard@netbsd.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89762
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

commit 53e825d6cfe49a4db5588718ea910c46d656ecfa
Author: Patrick Welche <prlw1@cam.ac.uk>
Date:   Mon Jan 26 12:25:42 2015 +0000

    configure.ac: pwd doesn't take an argument
    bash built-in doesn't give an error, but real pwd does, and the
    argument is unnecessary.
    Signed-off-by: Patrick Welche <prlw1@cam.ac.uk>
Comment 2 Richard PALO 2015-03-25 14:09:12 UTC
!wow. thanks guys... 
just noticed the following as well here:


    Check how to get alloca. Tries to get a builtin version by checking for alloca.h or the predefined C preprocessor macros __GNUC__ and _AIX. If this macro finds alloca.h, it defines HAVE_ALLOCA_H.

    If those attempts fail, it looks for the function in the standard C library. If any of those methods succeed, it defines HAVE_ALLOCA. Otherwise, it sets the output variable ALLOCA to ‘${LIBOBJDIR}alloca.o’ and defines C_ALLOCA (so programs can periodically call ‘alloca (0)’ to garbage collect). This variable is separate from LIBOBJS so multiple programs can share the value of ALLOCA without needing to create an actual library, in case only some of them use the code in LIBOBJS. The ‘${LIBOBJDIR}’ prefix serves the same purpose as in LIBOBJS (see AC_LIBOBJ vs LIBOBJS).

    This macro does not try to get alloca from the System V R3 libPW or the System V R4 libucb because those libraries contain some incompatible functions that cause trouble. Some versions do not even contain alloca or contain a buggy version. If you still want to use their alloca, use ar to extract alloca.o from them instead of compiling alloca.c.

    Source files that use alloca should start with a piece of code like the following, to declare it properly.

              #if HAVE_ALLOCA_H
              # include <alloca.h>
              #elif defined __GNUC__
              # define alloca __builtin_alloca
              #elif defined _AIX
              # define alloca __alloca
              #elif defined _MSC_VER
              # include <malloc.h>
              # define alloca _alloca
              # include <stddef.h>
              # ifdef  __cplusplus
              extern "C"
              # endif
              void *alloca (size_t);
Comment 3 Chris Wilson 2015-03-25 14:23:32 UTC
commit 8f11f2bdcdc7d84b11134c9e7d15df888f2b6f3c
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Mar 25 13:16:56 2015 +0000

    The preferred all-inclusive method for finding alloca().
    Reported-by: Richard Palo <richard@netbsd.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89762
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.