Changeset 1180

Show
Ignore:
Timestamp:
05/18/08 10:08:54 (16 years ago)
Author:
arnonym
Message:

Looks as if the old checks for gcc/g++ don't work reliably. Try a new one...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/SConstruct

    r1179 r1180  
    150150        return ret 
    151151 
     152def CompilerCheck( context ): 
     153        context.Message( "Checking for a working C-compiler " ) 
     154        ret = context.TryLink( """ 
     155#include <stdlib.h> 
     156 
     157int main() { 
     158        printf( "Hello World!" ); 
     159        return 0; 
     160}""", '.c' ) 
     161        context.Result( ret ) 
     162        if ret == 0: 
     163                return False; 
     164        context.Message( "Checking for a working C++-compiler " ) 
     165        ret = context.TryLink( """ 
     166#include <iostream> 
     167 
     168int main() { 
     169        std::cout << "Hello World!" << std::endl; 
     170        return 0; 
     171}""", ".cpp" ) 
     172        context.Result( ret ) 
     173        return ret 
     174 
    152175tests = { 
    153176        "ConfigGuess" : ConfigGuess, 
    154177        "CheckForApp" : CheckForApp, 
    155178        "CheckForPyModule": CheckForPyModule, 
     179        "CompilerCheck" : CompilerCheck, 
    156180} 
    157181tests.update( env['PKGCONFIG_TESTS'] ) 
     
    169193 
    170194if not env.GetOption('clean'): 
     195#       # 
     196#       # Check if the environment can actually compile c-files by checking for a 
     197#       # header shipped with gcc. 
     198#       # 
     199#       if not conf.CheckHeader( "stdio.h", language="C" ): 
     200#               print "It seems as if stdio.h is missing. This probably means that your build environment is broken, please make sure you have a working c-compiler and libstdc installed and usable." 
     201#               Exit( 1 ) 
     202#       # 
     203#       # ... and do the same with a c++-header. Because some distributions have 
     204#       # distinct packages for gcc and g++. 
     205#       # 
     206#       if not conf.CheckHeader( "iostream", language="C++" ): 
     207#               print "It seems as if iostream is missing. This probably means that your build environment is broken, please make sure you have a working c++-compiler installed and usable." 
     208#               Exit( 1 ) 
     209 
    171210        # 
    172         # Check if the environment can actually compile c-files by checking for a 
    173         # header shipped with gcc. 
     211        # Seems as if the above tests don't really work. This one should do the trick!? 
    174212        # 
    175         if not conf.CheckHeader( "stdio.h", language="C" ): 
    176                 print "It seems as if stdio.h is missing. This probably means that your build environment is broken, please make sure you have a working c-compiler and libstdc installed and usable." 
    177                 Exit( 1 ) 
    178         # 
    179         # ... and do the same with a c++-header. Because some distributions have 
    180         # distinct packages for gcc and g++. 
    181         # 
    182         if not conf.CheckHeader( "iostream", language="C++" ): 
    183                 print "It seems as if iostream is missing. This probably means that your build environment is broken, please make sure you have a working c++-compiler installed and usable." 
     213        if not conf.CompilerCheck(): 
     214                print "It seems as if your system isn't even able to compile any C-/C++-programs. Probably you don't have gcc and g++ installed. Compiling a package from source without a working compiler is very hard to do, please install the needed packages (Hint: on *ubuntu you need both gcc- and g++-packages installed)." 
    184215                Exit( 1 ) 
    185216