File: fopen.m4

package info (click to toggle)
gmap 2012-06-12-1
  • links: PTS, VCS
  • area: non-free
  • in suites: wheezy
  • size: 22,452 kB
  • sloc: ansic: 366,773; sh: 10,192; perl: 4,953; makefile: 356
file content (27 lines) | stat: -rw-r--r-- 707 bytes parent folder | download | duplicates (6)
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


define([_ACX_FUNC_FOPEN], [
AC_CACHE_CHECK([whether fopen accepts "$1" mode],
               [cvx_cv_func_fopen_$1],
               [AC_TRY_RUN([
#include <stdio.h>
int
main () {
  FILE *fp = fopen("conftest.bin","w$1");
  fprintf(fp,"\n");
  fclose(fp);
  return 0;
}],
                  [cvx_cv_func_fopen_$1=yes],
                  [cvx_cv_func_fopen_$1=no],
                  [cvx_cv_func_fopen_$1=no])])
if test x$cvx_cv_func_fopen_$1 = xyes; then
  AC_DEFINE([$2], 1,
            [Define this if we can use the "$1" mode for fopen safely.])
fi[]dnl
])


AC_DEFUN([ACX_FUNC_FOPEN_BINARY], [_ACX_FUNC_FOPEN(b, USE_FOPEN_BINARY)])
AC_DEFUN([ACX_FUNC_FOPEN_TEXT], [_ACX_FUNC_FOPEN(t, USE_FOPEN_TEXT)])