C99 gprof configury

Message ID 20210405055048.GF5425@bubble.grove.modra.org
State New
Headers show
Series
  • C99 gprof configury
Related show

Commit Message

H.J. Lu via Binutils April 5, 2021, 5:50 a.m.
This series of patches is a first pass at tidying some of the obsolete
configure tests we have in support of old systems.  No doubt there are
other things that could be removed too.

Given C99 we don't need to check HAVE_SETLOCALE.  The patch also
adds setitimer checks so that they can be removed from bfd where they
aren't needed.  According to the automake manual AC_ISC_POSIX is
obsolete, so that is removed.  HAVE_SETMODE isn't checked anywhere,
so it is pointless to have a configure test for setmode.

	* configure.ac: Check for sys/time.h and setitimer.  Don't invoke
	AC_ISC_POSIX.  Don't check for setmode.
	* gprof.c: Don't test HAVE_SETLOCALE.
	* gprof.h: Include sys/time.h.
	* configure: Regenerate.
	* gconfig.in: Regenerate.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/gprof/configure.ac b/gprof/configure.ac
index 36a40848097..25aa108ecf6 100644
--- a/gprof/configure.ac
+++ b/gprof/configure.ac
@@ -21,7 +21,6 @@  AC_INIT([gprof], BFD_VERSION)
 AC_CONFIG_SRCDIR([gprof.c])
 
 AC_CANONICAL_TARGET([])
-AC_ISC_POSIX
 
 AM_INIT_AUTOMAKE
 
@@ -39,7 +38,9 @@  AC_PROG_INSTALL
 LT_INIT
 ACX_LARGEFILE
 
-AC_CHECK_FUNCS(setmode)
+# These are in addition to what is made available in bfd/.
+AC_CHECK_HEADERS(sys/time.h)
+AC_CHECK_FUNCS(setitimer)
 
 ALL_LINGUAS="bg da de eo es fi fr ga hu id it ja ms nl pt_BR ro ru rw sr sv tr uk vi"
 ZW_GNU_GETTEXT_SISTER_DIR
diff --git a/gprof/gprof.c b/gprof/gprof.c
index 678299e7b0e..6ed88ff4776 100644
--- a/gprof/gprof.c
+++ b/gprof/gprof.c
@@ -187,12 +187,10 @@  main (int argc, char **argv)
   Sym **cg = 0;
   int ch, user_specified = 0;
 
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
   setlocale (LC_MESSAGES, "");
 #endif
-#if defined (HAVE_SETLOCALE)
   setlocale (LC_CTYPE, "");
-#endif
 #ifdef ENABLE_NLS
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
diff --git a/gprof/gprof.h b/gprof/gprof.h
index e1ce282437a..1c23dd83f2f 100644
--- a/gprof/gprof.h
+++ b/gprof/gprof.h
@@ -40,6 +40,10 @@ 
 #undef PACKAGE_VERSION
 #include "gconfig.h"
 
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
 #ifndef MIN
 #define MIN(a,b)	((a) < (b) ? (a) : (b))
 #endif
@@ -58,9 +62,7 @@ 
 #define	GMONNAME	"gmon.out"	/* default profile filename */
 #define	GMONSUM		"gmon.sum"	/* profile summary filename */
 
-#ifdef HAVE_LOCALE_H
-# include <locale.h>
-#endif
+#include <locale.h>
 
 #ifdef ENABLE_NLS
 /* Undefine BFD's `_' macro - it uses dgetext() and we want to use gettext().  */