From 9882c7226e384d7f791c274288708f0f47783bfe Mon Sep 17 00:00:00 2001 From: drl7x Date: Thu, 10 Jan 2002 05:14:54 +0000 Subject: [PATCH] Put builtin -D flags for specific arcitectures. --- config.hin | 2 + configure | 27 +++++++------ configure.ac | 3 ++ src/cpplib.c | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 127 insertions(+), 11 deletions(-) diff --git a/config.hin b/config.hin index f2d96bc..f7a5d50 100644 --- a/config.hin +++ b/config.hin @@ -35,6 +35,8 @@ /* drl: can't get autoheader to work so I had to enter these manually. figure out autoheader at some point... */ +#undef UNAME + #undef BUILD #undef HOST #undef TARGET diff --git a/configure b/configure index 2433660..ea4f3bf 100755 --- a/configure +++ b/configure @@ -3108,6 +3108,11 @@ EOF #just define some Header constants for now... +UNAME=`uname` +cat >>confdefs.h <>confdefs.h <&5 +{ echo "$as_me:3257: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -3425,7 +3430,7 @@ cat >>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:3428: error: ambiguous option: $1 + { { echo "$as_me:3433: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} @@ -3444,7 +3449,7 @@ Try \`$0 --help' for more information." >&2;} ac_need_defaults=false;; # This is an error. - -*) { { echo "$as_me:3447: error: unrecognized option: $1 + -*) { { echo "$as_me:3452: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} @@ -3497,7 +3502,7 @@ do "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.hin" ;; - *) { { echo "$as_me:3500: error: invalid argument: $ac_config_target" >&5 + *) { { echo "$as_me:3505: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -3747,7 +3752,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:3750: creating $ac_file" >&5 + { echo "$as_me:3755: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -3765,7 +3770,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:3768: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:3773: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -3778,7 +3783,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:3781: error: cannot find input file: $f" >&5 + { { echo "$as_me:3786: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -3839,7 +3844,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue * ) ac_file_in=$ac_file.in ;; esac - test x"$ac_file" != x- && { echo "$as_me:3842: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:3847: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -3850,7 +3855,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:3853: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:3858: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -3863,7 +3868,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:3866: error: cannot find input file: $f" >&5 + { { echo "$as_me:3871: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -3980,7 +3985,7 @@ cat >>$CONFIG_STATUS <<\EOF rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then - { echo "$as_me:3983: $ac_file is unchanged" >&5 + { echo "$as_me:3988: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ diff --git a/configure.ac b/configure.ac index dd48d85..4385575 100644 --- a/configure.ac +++ b/configure.ac @@ -160,6 +160,9 @@ AC_DEFINE(UNIX, 1, [Define if you're on a Unixy system]) #just define some Header constants for now... +UNAME=`uname` +AC_DEFINE_UNQUOTED(UNAME, "${UNAME}") + AC_DEFINE_UNQUOTED(BUILD, "${build}") AC_DEFINE_UNQUOTED(HOST, "${host}") AC_DEFINE_UNQUOTED(TARGET, "${target}") diff --git a/src/cpplib.c b/src/cpplib.c index 33f656a..b8837a6 100644 --- a/src/cpplib.c +++ b/src/cpplib.c @@ -3708,6 +3708,112 @@ initialize_builtins (cppReader *pfile) */ cpplib_installBuiltin ("__" TARGET_CPU, ctype_int, -1, T_CONST, 2, NULL, -1); + /*drl 1/2/2002 set some flags based on uname + I'd like to be able to do this with autoconf macro instead... + */ + + /*Thanks to Nelson Beebe for suggesting possible values for these */ + + if (! strcmp (UNAME, "Linux")) + { +#ifdef __ppc + cpplib_installBuiltin ("__BIG_ENDIAN__", ctype_int, -1, T_CONST, 2, NULL, -1); +#endif + } + + else if(! strcmp (UNAME, "Darwin")) + { + cpplib_installBuiltin ("__ppc__", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__BIG_ENDIAN__", ctype_int, -1, T_CONST, 2, NULL, -1); + } + else if(! strcmp (UNAME, "HP-UX")) + { + cpplib_installBuiltin ("PWB", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("_HIUX_SOURCE", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("_HPUX_SOURCE", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("_PA_RISC1_1", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__PWB", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__PWB__", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__STDC_EXT__", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__hp9000s700", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__hp9000s800", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__hp9000s800__", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__hp9k8", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__hp9k8__", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__hppa", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__hppa__", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__hpux", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__hpux__", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__unix", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__unix__", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("hp9000s800", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("hp9k8", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("hppa", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("hpux", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("unix", ctype_int, -1, T_CONST, 2, NULL, -1); + } + else if(! strcmp (UNAME, "IRIX64")) + { + cpplib_installBuiltin ("LANGUAGE_C", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("MIPSEB", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("_ABIN32", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("_COMPILER_VERSION", ctype_int, -1, T_CONST, 730, NULL, -1); + cpplib_installBuiltin ("_LANGUAGE_C", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("_LONGLONG", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("_MIPSEB", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("_MIPS_FPSET", ctype_int, -1, T_CONST, 32, NULL, -1); + cpplib_installBuiltin ("_MIPS_ISA", ctype_int, -1, T_CONST, 3, NULL, -1); + /*_MIPS_SIM=_ABIN32*/ + cpplib_installBuiltin ("_MIPS_SIM", ctype_int, -1, T_CONST, 2, NULL , -1); + cpplib_installBuiltin ("_MIPS_SZINT", ctype_int, -1, T_CONST, 32, NULL, -1); + cpplib_installBuiltin ("_MIPS_SZLONG", ctype_int, -1, T_CONST, 32, NULL, -1); + cpplib_installBuiltin ("_MIPS_SZPTR", ctype_int, -1, T_CONST, 32, NULL, -1); + cpplib_installBuiltin ("_MODERN_C", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("_PIC", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("_SGI_SOURCE", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("_SIZE_INT", ctype_int, -1, T_CONST, 32, NULL, -1); + cpplib_installBuiltin ("_SIZE_LONG", ctype_int, -1, T_CONST, 32, NULL, -1); + cpplib_installBuiltin ("_SIZE_PTR", ctype_int, -1, T_CONST, 32, NULL, -1); + cpplib_installBuiltin ("_SVR4_SOURCE", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("_SYSTYPE_SVR4", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__DSO__", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__EXTENSIONS__", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__INLINE_INTRINSICS", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__MATH_HAS_NO_SIDE_EFFECTS", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__host_mips", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__mips", ctype_int, -1, T_CONST, 3, NULL, -1); + cpplib_installBuiltin ("__sgi", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__unix", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("host_mips", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("mips", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("sgi", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("unix", ctype_int, -1, T_CONST, 2, NULL, -1); + } + else if(! strcmp (UNAME, "OSF1")) + { + cpplib_installBuiltin ("__alpha", ctype_int, -1, T_CONST, 2, NULL, -1); + } + else if (!strcmp (UNAME, "Rhapsody")) + { + cpplib_installBuiltin ("__ppc__", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__BIG_ENDIAN__", ctype_int, -1, T_CONST, 2, NULL, -1); + } + + else if (!strcmp (UNAME, "SunOS")) + { + cpplib_installBuiltin ("__OPEN_MAX", ctype_int, -1, T_CONST, 20, NULL, -1); + cpplib_installBuiltin ("__STDC__", ctype_int, -1, T_CONST, 2, NULL, -1); + cpplib_installBuiltin ("__sparc", ctype_int, -1, T_CONST, 2, NULL, -1); + /* This define "-Dfileno(f)=0" should be inserted but we're going to stick to deinfe constants for now...*/ + } + else + { + /* + types which we have not explictedly handled. + AIX, FreeBSD, IRIX, Mach + */ + + } if (CPPOPTIONS (pfile)->debug_output) { -- 2.45.2