From 430456e34753ac705a047c886eb4f73cf2906dfc Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 15 Jun 2021 20:20:11 -0400 Subject: [PATCH] sim: ppc: drop host endian configure option The --enable-sim-hostendian flag was purely so people had an escape route for when cross-compiling. This is because historically, AC_C_BIGENDIAN did not work in those cases. That was fixed a while ago though, so we can require that macro everywhere now and simplify a good bit of code. This was done for all the other ports years ago, so catch ppc up. --- sim/ppc/ChangeLog | 20 + sim/ppc/Makefile.in | 2 - sim/ppc/altivec_registers.h | 2 +- sim/ppc/config.in | 15 - sim/ppc/configure | 1698 +++++++++++++++-------------------- sim/ppc/configure.ac | 24 - sim/ppc/options.c | 2 +- sim/ppc/psim.c | 13 +- sim/ppc/sim-endian-n.h | 12 +- sim/ppc/sim-endian.c | 4 +- sim/ppc/sim-endian.h | 175 ---- sim/ppc/std-config.h | 17 +- 12 files changed, 765 insertions(+), 1219 deletions(-) diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index e2232a59d21..469d76bf203 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,23 @@ +2021-06-16 Mike Frysinger + + * Makefile.in (HOSTENDIAN_CFLAGS): Delete. + * configure.ac: Delete sim-hostendian logic. + * altivec_registers.h (WITH_HOST_BYTE_ORDER): Rename to ... + (HOST_BYTE_ORDER): ... this. + * options.c: Likewise. + * sim-endian.c: Likewise. + * psim.c (current_host_byte_order): Delete. + (CURRENT_HOST_BYTE_ORDER): Rename to ... + (HOST_BYTE_ORDER): ... this. + * sim-endian-n.h: Likewise. + * sim-endian.h: Delete all custom endian include & define logic. + * std-config.h (WITH_HOST_BYTE_ORDER): Delete. + (LITTLE_ENDIAN): Define fallback. + (BIG_ENDIAN): Likewise. + (HOST_BYTE_ORDER): Define based on WORDS_BIGENDIAN. + (current_host_byte_order, CURRENT_HOST_BYTE_ORDER): Delete. + * config.in, configure: Regenerate. + 2021-06-13 Mike Frysinger * Makefile.in (COMMON_OBJS_NAMES, +COMMON_OBJS): New variables. diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in index 0814a34fbc3..c1135a3a7b0 100644 --- a/sim/ppc/Makefile.in +++ b/sim/ppc/Makefile.in @@ -73,7 +73,6 @@ RANLIB = @RANLIB@ INLINE_CFLAGS = @sim_inline@ ENDIAN_CFLAGS = @sim_endian@ -HOSTENDIAN_CFLAGS = @sim_hostendian@ SMP_CFLAGS = @sim_smp@ XOR_ENDIAN_CFLAGS = @sim_xor_endian@ BITSIZE_CFLAGS = @sim_bitsize@ @@ -88,7 +87,6 @@ WARNING_CFLAGS = @sim_warnings@ DEVZERO_CFLAGS = @sim_devzero@ CONFIG_CFLAGS = \ $(ENDIAN_CFLAGS) \ - $(HOSTENDIAN_CFLAGS) \ $(SMP_CFLAGS) \ $(XOR_ENDIAN_CFLAGS) \ $(BITSIZE_CFLAGS) \ diff --git a/sim/ppc/altivec_registers.h b/sim/ppc/altivec_registers.h index 14c27cdb819..2c0bff07843 100644 --- a/sim/ppc/altivec_registers.h +++ b/sim/ppc/altivec_registers.h @@ -49,7 +49,7 @@ struct altivec_regs { work on N independant bits of data. This is only for the instructions that actually move data around. */ -#if (WITH_HOST_BYTE_ORDER == BIG_ENDIAN) +#if (HOST_BYTE_ORDER == BIG_ENDIAN) #define AV_BINDEX(x) ((x) & 15) #define AV_HINDEX(x) ((x) & 7) #else diff --git a/sim/ppc/config.in b/sim/ppc/config.in index 7b75892909d..c6182ae0e86 100644 --- a/sim/ppc/config.in +++ b/sim/ppc/config.in @@ -1,8 +1,5 @@ /* config.in. Generated from configure.ac by autoheader. */ -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS @@ -77,15 +74,3 @@ /* Sim assert settings */ #undef WITH_ASSERT - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif diff --git a/sim/ppc/configure b/sim/ppc/configure index c7dd1b4876c..65fe1846d63 100755 --- a/sim/ppc/configure +++ b/sim/ppc/configure @@ -638,7 +638,6 @@ sim_hostbitsize sim_bitsize sim_igen_smp sim_smp -sim_hostendian sim_xor_endian sim_endian sim_inline @@ -660,6 +659,9 @@ RANLIB AR CFLAGS_FOR_BUILD CC_FOR_BUILD +EGREP +GREP +CPP zlibinc zlibdir target_os @@ -675,9 +677,6 @@ build_vendor build_cpu build WERROR_CFLAGS -EGREP -GREP -CPP CATOBJEXT GENCAT INSTOBJEXT @@ -752,7 +751,6 @@ enable_sim_filter enable_sim_float enable_sim_hardware enable_sim_hostbitsize -enable_sim_hostendian enable_sim_icache enable_sim_inline enable_sim_jump @@ -1409,7 +1407,6 @@ Optional Features: --enable-sim-float Specify whether the target has hard, soft, altivec or e500 floating point. --enable-sim-hardware=list Specify the hardware to be included in the build. --enable-sim-hostbitsize=32|64 Specify host bitsize (32 or 64). - --enable-sim-hostendian=end Specify host byte endian orientation. --enable-sim-icache=size Specify instruction-decode cache size and type. --enable-sim-inline=inlines Specify which functions should be inlined. --enable-sim-jump Jump between semantic code (instead of call/return). @@ -1603,6 +1600,37 @@ fi } # ac_fn_c_try_run +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. @@ -1640,37 +1668,6 @@ fi } # ac_fn_c_try_cpp -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. @@ -3502,1109 +3499,860 @@ else fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= +# Check whether --enable-sim-icache was given. +if test "${enable_sim_icache+set}" = set; then : + enableval=$enable_sim_icache; icache="-R" + case "${enableval}" in + yes) icache="1024"; sim_icache="-I $icache";; + no) sim_icache="-R";; + *) icache=1024 + sim_icache="-" + for x in `echo "${enableval}" | sed -e "s/,/ /g"`; do + case "$x" in + define) sim_icache="${sim_icache}R";; + semantic) sim_icache="${sim_icache}C";; + insn) sim_icache="${sim_icache}S";; + 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) icache=$x;; + *) as_fn_error $? "\"Unknown value $x for --enable-sim-icache\"" "$LINENO" 5; sim_icache="";; + esac + done + sim_icache="${sim_icache}I $icache";; +esac +if test x"$silent" != x"yes" && test x"$icache" != x""; then + echo "Setting instruction cache size to $icache ($sim_icache)" fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : + sim_icache="-CSRI 1024" +if test x"$silent" != x"yes"; then + echo "Setting instruction cache size to 1024 ($sim_icache)" +fi +fi + +# Check whether --enable-sim-inline was given. +if test "${enable_sim_inline+set}" = set; then : + enableval=$enable_sim_inline; sim_inline="" +case "$enableval" in + no) sim_inline="-DDEFAULT_INLINE=0";; + 0) sim_inline="-DDEFAULT_INLINE=0";; + yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";; + 1) sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS";; + *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do + new_flag="" + case "$x" in + *_INLINE=*) new_flag="-D$x";; + *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;; + *_INLINE) new_flag="-D$x=ALL_INLINE";; + *) new_flag="-D$x""_INLINE=ALL_INLINE";; + esac + if test x"$sim_inline" = x""; then + sim_inline="$new_flag" + else + sim_inline="$sim_inline $new_flag" + fi + done;; +esac +if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then + echo "Setting inline flags = $sim_inline" 6>&1 +fi else - # Broken: fails on valid input. -continue + if test x"$GCC" != ""; then + sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS" + if test x"$silent" != x"yes"; then + echo "Setting inline flags = $sim_inline" 6>&1 + fi +else + sim_inline="" +fi fi -rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue + +# Check whether --enable-sim-jump was given. +if test "${enable_sim_jump+set}" = set; then : + enableval=$enable_sim_jump; case "${enableval}" in + yes) sim_jump="-J";; + no) sim_jump="";; + *) as_fn_error $? "\"--enable-sim-jump does not take a value\"" "$LINENO" 5; sim_jump="";; +esac +if test x"$silent" != x"yes" && test x"$sim_jump" != x""; then + echo "Setting jump flag = $sim_jump" 6>&1 +fi else - # Passes both tests. -ac_preproc_ok=: -break + sim_jump="" +if test x"$silent" != x"yes"; then + echo "Setting jump flag = $sim_jump" 6>&1 fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break fi - done - ac_cv_prog_CPP=$CPP +# Check whether --enable-sim-line-nr was given. +if test "${enable_sim_line_nr+set}" = set; then : + enableval=$enable_sim_line_nr; case "${enableval}" in + yes) sim_line_nr="";; + no) sim_line_nr="-L";; + *) as_fn_error $? "\"--enable-sim-line-nr does not take a value\"" "$LINENO" 5; sim_line_nr="";; +esac +if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then + echo "Setting warning flags = $sim_line_nr" 6>&1 fi - CPP=$ac_cv_prog_CPP else - ac_cv_prog_CPP=$CPP + sim_line_nr="" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : + +# Check whether --enable-sim-model was given. +if test "${enable_sim_model+set}" = set; then : + enableval=$enable_sim_model; case "${enableval}" in + yes|no) as_fn_error $? "\"No value supplied for --enable-sim-model=model\"" "$LINENO" 5;; + *) sim_model="-DWITH_MODEL=${enableval}";; +esac +if test x"$silent" != x"yes" && test x"$sim_model" != x""; then + echo "Setting model flags = $sim_model" 6>&1 +fi else - # Broken: fails on valid input. -continue + sim_model="" fi -rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue + +# Check whether --enable-sim-model-issue was given. +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";; + *) as_fn_error $? "\"--enable-sim-model-issue does not take a value\"" "$LINENO" 5; sim_model_issue="";; +esac +if test x"$silent" != x"yes"; then + echo "Setting model-issue flags = $sim_model_issue" 6>&1 +fi else - # Passes both tests. -ac_preproc_ok=: -break + sim_model_issue="" fi -rm -f conftest.err conftest.i conftest.$ac_ext -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +# Check whether --enable-sim-monitor was given. +if test "${enable_sim_monitor+set}" = set; then : + enableval=$enable_sim_monitor; case "${enableval}" in + yes) sim_monitor="-DWITH_MON='MONITOR_INSTRUCTION_ISSUE | MONITOR_LOAD_STORE_UNIT'";; + no) sim_monitor="-DWITH_MON=0";; + instruction) sim_monitor="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";; + memory) sim_monitor="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";; + *) as_fn_error $? "\"Unknown value $enableval passed to --enable-sim-mon\"" "$LINENO" 5;; +esac +if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then + echo "Setting monitor flags = $sim_monitor" 6>&1 +fi else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } + sim_monitor="" fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +# Check whether --enable-sim-opcode was given. +if test "${enable_sim_opcode+set}" = set; then : + enableval=$enable_sim_opcode; case "${enableval}" in + yes|no) as_fn_error $? "\"No value supplied for --enable-sim-opcode=file\"" "$LINENO" 5;; + *) if test -f "${srcdir}/${enableval}"; then + sim_opcode="${enableval}" + elif test -f "${srcdir}/dc-${enableval}"; then + sim_opcode="dc-${enableval}" + else + as_fn_error $? "\"File $enableval is not an opcode rules file\"" "$LINENO" 5; + sim_opcode="dc-complex" + fi;; esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi +if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then + echo "Setting opcode flags = $sim_opcode" 6>&1 +fi else - ac_cv_path_GREP=$GREP + sim_opcode="dc-complex" +if test x"$silent" != x"yes"; then + echo "Setting opcode flags = $sim_opcode" fi - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +# Check whether --enable-sim-packages was given. +if test "${enable_sim_packages+set}" = set; then : + enableval=$enable_sim_packages; packages=disklabel +case "${enableval}" in + yes) ;; + no) as_fn_error $? "\"List of packages must be specified for --enable-sim-packages\"" "$LINENO" 5; packages="";; + ,*) packages="${packages}${enableval}";; + *,) packages="${enableval}${packages}";; + *) packages="${enableval}"'';; esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi +sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'` +sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'` +if test x"$silent" != x"yes" && test x"$packages" != x""; then + echo "Setting packages to $sim_pk_src, $sim_pk_obj" +fi else - ac_cv_path_EGREP=$EGREP + packages=disklabel +sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'` +sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'` +if test x"$silent" != x"yes"; then + echo "Setting packages to $sim_pk_src, $sim_pk_obj" fi - - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 +# Check whether --enable-sim-reserved-bits was given. +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";; + *) as_fn_error $? "\"--enable-sim-reserved-bits does not take a value\"" "$LINENO" 5; sim_reserved="";; +esac +if test x"$silent" != x"yes" && test x"$sim_reserved" != x""; then + echo "Setting reserved flags = $sim_reserved" 6>&1 +fi else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include + sim_reserved="" +fi -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes +# Check whether --enable-sim-smp was given. +if test "${enable_sim_smp+set}" = set; then : + enableval=$enable_sim_smp; case "${enableval}" in + yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";; + no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";; + *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";; +esac +if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then + echo "Setting smp flags = $sim_smp" 6>&1 +fi else - ac_cv_header_stdc=no + sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5" +if test x"$silent" != x"yes"; then + echo "Setting smp flags = $sim_smp" 6>&1 +fi fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : +# Check whether --enable-sim-switch was given. +if test "${enable_sim_switch+set}" = set; then : + enableval=$enable_sim_switch; case "${enableval}" in + yes) sim_switch="-s";; + no) sim_switch="";; + *) as_fn_error $? "\"--enable-sim-switch does not take a value\"" "$LINENO" 5; sim_switch="";; +esac +if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then + echo "Setting switch flags = $sim_switch" 6>&1 +fi else - ac_cv_header_stdc=no + sim_switch=""; +if test x"$silent" != x"yes"; then + echo "Setting switch flags = $sim_switch" 6>&1 fi -rm -f conftest* - fi -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* +# Check whether --enable-sim-timebase was given. +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";; + *) as_fn_error $? "\"--enable-sim-timebase does not take a value\"" "$LINENO" 5; sim_timebase="";; +esac +if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then + echo "Setting timebase flags = $sim_timebase" 6>&1 fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif + sim_timebase="" +fi -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +# Check whether --enable-werror was given. +if test "${enable_werror+set}" = set; then : + enableval=$enable_werror; case "${enableval}" in + yes | y) ERROR_ON_WARNING="yes" ;; + no | n) ERROR_ON_WARNING="no" ;; + *) as_fn_error $? "bad value ${enableval} for --enable-werror" "$LINENO" 5 ;; + esac fi +# Enable -Werror by default when using gcc +if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then + ERROR_ON_WARNING=yes fi +WERROR_CFLAGS="" +if test "${ERROR_ON_WARNING}" = yes ; then + WERROR_CFLAGS="-Werror" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then +case "${host}" in + *-*-mingw32*) WERROR_CFLAGS="$WERROR_CFLAGS -Wno-format" ;; +esac -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +# Check whether --enable-sim-warnings was given. +if test "${enable_sim_warnings+set}" = set; then : + enableval=$enable_sim_warnings; case "${enableval}" in + yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";; + no) sim_warnings="-w";; + *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; +esac +if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then + echo "Setting warning flags = $sim_warnings" 6>&1 fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - +else + sim_warnings="" fi -done - -# Check whether --enable-sim-hostendian was given. -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";; - l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";; - *) as_fn_error $? "\"Unknown value $enableval for --enable-sim-hostendian\"" "$LINENO" 5; sim_hostendian="";; +# Check whether --enable-sim-xor-endian was given. +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";; + *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";; esac -if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then - echo "Setting hostendian flags = $sim_hostendian" 6>&1 +if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then + echo "Setting xor-endian flag = $sim_xor_endian" 6>&1 fi else + sim_xor_endian="" +fi -if test "x$cross_compiling" = "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else - ac_cv_c_bigendian=unknown - # See if we're dealing with a universal compiler. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - # Check for potential -arch flags. It is not universal unless - # there are at least two -arch flags with different values. - ac_arch= - ac_prev= - for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do - if test -n "$ac_prev"; then - case $ac_word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then - ac_arch=$ac_word - else - ac_cv_c_bigendian=universal - break - fi - ;; - esac - ac_prev= - elif test "x$ac_word" = "x-arch"; then - ac_prev=arch - fi - done fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ac_cv_c_bigendian = unknown; then - # See if sys/param.h defines the BYTE_ORDER macro. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ - && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ - && LITTLE_ENDIAN) - bogus endian macros - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) - bogus endian macros - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to _BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -int -main () -{ -#ifndef _BIG_ENDIAN - not big endian - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +$as_echo_n "checking target system type... " >&6; } +if ${ac_cv_target+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # Compile a test program. - if test "$cross_compiling" = yes; then : - # Try to guess by grepping values from an object file. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -short int ascii_mm[] = - { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = - { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; - int use_ascii (int i) { - return ascii_mm[i] + ascii_ii[i]; - } - short int ebcdic_ii[] = - { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = - { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; - int use_ebcdic (int i) { - return ebcdic_mm[i] + ebcdic_ii[i]; - } - extern int foo; -int -main () -{ -return use_ascii (foo) == use_ebcdic (foo); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then - ac_cv_c_bigendian=yes - fi - if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi - fi fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +$as_echo "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_bigendian=no -else - ac_cv_c_bigendian=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } - case $ac_cv_c_bigendian in #( - yes) - $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h -;; #( - no) - ;; #( - universal) +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h - ;; #( - *) - as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; - esac +# BFD conditionally uses zlib, so we must link it in if libbfd does, by +# using the same condition. - if test $ac_cv_c_bigendian = yes; then - sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN" - else - sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN" + # Use the system's zlib library. + zlibdir="-L\$(top_builddir)/../zlib" + zlibinc="-I\$(top_srcdir)/../zlib" + +# Check whether --with-system-zlib was given. +if test "${with_system_zlib+set}" = set; then : + withval=$with_system_zlib; if test x$with_system_zlib = xyes ; then + zlibdir= + zlibinc= fi -else - sim_hostendian="-DWITH_HOST_BYTE_ORDER=0" -fi + fi -# Check whether --enable-sim-icache was given. -if test "${enable_sim_icache+set}" = set; then : - enableval=$enable_sim_icache; icache="-R" - case "${enableval}" in - yes) icache="1024"; sim_icache="-I $icache";; - no) sim_icache="-R";; - *) icache=1024 - sim_icache="-" - for x in `echo "${enableval}" | sed -e "s/,/ /g"`; do - case "$x" in - define) sim_icache="${sim_icache}R";; - semantic) sim_icache="${sim_icache}C";; - insn) sim_icache="${sim_icache}S";; - 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) icache=$x;; - *) as_fn_error $? "\"Unknown value $x for --enable-sim-icache\"" "$LINENO" 5; sim_icache="";; - esac - done - sim_icache="${sim_icache}I $icache";; -esac -if test x"$silent" != x"yes" && test x"$icache" != x""; then - echo "Setting instruction cache size to $icache ($sim_icache)" -fi -else - sim_icache="-CSRI 1024" -if test x"$silent" != x"yes"; then - echo "Setting instruction cache size to 1024 ($sim_icache)" -fi -fi -# Check whether --enable-sim-inline was given. -if test "${enable_sim_inline+set}" = set; then : - enableval=$enable_sim_inline; sim_inline="" -case "$enableval" in - no) sim_inline="-DDEFAULT_INLINE=0";; - 0) sim_inline="-DDEFAULT_INLINE=0";; - yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";; - 1) sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS";; - *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do - new_flag="" - case "$x" in - *_INLINE=*) new_flag="-D$x";; - *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;; - *_INLINE) new_flag="-D$x=ALL_INLINE";; - *) new_flag="-D$x""_INLINE=ALL_INLINE";; - esac - if test x"$sim_inline" = x""; then - sim_inline="$new_flag" - else - sim_inline="$sim_inline $new_flag" - fi - done;; -esac -if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then - echo "Setting inline flags = $sim_inline" 6>&1 + +# BFD uses libdl when when plugins enabled. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 else - if test x"$GCC" != ""; then - sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS" - if test x"$silent" != x"yes"; then - echo "Setting inline flags = $sim_inline" 6>&1 - fi + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + else - sim_inline="" -fi + # Broken: fails on valid input. +continue fi +rm -f conftest.err conftest.i conftest.$ac_ext - -# Check whether --enable-sim-jump was given. -if test "${enable_sim_jump+set}" = set; then : - enableval=$enable_sim_jump; case "${enableval}" in - yes) sim_jump="-J";; - no) sim_jump="";; - *) as_fn_error $? "\"--enable-sim-jump does not take a value\"" "$LINENO" 5; sim_jump="";; -esac -if test x"$silent" != x"yes" && test x"$sim_jump" != x""; then - echo "Setting jump flag = $sim_jump" 6>&1 -fi + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue else - sim_jump="" -if test x"$silent" != x"yes"; then - echo "Setting jump flag = $sim_jump" 6>&1 -fi + # Passes both tests. +ac_preproc_ok=: +break fi +rm -f conftest.err conftest.i conftest.$ac_ext - -# Check whether --enable-sim-line-nr was given. -if test "${enable_sim_line_nr+set}" = set; then : - enableval=$enable_sim_line_nr; case "${enableval}" in - yes) sim_line_nr="";; - no) sim_line_nr="-L";; - *) as_fn_error $? "\"--enable-sim-line-nr does not take a value\"" "$LINENO" 5; sim_line_nr="";; -esac -if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then - echo "Setting warning flags = $sim_line_nr" 6>&1 -fi -else - sim_line_nr="" +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break fi + done + ac_cv_prog_CPP=$CPP -# Check whether --enable-sim-model was given. -if test "${enable_sim_model+set}" = set; then : - enableval=$enable_sim_model; case "${enableval}" in - yes|no) as_fn_error $? "\"No value supplied for --enable-sim-model=model\"" "$LINENO" 5;; - *) sim_model="-DWITH_MODEL=${enableval}";; -esac -if test x"$silent" != x"yes" && test x"$sim_model" != x""; then - echo "Setting model flags = $sim_model" 6>&1 fi + CPP=$ac_cv_prog_CPP else - sim_model="" + ac_cv_prog_CPP=$CPP fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : - -# Check whether --enable-sim-model-issue was given. -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";; - *) as_fn_error $? "\"--enable-sim-model-issue does not take a value\"" "$LINENO" 5; sim_model_issue="";; -esac -if test x"$silent" != x"yes"; then - echo "Setting model-issue flags = $sim_model_issue" 6>&1 -fi -else - sim_model_issue="" -fi - - -# Check whether --enable-sim-monitor was given. -if test "${enable_sim_monitor+set}" = set; then : - enableval=$enable_sim_monitor; case "${enableval}" in - yes) sim_monitor="-DWITH_MON='MONITOR_INSTRUCTION_ISSUE | MONITOR_LOAD_STORE_UNIT'";; - no) sim_monitor="-DWITH_MON=0";; - instruction) sim_monitor="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";; - memory) sim_monitor="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";; - *) as_fn_error $? "\"Unknown value $enableval passed to --enable-sim-mon\"" "$LINENO" 5;; -esac -if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then - echo "Setting monitor flags = $sim_monitor" 6>&1 -fi else - sim_monitor="" + # Broken: fails on valid input. +continue fi +rm -f conftest.err conftest.i conftest.$ac_ext - -# Check whether --enable-sim-opcode was given. -if test "${enable_sim_opcode+set}" = set; then : - enableval=$enable_sim_opcode; case "${enableval}" in - yes|no) as_fn_error $? "\"No value supplied for --enable-sim-opcode=file\"" "$LINENO" 5;; - *) if test -f "${srcdir}/${enableval}"; then - sim_opcode="${enableval}" - elif test -f "${srcdir}/dc-${enableval}"; then - sim_opcode="dc-${enableval}" - else - as_fn_error $? "\"File $enableval is not an opcode rules file\"" "$LINENO" 5; - sim_opcode="dc-complex" - fi;; -esac -if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then - echo "Setting opcode flags = $sim_opcode" 6>&1 -fi + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue else - sim_opcode="dc-complex" -if test x"$silent" != x"yes"; then - echo "Setting opcode flags = $sim_opcode" -fi + # Passes both tests. +ac_preproc_ok=: +break fi +rm -f conftest.err conftest.i conftest.$ac_ext +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : -# Check whether --enable-sim-packages was given. -if test "${enable_sim_packages+set}" = set; then : - enableval=$enable_sim_packages; packages=disklabel -case "${enableval}" in - yes) ;; - no) as_fn_error $? "\"List of packages must be specified for --enable-sim-packages\"" "$LINENO" 5; packages="";; - ,*) packages="${packages}${enableval}";; - *,) packages="${enableval}${packages}";; - *) packages="${enableval}"'';; -esac -sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'` -sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'` -if test x"$silent" != x"yes" && test x"$packages" != x""; then - echo "Setting packages to $sim_pk_src, $sim_pk_obj" -fi else - packages=disklabel -sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'` -sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'` -if test x"$silent" != x"yes"; then - echo "Setting packages to $sim_pk_src, $sim_pk_obj" -fi + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi - -# Check whether --enable-sim-reserved-bits was given. -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";; - *) as_fn_error $? "\"--enable-sim-reserved-bits does not take a value\"" "$LINENO" 5; sim_reserved="";; -esac -if test x"$silent" != x"yes" && test x"$sim_reserved" != x""; then - echo "Setting reserved flags = $sim_reserved" 6>&1 -fi -else - sim_reserved="" -fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -# Check whether --enable-sim-smp was given. -if test "${enable_sim_smp+set}" = set; then : - enableval=$enable_sim_smp; case "${enableval}" in - yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";; - no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";; - *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";; -esac -if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then - echo "Setting smp flags = $sim_smp" 6>&1 -fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 else - sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5" -if test x"$silent" != x"yes"; then - echo "Setting smp flags = $sim_smp" 6>&1 -fi -fi - - -# Check whether --enable-sim-switch was given. -if test "${enable_sim_switch+set}" = set; then : - enableval=$enable_sim_switch; case "${enableval}" in - yes) sim_switch="-s";; - no) sim_switch="";; - *) as_fn_error $? "\"--enable-sim-switch does not take a value\"" "$LINENO" 5; sim_switch="";; + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac -if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then - echo "Setting switch flags = $sim_switch" 6>&1 -fi -else - sim_switch=""; -if test x"$silent" != x"yes"; then - echo "Setting switch flags = $sim_switch" 6>&1 -fi -fi - -# Check whether --enable-sim-timebase was given. -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";; - *) as_fn_error $? "\"--enable-sim-timebase does not take a value\"" "$LINENO" 5; sim_timebase="";; -esac -if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then - echo "Setting timebase flags = $sim_timebase" 6>&1 -fi + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else - sim_timebase="" + ac_cv_path_GREP=$GREP fi - -# Check whether --enable-werror was given. -if test "${enable_werror+set}" = set; then : - enableval=$enable_werror; case "${enableval}" in - yes | y) ERROR_ON_WARNING="yes" ;; - no | n) ERROR_ON_WARNING="no" ;; - *) as_fn_error $? "bad value ${enableval} for --enable-werror" "$LINENO" 5 ;; - esac fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" -# Enable -Werror by default when using gcc -if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then - ERROR_ON_WARNING=yes -fi -WERROR_CFLAGS="" -if test "${ERROR_ON_WARNING}" = yes ; then - WERROR_CFLAGS="-Werror" -fi -case "${host}" in - *-*-mingw32*) WERROR_CFLAGS="$WERROR_CFLAGS -Wno-format" ;; + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac - -# Check whether --enable-sim-warnings was given. -if test "${enable_sim_warnings+set}" = set; then : - enableval=$enable_sim_warnings; case "${enableval}" in - yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";; - no) sim_warnings="-w";; - *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; -esac -if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then - echo "Setting warning flags = $sim_warnings" 6>&1 -fi + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else - sim_warnings="" + ac_cv_path_EGREP=$EGREP fi - -# Check whether --enable-sim-xor-endian was given. -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";; - *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";; -esac -if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then - echo "Setting xor-endian flag = $sim_xor_endian" 6>&1 -fi -else - sim_xor_endian="" + fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + ac_cv_header_stdc=no fi +rm -f conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -$as_echo_n "checking target system type... " >&6; } -if ${ac_cv_target+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 + ac_cv_header_stdc=no fi +rm -f conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -$as_echo "$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : -# BFD conditionally uses zlib, so we must link it in if libbfd does, by -# using the same condition. +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - # Use the system's zlib library. - zlibdir="-L\$(top_builddir)/../zlib" - zlibinc="-I\$(top_srcdir)/../zlib" +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then -# Check whether --with-system-zlib was given. -if test "${with_system_zlib+set}" = set; then : - withval=$with_system_zlib; if test x$with_system_zlib = xyes ; then - zlibdir= - zlibinc= - fi +$as_echo "#define STDC_HEADERS 1" >>confdefs.h fi +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF +fi +done -# BFD uses libdl when when plugins enabled. maybe_plugins=no for ac_header in dlfcn.h @@ -5157,7 +4905,6 @@ fi - ac_config_files="$ac_config_files Makefile" @@ -5274,7 +5021,6 @@ LTLIBOBJS=$ac_ltlibobjs - : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac index 3b93beefbfe..188330fa5c7 100644 --- a/sim/ppc/configure.ac +++ b/sim/ppc/configure.ac @@ -287,29 +287,6 @@ if test x"$silent" != x"yes" && test x"$sim_hostbitsize" != x""; then fi],[sim_hostbitsize=""])dnl -AC_ARG_ENABLE(sim-hostendian, -[ --enable-sim-hostendian=end Specify host byte endian orientation.], -[case "${enableval}" in - no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";; - b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";; - l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";; - *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";; -esac -if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then - echo "Setting hostendian flags = $sim_hostendian" 6>&1 -fi],[ -if test "x$cross_compiling" = "xno"; then - AC_C_BIGENDIAN - if test $ac_cv_c_bigendian = yes; then - sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN" - else - sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN" - fi -else - sim_hostendian="-DWITH_HOST_BYTE_ORDER=0" -fi])dnl - - AC_ARG_ENABLE(sim-icache, [ --enable-sim-icache=size Specify instruction-decode cache size and type.], [icache="-R" @@ -799,7 +776,6 @@ AC_SUBST(sim_pk_obj) AC_SUBST(sim_inline) AC_SUBST(sim_endian) AC_SUBST(sim_xor_endian) -AC_SUBST(sim_hostendian) AC_SUBST(sim_smp) AC_SUBST(sim_igen_smp) AC_SUBST(sim_bitsize) diff --git a/sim/ppc/options.c b/sim/ppc/options.c index e327187b375..330332ddf08 100644 --- a/sim/ppc/options.c +++ b/sim/ppc/options.c @@ -117,7 +117,7 @@ print_options (void) printf_filtered ("Compiled on %s %s\n", __DATE__, __TIME__); #endif - printf_filtered ("WITH_HOST_BYTE_ORDER = %s\n", options_byte_order (WITH_HOST_BYTE_ORDER)); + printf_filtered ("HOST_BYTE_ORDER = %s\n", options_byte_order (HOST_BYTE_ORDER)); printf_filtered ("WITH_TARGET_BYTE_ORDER = %s\n", options_byte_order (WITH_TARGET_BYTE_ORDER)); printf_filtered ("WITH_XOR_ENDIAN = %d\n", WITH_XOR_ENDIAN); printf_filtered ("WITH_SMP = %d\n", WITH_SMP); diff --git a/sim/ppc/psim.c b/sim/ppc/psim.c index 70c02f7141d..0c3f5a1090c 100644 --- a/sim/ppc/psim.c +++ b/sim/ppc/psim.c @@ -64,7 +64,6 @@ struct _psim { int current_target_byte_order; -int current_host_byte_order; int current_environment; int current_alignment; int current_floating_point; @@ -456,14 +455,6 @@ psim_create(const char *file_name, if (CURRENT_TARGET_BYTE_ORDER != current_target_byte_order) error("target and configured byte order conflict\n"); - /* fill in the missing HOST BYTE ORDER information */ - current_host_byte_order = (current_host_byte_order = 1, - (*(char*)(¤t_host_byte_order) - ? LITTLE_ENDIAN - : BIG_ENDIAN)); - if (CURRENT_HOST_BYTE_ORDER != current_host_byte_order) - error("host and configured byte order conflict\n"); - /* fill in the missing OEA/VEA information */ env = tree_find_string_property(root, "/openprom/options/env"); current_environment = ((strcmp(env, "user") == 0 @@ -917,7 +908,7 @@ psim_read_register(psim *system, break; #ifdef WITH_ALTIVEC case 16: - if (CURRENT_HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER) + if (HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER) { union { vreg v; unsigned_8 d[2]; } h, t; memcpy(&h.v/*dest*/, cooked_buf/*src*/, description.size); @@ -996,7 +987,7 @@ psim_write_register(psim *system, break; #ifdef WITH_ALTIVEC case 16: - if (CURRENT_HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER) + if (HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER) { union { vreg v; unsigned_8 d[2]; } h, t; memcpy(&t.v/*dest*/, buf/*src*/, description.size); diff --git a/sim/ppc/sim-endian-n.h b/sim/ppc/sim-endian-n.h index 095a642e9ee..415149e569d 100644 --- a/sim/ppc/sim-endian-n.h +++ b/sim/ppc/sim-endian-n.h @@ -38,7 +38,7 @@ INLINE_PSIM_ENDIAN\ (unsigned_N) endian_t2h_N(unsigned_N raw_in) { - if (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER) { + if (CURRENT_TARGET_BYTE_ORDER == HOST_BYTE_ORDER) { return raw_in; } else { @@ -51,7 +51,7 @@ INLINE_PSIM_ENDIAN\ (unsigned_N) endian_h2t_N(unsigned_N raw_in) { - if (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER) { + if (CURRENT_TARGET_BYTE_ORDER == HOST_BYTE_ORDER) { return raw_in; } else { @@ -73,7 +73,7 @@ INLINE_PSIM_ENDIAN\ (unsigned_N) endian_h2be_N(unsigned_N raw_in) { - if (CURRENT_HOST_BYTE_ORDER == BIG_ENDIAN) { + if (HOST_BYTE_ORDER == BIG_ENDIAN) { return raw_in; } else { @@ -86,7 +86,7 @@ INLINE_PSIM_ENDIAN\ (unsigned_N) endian_be2h_N(unsigned_N raw_in) { - if (CURRENT_HOST_BYTE_ORDER == BIG_ENDIAN) { + if (HOST_BYTE_ORDER == BIG_ENDIAN) { return raw_in; } else { @@ -99,7 +99,7 @@ INLINE_PSIM_ENDIAN\ (unsigned_N) endian_h2le_N(unsigned_N raw_in) { - if (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN) { + if (HOST_BYTE_ORDER == LITTLE_ENDIAN) { return raw_in; } else { @@ -112,7 +112,7 @@ INLINE_PSIM_ENDIAN\ (unsigned_N) endian_le2h_N(unsigned_N raw_in) { - if (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN) { + if (HOST_BYTE_ORDER == LITTLE_ENDIAN) { return raw_in; } else { diff --git a/sim/ppc/sim-endian.c b/sim/ppc/sim-endian.c index 2625d80d0b8..0f76b239256 100644 --- a/sim/ppc/sim-endian.c +++ b/sim/ppc/sim-endian.c @@ -31,7 +31,7 @@ #define _SWAP_1(SET,RAW) SET (RAW) #endif -#if !defined(_SWAP_2) && (WITH_HOST_BYTE_ORDER == LITTLE_ENDIAN) && defined(htons) +#if !defined(_SWAP_2) && (HOST_BYTE_ORDER == LITTLE_ENDIAN) && defined(htons) #define _SWAP_2(SET,RAW) SET htons (RAW) #endif @@ -39,7 +39,7 @@ #define _SWAP_2(SET,RAW) SET (((RAW) >> 8) | ((RAW) << 8)) #endif -#if !defined(_SWAP_4) && (WITH_HOST_BYTE_ORDER == LITTLE_ENDIAN) && defined(htonl) +#if !defined(_SWAP_4) && (HOST_BYTE_ORDER == LITTLE_ENDIAN) && defined(htonl) #define _SWAP_4(SET,RAW) SET htonl (RAW) #endif diff --git a/sim/ppc/sim-endian.h b/sim/ppc/sim-endian.h index 9a873333a11..e0745721287 100644 --- a/sim/ppc/sim-endian.h +++ b/sim/ppc/sim-endian.h @@ -60,181 +60,6 @@ INLINE_PSIM_ENDIAN(unsigned_4) endian_le2h_4(unsigned_4 x); INLINE_PSIM_ENDIAN(unsigned_8) endian_le2h_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. - - */ - - -/* NetBSD: - - NetBSD is easy, everything you could ever want is in a header file - (well almost :-) */ - -#if defined(__NetBSD__) -# include -# 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 -# 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 (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 (i686) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined (__i686__) -# 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 - -/* Power or PowerPC running AIX */ -#if defined(_POWER) && defined(_AIX) -# 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 "Power/PowerPC AIX was big endian last time I looked ..." -# endif -#endif - -/* Solaris running PowerPC */ -#if defined(__PPC) && defined(__sun__) -# 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 "Solaris on PowerPCs was little endian last time I looked ..." -# endif -#endif - -/* HP/PA */ -#if defined(__hppa__) -# 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 "HP/PA was big endian last time I looked ..." -# endif -#endif - -/* Big endian MIPS */ -#if defined(__MIPSEB__) -# 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 "MIPSEB was big endian last time I looked ..." -# endif -#endif - -/* Little endian MIPS */ -#if defined(__MIPSEL__) -# 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 "MIPSEL was little endian last time I looked ..." -# endif -#endif - -/* Windows NT */ -#if defined(__WIN32__) -# 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 "Windows NT was little endian last time I looked ..." -# endif -#endif - -/* Alpha running DEC unix */ -#if defined(__osf__) && defined(__alpha__) -# 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 "AXP running DEC unix was little endian last time I looked ..." -# endif -#endif - - -/* INSERT HERE - additional hosts that do not have LITTLE_ENDIAN and - BIG_ENDIAN definitions available. */ - /* SWAP */ #define SWAP_1 swap_1 diff --git a/sim/ppc/std-config.h b/sim/ppc/std-config.h index 6cf7f27fe55..375ba730bea 100644 --- a/sim/ppc/std-config.h +++ b/sim/ppc/std-config.h @@ -30,18 +30,23 @@ Possible values are 0 (unknown), LITTLE_ENDIAN, BIG_ENDIAN */ -#ifndef WITH_HOST_BYTE_ORDER -#define WITH_HOST_BYTE_ORDER 0 /*unknown*/ +#ifndef LITTLE_ENDIAN +#define LITTLE_ENDIAN 1234 +#endif +#ifndef BIG_ENDIAN +#define BIG_ENDIAN 4321 +#endif + +#ifdef WORDS_BIGENDIAN +# define HOST_BYTE_ORDER BIG_ENDIAN +#else +# define HOST_BYTE_ORDER LITTLE_ENDIAN #endif #ifndef WITH_TARGET_BYTE_ORDER #define WITH_TARGET_BYTE_ORDER 0 /*unknown*/ #endif -extern int current_host_byte_order; -#define CURRENT_HOST_BYTE_ORDER (WITH_HOST_BYTE_ORDER \ - ? WITH_HOST_BYTE_ORDER \ - : current_host_byte_order) extern int current_target_byte_order; #define CURRENT_TARGET_BYTE_ORDER (WITH_TARGET_BYTE_ORDER \ ? WITH_TARGET_BYTE_ORDER \ -- 2.30.2