Search
lxdream.org :: lxdream/acinclude.m4
lxdream 0.9.1
released Jun 29
Download Now
filename acinclude.m4
changeset 1147:e04e4af64626
prev985:52e64faac752
next1198:407659e01ef0
author nkeynes
date Sat Jan 22 06:07:17 2011 +1000 (13 years ago)
permissions -rw-r--r--
last change Mark the NV vertex range functions as weak (to keep things working on
drivers that don't provide the entry points)
Set the fence at the start (really just to prevent an error the first time
around)
view annotate diff log raw
     1 # AC_CHECK_FASTCALL([if-ok],[if-notok])
     2 # Test if the compiler recognizes __attribute__((regparm(3))) - we don't 
     3 # currently check if it actually works correctly, but probably should...
     4 # -----------------------
     5 AC_DEFUN([AC_CHECK_FASTCALL], [
     6 AC_MSG_CHECKING([support for fastcall calling conventions]);
     7 AC_RUN_IFELSE([
     8   AC_LANG_SOURCE([[
     9 int __attribute__((regparm(3))) foo(int a, int b) { return a+b; }
    11 int main(int argc, char *argv[])
    12 {
    13    return foo( 1, 2 ) == 3 ? 0 : 1;
    14 }]])], [ 
    15    AC_MSG_RESULT([yes])
    16    $1 ], [ 
    17    AC_MSG_RESULT([no])
    18    $2 ])
    19 ])
    21 # AC_CHECK_FORCEINLINE([if-ok],[if-notok])
    22 # Test if the compiler recognizes __attribute__((always_inline))
    23 # -----------------------
    24 AC_DEFUN([AC_CHECK_FORCEINLINE], [
    25 AC_MSG_CHECKING([support for force inlining]);
    26 AC_COMPILE_IFELSE([
    27   AC_LANG_SOURCE([[
    28 static int __attribute__((always_inline)) foo(int a, int b) { return a+b; }
    30 int main(int argc, char *argv[])
    31 {
    32    return foo( 1, 2 ) == 3 ? 0 : 1;
    33 }]])], [ 
    34    FORCEINLINE="__attribute__((always_inline))"
    35    AC_MSG_RESULT([$FORCEINLINE])
    36    $1 ], [ 
    37    FORCEINLINE=""
    38    AC_MSG_RESULT([no])
    39    $2 ])
    40 ])
    42 # AC_CHECK_FRAME_ADDRESS([if-ok],[if-notok])
    43 # Test if the compiler will let us modify the return address on the stack
    44 # via __builtin_frame_address()
    45 # -----------------------
    46 AC_DEFUN([AC_CHECK_FRAME_ADDRESS], [
    47 AC_MSG_CHECKING([if we have a working __builtin_frame_address()]);
    48 AC_RUN_IFELSE([
    49   AC_LANG_SOURCE([[
    50 void * __attribute__((noinline)) first_arg( void *x, void *y ) { return x; }
    51 int __attribute__((noinline)) foo( int arg, void *exc )
    52 {
    53     if( arg < 2 ) {
    54         *(((void **)__builtin_frame_address(0))+1) = exc;
    55     }
    56     return 0;
    57 }
    59 int main(int argc, char *argv[])
    60 {
    61    goto *first_arg(&&start, &&except);
    63 start:
    64    return foo( argc, &&except ) + 1;
    66 except:
    67    return 0;
    68 }]])], [ 
    69    AC_MSG_RESULT([yes])
    70    $1 ], [ 
    71    AC_MSG_RESULT([no])
    72    $2 ])
    73 ])
    75 # AC_CC_VERSION([if-gcc], [if-icc],[if-other])
    76 # Check which C compiler we're using and branch accordingly, eg to set
    77 # different optimization flags. Currently recognizes gcc and icc
    78 # ---------------
    79 AC_DEFUN([AC_CC_VERSION], [
    80 _GCC_VERSION=`$CC --version | $SED -ne '/gcc/p'`
    81 _ICC_VERSION=`$CC --version | $SED -ne '/(ICC)/p'`
    82 AC_MSG_CHECKING([CC version])
    83 if test -n "$_ICC_VERSION"; then
    84    AC_MSG_RESULT([ICC])
    85    [ $2 ]
    86 elif test -n "$_GCC_VERSION"; then
    87    AC_MSG_RESULT([GCC])
    88    [ $1 ] 
    89 else 
    90    AC_MSG_RESULT([Unknown])
    91    [ $3 ]
    92 fi
    93 ]);
    95 # AC_OBJC_VERSION([if-gcc],[if-other], [if-none])
    96 # Check which objective C compiler we're using and branch accordingly.
    97 AC_DEFUN([AC_OBJC_VERSION], [
    98 AC_MSG_CHECKING([OBJC version])
    99 if test -n "$OBJC"; then
   100   _GOBJC_VERSION=`$OBJC --version | $SED -ne '/(GCC)/p'`
   101   if test -n "$_GOBJC_VERSION"; then
   102     AC_MSG_RESULT([GCC])
   103     [ $1 ]
   104   else 
   105     AC_MSG_RESULT([Unknown])
   106     [ $2 ]
   107   fi
   108 else
   109   AC_MSG_RESULT([None])
   110   [ $3 ]
   111 fi
   112 ]);
   114 # AC_HAVE_OBJC([if-present],[if-not-present])
   115 # Check if we have a working Objective-C compiler
   116 AC_DEFUN([AC_HAVE_OBJC], [
   117 AC_PROG_OBJC
   118 AC_MSG_CHECKING([for a working Objective-C compiler])
   119 AC_LANG_PUSH([Objective C])dnl
   120 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@interface Foo @end]], [])],
   121    [AC_MSG_RESULT([yes])
   122     $1 ],
   123    [AC_MSG_RESULT([No])
   124     $2 ]);
   125 AC_LANG_POP([Objective C])
   126 ]);
.