sim: configury: fix obsolete macros

Running `autoreconf -vf -Wall' in the sim directory shows errors about the use
of obsolete macros.  This patch fix the issues with macros used or defined in
the sim directory.  However, it doesn't fix all warnings.  There's 1 autoconf
warning  from `config/pkg.m4', and many automake warnings about target
shadowing.  It cuts a lot of the noise down and makes an upgrade to
autoconf 2.71+ easier.

- Replace AC_CANONICAL_SYSTEM by AC_CANONICAL_TARGET
  https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/
Obsolete-Macros.html#index-AC_005fCANONICAL_005fSYSTEM-1997

- Replace AC_TRY_COMPILE by AC_COMPILE_IFELSE
  https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/
Obsolete-Macros.html#index-AC_005fTRY_005fCOMPILE-2203

- Replace AC_ERROR by AC_MSG_ERROR
  https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/
Obsolete-Macros.html#index-AC_005fERROR-2034

- Remove AC_TYPE_SIGNAL and replace `RETSIGTYPE' by `void' in the source
  https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/
Obsolete-Macros.html#index-AC_005fTYPE_005fSIGNAL-2213

- Remove AC_STRUCT_ST_BLKSIZE, it's already covered by a AC_CHECK_MEMBERS call
  https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/
Obsolete-Macros.html#index-AC_005fSTRUCT_005fST_005fBLKSIZE-2176

- Remove AC_STRUCT_ST_RDEV, it's already covered by a AC_CHECK_MEMBERS call
  https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/
Obsolete-Macros.html#index-AC_005fSTRUCT_005fST_005fRDEV-2180

- Remove AC_STRUCT_ST_BLOCKS.  It is not obsolete, but it's already covered by a
AC_CHECK_MEMBERS call.

- Replace deprecated C macros HAVE_ST_${MEMBER} by HAVE_STRUCT_STAT_ST_${MEMBER}
  https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/
Particular-Structures.html#index-AC_005fSTRUCT_005fST_005fBLOCKS-693

Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Pietro Monteiro
2025-07-04 21:13:13 -04:00
parent f4dfd7625a
commit 3960e5b824
9 changed files with 35 additions and 133 deletions

View File

@@ -175,7 +175,7 @@ dv_sockser_init (SIM_DESC sd)
??? Need a central signal management module. */
#ifdef SIGPIPE
{
RETSIGTYPE (*orig) (int);
void (*orig) (int);
orig = signal (SIGPIPE, SIG_IGN);
/* If a handler is already set up, don't mess with it. */
if (orig != SIG_DFL && orig != SIG_IGN)

View File

@@ -44,7 +44,7 @@ static const char *myname;
static SIM_DESC sd;
static RETSIGTYPE
static void
cntrl_c (int sig)
{
if (! sim_stop (sd))
@@ -64,7 +64,7 @@ main (int argc, char **argv)
enum sim_stop reason;
int sigrc = 0;
int single_step = 0;
RETSIGTYPE (*prev_sigint) (int);
void (*prev_sigint) (int);
myname = lbasename (argv[0]);

View File

@@ -307,18 +307,6 @@
/* Define to 1 if `tm_zone' is a member of `struct tm'. */
#undef HAVE_STRUCT_TM_TM_ZONE
/* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use
`HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */
#undef HAVE_ST_BLKSIZE
/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use
`HAVE_STRUCT_STAT_ST_BLOCKS' instead. */
#undef HAVE_ST_BLOCKS
/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
`HAVE_STRUCT_STAT_ST_RDEV' instead. */
#undef HAVE_ST_RDEV
/* Define to 1 if you have the `symlink' function. */
#undef HAVE_SYMLINK
@@ -483,9 +471,6 @@
/* Bug reporting address */
#undef REPORT_BUGS_TO
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
/* The size of `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG

85
sim/configure vendored
View File

@@ -637,6 +637,7 @@ ac_func_list=
ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
SIM_RX_CYCLE_ACCURATE_FLAGS
SIM_RISCV_BITSIZE
sim_ppc_model_issue
@@ -905,7 +906,6 @@ LD
FGREP
SED
LIBTOOL
LIBOBJS
C_DIALECT
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
@@ -8559,52 +8559,6 @@ fi
ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default"
if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
_ACEOF
$as_echo "#define HAVE_ST_BLKSIZE 1" >>confdefs.h
fi
ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default"
if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_STAT_ST_BLOCKS 1
_ACEOF
$as_echo "#define HAVE_ST_BLOCKS 1" >>confdefs.h
else
case " $LIBOBJS " in
*" fileblocks.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS fileblocks.$ac_objext"
;;
esac
fi
ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default"
if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_STAT_ST_RDEV 1
_ACEOF
$as_echo "#define HAVE_ST_RDEV 1" >>confdefs.h
fi
ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_zone" "#include <sys/types.h>
#include <$ac_cv_struct_tm>
@@ -9311,39 +9265,6 @@ _ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
$as_echo_n "checking return type of signal handlers... " >&6; }
if ${ac_cv_type_signal+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
#include <signal.h>
int
main ()
{
return *(signal (0, 0)) (0) == 1;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_type_signal=int
else
ac_cv_type_signal=void
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
$as_echo "$ac_cv_type_signal" >&6; }
cat >>confdefs.h <<_ACEOF
#define RETSIGTYPE $ac_cv_type_signal
_ACEOF
ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
if test "x$ac_cv_type_size_t" = xyes; then :
@@ -12878,7 +12799,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 12881 "configure"
#line 12802 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12984,7 +12905,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 12987 "configure"
#line 12908 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H

View File

@@ -189,7 +189,7 @@ AC_DEFUN([_SIM_TEST_WARNING_FLAG], [dnl
dnl Check whether GCC accepts it.
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror $wtest"
AC_TRY_COMPILE([],[],$2,$3)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[$2],[$3])
CFLAGS="$saved_CFLAGS"
])
dnl Export variable $1 to $2 for use in makefiles.

View File

@@ -112,9 +112,6 @@ AC_CHECK_FUNCS_ONCE(m4_flatten([
utime
]))
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_STRUCT_ST_RDEV
AC_STRUCT_TIMEZONE
AC_CHECK_MEMBERS([[struct stat.st_dev], [struct stat.st_ino],
@@ -138,7 +135,7 @@ AC_CHECK_SIZEOF([void *])
dnl Check for struct statfs.
AC_CACHE_CHECK([for struct statfs],
[sim_cv_struct_statfs],
[AC_TRY_COMPILE([
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
@@ -151,9 +148,9 @@ AC_CACHE_CHECK([for struct statfs],
#endif
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif], [
#endif]], [[
struct statfs s;
], [sim_cv_struct_statfs="yes"], [sim_cv_struct_statfs="no"])])
]])],[sim_cv_struct_statfs="yes"],[sim_cv_struct_statfs="no"])])
AS_IF([test x"sim_cv_struct_statfs" = x"yes"], [dnl
AC_DEFINE(HAVE_STRUCT_STATFS, 1,
[Define if struct statfs is defined in <sys/mount.h>])
@@ -162,12 +159,12 @@ AS_IF([test x"sim_cv_struct_statfs" = x"yes"], [dnl
dnl Some System V related checks.
AC_CACHE_CHECK([if union semun defined],
[sim_cv_has_union_semun],
[AC_TRY_COMPILE([
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>], [
#include <sys/sem.h>]], [[
union semun arg;
], [sim_cv_has_union_semun="yes"], [sim_cv_has_union_semun="no"])])
]])],[sim_cv_has_union_semun="yes"],[sim_cv_has_union_semun="no"])])
AS_IF([test x"$sim_cv_has_union_semun" = x"yes"], [dnl
AC_DEFINE(HAVE_UNION_SEMUN, 1,
[Define if union semun is defined in <sys/sem.h>])
@@ -175,7 +172,7 @@ AS_IF([test x"$sim_cv_has_union_semun" = x"yes"], [dnl
AC_CACHE_CHECK([whether System V semaphores are supported],
[sim_cv_sysv_sem],
[AC_TRY_COMPILE([
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
@@ -185,7 +182,7 @@ AC_CACHE_CHECK([whether System V semaphores are supported],
struct semid_ds *buf;
ushort *array;
};
#endif], [
#endif]], [[
union semun arg;
int id = semget(IPC_PRIVATE, 1, IPC_CREAT|0400);
if (id == -1)
@@ -193,23 +190,23 @@ AC_CACHE_CHECK([whether System V semaphores are supported],
arg.val = 0; /* avoid implicit type cast to union */
if (semctl(id, 0, IPC_RMID, arg) == -1)
return 1;
], [sim_cv_sysv_sem="yes"], [sim_cv_sysv_sem="no"])])
]])],[sim_cv_sysv_sem="yes"],[sim_cv_sysv_sem="no"])])
AS_IF([test x"$sim_cv_sysv_sem" = x"yes"], [dnl
AC_DEFINE(HAVE_SYSV_SEM, 1, [Define if System V semaphores are supported])
])
AC_CACHE_CHECK([whether System V shared memory is supported],
[sim_cv_sysv_shm],
[AC_TRY_COMPILE([
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>], [
#include <sys/shm.h>]], [[
int id = shmget(IPC_PRIVATE, 1, IPC_CREAT|0400);
if (id == -1)
return 1;
if (shmctl(id, IPC_RMID, 0) == -1)
return 1;
], [sim_cv_sysv_shm="yes"], [sim_cv_sysv_shm="no"])])
]])],[sim_cv_sysv_shm="yes"],[sim_cv_sysv_shm="no"])])
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])
])
@@ -217,16 +214,16 @@ AS_IF([test x"$sim_cv_sysv_shm" = x"yes"], [dnl
dnl Figure out what type of termio/termios support there is
AC_CACHE_CHECK([for struct termios],
[sim_cv_termios_struct],
[AC_TRY_COMPILE([
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/termios.h>], [
#include <sys/termios.h>]], [[
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"])])
]])],[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
@@ -250,16 +247,16 @@ fi
if test "$sim_cv_termios_struct" != "yes"; then
AC_CACHE_CHECK([for struct termio],
[sim_cv_termio_struct],
[AC_TRY_COMPILE([
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/termio.h>], [
#include <sys/termio.h>]], [[
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"])])
]])],[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
@@ -288,7 +285,6 @@ AC_TYPE_GETGROUPS
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_UID_T
@@ -344,7 +340,7 @@ if test -r ../readline/Makefile; then
READLINE_CFLAGS='-I$(READLINE_SRC)/..'
else
AC_CHECK_LIB(readline, readline, READLINE_LIB=-lreadline,
AC_ERROR([the required "readline" library is missing]), $TERMCAP_LIB)
AC_MSG_ERROR(the required "readline" library is missing), $TERMCAP_LIB)
READLINE_CFLAGS=
fi
AC_SUBST(READLINE_LIB)

View File

@@ -16,7 +16,7 @@ dnl
dnl Setup the toolchain variables.
AC_DEFUN([SIM_AC_TOOLCHAIN],
[dnl
AC_CANONICAL_SYSTEM
AC_CANONICAL_TARGET
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PROG_CPP])
AC_C_BIGENDIAN

View File

@@ -1094,19 +1094,19 @@ convert_to_solaris_stat(unsigned_word addr,
target.st_gid = H2T_4(host->st_gid);
target.st_size = H2T_4(host->st_size);
#ifdef HAVE_ST_RDEV
#ifdef HAVE_STRUCT_STAT_ST_RDEV
target.st_rdev = H2T_4(host->st_rdev);
#else
target.st_rdev = 0;
#endif
#ifdef HAVE_ST_BLKSIZE
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
target.st_blksize = H2T_4(host->st_blksize);
#else
target.st_blksize = 0;
#endif
#ifdef HAVE_ST_BLOCKS
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
target.st_blocks = H2T_4(host->st_blocks);
#else
target.st_blocks = 0;
@@ -2043,19 +2043,19 @@ convert_to_linux_stat(unsigned_word addr,
target.st_gid = H2T_4(host->st_gid);
target.st_size = H2T_4(host->st_size);
#ifdef HAVE_ST_RDEV
#ifdef HAVE_STRUCT_STAT_ST_RDEV
target.st_rdev = H2T_4(host->st_rdev);
#else
target.st_rdev = 0;
#endif
#ifdef HAVE_ST_BLKSIZE
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
target.st_blksize = H2T_4(host->st_blksize);
#else
target.st_blksize = 0;
#endif
#ifdef HAVE_ST_BLOCKS
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
target.st_blocks = H2T_4(host->st_blocks);
#else
target.st_blocks = 0;

View File

@@ -245,7 +245,7 @@ zalloc(long size)
/* When a CNTRL-C occures, queue an event to shut down the simulation */
static RETSIGTYPE
static void
cntrl_c(int sig)
{
psim_stop (simulation);
@@ -289,7 +289,7 @@ main(int argc, char * const *argv)
psim_stack(simulation, argv, environ);
{
RETSIGTYPE (*prev) (int);
void (*prev) (int);
prev = signal(SIGINT, cntrl_c);
psim_run(simulation);
signal(SIGINT, prev);