config.tests/unix/precomp.test
changeset 0 1918ee327afb
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 #!/bin/sh
       
     2 
       
     3 PRECOMP_SUPPORT=no
       
     4 COMPILER=$1
       
     5 VERBOSE=$2
       
     6 
       
     7 case "$COMPILER" in
       
     8 icpc)
       
     9     cat >header.h <<EOF
       
    10 #define HEADER_H
       
    11 
       
    12 EOF
       
    13     >header.cpp
       
    14     cat >source.cpp <<EOF
       
    15 #ifndef HEADER_H
       
    16 #error no go
       
    17 #endif
       
    18 
       
    19 EOF
       
    20 
       
    21     rm -f header.pchi
       
    22     $COMPILER -pch-create header.pchi -include header.h -c header.cpp -o header.o >/dev/null 2>&1 \
       
    23         && $COMPILER -pch-use header.pchi -include header.h -c source.cpp -o source.o >/dev/null 2>&1 \
       
    24         && PRECOMP_SUPPORT=yes
       
    25 
       
    26     rm -f header.h header.cpp source.cpp
       
    27     rm -f header.pchi header.o source.o
       
    28     ;;
       
    29 
       
    30 *g++*|c++)
       
    31     case `"$COMPILER" -dumpversion 2>/dev/null` in
       
    32     3.*)
       
    33         ;;
       
    34     *)
       
    35 
       
    36         >precomp_header.h
       
    37         if $COMPILER -x c-header precomp_header.h >/dev/null 2>&1; then
       
    38            $COMPILER -x c++-header precomp_header.h && PRECOMP_SUPPORT=yes
       
    39         fi
       
    40         rm -f precomp_header.h precomp_header.h.gch
       
    41         ;;
       
    42     esac
       
    43     ;;
       
    44 esac
       
    45 
       
    46 
       
    47 # done
       
    48 if [ "$PRECOMP_SUPPORT" != "yes" ]; then
       
    49     [ "$VERBOSE" = "yes" ] && echo "Precompiled-headers support disabled."
       
    50     exit 0
       
    51 else
       
    52     [ "$VERBOSE" = "yes" ] && echo "Precompiled-headers support enabled."
       
    53     exit 1
       
    54 fi