aboutsummaryrefslogtreecommitdiffstats
path: root/m4/strtod.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/strtod.m4')
-rw-r--r--m4/strtod.m458
1 files changed, 58 insertions, 0 deletions
diff --git a/m4/strtod.m4 b/m4/strtod.m4
new file mode 100644
index 00000000..a719fb92
--- /dev/null
+++ b/m4/strtod.m4
@@ -0,0 +1,58 @@
+dnl
+dnl strtod.m4 --- autoconf input file for gawk
+dnl
+dnl Copyright (C) 2001 the Free Software Foundation, Inc.
+dnl
+dnl This file is part of GAWK, the GNU implementation of the
+dnl AWK Progamming Language.
+dnl
+dnl GAWK is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl GAWK is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+
+dnl Check for strtod with C89 semantics
+
+AC_DEFUN(GAWK_AC_FUNC_STRTOD_C89,
+[
+AC_CHECK_HEADERS(stdlib.h)
+AC_CHECK_FUNCS(strtod)
+AC_CACHE_CHECK([for strtod with C89 semantics], gawk_ac_cv_func_strtod_c89,
+[AC_TRY_RUN(
+[/* Test program from Arnold Robbins (arnold@skeeve.com) */
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#else
+extern double strtod();
+#endif
+
+int
+main ()
+{
+#if ! HAVE_STRTOD
+ exit(1);
+#else
+ double d;
+ char *str = "0x345a";
+
+ d = strtod(str, 0);
+ if (d == 0)
+ exit (0);
+ else
+ exit (1);
+}],
+gawk_ac_cv_func_strtod_c89=yes, gawk_ac_cv_func_strtod_c89=no,
+gawk_ac_cv_func_strtod_c89=no)])
+if test $gawk_ac_cv_func_strtod_c89 = no; then
+ AC_DEFINE(STRTOD_NOT_C89)
+fi
+])# GAWK_FUNC_STRTOD_C89