Mercurial > hg > octave-nkf > gnulib-hg
annotate m4/fpurge.m4 @ 14079:97fc9a21a8fb
maint: update almost all copyright ranges to include 2011
Run the new "make update-copyright" rule.
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Sat, 01 Jan 2011 20:17:23 +0100 |
parents | c2cbabec01dd |
children | 69610f25d34f |
rev | line source |
---|---|
11842 | 1 # fpurge.m4 serial 6 |
14079
97fc9a21a8fb
maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents:
12559
diff
changeset
|
2 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. |
8693 | 3 dnl This file is free software; the Free Software Foundation |
4 dnl gives unlimited permission to copy and/or distribute it, | |
5 dnl with or without modifications, as long as this notice is preserved. | |
6 | |
7 AC_DEFUN([gl_FUNC_FPURGE], | |
8 [ | |
11653 | 9 AC_REQUIRE([gl_STDIO_H_DEFAULTS]) |
8693 | 10 AC_CHECK_FUNCS_ONCE([fpurge]) |
11 AC_CHECK_FUNCS_ONCE([__fpurge]) | |
11653 | 12 AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]]) |
13 if test "x$ac_cv_func_fpurge" = xyes; then | |
11839
04ea0561a820
fpurge: don't wrap working cygwin implementation
Eric Blake <ebb9@byu.net>
parents:
11653
diff
changeset
|
14 # Detect BSD bug. Only cygwin 1.7 is known to be immune. |
04ea0561a820
fpurge: don't wrap working cygwin implementation
Eric Blake <ebb9@byu.net>
parents:
11653
diff
changeset
|
15 AC_CACHE_CHECK([whether fpurge works], [gl_cv_func_fpurge_works], |
04ea0561a820
fpurge: don't wrap working cygwin implementation
Eric Blake <ebb9@byu.net>
parents:
11653
diff
changeset
|
16 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h> |
04ea0561a820
fpurge: don't wrap working cygwin implementation
Eric Blake <ebb9@byu.net>
parents:
11653
diff
changeset
|
17 ]], [FILE *f = fopen ("conftest.txt", "w+"); |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
18 if (!f) return 1; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
19 if (fputc ('a', f) != 'a') return 2; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
20 rewind (f); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
21 if (fgetc (f) != 'a') return 3; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
22 if (fgetc (f) != EOF) return 4; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
23 if (fpurge (f) != 0) return 5; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
24 if (putc ('b', f) != 'b') return 6; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
25 if (fclose (f) != 0) return 7; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
26 if ((f = fopen ("conftest.txt", "r")) == NULL) return 8; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
27 if (fgetc (f) != 'a') return 9; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
28 if (fgetc (f) != 'b') return 10; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
29 if (fgetc (f) != EOF) return 11; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
30 if (fclose (f) != 0) return 12; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
31 if (remove ("conftest.txt") != 0) return 13; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11842
diff
changeset
|
32 return 0;])], |
11839
04ea0561a820
fpurge: don't wrap working cygwin implementation
Eric Blake <ebb9@byu.net>
parents:
11653
diff
changeset
|
33 [gl_cv_func_fpurge_works=yes], [gl_cv_func_fpurge_works=no], |
04ea0561a820
fpurge: don't wrap working cygwin implementation
Eric Blake <ebb9@byu.net>
parents:
11653
diff
changeset
|
34 [gl_cv_func_fpurge_works='guessing no'])]) |
04ea0561a820
fpurge: don't wrap working cygwin implementation
Eric Blake <ebb9@byu.net>
parents:
11653
diff
changeset
|
35 if test "x$gl_cv_func_fpurge_works" != xyes; then |
04ea0561a820
fpurge: don't wrap working cygwin implementation
Eric Blake <ebb9@byu.net>
parents:
11653
diff
changeset
|
36 REPLACE_FPURGE=1 |
11840 | 37 AC_LIBOBJ([fpurge]) |
11839
04ea0561a820
fpurge: don't wrap working cygwin implementation
Eric Blake <ebb9@byu.net>
parents:
11653
diff
changeset
|
38 fi |
11842 | 39 else |
40 AC_LIBOBJ([fpurge]) | |
11653 | 41 fi |
42 if test "x$ac_cv_have_decl_fpurge" = xno; then | |
43 HAVE_DECL_FPURGE=0 | |
44 fi | |
8693 | 45 ]) |