aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2025-03-21 10:22:58 +0000
committerIain Sandoe <iain@sandoe.co.uk>2025-04-04 19:38:16 +0100
commit8f1f35f1cb1c31e2822e241e56e0a04927e1b78a (patch)
tree5734c74d947b9e717b4a9bb08c2b9843c042b668
parente70fe5ed46ab129a8b1da961c47d3fb75b11b988 (diff)
downloadgcc-8f1f35f1cb1c31e2822e241e56e0a04927e1b78a.zip
gcc-8f1f35f1cb1c31e2822e241e56e0a04927e1b78a.tar.gz
gcc-8f1f35f1cb1c31e2822e241e56e0a04927e1b78a.tar.bz2
libgcobol: Check if the target needs libm.
Use the libtool config check and $(LIBM). libgcobol/ChangeLog: * Makefile.am: Use $(LIBM) to add the math lib when it is needed. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Check if the target wants libm. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
-rw-r--r--libgcobol/Makefile.am2
-rw-r--r--libgcobol/Makefile.in3
-rwxr-xr-xlibgcobol/configure146
-rw-r--r--libgcobol/configure.ac1
4 files changed, 148 insertions, 4 deletions
diff --git a/libgcobol/Makefile.am b/libgcobol/Makefile.am
index cafb733..4521742 100644
--- a/libgcobol/Makefile.am
+++ b/libgcobol/Makefile.am
@@ -48,7 +48,7 @@ libgcobol_la_LINK = $(LIBTOOL) --mode=link --tag=CXX $(CXX) \
-Wc,-shared-libgcc \
-version-info $(LIBGCOBOL_VERSION) \
-lstdc++ \
- $(LTLDFLAGS) $(LTLIBICONV)
+ $(LTLDFLAGS) $(LTLIBICONV) $(LIBM)
WARN_CFLAGS = -W -Wall -Wwrite-strings
diff --git a/libgcobol/Makefile.in b/libgcobol/Makefile.in
index c4a562a..0f0d9b6 100644
--- a/libgcobol/Makefile.in
+++ b/libgcobol/Makefile.in
@@ -305,6 +305,7 @@ LD = @LD@
LDFLAGS = @LDFLAGS@
LIBGCOBOL_VERSION = @LIBGCOBOL_VERSION@
LIBICONV = @LIBICONV@
+LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
@@ -428,7 +429,7 @@ libgcobol_la_LINK = $(LIBTOOL) --mode=link --tag=CXX $(CXX) \
-Wc,-shared-libgcc \
-version-info $(LIBGCOBOL_VERSION) \
-lstdc++ \
- $(LTLDFLAGS) $(LTLIBICONV)
+ $(LTLDFLAGS) $(LTLIBICONV) $(LIBM)
WARN_CFLAGS = -W -Wall -Wwrite-strings
AM_CXXFLAGS = $(CXXFLAGS_FOR_TARGET)
diff --git a/libgcobol/configure b/libgcobol/configure
index e12b72e..e7b3b83 100755
--- a/libgcobol/configure
+++ b/libgcobol/configure
@@ -646,6 +646,7 @@ enable_static
enable_shared
ENABLE_DARWIN_AT_RPATH_FALSE
ENABLE_DARWIN_AT_RPATH_TRUE
+LIBM
CXXCPP
OTOOL64
OTOOL
@@ -12908,7 +12909,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12911 "configure"
+#line 12912 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13014,7 +13015,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 13017 "configure"
+#line 13018 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16348,6 +16349,147 @@ enable_dlopen=yes
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5
+$as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; }
+if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmw $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char _mwvalidcheckl ();
+int
+main ()
+{
+return _mwvalidcheckl ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mw__mwvalidcheckl=yes
+else
+ ac_cv_lib_mw__mwvalidcheckl=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5
+$as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; }
+if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then :
+ LIBM="-lmw"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_cos=yes
+else
+ ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+ LIBM="$LIBM -lm"
+fi
+
+ ;;
+*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if ${ac_cv_lib_m_cos+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_cos=yes
+else
+ ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = xyes; then :
+ LIBM="-lm"
+fi
+
+ ;;
+esac
+
+
if test x$enable_darwin_at_rpath = xyes; then
ENABLE_DARWIN_AT_RPATH_TRUE=
diff --git a/libgcobol/configure.ac b/libgcobol/configure.ac
index 34c0235..6b287a1 100644
--- a/libgcobol/configure.ac
+++ b/libgcobol/configure.ac
@@ -209,6 +209,7 @@ AM_PROG_LIBTOOL
LT_INIT
AC_LIBTOOL_DLOPEN
+LT_LIB_M
AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])