From 6bf212a8ac97a844db0ed8213eeb6deee723d453 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 1 Jan 2024 23:57:12 -0500 Subject: sim: ppc: move termios probes to top-level This is the last compile-time logic in the ppc subdir. --- sim/config.h.in | 12 +++ sim/configure | 138 ++++++++++++++++++++++++++++++++- sim/m4/sim_ac_platform.m4 | 69 +++++++++++++++++ sim/ppc/config.in | 12 --- sim/ppc/configure | 192 ---------------------------------------------- sim/ppc/configure.ac | 69 ----------------- 6 files changed, 217 insertions(+), 275 deletions(-) (limited to 'sim') diff --git a/sim/config.h.in b/sim/config.h.in index 78fa632..4e27246 100644 --- a/sim/config.h.in +++ b/sim/config.h.in @@ -353,9 +353,21 @@ /* Define to 1 if you have the `tcsetpgrp' function. */ #undef HAVE_TCSETPGRP +/* Define if struct termios has c_line. */ +#undef HAVE_TERMIOS_CLINE + /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H +/* Define if struct termios exists. */ +#undef HAVE_TERMIOS_STRUCTURE + +/* Define if struct termio has c_line. */ +#undef HAVE_TERMIO_CLINE + +/* Define if struct termio exists. */ +#undef HAVE_TERMIO_STRUCTURE + /* Define to 1 if you have the `time' function. */ #undef HAVE_TIME diff --git a/sim/configure b/sim/configure index b68c619..fcf6e81 100755 --- a/sim/configure +++ b/sim/configure @@ -8810,6 +8810,140 @@ $as_echo "#define HAVE_SYSV_SHM 1" >>confdefs.h fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct termios" >&5 +$as_echo_n "checking for struct termios... " >&6; } +if ${sim_cv_termios_struct+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +int +main () +{ + + static struct termios x; + x.c_iflag = 0; + x.c_oflag = 0; + x.c_cflag = 0; + x.c_lflag = 0; + x.c_cc[NCCS] = 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + sim_cv_termios_struct="yes" +else + sim_cv_termios_struct="no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sim_cv_termios_struct" >&5 +$as_echo "$sim_cv_termios_struct" >&6; } +if test $sim_cv_termios_struct = yes; then + +$as_echo "#define HAVE_TERMIOS_STRUCTURE 1" >>confdefs.h + +fi + +if test "$sim_cv_termios_struct" = "yes"; then + if ${sim_cv_termios_cline+:} false; then : + $as_echo_n "(cached) " >&6 +fi + + ac_fn_c_check_member "$LINENO" "struct termios" "c_line" "ac_cv_member_struct_termios_c_line" " +#include +#include + +" +if test "x$ac_cv_member_struct_termios_c_line" = xyes; then : + sim_cv_termios_cline="yes" +else + sim_cv_termios_cline="no" +fi + + if test $sim_cv_termios_cline = yes; then + +$as_echo "#define HAVE_TERMIOS_CLINE 1" >>confdefs.h + + fi +else + sim_cv_termios_cline=no +fi + +if test "$sim_cv_termios_struct" != "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct termio" >&5 +$as_echo_n "checking for struct termio... " >&6; } +if ${sim_cv_termio_struct+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +int +main () +{ + + static struct termio x; + x.c_iflag = 0; + x.c_oflag = 0; + x.c_cflag = 0; + x.c_lflag = 0; + x.c_cc[NCC] = 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + sim_cv_termio_struct="yes" +else + sim_cv_termio_struct="no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sim_cv_termio_struct" >&5 +$as_echo "$sim_cv_termio_struct" >&6; } + if test $sim_cv_termio_struct = yes; then + +$as_echo "#define HAVE_TERMIO_STRUCTURE 1" >>confdefs.h + + fi +else + sim_cv_termio_struct=no +fi + +if test "$sim_cv_termio_struct" = "yes"; then + if ${sim_cv_termio_cline+:} false; then : + $as_echo_n "(cached) " >&6 +fi + + ac_fn_c_check_member "$LINENO" "struct termio" "c_line" "ac_cv_member_struct_termio_c_line" " +#include +#include + +" +if test "x$ac_cv_member_struct_termio_c_line" = xyes; then : + sim_cv_termio_cline="yes" +else + sim_cv_termio_cline="no" +fi + + if test $sim_cv_termio_cline = yes; then + +$as_echo "#define HAVE_TERMIO_CLINE 1" >>confdefs.h + + fi +else + sim_cv_termio_cline=no +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking type of array argument to getgroups" >&5 $as_echo_n "checking type of array argument to getgroups... " >&6; } if ${ac_cv_type_getgroups+:} false; then : @@ -12477,7 +12611,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12480 "configure" +#line 12614 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12583,7 +12717,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12586 "configure" +#line 12720 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4 index 6f3e48f..f523f03 100644 --- a/sim/m4/sim_ac_platform.m4 +++ b/sim/m4/sim_ac_platform.m4 @@ -213,6 +213,75 @@ AS_IF([test x"$sim_cv_sysv_shm" = x"yes"], [dnl AC_DEFINE(HAVE_SYSV_SHM, 1, [Define if System V shared memory is supported]) ]) +dnl Figure out what type of termio/termios support there is +AC_CACHE_CHECK([for struct termios], + [sim_cv_termios_struct], + [AC_TRY_COMPILE([ +#include +#include ], [ + static struct termios x; + x.c_iflag = 0; + x.c_oflag = 0; + x.c_cflag = 0; + x.c_lflag = 0; + x.c_cc[NCCS] = 0; +], [sim_cv_termios_struct="yes"], [sim_cv_termios_struct="no"])]) +if test $sim_cv_termios_struct = yes; then + AC_DEFINE([HAVE_TERMIOS_STRUCTURE], 1, [Define if struct termios exists.]) +fi + +if test "$sim_cv_termios_struct" = "yes"; then + AC_CACHE_VAL([sim_cv_termios_cline]) + AC_CHECK_MEMBER( + [struct termios.c_line], + [sim_cv_termios_cline="yes"], + [sim_cv_termios_cline="no"], [ +#include +#include +]) + if test $sim_cv_termios_cline = yes; then + AC_DEFINE([HAVE_TERMIOS_CLINE], 1, [Define if struct termios has c_line.]) + fi +else + sim_cv_termios_cline=no +fi + +if test "$sim_cv_termios_struct" != "yes"; then + AC_CACHE_CHECK([for struct termio], + [sim_cv_termio_struct], + [AC_TRY_COMPILE([ +#include +#include ], [ + static struct termio x; + x.c_iflag = 0; + x.c_oflag = 0; + x.c_cflag = 0; + x.c_lflag = 0; + x.c_cc[NCC] = 0; +], [sim_cv_termio_struct="yes"], [sim_cv_termio_struct="no"])]) + if test $sim_cv_termio_struct = yes; then + AC_DEFINE([HAVE_TERMIO_STRUCTURE], 1, [Define if struct termio exists.]) + fi +else + sim_cv_termio_struct=no +fi + +if test "$sim_cv_termio_struct" = "yes"; then + AC_CACHE_VAL([sim_cv_termio_cline]) + AC_CHECK_MEMBER( + [struct termio.c_line], + [sim_cv_termio_cline="yes"], + [sim_cv_termio_cline="no"], [ +#include +#include +]) + if test $sim_cv_termio_cline = yes; then + AC_DEFINE([HAVE_TERMIO_CLINE], 1, [Define if struct termio has c_line.]) + fi +else + sim_cv_termio_cline=no +fi + dnl Types used by common code AC_TYPE_GETGROUPS AC_TYPE_MODE_T diff --git a/sim/ppc/config.in b/sim/ppc/config.in index 78786df..2a60b8d 100644 --- a/sim/ppc/config.in +++ b/sim/ppc/config.in @@ -1,17 +1,5 @@ /* config.in. Generated from configure.ac by autoheader. */ -/* Define if struct termios has c_line. */ -#undef HAVE_TERMIOS_CLINE - -/* Define if struct termios exists. */ -#undef HAVE_TERMIOS_STRUCTURE - -/* Define if struct termio has c_line. */ -#undef HAVE_TERMIO_CLINE - -/* Define if struct termio exists. */ -#undef HAVE_TERMIO_STRUCTURE - /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT diff --git a/sim/ppc/configure b/sim/ppc/configure index b64e4c4..4644439 100755 --- a/sim/ppc/configure +++ b/sim/ppc/configure @@ -1451,63 +1451,6 @@ fi as_fn_set_status $ac_retval } # ac_fn_c_try_compile - -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $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_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -3221,141 +3164,6 @@ ac_config_headers="$ac_config_headers config.h:config.in" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct termios" >&5 -$as_echo_n "checking for struct termios... " >&6; } -if ${sim_cv_termios_struct+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -int -main () -{ - - static struct termios x; - x.c_iflag = 0; - x.c_oflag = 0; - x.c_cflag = 0; - x.c_lflag = 0; - x.c_cc[NCCS] = 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - sim_cv_termios_struct="yes" -else - sim_cv_termios_struct="no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sim_cv_termios_struct" >&5 -$as_echo "$sim_cv_termios_struct" >&6; } -if test $sim_cv_termios_struct = yes; then - -$as_echo "#define HAVE_TERMIOS_STRUCTURE 1" >>confdefs.h - -fi - -if test "$sim_cv_termios_struct" = "yes"; then - if ${sim_cv_termios_cline+:} false; then : - $as_echo_n "(cached) " >&6 -fi - - ac_fn_c_check_member "$LINENO" "struct termios" "c_line" "ac_cv_member_struct_termios_c_line" " -#include -#include - -" -if test "x$ac_cv_member_struct_termios_c_line" = xyes; then : - sim_cv_termios_cline="yes" -else - sim_cv_termios_cline="no" -fi - - if test $sim_cv_termios_cline = yes; then - -$as_echo "#define HAVE_TERMIOS_CLINE 1" >>confdefs.h - - fi -else - sim_cv_termios_cline=no -fi - -if test "$sim_cv_termios_struct" != "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct termio" >&5 -$as_echo_n "checking for struct termio... " >&6; } -if ${sim_cv_termio_struct+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -int -main () -{ - - static struct termio x; - x.c_iflag = 0; - x.c_oflag = 0; - x.c_cflag = 0; - x.c_lflag = 0; - x.c_cc[NCC] = 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - sim_cv_termio_struct="yes" -else - sim_cv_termio_struct="no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sim_cv_termio_struct" >&5 -$as_echo "$sim_cv_termio_struct" >&6; } - if test $sim_cv_termio_struct = yes; then - -$as_echo "#define HAVE_TERMIO_STRUCTURE 1" >>confdefs.h - - fi -else - sim_cv_termio_struct=no -fi - -if test "$sim_cv_termio_struct" = "yes"; then - if ${sim_cv_termio_cline+:} false; then : - $as_echo_n "(cached) " >&6 -fi - - ac_fn_c_check_member "$LINENO" "struct termio" "c_line" "ac_cv_member_struct_termio_c_line" " -#include -#include - -" -if test "x$ac_cv_member_struct_termio_c_line" = xyes; then : - sim_cv_termio_cline="yes" -else - sim_cv_termio_cline="no" -fi - - if test $sim_cv_termio_cline = yes; then - -$as_echo "#define HAVE_TERMIO_CLINE 1" >>confdefs.h - - fi -else - sim_cv_termio_cline=no -fi - - diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac index 7b4b998..b19be90 100644 --- a/sim/ppc/configure.ac +++ b/sim/ppc/configure.ac @@ -288,75 +288,6 @@ fi],[sim_xor_endian=""])dnl AC_CONFIG_HEADER(config.h:config.in) -dnl Figure out what type of termio/termios support there is -AC_CACHE_CHECK([for struct termios], - [sim_cv_termios_struct], - [AC_TRY_COMPILE([ -#include -#include ], [ - static struct termios x; - x.c_iflag = 0; - x.c_oflag = 0; - x.c_cflag = 0; - x.c_lflag = 0; - x.c_cc[NCCS] = 0; -], [sim_cv_termios_struct="yes"], [sim_cv_termios_struct="no"])]) -if test $sim_cv_termios_struct = yes; then - AC_DEFINE([HAVE_TERMIOS_STRUCTURE], 1, [Define if struct termios exists.]) -fi - -if test "$sim_cv_termios_struct" = "yes"; then - AC_CACHE_VAL([sim_cv_termios_cline]) - AC_CHECK_MEMBER( - [struct termios.c_line], - [sim_cv_termios_cline="yes"], - [sim_cv_termios_cline="no"], [ -#include -#include -]) - if test $sim_cv_termios_cline = yes; then - AC_DEFINE([HAVE_TERMIOS_CLINE], 1, [Define if struct termios has c_line.]) - fi -else - sim_cv_termios_cline=no -fi - -if test "$sim_cv_termios_struct" != "yes"; then - AC_CACHE_CHECK([for struct termio], - [sim_cv_termio_struct], - [AC_TRY_COMPILE([ -#include -#include ], [ - static struct termio x; - x.c_iflag = 0; - x.c_oflag = 0; - x.c_cflag = 0; - x.c_lflag = 0; - x.c_cc[NCC] = 0; -], [sim_cv_termio_struct="yes"], [sim_cv_termio_struct="no"])]) - if test $sim_cv_termio_struct = yes; then - AC_DEFINE([HAVE_TERMIO_STRUCTURE], 1, [Define if struct termio exists.]) - fi -else - sim_cv_termio_struct=no -fi - -if test "$sim_cv_termio_struct" = "yes"; then - AC_CACHE_VAL([sim_cv_termio_cline]) - AC_CHECK_MEMBER( - [struct termio.c_line], - [sim_cv_termio_cline="yes"], - [sim_cv_termio_cline="no"], [ -#include -#include -]) - if test $sim_cv_termio_cline = yes; then - AC_DEFINE([HAVE_TERMIO_CLINE], 1, [Define if struct termio has c_line.]) - fi -else - sim_cv_termio_cline=no -fi - AC_SUBST(sim_line_nr) AC_SUBST(sim_opcode) AC_SUBST(sim_switch) -- cgit v1.1