maint: update copyright
[gnulib.git] / m4 / popen.m4
1 # popen.m4 serial 5
2 dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
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_POPEN],
8 [
9   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
10   AC_CHECK_FUNCS_ONCE([popen])
11   if test $ac_cv_func_popen = no; then
12     HAVE_POPEN=0
13   else
14     AC_CACHE_CHECK([whether popen works with closed stdin],
15       [gl_cv_func_popen_works],
16       [
17         AC_RUN_IFELSE(
18           [AC_LANG_PROGRAM(
19              [[#include <stdio.h>]],
20              [[int result = 0;
21                FILE *child;
22                fclose (stdin);
23                fclose (stdout);
24                child = popen ("echo a", "r");
25                if (fgetc (child) != 'a')
26                  result |= 1;
27                if (pclose (child) != 0)
28                  result |= 2;
29                return result;
30              ]])],
31           [gl_cv_func_popen_works=yes],
32           [gl_cv_func_popen_works=no],
33           dnl For now, only cygwin 1.5 or older is known to be broken.
34           [gl_cv_func_popen_works='guessing yes'])
35       ])
36     if test "$gl_cv_func_popen_works" = no; then
37       REPLACE_POPEN=1
38     fi
39   fi
40 ])
41
42 # Prerequisites of lib/popen.c.
43 AC_DEFUN([gl_PREREQ_POPEN],
44 [
45   :
46 ])