bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

copysignf: fix link error on HP-UX with cc


From: Bruno Haible
Subject: copysignf: fix link error on HP-UX with cc
Date: Tue, 11 Feb 2020 04:17:01 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-171-generic; KDE/5.18.0; x86_64; ; )

On HP-UX 11.31/ia64 with cc, I'm seeing this link error:

cc +DD64 -AC99 -D_HPUX_SOURCE -D_XOPEN_SOURCE=600  -g  
-L/home/haible/prefix-hpux113ia64-64-cc/lib -o test-copysignf test-copysignf.o 
libtests.a ../gllib/libgnu.a libtests.a
ld: Unsatisfied symbol "_copysignf" in file test-copysignf.o
1 error.
gmake[4]: *** [test-copysignf] Error 1

This patch fixes it.


2020-02-10  Bruno Haible  <address@hidden>

        copysignf: Fix link error on HP-UX with cc.
        * m4/copysignf.m4 (gl_FUNC_COPYSIGNF): Require AC_CANONICAL_HOST. On
        HP-UX, set COPYSIGNF_LIBM to -lm.

diff --git a/m4/copysignf.m4 b/m4/copysignf.m4
index c6dea3e..284eb74 100644
--- a/m4/copysignf.m4
+++ b/m4/copysignf.m4
@@ -1,4 +1,4 @@
-# copysignf.m4 serial 3
+# copysignf.m4 serial 4
 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is 
preserved.
 AC_DEFUN([gl_FUNC_COPYSIGNF],
 [
   AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
 
   dnl Persuade glibc <math.h> to declare copysignf().
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
@@ -28,7 +29,12 @@ AC_DEFUN([gl_FUNC_COPYSIGNF],
   else
     HAVE_COPYSIGNF=0
     HAVE_DECL_COPYSIGNF=0
-    COPYSIGNF_LIBM=
+    dnl On HP-UX 11.31/ia64, cc has a built-in for copysignf that redirects
+    dnl to the symbol '_copysignf', defined in libm, not libc.
+    case "$host_os" in
+      hpux*) COPYSIGNF_LIBM='-lm' ;;
+      *)     COPYSIGNF_LIBM= ;;
+    esac
   fi
   AC_SUBST([COPYSIGNF_LIBM])
 ])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]