make this script suck less: - dont use known files in /tmp - dont use absolute paths to headers - dont hardcode gcc/cc - dont spit out warnings about incompat func types http://bugs.gentoo.org/146903 --- config/parse-types.sh +++ config/parse-types.sh @@ -1,27 +1,20 @@ #!/bin/sh -ASM_TYPES=/usr/include/asm/types.h - -if test ! -f $ASM_TYPES -then - echo "" > asm_types.h - echo "No asm_types file found" - exit 1 -fi - -cat > /tmp/sed.script << "EOF" +echo '#include ' | ${CPP-${CC-gcc} -E} - | sed \ +" /^#/d /^$/d s/__extension__ // s/typedef \(.*\) __u\([1-9]*\);/#define __U\2_TYPEDEF \1/ s/typedef \(.*\) __s\([1-9]*\);/#define __S\2_TYPEDEF \1/ -EOF - -gcc -E $ASM_TYPES | sed -f /tmp/sed.script | grep ^# > asm_types.h +" \ +| grep ^# > asm_types.h cp asm_types.h asm_types.c cat >> asm_types.c < +#include main(int argc, char **argv) { #ifdef __U8_TYPEDEF @@ -102,7 +95,7 @@ } EOF -cc -o asm_types asm_types.c +${BUILD_CC-gcc} -o asm_types asm_types.c if ! ./asm_types then echo "Problem detected with asm_types.h"