]> www.ginac.de Git - cln.git/commitdiff
Define HAVE_LONGLONG and HAVE_LONGDOUBLE when cross-compiling.
authorBruno Haible <bruno@clisp.org>
Mon, 29 Aug 2005 13:08:45 +0000 (13:08 +0000)
committerBruno Haible <bruno@clisp.org>
Mon, 29 Aug 2005 13:08:45 +0000 (13:08 +0000)
ChangeLog
autoconf/aclocal.m4

index 6ca8c78952c94390343305d75bb82f30cf596399..4f6c6279205d7786ab316b5674e1e18965a1b693 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-08-27  Bruno Haible  <bruno@clisp.org>
+
+       Define HAVE_LONGLONG and HAVE_LONGDOUBLE when cross-compiling.
+       * autoconf/aclocal.m4 (CL_LONGLONG, CL_LONGDOUBLE): When cross-
+       compiling, use the test code from gnulib.
+
 2005-08-27  Bruno Haible  <bruno@clisp.org>
 
        * autoconf/aclocal.m4 (CL_RUSAGE): Fix error when cross-compiling.
index 3d2e0188d299b5af0a2a603b807e8482794f6d93..3a2727b098f1dccc7df560d7fa313c66bcd169b2 100644 (file)
@@ -595,14 +595,14 @@ echo "cross-compiling - cannot create $cl_machine_file_h"
 fi
 ])
 
-dnl Copyright (C) 1993-2002 Free Software Foundation, Inc.
+dnl Copyright (C) 1993-2005 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
 dnl that contains a configuration script generated by Autoconf, under
 dnl the same distribution terms as the rest of that program.
 
-dnl From Bruno Haible, Marcus Daniels.
+dnl From Bruno Haible, Marcus Daniels, Paul Eggert.
 
 AC_PREREQ(2.13)
 
@@ -610,25 +610,29 @@ AC_DEFUN([CL_LONGDOUBLE],
 [AC_CACHE_CHECK(for long double type, cl_cv_c_longdouble, [
 AC_TRY_RUN([int main()
 { long double x = 2.7182818284590452354L; x = x*x; exit (x==0.0L); }],
-cl_cv_c_longdouble=yes, cl_cv_c_longdouble=no,
-dnl When cross-compiling, don't assume anything.
-cl_cv_c_longdouble="guessing no")
-])
-case "$cl_cv_c_longdouble" in
-  *yes) AC_DEFINE(HAVE_LONGDOUBLE) ;;
-  *no) ;;
-esac
+cl_cv_c_longdouble=yes, cl_cv_c_longdouble=no, [
+dnl When cross-compiling, use the test from gnulib.
+AC_TRY_COMPILE([
+  /* The Stardent Vistra knows sizeof(long double), but does not support it.  */
+  long double foo = 0.0;
+  /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
+  int array [2*(sizeof(long double) >= sizeof(double)) - 1];
+  ], , cl_cv_c_longdouble=yes, cl_cv_c_longdouble=no)])
+])
+if test $cl_cv_c_longdouble = yes; then
+  AC_DEFINE(HAVE_LONGDOUBLE)
+fi
 ])
 
 dnl -*- Autoconf -*-
-dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
+dnl Copyright (C) 1993-2005 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
 dnl that contains a configuration script generated by Autoconf, under
 dnl the same distribution terms as the rest of that program.
 
-dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
+dnl From Bruno Haible, Marcus Daniels, Sam Steingold, Paul Eggert.
 
 AC_PREREQ(2.57)
 
@@ -648,14 +652,17 @@ AC_TRY_RUN([int main()
     exit(!(((long long) x)*((long long) y)>>32 == z));
   }
 }],
-cl_cv_c_longlong=yes, cl_cv_c_longlong=no,
-dnl When cross-compiling, don't assume anything.
-cl_cv_c_longlong="guessing no")
-])
-case "$cl_cv_c_longlong" in
-  *yes) AC_DEFINE(HAVE_LONGLONG,,[compiler supports the `long long' type]) ;;
-  *no) ;;
-esac
+cl_cv_c_longlong=yes, cl_cv_c_longlong=no, [
+dnl When cross-compiling, use the test from gnulib.
+AC_TRY_LINK([long long ll = 1LL; int i = 63;],
+  [long long llmax = (long long) -1;
+   return ll << i | ll >> i | llmax / ll | llmax % ll;],
+  cl_cv_c_longlong=yes,
+  cl_cv_c_longlong=no)])
+])
+if test $cl_cv_c_longlong = yes; then
+  AC_DEFINE(HAVE_LONGLONG,,[compiler supports the `long long' type])
+fi
 ])
 
 dnl -*- Autoconf -*-