pod2html(1) temporary files are global illness.
[macros.git] / need-declaration.m4
1 dnl $Id$
2 dnl See whether we need a declaration for a function.
3 dnl Copyright (C) 2003 Jan Kratochvil <project-macros@jankratochvil.net>
4 dnl 
5 dnl This program is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; exactly version 2 of June 1991 is required
8 dnl 
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl 
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program; if not, write to the Free Software
16 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
18
19 dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
20 AC_DEFUN([GCC_NEED_DECLARATION],
21 [AC_MSG_CHECKING([whether $1 must be declared])
22 AC_CACHE_VAL(gcc_cv_decl_needed_$1,
23 [AC_TRY_COMPILE([
24 #include <stdio.h>
25 #ifdef HAVE_STRING_H
26 #include <string.h>
27 #else
28 #ifdef HAVE_STRINGS_H
29 #include <strings.h>
30 #endif
31 #endif
32 #ifdef HAVE_STDLIB_H
33 #include <stdlib.h>
34 #endif
35 #ifdef HAVE_UNISTD_H
36 #include <unistd.h>
37 #endif
38 $2],
39 [char *(*pfn) = (char *(*)) $1],
40 eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
41 if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then
42   AC_MSG_RESULT(yes)
43   gcc_need_declarations="$gcc_need_declarations $1"
44   gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
45   AC_DEFINE_UNQUOTED($gcc_tr_decl)
46 else
47   AC_MSG_RESULT(no)
48 fi
49 ])dnl
50
51 dnl Check multiple functions to see whether each needs a declaration.
52 dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
53 AC_DEFUN([GCC_NEED_DECLARATIONS],
54 [for ac_func in $1
55 do
56 GCC_NEED_DECLARATION($ac_func, $2)
57 done
58 ]
59 )