vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
982 stars 118 forks source link

"obsolete" warnings with the latest Autotools #416

Closed tueda closed 1 year ago

tueda commented 1 year ago

With the most up-to-date version of Autotools (autoconf 2.71 and automake 1.16.5, for example, on Ubuntu 22.04), running autoreconf gives warnings saying some macros are obsolete:

$ autoreconf -i 
configure.ac:99: warning: The macro `AC_HEADER_STDC' is obsolete.
configure.ac:99: You should run autoupdate.
./lib/autoconf/headers.m4:704: AC_HEADER_STDC is expanded from...
configure.ac:99: the top level
configure.ac:100: warning: The macro `AC_HEADER_TIME' is obsolete.
configure.ac:100: You should run autoupdate.
./lib/autoconf/headers.m4:743: AC_HEADER_TIME is expanded from...
configure.ac:100: the top level
configure.ac:93: installing 'build-aux/compile'
configure.ac:136: installing 'build-aux/config.guess'
configure.ac:136: installing 'build-aux/config.sub'
configure.ac:74: installing 'build-aux/install-sh'
configure.ac:74: installing 'build-aux/missing'
sources/Makefile.am: installing 'build-aux/depcomp'

If you run autoupdate, following this message, then configure.ac will be rewritten, making it incompatible with older versions (AC_PREREQ([2.71]) is specified).

diff --git a/configure.ac b/configure.ac
index c3568c3..ef60641 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,8 +66,8 @@ m4_define([serial_tests], [m4_esyscmd_s([
        awk '{split ($NF,a,"."); if (a[1] >= 2 || (a[1] == 1 && a[2] >= 13)) { print "serial-tests" }}'
 ])])

-AC_PREREQ(2.59)
-AC_INIT([FORM], FORM_VERSION, [https://github.com/vermaseren/form/issues])
+AC_PREREQ([2.71])
+AC_INIT([FORM],[FORM_VERSION],[https://github.com/vermaseren/form/issues])
 AC_CONFIG_SRCDIR([sources/form3.h])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_AUX_DIR([build-aux])
@@ -96,8 +96,29 @@ AC_PROG_CXX([g++ c++ icpc])
 AC_PROG_LN_S

 # Checks for header files
-AC_HEADER_STDC
-AC_HEADER_TIME
+m4_warn([obsolete],
+[The preprocessor macro `STDC_HEADERS' is obsolete.
+  Except in unusual embedded environments, you can safely include all
+  ISO C90 headers unconditionally.])dnl
+# Autoupdate added the next two lines to ensure that your configure
+# script's behavior did not change.  They are probably safe to remove.
+AC_CHECK_INCLUDES_DEFAULT
+AC_PROG_EGREP
+
+m4_warn([obsolete],
+[Update your code to rely only on HAVE_SYS_TIME_H,
+then remove this warning and the obsolete code below it.
+All current systems provide time.h; it need not be checked for.
+Not all systems provide sys/time.h, but those that do, all allow
+you to include it and time.h simultaneously.])dnl
+AC_CHECK_HEADERS_ONCE([sys/time.h])
+# Obsolete code to be removed.
+if test $ac_cv_header_sys_time_h = yes; then
+  AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include both <sys/time.h>
+            and <time.h>.  This macro is obsolete.])
+fi
+# End of obsolete code.
+
 AC_CHECK_HEADERS([fcntl.h limits.h sys/file.h])

 AC_LANG_PUSH([C++])

We may adopt the above change generated by autoupdate, except AC_PREREQ([2.71]), but the AC_CHECK_INCLUDES_DEFAULT macro is relatively new (introduced in 2.70, 2020-12-08). I think we should endure these annoying warnings and simply ignore them for the time being.