summaryrefslogtreecommitdiff
path: root/m4/strtod.m4
blob: 8185e6cff1261449eac1de1a70b31b76e550b48a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
dnl
dnl strtod.m4 --- autoconf input file for gawk
dnl
dnl Copyright (C) 2001, 2002 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);
#endif
}],
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