]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
build: modernize obsolete autoconf macros in configure.ac
authorTobias Oetiker <tobi@oetiker.ch>
Tue, 19 May 2026 08:20:12 +0000 (10:20 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Tue, 19 May 2026 08:20:12 +0000 (10:20 +0200)
Replace obsolete autoconf macros that newer autoconf warns about:

- AC_PREREQ(2.59) -> AC_PREREQ([2.69])  (quoted; 2.69 is the autoconf
  shipped by AlmaLinux 8, the oldest distro in the release matrix)
- AC_PROG_LIBTOOL -> LT_INIT
- AC_TRY_RUN / AC_TRY_COMPILE -> AC_RUN_IFELSE / AC_COMPILE_IFELSE
- drop AC_HEADER_STDC and AC_HEADER_TIME (obsolete: every supported
  platform is standard-C and can include <sys/time.h> and <time.h>
  together)

rrd_config_bottom.h relied on the STDC_HEADERS and TIME_WITH_SYS_TIME
defines those macros produced, so collapse the now-dead branches:
string.h is included unconditionally, and sys/time.h is gated on
HAVE_SYS_TIME_H. AC_HEADER_TIME used to pull in sys/time.h on its own,
so add sys/time.h to AC_CHECK_HEADERS — otherwise HAVE_SYS_TIME_H is
never defined and gettimeofday loses its declaration.

Remaining obsolete-macro warnings originate in the bundled gettext m4
and in m4/acinclude.m4; those are left for a separate change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
configure.ac
src/rrd_config_bottom.h

index f44b18f82110b67cc9202bfa87b9df3c2e36d02b..19bb395cfca6801b9d7a55ec2d964ce81125c7da 100644 (file)
@@ -9,7 +9,7 @@ dnl Inspiration from http://autoconf-archive.cryp.to
 dnl tell automake the this script is for rrdtool
 
 dnl Minimum Autoconf version required.
-AC_PREREQ(2.59)
+AC_PREREQ([2.69])
 
 dnl the official version number is
 dnl a.b.c
@@ -170,7 +170,7 @@ dnl Check for the compiler and static/shared library creation.
 AC_PROG_CPP
 AC_PROG_CC
 AM_PROG_CC_C_O
-AC_PROG_LIBTOOL
+LT_INIT
 
 dnl Try to detect/use GNU features
 CFLAGS="$CFLAGS -D_GNU_SOURCE"
@@ -211,13 +211,11 @@ AC_SUBST(RRD_DEFAULT_FONT)
 CONFIGURE_PART(Checking for Header Files)
 
 dnl Checks for header files.
-AC_HEADER_STDC
 AC_HEADER_DIRENT
-AC_CHECK_HEADERS(langinfo.h stdint.h inttypes.h libgen.h features.h sys/stat.h sys/types.h fcntl.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/times.h sys/param.h sys/resource.h signal.h float.h stdio.h stdlib.h errno.h string.h ctype.h grp.h pwd.h glob.h)
+AC_CHECK_HEADERS(langinfo.h stdint.h inttypes.h libgen.h features.h sys/stat.h sys/types.h fcntl.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/time.h sys/times.h sys/param.h sys/resource.h signal.h float.h stdio.h stdlib.h errno.h string.h ctype.h grp.h pwd.h glob.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
-AC_HEADER_TIME
 AC_STRUCT_TM
 
 dnl figure out 'stuff' about
@@ -340,7 +338,7 @@ volatile int x;volatile float f;  ]], [[x = isinf(f)]])],[AC_MSG_RESULT(yes)
 
 dnl finite is BSD, isfinite is C99, so prefer the latter
 AC_CACHE_CHECK([whether isfinite is broken],[ac_cv_have_broken_isfinite],[
-AC_TRY_RUN([
+AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #ifdef HAVE_MATH_H
 #include <math.h>
 #endif
@@ -358,7 +356,7 @@ int main ()
 #endif
 #endif
 return 0;
-}],[ac_cv_have_broken_isfinite=no],[ac_cv_have_broken_isfinite=yes],[
+}]])],[ac_cv_have_broken_isfinite=no],[ac_cv_have_broken_isfinite=yes],[
 case "${target}" in
   hppa*-*-hpux*) ac_cv_have_broken_isfinite=yes ;;
   *-solaris2.8) ac_cv_have_broken_isfinite=yes ;;
@@ -394,15 +392,14 @@ GC_TIMEZONE()
 
 AC_CACHE_CHECK(whether sigwait has 2 arguments,
     ac_cv_libc_sigwait,
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
         #define _POSIX_PTHREAD_SEMANTICS
         #include <stdio.h>
-        #include <signal.h>],
-        [sigset_t sigs; int signo; sigwait(&sigs, &signo);],
-        AC_DEFINE(HAVE_SIGWAIT,1,[have two argument posix sigwait])
-        AC_MSG_RESULT(yes)
-        ,
-        AC_MSG_RESULT(no)
+        #include <signal.h>]],
+        [[sigset_t sigs; int signo; sigwait(&sigs, &signo);]])],
+        [AC_DEFINE(HAVE_SIGWAIT,1,[have two argument posix sigwait])
+        AC_MSG_RESULT(yes)],
+        [AC_MSG_RESULT(no)]
     )
 )
 
@@ -618,10 +615,10 @@ EX_CHECK_ALL(glib-2.0,   glib_check_version,            glib.h,
 
 AC_CACHE_CHECK([whether we need to include gthreads for g_thread_init],
     [ac_cv_glibc_g_thread_init],
-    [AC_TRY_COMPILE([#include <glib.h>],
-                    [#if !GLIB_CHECK_VERSION(2, 32, 0)
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <glib.h>]],
+                    [[#if !GLIB_CHECK_VERSION(2, 32, 0)
                      # error "glib needs g_thread_init"
-                     #endif],
+                     #endif]])],
                      [AC_MSG_RESULT(no)],
                      [EX_CHECK_ALL(gthread-2.0, g_thread_init, glib.h, gthread-2.0, x.x.x, "", "")
                      AC_MSG_RESULT(yes)])])
index 94091400df90ec87edd00ac8cca3f883dfb66d18..c6a44485fd3d0754eba280bca56d113dd5f0af8b 100644 (file)
 #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
 #endif
 
-#ifdef TIME_WITH_SYS_TIME
+#ifdef HAVE_SYS_TIME_H
 # include <sys/time.h>
-# include <time.h>
-#else
-# ifdef HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
 #endif
+#include <time.h>
 
 #ifdef HAVE_SYS_TIMES_H
 # include <sys/times.h>
@@ -106,22 +100,7 @@ extern int getrusage(int, struct rusage *);
 #endif
 
 
-/* define strrchr, strchr and memcpy, memmove in terms of bsd funcs
-   make sure you are NOT using bcopy, index or rindex in the code */
-      
-#ifdef STDC_HEADERS
-# include <string.h>
-#else
-# ifndef HAVE_STRCHR
-#  define strchr index
-#  define strrchr rindex
-# endif
-char *strchr (), *strrchr ();
-# ifndef HAVE_MEMMOVE
-#  define memcpy(d, s, n) bcopy ((s), (d), (n))
-#  define memmove(d, s, n) bcopy ((s), (d), (n))
-# endif
-#endif
+#include <string.h>
 
 #ifdef NO_NULL_REALLOC
 # define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))