]> www.ginac.de Git - cln.git/blobdiff - autoconf/aclocal.m4
Make it possible to cross-compile CLN.
[cln.git] / autoconf / aclocal.m4
index 388b458167a8aa33dc88f634ace202ae17527b91..ad086e15e4ddec895e3992863c178619931472bc 100644 (file)
@@ -11,6 +11,9 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
+m4_include([intparam.m4])
+m4_include([floatparam.m4])
+
 dnl -*- Autoconf -*-
 dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
@@ -543,7 +546,7 @@ 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
@@ -554,14 +557,15 @@ dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
 
 AC_PREREQ(2.13)
 
+dnl CL_MACHINE([MESSAGE], [PROGRAM_TO_RUN], [CROSS_MACRO], [DESTINATION], [CACHE_VAR])
 AC_DEFUN([CL_MACHINE],
 [AC_REQUIRE([AC_PROG_CC])dnl
 AC_REQUIRE([AC_C_CHAR_UNSIGNED])dnl
 cl_machine_file_c=$2
-cl_machine_file_h=$3
-if test $cross_compiling = no; then
-if test -z "$[$4]"; then
+if test -z "$[$5]"; then
 AC_CHECKING(for [$1])
+if test $cross_compiling = no; then
+cl_machine_file_h=$4
 cat > conftest.$ac_ext <<EOF
 #include "confdefs.h"
 EOF
@@ -584,25 +588,25 @@ if test -s conftest; then
     rm -f "$cl_machine_file_h"
     mv conftest.h "$cl_machine_file_h"
   fi
-  [$4]=1
+  [$5]=1
 else
   echo "creation of $cl_machine_file_h failed"
 fi
 rm -f conftest*
-fi
 else
-echo "cross-compiling - cannot create $cl_machine_file_h"
+$3([$4])
+fi
 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 +614,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 +656,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 -*-
@@ -812,7 +823,7 @@ cl_cv_func_getrusage_works=no,
 dnl When cross-compiling, don't assume anything.
 cl_cv_func_getrusage_works="guessing no")])
   fi
-  if test $cl_cv_func_getrusage_works = yes; then
+  if test "$cl_cv_func_getrusage_works" = yes; then
     AC_DEFINE(HAVE_GETRUSAGE,,[have <sys/time.h>, the getrusage() function, the struct rusage type, and <sys/resource.h> defines RUSAGE_SELF])
     AC_DEFINE_UNQUOTED(RUSAGE_WHO_T,$cl_cv_proto_getrusage_arg1,[type of `who' in getrusage() declaration])
   fi
@@ -868,5 +879,6 @@ fi
 fi
 ])
 
+m4_include([m4/cc.m4])
 m4_include([m4/gmp.m4])
 m4_include([m4/libtool.m4])