diff options
author | Mike Frysinger <vapier@gentoo.org> | 2024-01-01 23:53:53 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2024-01-02 00:32:29 -0500 |
commit | 1a9f6039fb28ce17f9481af482f8af1fdb4cf3e6 (patch) | |
tree | a3946bfd34f259c5b13c0a68de549402e6a0e3a4 /sim | |
parent | e04ab9b01aa389fe4924bcabededd60c9b2851b4 (diff) | |
download | gdb-1a9f6039fb28ce17f9481af482f8af1fdb4cf3e6.zip gdb-1a9f6039fb28ce17f9481af482f8af1fdb4cf3e6.tar.gz gdb-1a9f6039fb28ce17f9481af482f8af1fdb4cf3e6.tar.bz2 |
sim: ppc: switch struct member checks to AC_CHECK_MEMBER
This covers a lot of the AC_MSG_CHECKING+AC_TRY_COMPILE+AC_MSG_RESULT
boilerplate and matches what we do in the top-level platform checks.
Diffstat (limited to 'sim')
-rwxr-xr-x | sim/ppc/configure | 127 | ||||
-rw-r--r-- | sim/ppc/configure.ac | 40 |
2 files changed, 99 insertions, 68 deletions
diff --git a/sim/ppc/configure b/sim/ppc/configure index ce591d6..0e3c918 100755 --- a/sim/ppc/configure +++ b/sim/ppc/configure @@ -1451,6 +1451,63 @@ 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. @@ -3203,41 +3260,28 @@ $as_echo "#define HAVE_TERMIOS_STRUCTURE 1" >>confdefs.h fi if test "$ac_cv_termios_struct" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for c_line field in struct termios" >&5 -$as_echo_n "checking for c_line field in struct termios... " >&6; } - if ${ac_cv_termios_cline+:} false; then : + if ${sim_cv_termios_cline+:} false; then : $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +fi + + ac_fn_c_check_member "$LINENO" "struct termios" "c_line" "ac_cv_member_struct_termios_c_line" " #include <sys/types.h> #include <sys/termios.h> -int -main () -{ -static struct termios x; x.c_line = 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_termios_cline=yes + +" +if test "x$ac_cv_member_struct_termios_c_line" = xyes; then : + sim_cv_termios_cline="yes" else - ac_cv_termios_cline=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + sim_cv_termios_cline="no" fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_termios_cline" >&5 -$as_echo "$ac_cv_termios_cline" >&6; } - if test $ac_cv_termios_cline = yes; then + if test $sim_cv_termios_cline = yes; then $as_echo "#define HAVE_TERMIOS_CLINE 1" >>confdefs.h fi else - ac_cv_termios_cline=no + sim_cv_termios_cline=no fi if test "$ac_cv_termios_struct" != "yes"; then @@ -3283,41 +3327,28 @@ else fi if test "$ac_cv_termio_struct" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for c_line field in struct termio" >&5 -$as_echo_n "checking for c_line field in struct termio... " >&6; } - if ${ac_cv_termio_cline+:} false; then : + if ${sim_cv_termio_cline+:} false; then : $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +fi + + ac_fn_c_check_member "$LINENO" "struct termio" "c_line" "ac_cv_member_struct_termio_c_line" " #include <sys/types.h> #include <sys/termio.h> -int -main () -{ -static struct termio x; x.c_line = 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_termio_cline=yes + +" +if test "x$ac_cv_member_struct_termio_c_line" = xyes; then : + sim_cv_termio_cline="yes" else - ac_cv_termio_cline=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + sim_cv_termio_cline="no" fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_termio_cline" >&5 -$as_echo "$ac_cv_termio_cline" >&6; } - if test $ac_cv_termio_cline = yes; then + if test $sim_cv_termio_cline = yes; then $as_echo "#define HAVE_TERMIO_CLINE 1" >>confdefs.h fi else - ac_cv_termio_cline=no + sim_cv_termio_cline=no fi diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac index e835479..8810ff2 100644 --- a/sim/ppc/configure.ac +++ b/sim/ppc/configure.ac @@ -306,19 +306,19 @@ if test $ac_cv_termios_struct = yes; then fi if test "$ac_cv_termios_struct" = "yes"; then - AC_MSG_CHECKING(for c_line field in struct termios) - AC_CACHE_VAL(ac_cv_termios_cline, - [AC_TRY_COMPILE([#include <sys/types.h> -#include <sys/termios.h>], -[static struct termios x; x.c_line = 0;], - ac_cv_termios_cline=yes, ac_cv_termios_cline=no)]) - - AC_MSG_RESULT($ac_cv_termios_cline) - if test $ac_cv_termios_cline = 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 <sys/types.h> +#include <sys/termios.h> +]) + if test $sim_cv_termios_cline = yes; then AC_DEFINE([HAVE_TERMIOS_CLINE], 1, [Define if struct termios has c_line.]) fi else - ac_cv_termios_cline=no + sim_cv_termios_cline=no fi if test "$ac_cv_termios_struct" != "yes"; then @@ -342,19 +342,19 @@ else fi if test "$ac_cv_termio_struct" = "yes"; then - AC_MSG_CHECKING(for c_line field in struct termio) - AC_CACHE_VAL(ac_cv_termio_cline, - [AC_TRY_COMPILE([#include <sys/types.h> -#include <sys/termio.h>], -[static struct termio x; x.c_line = 0;], - ac_cv_termio_cline=yes, ac_cv_termio_cline=no)]) - - AC_MSG_RESULT($ac_cv_termio_cline) - if test $ac_cv_termio_cline = 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 <sys/types.h> +#include <sys/termio.h> +]) + if test $sim_cv_termio_cline = yes; then AC_DEFINE([HAVE_TERMIO_CLINE], 1, [Define if struct termio has c_line.]) fi else - ac_cv_termio_cline=no + sim_cv_termio_cline=no fi AC_SUBST(sim_line_nr) |