3 # Prex configuration script
6 [ ! -d conf
] && { echo "configure: must be run from the top source level"; exit 1; }
12 option
=`expr "x$1" : 'x\([^=]*\)='`
13 optarg
=`expr "x$1" : 'x[^=]*=\(.*\)'`
19 echo "configure: unrecognized option $1"
26 echo "Usage: configure [options]"
27 echo " General options:"
28 echo " --target=TARGET target system"
29 echo " --cross-compile=PREFIX prefix for cros-compile tools"
30 echo " --no-debug disable all debug code"
31 echo " Supported targets:"
32 echo " i386-pc i386-nommu arm-gba"
42 echo "configure: unrecognized option $1"
50 if [ "x$target" = x
] ; then
57 arch
=`expr "x$target" : 'x\([^=]*\)-'`
58 platform
=`expr "x$target" : 'x[^=]*-\(.*\)'`
63 if [ x
$cross = x
]; then
65 i386
) cross
="i386-elf-" ;;
66 arm
) cross
="arm-elf-" ;;
67 powerpc
) cross
="powerpc-eabi-" ;;
68 sh
) cross
="sh-elf-" ;;
69 mips
) cross
="mips-elf-" ;;
75 CONFIG_IN
=$srcdir/conf
/config.
$arch-$platform
76 CONFIG_MK
=$srcdir/conf
/config.mk
77 CONFIG_H
=$srcdir/conf
/config.h
79 [ ! -f $CONFIG_IN ] && { echo "configure: can not find conf/config.$arch-$platform"; exit 1; }
81 echo "Processing configuration file..."
84 echo "# Automatically generated from $CONFIG_IN." >> $CONFIG_MK
85 echo "# Don't edit!" >> $CONFIG_MK
86 echo "#" >> $CONFIG_MK
89 echo " * Automatically generated from $CONFIG_IN." >> $CONFIG_H
90 echo " * Don't edit!" >> $CONFIG_H
91 echo " */" >> $CONFIG_H
93 echo "PREX_SRC=$srcdir" >> $CONFIG_MK
94 echo "PREX_ARCH=$arch" >> $CONFIG_MK
95 echo "PREX_PLATFORM=$platform" >> $CONFIG_MK
96 [ "x$cross" != x
] && echo "CROSS_COMPILE=$cross" >> $CONFIG_MK
97 [ "x$nodebug" != x
] && echo "NDEBUG=1" >> $CONFIG_MK
103 word
=`expr "x$line" : 'x\(CONFIG_[A-Za-z0-9_=]*\)'`
104 param
=`expr "x$word" : 'x\([^=]*\)='`
105 value
=`expr "x$word" : 'x[^=]*=\([A-Za-z0-9]*\)'`
106 if [ -n "$param" ] ; then
108 echo "$word" >> $CONFIG_MK
109 if [ "$value" = "n" ] ; then
110 echo "#undef $param" >> $CONFIG_H
112 echo "#define $param $value" >> $CONFIG_H
117 if [ $default_target = 1 ]; then
119 echo "Warning: '--target' option was not specified."
120 echo "The target system was set to 'i386-pc' as default."