annotate m4/fpurge.m4 @ 17921:58c1b50299a6

getopt: give accurate ambiguity diagnostic on mem exhaustion * lib/getopt.c (_getopt_internal_r): The previous commit broke out the loop too early, which could give a false indication of ambiguous options under memory exhaustion.
author Pádraig Brady <P@draigBrady.com>
date Wed, 18 Feb 2015 22:37:31 +0000
parents ab58d4870664
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14944
69610f25d34f fpurge: Move AC_LIBOBJ invocations to module description.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
1 # fpurge.m4 serial 7
17848
ab58d4870664 version-etc: new year
Paul Eggert <eggert@cs.ucla.edu>
parents: 17587
diff changeset
2 dnl Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
8693
245bb390f2ad New module 'fpurge'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
245bb390f2ad New module 'fpurge'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
245bb390f2ad New module 'fpurge'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
245bb390f2ad New module 'fpurge'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
245bb390f2ad New module 'fpurge'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 AC_DEFUN([gl_FUNC_FPURGE],
245bb390f2ad New module 'fpurge'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 [
11653
ecb384fccb5b fpurge: migrate into <stdio.h>
Eric Blake <ebb9@byu.net>
parents: 8759
diff changeset
9 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
8693
245bb390f2ad New module 'fpurge'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 AC_CHECK_FUNCS_ONCE([fpurge])
245bb390f2ad New module 'fpurge'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 AC_CHECK_FUNCS_ONCE([__fpurge])
11653
ecb384fccb5b fpurge: migrate into <stdio.h>
Eric Blake <ebb9@byu.net>
parents: 8759
diff changeset
12 AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]])
ecb384fccb5b fpurge: migrate into <stdio.h>
Eric Blake <ebb9@byu.net>
parents: 8759
diff changeset
13 if test "x$ac_cv_func_fpurge" = xyes; then
14944
69610f25d34f fpurge: Move AC_LIBOBJ invocations to module description.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
14 HAVE_FPURGE=1
11839
04ea0561a820 fpurge: don't wrap working cygwin implementation
Eric Blake <ebb9@byu.net>
parents: 11653
diff changeset
15 # 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
16 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
17 [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
18 ]], [FILE *f = fopen ("conftest.txt", "w+");
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11842
diff changeset
19 if (!f) return 1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11842
diff changeset
20 if (fputc ('a', f) != 'a') return 2;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11842
diff changeset
21 rewind (f);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11842
diff changeset
22 if (fgetc (f) != 'a') return 3;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11842
diff changeset
23 if (fgetc (f) != EOF) return 4;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11842
diff changeset
24 if (fpurge (f) != 0) return 5;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11842
diff changeset
25 if (putc ('b', f) != 'b') return 6;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11842
diff changeset
26 if (fclose (f) != 0) return 7;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11842
diff changeset
27 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
28 if (fgetc (f) != 'a') return 9;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11842
diff changeset
29 if (fgetc (f) != 'b') return 10;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11842
diff changeset
30 if (fgetc (f) != EOF) return 11;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11842
diff changeset
31 if (fclose (f) != 0) return 12;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11842
diff changeset
32 if (remove ("conftest.txt") != 0) return 13;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11842
diff changeset
33 return 0;])],
11839
04ea0561a820 fpurge: don't wrap working cygwin implementation
Eric Blake <ebb9@byu.net>
parents: 11653
diff changeset
34 [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
35 [gl_cv_func_fpurge_works='guessing no'])])
04ea0561a820 fpurge: don't wrap working cygwin implementation
Eric Blake <ebb9@byu.net>
parents: 11653
diff changeset
36 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
37 REPLACE_FPURGE=1
04ea0561a820 fpurge: don't wrap working cygwin implementation
Eric Blake <ebb9@byu.net>
parents: 11653
diff changeset
38 fi
11842
f4bcc8a0cd47 fpurge: fix previous commits
Eric Blake <ebb9@byu.net>
parents: 11840
diff changeset
39 else
14944
69610f25d34f fpurge: Move AC_LIBOBJ invocations to module description.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
40 HAVE_FPURGE=0
11653
ecb384fccb5b fpurge: migrate into <stdio.h>
Eric Blake <ebb9@byu.net>
parents: 8759
diff changeset
41 fi
ecb384fccb5b fpurge: migrate into <stdio.h>
Eric Blake <ebb9@byu.net>
parents: 8759
diff changeset
42 if test "x$ac_cv_have_decl_fpurge" = xno; then
ecb384fccb5b fpurge: migrate into <stdio.h>
Eric Blake <ebb9@byu.net>
parents: 8759
diff changeset
43 HAVE_DECL_FPURGE=0
ecb384fccb5b fpurge: migrate into <stdio.h>
Eric Blake <ebb9@byu.net>
parents: 8759
diff changeset
44 fi
8693
245bb390f2ad New module 'fpurge'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 ])