As detailed in PR modula2/113888, the 32-bit libm2pim/target.c doesn't
assemble in a Linux/sparc64 multilib build.  However, the root cause is
that the HAVE_EXP10* macros are never defined.  While I was at it, I
checked for other cases where the code uses HAVE_* macros that are
missing from config.h.in.

This patch adds the missing checks, changes the configure checks where
the names don't match what's used in the code, or corrects the code to
use the right names.

So far tested on sparc64-unknown-linux-gnu by building libgm2 (32 and
64-bit) and running the gm2 tests.

Ok for trunk?

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-02-12  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        libmgm2:
        PR modula2/113888
        * configure.ac (GM2_CHECK_LIB): Rename gettimeofday guard to
        HAVE_GETTIMEOFDAY.
        (GM_CHECK_LIB): Check for settimeofday.
        (GM2_CHECK_LIB): Check for exp10, exp10f, exp10l in libm.
        (AC_CHECK_DECLS): Check for getenv.
        * configure, config.h.in: Regenerate.
        * libm2pim/dtoa.cc: Rename <strings.h>, <string.h> guards to
        HAVE_STRINGS_H, HAVE_STRING_H.
        * libm2pim/ldtoa.cc: Likewise.

# HG changeset patch
# Parent  4f9cde8a5ed4b67cc625923887c1fcf610e8234c
libgm2: Define missing configure macros [PR113888]

diff --git a/libgm2/configure.ac b/libgm2/configure.ac
--- a/libgm2/configure.ac
+++ b/libgm2/configure.ac
@@ -297,7 +297,7 @@ GM2_CHECK_LIB([c],[getgid],[GETGID])
 GM2_CHECK_LIB([c],[getopt_long],[GETOPT_LONG])
 GM2_CHECK_LIB([c],[getopt_long_only],[GETOPT_LONG_ONLY])
 GM2_CHECK_LIB([c],[getpid],[GETPID])
-GM2_CHECK_LIB([c],[gettimeofday],[GETTIMEOFD])
+GM2_CHECK_LIB([c],[gettimeofday],[GETTIMEOFDAY])
 GM2_CHECK_LIB([c],[getuid],[GETUID])
 GM2_CHECK_LIB([c],[ioctl],[IOCTL])
 GM2_CHECK_LIB([c],[kill],[KILL])
@@ -311,6 +311,7 @@ GM2_CHECK_LIB([c],[read],[READ])
 GM2_CHECK_LIB([c],[select],[SELECT])
 GM2_CHECK_LIB([c],[setitimer],[SETITIMER])
 GM2_CHECK_LIB([c],[setgid],[SETGID])
+GM2_CHECK_LIB([c],[settimeofday],[SETTIMEOFDAY])
 GM2_CHECK_LIB([c],[setuid],[SETUID])
 GM2_CHECK_LIB([c],[stat],[STAT])
 GM2_CHECK_LIB([c],[strsignal],[STRSIGNAL])
@@ -323,10 +324,15 @@ GM2_CHECK_LIB([c],[unlink],[UNLINK])
 GM2_CHECK_LIB([c],[wait],[WAIT])
 GM2_CHECK_LIB([c],[write],[WRITE])
 
+GM2_CHECK_LIB([m],[exp10],[EXP10])
+GM2_CHECK_LIB([m],[exp10f],[EXP10F])
+GM2_CHECK_LIB([m],[exp10l],[EXP10L])
 GM2_CHECK_LIB([m],[signbit],[SIGNBIT])
 GM2_CHECK_LIB([m],[signbitf],[SIGNBITF])
 GM2_CHECK_LIB([m],[signbitl],[SIGNBITL])
 
+AC_CHECK_DECLS([getenv])
+
 AC_MSG_NOTICE([libgm2 has finished checking target libc and libm contents.])
 
 # We test the host here and later on check the target.
diff --git a/libgm2/libm2pim/dtoa.cc b/libgm2/libm2pim/dtoa.cc
--- a/libgm2/libm2pim/dtoa.cc
+++ b/libgm2/libm2pim/dtoa.cc
@@ -33,11 +33,11 @@ see the files COPYING3 and COPYING.RUNTI
 #define M2EXPORT(FUNC) m2pim ## _M2_dtoa_ ## FUNC
 #define M2LIBNAME "m2pim"
 
-#if defined(HAVE_STRINGS)
+#if defined(HAVE_STRINGS_H)
 #include <strings.h>
 #endif
 
-#if defined(HAVE_STRING)
+#if defined(HAVE_STRING_H)
 #include <string.h>
 #endif
 
diff --git a/libgm2/libm2pim/ldtoa.cc b/libgm2/libm2pim/ldtoa.cc
--- a/libgm2/libm2pim/ldtoa.cc
+++ b/libgm2/libm2pim/ldtoa.cc
@@ -34,11 +34,11 @@ see the files COPYING3 and COPYING.RUNTI
 #define M2EXPORT(FUNC) m2pim ## _M2_ldtoa_ ## FUNC
 #define M2LIBNAME "m2pim"
 
-#if defined(HAVE_STRINGS)
+#if defined(HAVE_STRINGS_H)
 #include <strings.h>
 #endif
 
-#if defined(HAVE_STRING)
+#if defined(HAVE_STRING_H)
 #include <string.h>
 #endif
 

Reply via email to