Remove dependencies on unlocked-io.
[gnulib.git] / m4 / unlocked-io.m4
1 # unlocked-io.m4 serial 10
2
3 # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
4 # Foundation, Inc.
5
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software Foundation,
18 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20 dnl From Jim Meyering.
21 dnl
22 dnl See if the glibc *_unlocked I/O macros or functions are available.
23 dnl Use only those *_unlocked macros or functions that are declared
24 dnl (because some of them were declared in Solaris 2.5.1 but were removed
25 dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run
26 dnl on Solaris 2.6).
27
28 AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO],
29 [
30   AC_DEFINE([USE_UNLOCKED_IO], 1,
31     [Define to 1 if you want getc etc. to use unlocked I/O if available.
32      Unlocked I/O can improve performance in unithreaded apps,
33      but it is not safe for multithreaded apps.])
34
35   dnl Persuade glibc and Solaris <stdio.h> to declare
36   dnl fgets_unlocked(), fputs_unlocked() etc.
37   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
38
39   AC_CHECK_DECLS_ONCE(
40      [clearerr_unlocked feof_unlocked ferror_unlocked
41       fflush_unlocked fgets_unlocked fputc_unlocked fputs_unlocked
42       fread_unlocked fwrite_unlocked getc_unlocked
43       getchar_unlocked putc_unlocked putchar_unlocked])
44 ])