diff --git a/ChangeLog b/ChangeLog index 6ca8c78..4f6c627 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-08-27 Bruno Haible + + 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 * autoconf/aclocal.m4 (CL_RUSAGE): Fix error when cross-compiling. diff --git a/autoconf/aclocal.m4 b/autoconf/aclocal.m4 index 3d2e018..3a2727b 100644 --- a/autoconf/aclocal.m4 +++ b/autoconf/aclocal.m4 @@ -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 -*-