From 096e3b7bc63ca95b9caf6e39d6914b258b588ac7 Mon Sep 17 00:00:00 2001 From: michaelh Date: Sat, 8 Apr 2000 01:10:50 +0000 Subject: [PATCH 1/1] Merged changes between gbdk-293 and main git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@226 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- configure | 287 +++++++++++++++++++++++++++++---------------- configure.in | 29 +++++ sdccconf_in.h | 6 + src/SDCCast.c | 2 +- src/SDCChasht.c | 1 + src/SDCCmain.c | 24 +++- src/SDCCmem.c | 7 +- src/avr/main.c | 1 + src/mcs51/main.c | 1 + src/port.h | 3 + src/z80/main.c | 9 ++ src/z80/mappings.i | 98 ++++++++++++++++ 12 files changed, 357 insertions(+), 111 deletions(-) diff --git a/configure b/configure index 719e176a..a36c8996 100755 --- a/configure +++ b/configure @@ -11,6 +11,14 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: +ac_help="$ac_help +--disable-z80-port: Excludes the z80 port" +ac_help="$ac_help +--disable-gbz80-port: Excludes the Gameboy gbz80 port" +ac_help="$ac_help +--disable-mcs51-port: Excludes the Intel mcs51 port" +ac_help="$ac_help +--disable-avr-port: Excludes the AVR port" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -528,7 +536,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:532: checking for $ac_word" >&5 +echo "configure:540: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -559,7 +567,7 @@ done echo $ac_n "checking version of the package""... $ac_c" 1>&6 -echo "configure:563: checking version of the package" >&5 +echo "configure:571: checking version of the package" >&5 if test -f .version; then VERSION=`cat .version` elif test -f ../.version; then @@ -601,7 +609,7 @@ sdcc_cv_versionp=$VERSIONP # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:605: checking for $ac_word" >&5 +echo "configure:613: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -631,7 +639,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:635: checking for $ac_word" >&5 +echo "configure:643: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -682,7 +690,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:686: checking for $ac_word" >&5 +echo "configure:694: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -714,7 +722,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:718: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:726: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -725,12 +733,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 729 "configure" +#line 737 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -756,12 +764,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:760: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:768: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:765: checking whether we are using GNU C" >&5 +echo "configure:773: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -770,7 +778,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:774: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:782: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -789,7 +797,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:793: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:801: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -825,7 +833,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:829: checking for $ac_word" >&5 +echo "configure:837: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -857,7 +865,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:861: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:869: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -868,12 +876,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 872 "configure" +#line 880 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -899,12 +907,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:903: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:911: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:908: checking whether we are using GNU C++" >&5 +echo "configure:916: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -913,7 +921,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:917: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:925: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -932,7 +940,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:936: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:944: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -964,7 +972,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:968: checking how to run the C preprocessor" >&5 +echo "configure:976: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -979,13 +987,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:997: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -996,13 +1004,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1006: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1014: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1013,13 +1021,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1074,7 +1082,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1078: checking for a BSD compatible install" >&5 +echo "configure:1086: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1129,7 +1137,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1133: checking for $ac_word" >&5 +echo "configure:1141: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1161,7 +1169,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1165: checking for $ac_word" >&5 +echo "configure:1173: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1194,7 +1202,7 @@ test -n "$YACC" || YACC="yacc" # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1198: checking for $ac_word" >&5 +echo "configure:1206: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1228,7 +1236,7 @@ then *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:1232: checking for yywrap in -l$ac_lib" >&5 +echo "configure:1240: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1236,7 +1244,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1272,7 +1280,7 @@ fi # Extract the first word of "autoconf", so it can be a program name with args. set dummy autoconf; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1276: checking for $ac_word" >&5 +echo "configure:1284: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AUTOCONF'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1302,7 +1310,7 @@ fi # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1306: checking for $ac_word" >&5 +echo "configure:1314: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1332,7 +1340,7 @@ fi # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1336: checking for $ac_word" >&5 +echo "configure:1344: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1371,12 +1379,12 @@ cross_compiling=$ac_cv_prog_cc_cross # Checking for header files. # =========================================================================== echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1375: checking for ANSI C header files" >&5 +echo "configure:1383: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1384,7 +1392,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1388: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1396: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1401,7 +1409,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1419,7 +1427,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1440,7 +1448,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1451,7 +1459,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1478,17 +1486,17 @@ for ac_hdr in getopt.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1482: checking for $ac_hdr" >&5 +echo "configure:1490: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1500: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1518,17 +1526,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1522: checking for $ac_hdr" >&5 +echo "configure:1530: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1532: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1540: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1558,17 +1566,17 @@ for ac_hdr in endian.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1562: checking for $ac_hdr" >&5 +echo "configure:1570: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1572: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1580: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1598,17 +1606,17 @@ for ac_hdr in sys/isa_defs.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1602: checking for $ac_hdr" >&5 +echo "configure:1610: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1620: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1638,17 +1646,17 @@ for ac_hdr in sys/socket.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1642: checking for $ac_hdr" >&5 +echo "configure:1650: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1660: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1679,12 +1687,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1683: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1691: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -1692,7 +1700,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1696: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1717,7 +1725,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1721: checking for opendir in -ldir" >&5 +echo "configure:1729: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1725,7 +1733,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1758,7 +1766,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1762: checking for opendir in -lx" >&5 +echo "configure:1770: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1766,7 +1774,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1803,13 +1811,13 @@ fi # This must be after CPP echo $ac_n "checking which header file defines FD_ macros""... $ac_c" 1>&6 -echo "configure:1807: checking which header file defines FD_ macros" >&5 +echo "configure:1815: checking which header file defines FD_ macros" >&5 if eval "test \"`echo '$''{'s51_cv_fd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else sdcc_cv_fd="unknown" cat > conftest.$ac_ext < @@ -1825,7 +1833,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < @@ -1841,7 +1849,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < @@ -1921,12 +1929,12 @@ EOF for ac_func in strlen strcpy strcat strstr strcmp strerror strtok strdup do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1925: checking for $ac_func" >&5 +echo "configure:1933: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1976,12 +1984,12 @@ done for ac_func in strchr memcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1980: checking for $ac_func" >&5 +echo "configure:1988: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2031,12 +2039,12 @@ done for ac_func in fgets do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2035: checking for $ac_func" >&5 +echo "configure:2043: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2086,12 +2094,12 @@ done for ac_func in yylex do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2090: checking for $ac_func" >&5 +echo "configure:2098: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2142,14 +2150,14 @@ done # check if -lsocket && -lxnet is required to compile socket stuff echo $ac_n "checking for library containing socket""... $ac_c" 1>&6 -echo "configure:2146: checking for library containing socket" >&5 +echo "configure:2154: checking for library containing socket" >&5 if eval "test \"`echo '$''{'ac_cv_search_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_socket="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_socket="none required" else @@ -2171,7 +2179,7 @@ rm -f conftest* test "$ac_cv_search_socket" = "no" && for i in socket; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_socket="-l$i" break @@ -2204,14 +2212,14 @@ else : fi echo $ac_n "checking for library containing inet_addr""... $ac_c" 1>&6 -echo "configure:2208: checking for library containing inet_addr" >&5 +echo "configure:2216: checking for library containing inet_addr" >&5 if eval "test \"`echo '$''{'ac_cv_search_inet_addr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_inet_addr="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_inet_addr="none required" else @@ -2233,7 +2241,7 @@ rm -f conftest* test "$ac_cv_search_inet_addr" = "no" && for i in nsl xnet; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_inet_addr="-l$i" break @@ -2278,7 +2286,7 @@ fi # Checking characteristics of compilers and other programs # -------------------------------------------------------- echo $ac_n "checking whether preprocessor accepts -MM or -M""... $ac_c" 1>&6 -echo "configure:2282: checking whether preprocessor accepts -MM or -M" >&5 +echo "configure:2290: checking whether preprocessor accepts -MM or -M" >&5 if eval "test \"`echo '$''{'sdcc_cv_MM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2300,7 +2308,7 @@ M_OR_MM=$sdcc_cv_MM # This is the first time when CFLAGS are set/modified!! echo $ac_n "checking whether $CC accepts -ggdb""... $ac_c" 1>&6 -echo "configure:2304: checking whether $CC accepts -ggdb" >&5 +echo "configure:2312: checking whether $CC accepts -ggdb" >&5 if eval "test \"`echo '$''{'sdcc_cv_CCggdb'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2325,7 +2333,7 @@ fi echo $ac_n "checking whether $CC accepts -pipe""... $ac_c" 1>&6 -echo "configure:2329: checking whether $CC accepts -pipe" >&5 +echo "configure:2337: checking whether $CC accepts -pipe" >&5 if eval "test \"`echo '$''{'sdcc_cv_CCpipe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2352,12 +2360,12 @@ fi # Checks for typedefs, structures, and compiler characteristics. # =========================================================================== echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2356: checking return type of signal handlers" >&5 +echo "configure:2364: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2374,7 +2382,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2378: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2386: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2449,7 +2457,7 @@ EOF # mlh: dont compile libgc if it's available locally echo $ac_n "checking for GC_malloc in -lgc""... $ac_c" 1>&6 -echo "configure:2453: checking for GC_malloc in -lgc" >&5 +echo "configure:2461: checking for GC_malloc in -lgc" >&5 ac_lib_var=`echo gc'_'GC_malloc | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2457,7 +2465,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2490,6 +2498,79 @@ fi +# Now handle the port selection +# Check whether --enable-z80-port or --disable-z80-port was given. +if test "${enable_z80_port+set}" = set; then + enableval="$enable_z80_port" + : +fi + +if test "$enable_z80_port" = "no"; then + cat >> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <stack = SPEC_STAK(fetype) = stack; /* name needs to be mangled */ - sprintf (name->rname,"_%s",name->name); + sprintf (name->rname,"%s%s", port->fun_prefix, name->name); body = resolveSymbols(body); /* resolve the symbols */ body = decorateType (body); /* propagateType & do semantic checks */ diff --git a/src/SDCChasht.c b/src/SDCChasht.c index 1343a762..ce646461 100644 --- a/src/SDCChasht.c +++ b/src/SDCChasht.c @@ -26,6 +26,7 @@ #include #include #include +#include "SDCCglobl.h" #include "SDCChasht.h" #define DEFAULT_HTAB_SIZE 128 diff --git a/src/SDCCmain.c b/src/SDCCmain.c index c47d9109..28eebe72 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -128,18 +128,34 @@ static const char *_preCmd[] = { "-I" SDCC_INCLUDE_DIR, "$l", "$1", "$2", NULL }; +#if !OPT_DISABLE_MCS51 extern PORT mcs51_port; -extern PORT z80_port; +#endif +#if !OPT_DISABLE_GBZ80 extern PORT gbz80_port; +#endif +#if !OPT_DISABLE_Z80 +extern PORT z80_port; +#endif +#if !OPT_DISABLE_AVR extern PORT avr_port; +#endif PORT *port; static PORT *_ports[] = { - &mcs51_port, - &z80_port, +#if !OPT_DISABLE_MCS51 + &mcs51_port, +#endif +#if !OPT_DISABLE_GBZ80 &gbz80_port, - &avr_port +#endif +#if !OPT_DISABLE_Z80 + &z80_port, +#endif +#if !OPT_DISABLE_AVR + &avr_port, +#endif }; #define NUM_PORTS (sizeof(_ports)/sizeof(_ports[0])) diff --git a/src/SDCCmem.c b/src/SDCCmem.c index c7de4c64..a134a4d9 100644 --- a/src/SDCCmem.c +++ b/src/SDCCmem.c @@ -254,7 +254,7 @@ void allocIntoSeg (symbol *sym) void allocGlobal ( symbol *sym ) { /* symbol name is internal name */ - sprintf (sym->rname,"_%s",sym->name); + sprintf (sym->rname,"%s%s", port->fun_prefix, sym->name); /* add it to the operandKey reset */ addSet(&operKeyReset,sym); @@ -437,7 +437,7 @@ void allocParms ( value *val ) } else { /* allocate them in the automatic space */ /* generate a unique name */ - sprintf (lval->sym->rname,"_%s_PARM_%d",currFunc->name,pNum); + sprintf (lval->sym->rname,"%s%s_PARM_%d", port->fun_prefix, currFunc->name,pNum); strcpy (lval->name,lval->sym->rname); /* if declared in external storage */ @@ -508,7 +508,8 @@ void allocLocal ( symbol *sym ) { /* generate an unique name */ - sprintf(sym->rname,"_%s_%s_%d_%d", + sprintf(sym->rname,"%s%s_%s_%d_%d", + port->fun_prefix, currFunc->name,sym->name,sym->level,sym->block); sym->islocal = 1; diff --git a/src/avr/main.c b/src/avr/main.c index 0bdfbc55..9b8b8d3c 100644 --- a/src/avr/main.c +++ b/src/avr/main.c @@ -179,6 +179,7 @@ PORT avr_port = { { 1 }, + "_", _avr_init, _avr_parseOptions, _avr_finaliseOptions, diff --git a/src/mcs51/main.c b/src/mcs51/main.c index c77535c3..cab02da9 100644 --- a/src/mcs51/main.c +++ b/src/mcs51/main.c @@ -236,6 +236,7 @@ PORT mcs51_port = { { 1 }, + "_", _mcs51_init, _mcs51_parseOptions, _mcs51_finaliseOptions, diff --git a/src/port.h b/src/port.h index 2e5df533..e380441a 100644 --- a/src/port.h +++ b/src/port.h @@ -96,6 +96,9 @@ typedef struct { int native_below; } muldiv; + /** Prefix to add to a C function (eg "_") */ + const char *fun_prefix; + /** Called once the processor target has been selected. First chance to initalise and set any port specific varibles. 'port' is set before calling this. May be NULL. diff --git a/src/z80/main.c b/src/z80/main.c index e836d4aa..58d346d7 100644 --- a/src/z80/main.c +++ b/src/z80/main.c @@ -91,6 +91,13 @@ static bool _parseOptions(int *pargc, char **argv, int *i) _G.fsetAsmType = TRUE; return TRUE; } + else if (!strcmp(argv[*i], "--asm=isas")) { + asm_addTree(&_isas_gb); + /* Munge the function prefix */ + gbz80_port.fun_prefix = ""; + _G.fsetAsmType = TRUE; + return TRUE; + } } } return FALSE; @@ -205,6 +212,7 @@ PORT z80_port = { { 0 }, + "_", _z80_init, _parseOptions, _finaliseOptions, @@ -263,6 +271,7 @@ PORT gbz80_port = { { 0 }, + "_", _gbz80_init, _parseOptions, _finaliseOptions, diff --git a/src/z80/mappings.i b/src/z80/mappings.i index 649f7983..677e359c 100644 --- a/src/z80/mappings.i +++ b/src/z80/mappings.i @@ -1,4 +1,5 @@ static const ASM_MAPPING _asxxxx_gb_mapping[] = { + { "functionlabeldef", "%s:" }, { "*hl", "(hl)" }, { "di", "di" }, { "ldahli", "ld a,(hl+)" }, @@ -142,6 +143,103 @@ static const ASM_MAPPING _rgbds_gb_mapping[] = { { NULL, NULL } }; +static const ASM_MAPPING _isas_mapping[] = { + { "global", "GLOBAL %s" }, + { "labeldef", "%s:" }, + { "tlabeldef", "?l%05d:" }, + { "tlabel", "?l%05d" }, + { "fileprelude", + ";Generated using the isas tokens.\n" + "\tLPREFIX '?' ; Treat labels starting with ? as local.\n" + "\tONCNUM ; Numbers are hex\n" + "\tCAPSOFF ; Case sensitive\n" + "\tISDMG ; Gameboy mode\n" + "_CODE\tGROUP\n" + "\t; We have to define these here as sdcc dosnt make them global by default\n" + "\tGLOBAL __mulschar\n" + "\tGLOBAL __muluchar\n" + "\tGLOBAL __mulsint\n" + "\tGLOBAL __muluint\n" + "\tGLOBAL __divschar\n" + "\tGLOBAL __divuchar\n" + "\tGLOBAL __divsint\n" + "\tGLOBAL __divuint\n" + "\tGLOBAL __modschar\n" + "\tGLOBAL __moduchar\n" + "\tGLOBAL __modsint\n" + "\tGLOBAL __moduint" + }, + { "functionheader", + "; ---------------------------------\n" + "; Function %s\n" + "; ---------------------------------" + }, + { "functionlabeldef", "%s:" }, + { "zero", "$00" }, + { "one", "$01" }, + { "area", "%s\tGROUP" }, + { "areacode", "_CODE\tGROUP" }, + { "areadata", "_DATA\tGROUP" }, + { "ascii", "DB \"%s\"" }, + { "ds", "DS %d" }, + { "db", "DB %d" }, + { "dbs", "DB %s" }, + { "dw", "DW %d" }, + { "dws", "DW %s" }, + { "immed", "" }, + { "constbyte", "0x%02X" }, + { "constword", "0x%04X" }, + { "immedword", "0x%04X" }, + { "immedbyte", "0x%02X" }, + { "hashedstr", "%s" }, + { "lsbimmeds", "%s & 0xFF" }, + { "msbimmeds", "%s >> 8" }, + { "module", "; MODULE %s" }, + { NULL, NULL } +}; + +static const ASM_MAPPING _isas_gb_mapping[] = { + { "pusha", + "push af\n" + "\tpush bc\n" + "\tpush de\n" + "\tpush hl" + }, + { "di", "di" }, + { "adjustsp", "add sp,-%d" }, + { "enter", "push bc" }, + { "enterx", + "push bc\n" + "\tadd sp,-%d" + }, + { "leave", + "pop bc\n" + "\tret" + }, + { "leavex", + "add sp,%d\n" + "\tpop bc\n" + "\tret" + }, + { "ldahli", "ld a,(hli)" }, + { "*hl", "(hl)" }, + { "ldahlsp", "ldhl sp,%d" }, + { "ldaspsp", "add sp,%d" }, + { "*pair", "(%s)" }, + { "shortjp", "jr" }, + { NULL, NULL } +}; + +static const ASM_MAPPINGS _isas = { + NULL, + _isas_mapping +}; + +const ASM_MAPPINGS _isas_gb = { + &_isas, + _isas_gb_mapping +}; + static const ASM_MAPPINGS _rgbds = { NULL, _rgbds_mapping -- 2.30.2