1 #!/bin/bash 2 # zsh handles for-loop in braindead way 3 4 CCNAMES="CC c++ g++ g++2 g++3 g++-2.95 g++-3.0 g++-3.2 g++-3.3 \ 5 g++-3.4 gcc-4.0 gcc-4.1 gcc-4.2 gcc-4.3 gcc-4.4" 6 7 TESTCC=conftest.cc 8 TESTEXE=conftest 9 10 test1() 11 { 12 cat > $TESTCC <<'EOF' 13 #define __ENABLE_WSTRING 1 14 #include <string> 15 16 using namespace std; 17 18 int main(void) 19 { 20 wstring test; 21 test += (wchar_t)5; 22 return 0; 23 } 24 EOF 25 $1 -o $TESTEXE $TESTCC 26 } 27 28 test2() 29 { 30 cat > $TESTCC <<'EOF' 31 #include <string> 32 33 using namespace std; 34 35 int main(void) 36 { 37 basic_string<unsigned> test; 38 test += 5; 39 return 0; 40 } 41 EOF 42 $1 -o $TESTEXE $TESTCC 43 } 44 45 echo "Running tests for compilers" 46 for ccname in $CCNAMES 47 do 48 if which $ccname >/dev/null 2>/dev/null; then 49 printf "%10s " $ccname 50 c=0 51 eka=1 52 for test in test1 test2; do 53 cmd='' 54 if $test $ccname 2>/dev/null; then 55 cmd=' passes' 56 else 57 if [ $? = 127 ]; then 58 cmd=" doesn't exist" 59 test="" 60 else 61 cmd=' fails' 62 fi 63 fi 64 if [ "$c" = "$cmd" ]; then 65 if [ ! "$test" = "" ]; then 66 printf ' and' 67 fi 68 else 69 if [ "$eka" = 1 ]; then 70 eka=0 71 else 72 printf "," 73 fi 74 printf "$cmd" 75 c="$cmd" 76 fi 77 printf " $test" 78 done 79 if [ "$c" = 0 ]; then 80 printf ' fails all tests' 81 fi 82 printf "\\n" 83 fi 84 done 85 rm -f $TESTEXE $TESTCC 86 echo "--" 87 echo " Okay, I just tested your compilers." 88 echo " As it seems, various gcc versions handle wide-strings" 89 echo " in many various ways. This variety makes it difficult" 90 echo " to write wide-string-using programs portably." 91 echo " I wish you luck." 92 echo " If it fails, try changing the wchar_t/wstring definitions" 93 echo " near the beginning of htmlrecode.hh ." 94 echo "Type 'make'" 95