diff options
author | Michael Meissner <gnu@the-meissners.org> | 1995-11-30 11:13:08 +0000 |
---|---|---|
committer | Michael Meissner <gnu@the-meissners.org> | 1995-11-30 11:13:08 +0000 |
commit | 1f1e5dd85f05454abbad6847723ab6809de131c3 (patch) | |
tree | 3c3139694568aa48292a88f8901f26aa8c0501a6 /sim | |
parent | 9d5aef807526857c70081e0da47b45a5245c1f71 (diff) | |
download | gdb-1f1e5dd85f05454abbad6847723ab6809de131c3.zip gdb-1f1e5dd85f05454abbad6847723ab6809de131c3.tar.gz gdb-1f1e5dd85f05454abbad6847723ab6809de131c3.tar.bz2 |
Let autoconf determine if host is big endian or not
Diffstat (limited to 'sim')
-rw-r--r-- | sim/ppc/ChangeLog | 9 | ||||
-rwxr-xr-x | sim/ppc/configure | 387 | ||||
-rw-r--r-- | sim/ppc/configure.in | 3 | ||||
-rw-r--r-- | sim/ppc/sim-endian.h | 315 |
4 files changed, 630 insertions, 84 deletions
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index 0b6fa44..8c9eebb 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,11 +1,18 @@ Tue Nov 28 13:38:26 1995 Michael Meissner <meissner@tiktok.cygnus.com> + * sim-endian.h: Look at WORDS_BIGENDIAN to determine if the host + is big endian or little endian. For SWAP_n, use htonl/htons if + host is little endian, not big endian and if WITH_NTOH is defined. + * configure{,.in} (--enable-sim-model-issue): Instead of defining - 0/1, define it to be MODEL_ISSUE_{PROCESS,IGNORE}. + 0/1, define it to be MODEL_ISSUE_{PROCESS,IGNORE}. Add + AC_C_BIGENDIAN to determine if the host is big endian or not. + * config.in: Regenerate. * std-config.h (WITH_MODEL_ISSUE): Default to 0. (CURRENT_MODEL_ISSUE): Reference WITH_MODEL_ISSUE, and if that is 0, use current_model_issue. + (MODEL_ISSUE_{PROCESS,IGNORE}): Define as -1/1. * psim.c (current_model_issue): New global variable. diff --git a/sim/ppc/configure b/sim/ppc/configure index f172a5c..6bdb818 100755 --- a/sim/ppc/configure +++ b/sim/ppc/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.4 +# Generated automatically using autoconf version 2.7 # Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -87,9 +87,22 @@ target=NONE verbose= x_includes=NONE x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' # Initialize some other variables. subdirs= +MFLAGS= MAKEFLAGS= ac_prev= for ac_option @@ -111,9 +124,14 @@ do case "$ac_option" in - -build | --build | --buil | --bui | --bu | --b) + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*) + -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ @@ -123,6 +141,12 @@ do | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. @@ -173,12 +197,29 @@ Configuration: Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] - --exec-prefix=PREFIX install architecture-dependent files in PREFIX + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] @@ -190,8 +231,10 @@ Features and packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR ---enable and --with options recognized:$ac_help EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi exit 0 ;; -host | --host | --hos | --ho) @@ -199,6 +242,44 @@ EOF -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; @@ -211,6 +292,15 @@ EOF | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) @@ -251,6 +341,23 @@ EOF | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) @@ -261,6 +368,13 @@ EOF -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) @@ -270,7 +384,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.4" + echo "configure generated by autoconf version 2.7" exit 0 ;; -with-* | --with-*) @@ -316,7 +430,7 @@ EOF -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; - *) + *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi @@ -435,9 +549,12 @@ fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5' +ac_cpp='echo $CPP $CPPFLAGS 1>&5; +$CPP $CPPFLAGS' +ac_compile='echo ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5; +${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5' +ac_link='echo ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5; +${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5' if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. @@ -454,8 +571,8 @@ fi # Check whether --enable-sim-cflags or --disable-sim-cflags was given. -enableval="$enable_sim_cflags" -if test -n "$enableval"; then +if test "${enable_sim_cflags+set}" = set; then + enableval="$enable_sim_cflags" case "${enableval}" in yes) sim_cflags="-O2 -fomit-frame-pointer";; no) sim_cflags="";; @@ -469,8 +586,8 @@ else fi # Check whether --enable-sim-warnings or --disable-sim-warnings was given. -enableval="$enable_sim_warnings" -if test -n "$enableval"; then +if test "${enable_sim_warnings+set}" = set; then + enableval="$enable_sim_warnings" case "${enableval}" in yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes";; no) sim_warnings="-w";; @@ -484,8 +601,8 @@ else fi # Check whether --enable-sim-config or --disable-sim-config was given. -enableval="$enable_sim_config" -if test -n "$enableval"; then +if test "${enable_sim_config+set}" = set; then + enableval="$enable_sim_config" case "${enableval}" in yes|no) { echo "configure: error: "No value supplied for --enable-sim-config=file"" 1>&2; exit 1; };; *) if test -f "${srcdir}/${enableval}"; then @@ -508,8 +625,8 @@ fi fi # Check whether --enable-sim-opcode or --disable-sim-opcode was given. -enableval="$enable_sim_opcode" -if test -n "$enableval"; then +if test "${enable_sim_opcode+set}" = set; then + enableval="$enable_sim_opcode" case "${enableval}" in yes|no) { echo "configure: error: "No value supplied for --enable-sim-opcode=file"" 1>&2; exit 1; };; *) if test -f "${srcdir}/${enableval}"; then @@ -532,8 +649,8 @@ fi fi # Check whether --enable-sim-switch or --disable-sim-switch was given. -enableval="$enable_sim_switch" -if test -n "$enableval"; then +if test "${enable_sim_switch+set}" = set; then + enableval="$enable_sim_switch" case "${enableval}" in yes) sim_switch="-s";; no) sim_switch="";; @@ -550,8 +667,8 @@ fi fi # Check whether --enable-sim-duplicate or --disable-sim-duplicate was given. -enableval="$enable_sim_duplicate" -if test -n "$enableval"; then +if test "${enable_sim_duplicate+set}" = set; then + enableval="$enable_sim_duplicate" case "${enableval}" in yes) sim_dup="-e";; no) sim_dup="";; @@ -568,8 +685,8 @@ fi fi # Check whether --enable-sim-filter or --disable-sim-filter was given. -enableval="$enable_sim_filter" -if test -n "$enableval"; then +if test "${enable_sim_filter+set}" = set; then + enableval="$enable_sim_filter" case "${enableval}" in yes) { echo "configure: error: "--enable-sim-filter must be specified with a rule to filter or no"" 1>&2; exit 1; }; sim_filter="";; no) sim_filter="";; @@ -586,8 +703,8 @@ fi fi # Check whether --enable-sim-icache or --disable-sim-icache was given. -enableval="$enable_sim_icache" -if test -n "$enableval"; then +if test "${enable_sim_icache+set}" = set; then + enableval="$enable_sim_icache" icache="" case "${enableval}" in yes) sim_icache="-r 1024"; icache="1024";; @@ -606,8 +723,8 @@ fi fi # Check whether --enable-sim-inline or --disable-sim-inline was given. -enableval="$enable_sim_inline" -if test -n "$enableval"; then +if test "${enable_sim_inline+set}" = set; then + enableval="$enable_sim_inline" sim_inline="" case "$enableval" in no) sim_inline="-DDEFAULT_INLINE=0 -DINLINE=";; @@ -644,8 +761,8 @@ fi fi # Check whether --enable-sim-bswap or --disable-sim-bswap was given. -enableval="$enable_sim_bswap" -if test -n "$enableval"; then +if test "${enable_sim_bswap+set}" = set; then + enableval="$enable_sim_bswap" case "${enableval}" in yes) sim_bswap="-DWITH_BSWAP=1";; no) sim_bswap="-DWITH_BSWAP=0";; @@ -659,8 +776,8 @@ else fi # Check whether --enable-sim-endian or --disable-sim-endian was given. -enableval="$enable_sim_endian" -if test -n "$enableval"; then +if test "${enable_sim_endian+set}" = set; then + enableval="$enable_sim_endian" case "${enableval}" in yes) case "$target" in *powerpc-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";; @@ -680,8 +797,8 @@ else fi # Check whether --enable-sim-hostendian or --disable-sim-hostendian was given. -enableval="$enable_sim_hostendian" -if test -n "$enableval"; then +if test "${enable_sim_hostendian+set}" = set; then + enableval="$enable_sim_hostendian" case "${enableval}" in no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";; b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";; @@ -696,8 +813,8 @@ else fi # Check whether --enable-sim-smp or --disable-sim-smp was given. -enableval="$enable_sim_smp" -if test -n "$enableval"; then +if test "${enable_sim_smp+set}" = set; then + enableval="$enable_sim_smp" case "${enableval}" in yes) sim_smp="-DWITH_SMP=5";; no) sim_smp="-DWITH_SMP=0";; @@ -714,8 +831,8 @@ fi fi # Check whether --enable-sim-xor-endian or --disable-sim-xor-endian was given. -enableval="$enable_sim_xor_endian" -if test -n "$enableval"; then +if test "${enable_sim_xor_endian+set}" = set; then + enableval="$enable_sim_xor_endian" case "${enableval}" in yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";; no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";; @@ -726,8 +843,8 @@ else fi # Check whether --enable-sim-bitsize or --disable-sim-bitsize was given. -enableval="$enable_sim_bitsize" -if test -n "$enableval"; then +if test "${enable_sim_bitsize+set}" = set; then + enableval="$enable_sim_bitsize" case "${enableval}" in 32|64) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=$enableval";; *) { echo "configure: error: "--enable-sim-bitsize was given $enableval" 1>&2; exit 1; }; sim_bitsize="";; @@ -740,8 +857,8 @@ else fi # Check whether --enable-sim-hostbitsize or --disable-sim-hostbitsize was given. -enableval="$enable_sim_hostbitsize" -if test -n "$enableval"; then +if test "${enable_sim_hostbitsize+set}" = set; then + enableval="$enable_sim_hostbitsize" case "${enableval}" in 32|64) sim_hostbitsize="-DWITH_HOST_WORD_BITSIZE=$enableval";; *) { echo "configure: error: "--enable-sim-hostbitsize was given $enableval" 1>&2; exit 1; }; sim_hostbitsize="";; @@ -754,8 +871,8 @@ else fi # Check whether --enable-sim-env or --disable-sim-env was given. -enableval="$enable_sim_env" -if test -n "$enableval"; then +if test "${enable_sim_env+set}" = set; then + enableval="$enable_sim_env" case "${enableval}" in operating | os | oea) sim_env="-DWITH_ENVIRONMENT=OPERATING_ENVIRONMENT";; virtual | vea) sim_env="-DWITH_ENVIRONMENT=VIRTUAL_ENVIRONMENT";; @@ -771,8 +888,8 @@ else fi # Check whether --enable-sim-timebase or --disable-sim-timebase was given. -enableval="$enable_sim_timebase" -if test -n "$enableval"; then +if test "${enable_sim_timebase+set}" = set; then + enableval="$enable_sim_timebase" case "${enableval}" in yes) sim_timebase="-DWITH_TIME_BASE=1";; no) sim_timebase="-DWITH_TIME_BASE=0";; @@ -786,8 +903,8 @@ else fi # Check whether --enable-sim-alignment or --disable-sim-alignment was given. -enableval="$enable_sim_alignment" -if test -n "$enableval"; then +if test "${enable_sim_alignment+set}" = set; then + enableval="$enable_sim_alignment" case "${enableval}" in yes | strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";; no | nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";; @@ -801,8 +918,8 @@ else fi # Check whether --enable-sim-trace or --disable-sim-trace was given. -enableval="$enable_sim_trace" -if test -n "$enableval"; then +if test "${enable_sim_trace+set}" = set; then + enableval="$enable_sim_trace" case "${enableval}" in yes) sim_trace="-DWITH_TRACE=1";; no) sim_trace="-DWITH_TRACE=0";; @@ -816,8 +933,8 @@ else fi # Check whether --enable-sim-assert or --disable-sim-assert was given. -enableval="$enable_sim_assert" -if test -n "$enableval"; then +if test "${enable_sim_assert+set}" = set; then + enableval="$enable_sim_assert" case "${enableval}" in yes) sim_assert="-DWITH_ASSERT=1";; no) sim_assert="-DWITH_ASSERT=0";; @@ -831,8 +948,8 @@ else fi # Check whether --enable-sim-reserved-bits or --disable-sim-reserved-bits was given. -enableval="$enable_sim_reserved_bits" -if test -n "$enableval"; then +if test "${enable_sim_reserved_bits+set}" = set; then + enableval="$enable_sim_reserved_bits" case "${enableval}" in yes) sim_reserved="-DWITH_RESERVED_BITS=1";; no) sim_reserved="-DWITH_RESERVED_BITS=0";; @@ -846,8 +963,8 @@ else fi # Check whether --enable-sim-float or --disable-sim-float was given. -enableval="$enable_sim_float" -if test -n "$enableval"; then +if test "${enable_sim_float+set}" = set; then + enableval="$enable_sim_float" case "${enableval}" in yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";; no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";; @@ -861,8 +978,8 @@ else fi # Check whether --enable-sim-monitor or --disable-sim-monitor was given. -enableval="$enable_sim_monitor" -if test -n "$enableval"; then +if test "${enable_sim_monitor+set}" = set; then + enableval="$enable_sim_monitor" case "${enableval}" in yes) sim_mon="-DWITH_MON='MONITOR_INSTRUCTION_ISSUE | MONITOR_LOAD_STORE_UNIT'";; no) sim_mon="-DWITH_MON=0";; @@ -878,8 +995,8 @@ else fi # Check whether --enable-sim-model or --disable-sim-model was given. -enableval="$enable_sim_model" -if test -n "$enableval"; then +if test "${enable_sim_model+set}" = set; then + enableval="$enable_sim_model" case "${enableval}" in yes|no) { echo "configure: error: "No value supplied for --enable-sim-model=model"" 1>&2; exit 1; };; *) sim_model="-DWITH_MODEL=${enableval}";; @@ -892,8 +1009,8 @@ else fi # Check whether --enable-sim-default-model or --disable-sim-default-model was given. -enableval="$enable_sim_default_model" -if test -n "$enableval"; then +if test "${enable_sim_default_model+set}" = set; then + enableval="$enable_sim_default_model" case "${enableval}" in yes|no) { echo "configure: error: "No value supplied for --enable-sim-default-model=model"" 1>&2; exit 1; };; *) sim_default_model="-DWITH_DEFAULT_MODEL=${enableval}";; @@ -906,8 +1023,8 @@ else fi # Check whether --enable-sim-model-issue or --disable-sim-model-issue was given. -enableval="$enable_sim_model_issue" -if test -n "$enableval"; then +if test "${enable_sim_model_issue+set}" = set; then + enableval="$enable_sim_model_issue" case "${enableval}" in yes) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_PROCESS";; no) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_IGNORE";; @@ -946,7 +1063,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # # The rules are: # 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. +# same time. # 2. Host defaults to nonopt. # 3. If nonopt is not specified, then host defaults to the current host, # as determined by config.guess. @@ -1028,8 +1145,10 @@ test "$host_alias" != "$target_alias" && if test "$program_transform_name" = s,x,x,; then program_transform_name= else - # Double any \ or $. - echo 's,\\,\\\\,g; s,\$,$$,g' > conftestsed + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED program_transform_name="`echo $program_transform_name|sed -f conftestsed`" rm -f conftestsed fi @@ -1091,6 +1210,7 @@ else ac_cv_prog_gcc=no fi fi + echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes @@ -1108,7 +1228,8 @@ fi rm -f conftest* fi - echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 + +echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 if test $ac_cv_prog_gcc_g = yes; then CFLAGS="-g -O" else @@ -1187,13 +1308,13 @@ 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 <<EOF -#line 1191 "configure" +#line 1312 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ -char $ac_func(); +char $ac_func(); int main() { return 0; } int t() { @@ -1221,7 +1342,7 @@ rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'` + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <<EOF #define $ac_tr_func 1 EOF @@ -1242,7 +1363,7 @@ else ac_cv_c_cross=yes else cat > conftest.$ac_ext <<EOF -#line 1246 "configure" +#line 1367 "configure" #include "confdefs.h" main(){return(0);} EOF @@ -1255,14 +1376,100 @@ fi fi rm -fr conftest* fi -cross_compiling=$ac_cv_c_cross + echo "$ac_t""$ac_cv_c_cross" 1>&6 +cross_compiling=$ac_cv_c_cross if test "x$cross_compiling" = "xno"; then CC_FOR_BUILD='$(CC)' else CC_FOR_BUILD=gcc fi +echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_bigendian=unknown +# See if sys/param.h defines the BYTE_ORDER macro. +cat > conftest.$ac_ext <<EOF +#line 1396 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/param.h> +int main() { return 0; } +int t() { + +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + # It does; now see whether it defined to BIG_ENDIAN or not. +cat > conftest.$ac_ext <<EOF +#line 1412 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/param.h> +int main() { return 0; } +int t() { + +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + ac_cv_c_bigendian=yes +else + rm -rf conftest* + ac_cv_c_bigendian=no +fi +rm -f conftest* + +fi +rm -f conftest* + +if test $ac_cv_c_bigendian = unknown; then +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else +cat > conftest.$ac_ext <<EOF +#line 1441 "configure" +#include "confdefs.h" +main () { + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +EOF +eval $ac_link +if test -s conftest && (./conftest; exit) 2>/dev/null; then + ac_cv_c_bigendian=no +else + ac_cv_c_bigendian=yes +fi +fi +rm -fr conftest* +fi +fi + +echo "$ac_t""$ac_cv_c_bigendian" 1>&6 +if test $ac_cv_c_bigendian = yes; then + cat >> confdefs.h <<\EOF +#define WORDS_BIGENDIAN 1 +EOF + +fi + + echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 @@ -1280,7 +1487,7 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 1284 "configure" +#line 1491 "configure" #include "confdefs.h" #include <assert.h> Syntax Error @@ -1294,7 +1501,7 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1298 "configure" +#line 1505 "configure" #include "confdefs.h" #include <assert.h> Syntax Error @@ -1327,7 +1534,7 @@ 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 -#line 1331 "configure" +#line 1538 "configure" #include "confdefs.h" #include <$ac_hdr> EOF @@ -1345,7 +1552,7 @@ rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'` + ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` cat >> confdefs.h <<EOF #define $ac_tr_hdr 1 EOF @@ -1432,7 +1639,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.4" + echo "$CONFIG_STATUS generated by autoconf version 2.7" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -1443,10 +1650,12 @@ done ac_given_srcdir=$srcdir trap 'rm -fr `echo "Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@CFLAGS@%$CFLAGS%g @@ -1458,6 +1667,18 @@ s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g s%@host@%$host%g s%@host_alias@%$host_alias%g s%@host_cpu@%$host_cpu%g @@ -1599,7 +1820,7 @@ EOF # Transform confdefs.h into a sed script conftest.vals that substitutes # the proper values into config.h.in to produce config.h. And first: -# Protect against being on the right side of a sed subst in config.status. +# Protect against being on the right side of a sed subst in config.status. # Protect against being in an unquoted here document in config.status. rm -f conftest.vals cat > conftest.hdr <<\EOF diff --git a/sim/ppc/configure.in b/sim/ppc/configure.in index a8382ce..9b8bd1c 100644 --- a/sim/ppc/configure.in +++ b/sim/ppc/configure.in @@ -414,6 +414,9 @@ else fi AC_SUBST(CC_FOR_BUILD) +AC_C_BIGENDIAN +AC_SUBST(WORDS_BIGENDIAN) + AC_CHECK_HEADERS(string.h strings.h stdlib.h time.h sys/types.h sys/time.h sys/times.h unistd.h sys/resource.h) AC_OUTPUT(Makefile, diff --git a/sim/ppc/sim-endian.h b/sim/ppc/sim-endian.h new file mode 100644 index 0000000..c19691a --- /dev/null +++ b/sim/ppc/sim-endian.h @@ -0,0 +1,315 @@ +/* This file is part of the program psim. + + Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + + +#ifndef _SIM_ENDIAN_H_ +#define _SIM_ENDIAN_H_ + +#ifndef INLINE_SIM_ENDIAN +#define INLINE_SIM_ENDIAN +#endif + + +/* C byte conversion functions */ + +INLINE_SIM_ENDIAN unsigned_1 endian_h2t_1(unsigned_1 x); +INLINE_SIM_ENDIAN unsigned_2 endian_h2t_2(unsigned_2 x); +INLINE_SIM_ENDIAN unsigned_4 endian_h2t_4(unsigned_4 x); +INLINE_SIM_ENDIAN unsigned_8 endian_h2t_8(unsigned_8 x); + +INLINE_SIM_ENDIAN unsigned_1 endian_t2h_1(unsigned_1 x); +INLINE_SIM_ENDIAN unsigned_2 endian_t2h_2(unsigned_2 x); +INLINE_SIM_ENDIAN unsigned_4 endian_t2h_4(unsigned_4 x); +INLINE_SIM_ENDIAN unsigned_8 endian_t2h_8(unsigned_8 x); + +INLINE_SIM_ENDIAN unsigned_1 swap_1(unsigned_1 x); +INLINE_SIM_ENDIAN unsigned_2 swap_2(unsigned_2 x); +INLINE_SIM_ENDIAN unsigned_4 swap_4(unsigned_4 x); +INLINE_SIM_ENDIAN unsigned_8 swap_8(unsigned_8 x); + + +/* Host dependant: + + The CPP below defines information about the compilation host. In + particular it defines the macro's: + + WITH_HOST_BYTE_ORDER The byte order of the host. Could + be any of LITTLE_ENDIAN, BIG_ENDIAN + or 0 (unknown). Those macro's also + need to be defined. + + WITH_NTOH Network byte order macros defined. + Possible value is 32 or (maybe one + day 64 because some 64bit network + byte order macro is defined. + */ + + +/* NetBSD: + + NetBSD is easy, everything you could ever want is in a header file + (well almost :-) */ + +#if defined(__NetBSD__) +# include <machine/endian.h> +# define WITH_NTOH 32 /* what about alpha? */ +# if (WITH_HOST_BYTE_ORDER == 0) +# undef WITH_HOST_BYTE_ORDER +# define WITH_HOST_BYTE_ORDER BYTE_ORDER +# endif +# if (BYTE_ORDER != WITH_HOST_BYTE_ORDER) +# error "host endian incorrectly configured, check config.h" +# endif +#endif + +/* Linux is similarly easy. */ + +#if defined(__linux__) +# include <endian.h> +# include <asm/byteorder.h> +# if defined(__LITTLE_ENDIAN) && !defined(LITTLE_ENDIAN) +# define LITTLE_ENDIAN __LITTLE_ENDIAN +# endif +# if defined(__BIG_ENDIAN) && !defined(BIG_ENDIAN) +# define BIG_ENDIAN __BIG_ENDIAN +# endif +# if defined(__BYTE_ORDER) && !defined(BYTE_ORDER) +# define BYTE_ORDER __BYTE_ORDER +# endif +# if !defined(__alpha__) +# define WITH_NTOH 32 /* what about alpha? */ +# endif +# if (WITH_HOST_BYTE_ORDER == 0) +# undef WITH_HOST_BYTE_ORDER +# define WITH_HOST_BYTE_ORDER BYTE_ORDER +# endif +# if (BYTE_ORDER != WITH_HOST_BYTE_ORDER) +# error "host endian incorrectly configured, check config.h" +# endif +#endif + +/* INSERT HERE - hosts that have available LITTLE_ENDIAN and + BIG_ENDIAN macro's */ + + +/* Some hosts don't define LITTLE_ENDIAN or BIG_ENDIAN, help them out */ + +#ifndef LITTLE_ENDIAN +#define LITTLE_ENDIAN 1234 +#endif +#ifndef BIG_ENDIAN +#define BIG_ENDIAN 4321 +#endif + + +/* SunOS on SPARC: + + Big endian last time I looked */ + +#if defined(sparc) || defined(__sparc__) +# if (WITH_HOST_BYTE_ORDER == 0) +# undef WITH_HOST_BYTE_ORDER +# define WITH_HOST_BYTE_ORDER BIG_ENDIAN +# endif +# if (WITH_HOST_BYTE_ORDER != BIG_ENDIAN) +# error "sun was big endian last time I looked ..." +# endif +#endif + + +/* Random x86 + + Little endian last time I looked */ + +#if defined(i386) || defined(i486) || defined(i586) || defined(__i386__) || defined(__i486__) || defined(__i586__) +# if (WITH_HOST_BYTE_ORDER == 0) +# undef WITH_HOST_BYTE_ORDER +# define WITH_HOST_BYTE_ORDER LITTLE_ENDIAN +# endif +# if (WITH_HOST_BYTE_ORDER != LITTLE_ENDIAN) +# error "x86 was little endian last time I looked ..." +# endif +#endif + +#if (defined (__i486__) || defined (__i586__)) && defined(__GNUC__) && WITH_BSWAP && WITH_NTOH +#undef htonl +#undef ntohl +#define htonl(IN) __extension__ ({ int _out; __asm__ ("bswap %0" : "=r" (_out) : "0" (IN)); _out; }) +#define ntohl(IN) __extension__ ({ int _out; __asm__ ("bswap %0" : "=r" (_out) : "0" (IN)); _out; }) +#endif + + +/* Configure defines WORDS_BIGENDIAN if the host is big endian. */ + +#if (WITH_HOST_BYTE_ORDER == 0) +# undef WITH_HOST_BYTE_ORDER +# ifdef WORDS_BIGENDIAN +# define WITH_HOST_BYTE_ORDER BIG_ENDIAN +# else +# define WITH_HOST_BYTE_ORDER LITTLE_ENDIAN +# endif +#endif + +/* SWAP: + + Some times a swap must always be performed, select the most + effecient method to swap a collection of bytes. + + HOST BE sw + HOST LE sw/ntoh + HOST ?? sw + + */ + +#if (WITH_HOST_BYTE_ORDER \ + && WITH_NTOH \ + && WITH_HOST_BYTE_ORDER == LITTLE_ENDIAN) +#define SWAP_1(X) (X) +#define SWAP_2(X) ntohs(X) +#define SWAP_4(X) ntohl(X) +#define SWAP_8(X) swap_8(X) +#else +#define SWAP_1(X) (X) +#define SWAP_2(X) swap_2(X) +#define SWAP_4(X) swap_4(X) +#define SWAP_8(X) swap_8(X) +#endif + + +/* CONVERSION: + + Convert between host and target byte orders by the most efficient + method known (if needed at all) + + TARG BE TARG LE TARG ?? + HOST BE ok swap swap + HOST LE htohl ok ok|ntohl + HOST ?? ntohl swap swap + + */ + + +/* FUNCTIONS: + + Returns the value swapped according to the host/target byte order */ + +/* no need to swap */ +#if (WITH_HOST_BYTE_ORDER \ + && WITH_TARGET_BYTE_ORDER \ + && WITH_HOST_BYTE_ORDER == WITH_TARGET_BYTE_ORDER ) +#define H2T_1(X) (X) +#define H2T_2(X) (X) +#define H2T_4(X) (X) +#define H2T_8(X) (X) +#define T2H_1(X) (X) +#define T2H_2(X) (X) +#define T2H_4(X) (X) +#define T2H_8(X) (X) +#endif + +/* have ntoh and big endian target */ +#if (WITH_TARGET_BYTE_ORDER == BIG_ENDIAN \ + && WITH_HOST_BYTE_ORDER != BIG_ENDIAN \ + && WITH_NTOH) +#define H2T_8(X) endian_h2t_8(X) +#define H2T_4(X) htonl(X) +#define H2T_2(X) htons(X) +#define H2T_1(X) (X) +#define T2H_8(X) endian_t2h_8(X) +#define T2H_4(X) htonl(X) +#define T2H_2(X) htons(X) +#define T2H_1(X) (X) +#endif + +/* have ntoh, little host and unknown target */ +#if (WITH_HOST_BYTE_ORDER == LITTLE_ENDIAN \ + && WITH_TARGET_BYTE_ORDER == 0 \ + && WITH_NTOH) +#define H2T_8(X) (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER \ + ? (X) : endian_h2t_8(X)) +#define H2T_4(X) (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER \ + ? (X) : htonl(X)) +#define H2T_2(X) (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER \ + ? (X) : htons(X)) +#define H2T_1(X) (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER \ + ? (X) : (X)) +#define T2H_8(X) (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER \ + ? (X) : endian_t2h_8(X)) +#define T2H_4(X) (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER \ + ? (X) : htonl(X)) +#define T2H_2(X) (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER \ + ? (X) : htons(X)) +#define T2H_1(X) (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER \ + ? (X) : (X)) +#endif + +/* if all else fails use software */ +#ifndef H2T_1 +#define H2T_1(X) (X) +#define H2T_2(X) endian_h2t_2(X) +#define H2T_4(X) endian_h2t_4(X) +#define H2T_8(X) endian_h2t_8(X) +#define T2H_1(X) (X) +#define T2H_2(X) endian_t2h_2(X) +#define T2H_4(X) endian_t2h_4(X) +#define T2H_8(X) endian_t2h_8(X) +#endif + + +/* CONVERT IN PLACE: + + These macros, given an argument of unknown size, swap its value in + place if a host/target conversion is required. */ + +#define H2T(VARIABLE) \ +do { \ + switch (sizeof(VARIABLE)) { \ + case 1: VARIABLE = H2T_1(VARIABLE); break; \ + case 2: VARIABLE = H2T_2(VARIABLE); break; \ + case 4: VARIABLE = H2T_4(VARIABLE); break; \ + case 8: VARIABLE = H2T_8(VARIABLE); break; \ + } \ +} while (0) + +#define T2H(VARIABLE) \ +do { \ + switch (sizeof(VARIABLE)) { \ + case 1: VARIABLE = T2H_1(VARIABLE); break; \ + case 2: VARIABLE = T2H_2(VARIABLE); break; \ + case 4: VARIABLE = T2H_4(VARIABLE); break; \ + case 8: VARIABLE = T2H_8(VARIABLE); break; \ + } \ +} while (0) + + +/* TARGET WORD: + + Byte swap a quantity the size of the targets word */ + +#if (WITH_TARGET_WORD_BITSIZE == 64) +#define H2T_word(X) H2T_8(X) +#define T2H_word(X) T2H_8(X) +#endif +#if (WITH_TARGET_WORD_BITSIZE == 32) +#define H2T_word(X) H2T_4(X) +#define T2H_word(X) T2H_4(X) +#endif + +#endif /* _SIM_ENDIAN_H_ */ |