aclocal.m4 revision 79543
118099Spstdnl Autoconf macros for groff.
275584Srudnl Copyright (C) 1989-1995, 2001 Free Software Foundation, Inc.
318099Spstdnl 
418099Spstdnl This file is part of groff.
518099Spstdnl 
618099Spstdnl groff is free software; you can redistribute it and/or modify it under
718099Spstdnl the terms of the GNU General Public License as published by the Free
818099Spstdnl Software Foundation; either version 2, or (at your option) any later
918099Spstdnl version.
1018099Spstdnl 
1118099Spstdnl groff is distributed in the hope that it will be useful, but WITHOUT ANY
1218099Spstdnl WARRANTY; without even the implied warranty of MERCHANTABILITY or
1318099Spstdnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1418099Spstdnl for more details.
1518099Spstdnl 
1618099Spstdnl You should have received a copy of the GNU General Public License along
1718099Spstdnl with groff; see the file COPYING.  If not, write to the Free Software
1818099Spstdnl Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1918099Spstdnl
2055839Sasmodaidnl
2118099SpstAC_DEFUN(GROFF_PRINT,
2255839Sasmodai[if test -z "$PSPRINT"; then
2318099Spst	AC_CHECK_PROGS(LPR,lpr)
2418099Spst	AC_CHECK_PROGS(LP,lp)
2555839Sasmodai	if test -n "$LPR" && test -n "$LP"; then
2618099Spst		# HP-UX provides an lpr command that emulates lpr using lp,
2718099Spst		# but it doesn't have lpq; in this case we want to use lp
2818099Spst		# rather than lpr.
2918099Spst		AC_CHECK_PROGS(LPQ,lpq)
3018099Spst		test -n "$LPQ" || LPR=
3118099Spst	fi
3255839Sasmodai	if test -n "$LPR"; then
3318099Spst		PSPRINT="$LPR"
3455839Sasmodai	elif test -n "$LP"; then
3518099Spst		PSPRINT="$LP"
3618099Spst	fi
3718099Spstfi
3818099SpstAC_SUBST(PSPRINT)
3918099SpstAC_MSG_CHECKING([for command to use for printing PostScript files])
4018099SpstAC_MSG_RESULT($PSPRINT)
4118099Spst# Figure out DVIPRINT from PSPRINT.
4218099SpstAC_MSG_CHECKING([for command to use for printing dvi files])
4355839Sasmodaiif test -n "$PSPRINT" && test -z "$DVIPRINT"; then
4455839Sasmodai	if test "X$PSPRINT" = "Xlpr"; then
4518099Spst		DVIPRINT="lpr -d"
4618099Spst	else
4718099Spst		DVIPRINT="$PSPRINT"
4818099Spst	fi
4918099Spstfi
5018099SpstAC_SUBST(DVIPRINT)
5118099SpstAC_MSG_RESULT($DVIPRINT)])dnl
5255839Sasmodaidnl
5355839Sasmodaidnl
5418099Spstdnl Bison generated parsers have problems with C++ compilers other than g++.
5518099Spstdnl So byacc is preferred over bison.
5655839Sasmodaidnl
5718099SpstAC_DEFUN(GROFF_PROG_YACC,
5869626Sru[AC_CHECK_PROGS(YACC, byacc 'bison -y', yacc)])dnl
5955839Sasmodaidnl
6055839Sasmodaidnl
6118099Spstdnl GROFF_CSH_HACK(if hack present, if not present)
6255839Sasmodaidnl
6318099SpstAC_DEFUN(GROFF_CSH_HACK,
6418099Spst[AC_MSG_CHECKING([for csh hash hack])
6518099Spstcat <<EOF >conftest.sh
6618099Spst#!/bin/sh
6718099Spsttrue || exit 0
6818099Spstexport PATH || exit 0
6918099Spstexit 1
7018099SpstEOF
7118099Spstchmod +x conftest.sh
7255839Sasmodaiif echo ./conftest.sh | (csh >/dev/null 2>&1) >/dev/null 2>&1; then
7318099Spst	AC_MSG_RESULT(yes); $1
7418099Spstelse
7518099Spst	AC_MSG_RESULT(no); $2
7618099Spstfi
7755839Sasmodairm -f conftest.sh])dnl
7855839Sasmodaidnl
7955839Sasmodaidnl
8018099Spstdnl From udodo!hans@relay.NL.net (Hans Zuidam)
8155839Sasmodaidnl
8218099SpstAC_DEFUN(GROFF_ISC_SYSV3,
8318099Spst[AC_MSG_CHECKING([for ISC 3.x or 4.x])
8418099Spstchangequote(,)dnl
8518099Spstif grep '[34]\.' /usr/options/cb.name >/dev/null 2>&1
8618099Spstchangequote([,])dnl
8718099Spstthen
8818099Spst	AC_MSG_RESULT(yes)
8918099Spst	AC_DEFINE(_SYSV3)
9018099Spstelse
9118099Spst	AC_MSG_RESULT(no)
9218099Spstfi])dnl
9355839Sasmodaidnl
9455839Sasmodaidnl
9518099SpstAC_DEFUN(GROFF_POSIX,
9618099Spst[AC_MSG_CHECKING([whether -D_POSIX_SOURCE is necessary])
9779543SruAC_LANG_PUSH(C++)
9818099SpstAC_TRY_COMPILE([#include <stdio.h>
9918099Spstextern "C" { void fileno(int); }],,
10018099SpstAC_MSG_RESULT(yes);AC_DEFINE(_POSIX_SOURCE),
10118099SpstAC_MSG_RESULT(no))
10279543SruAC_LANG_POP(C++)])dnl
10355839Sasmodaidnl
10455839Sasmodaidnl
10569626Srudnl srand() of SunOS 4.1.3 has return type int instead of void
10655839Sasmodaidnl
10769626SruAC_DEFUN(GROFF_SRAND,
10879543Sru[AC_LANG_PUSH(C++)
10969626SruAC_MSG_CHECKING([for return type of srand])
11018099SpstAC_TRY_COMPILE([#include <stdlib.h>
11169626Sruextern "C" { void srand(unsigned int); }],,
11269626SruAC_MSG_RESULT(void);AC_DEFINE(RET_TYPE_SRAND_IS_VOID),
11369626SruAC_MSG_RESULT(int))
11479543SruAC_LANG_POP(C++)])dnl
11555839Sasmodaidnl
11655839Sasmodaidnl
11755839SasmodaiAC_DEFUN(GROFF_SYS_NERR,
11879543Sru[AC_LANG_PUSH(C++)
11955839SasmodaiAC_MSG_CHECKING([for sys_nerr in <errno.h> or <stdio.h>])
12055839SasmodaiAC_TRY_COMPILE([#include <errno.h>
12155839Sasmodai#include <stdio.h>],
12255839Sasmodai[int k; k = sys_nerr;],
12355839SasmodaiAC_MSG_RESULT(yes);AC_DEFINE(HAVE_SYS_NERR),
12455839SasmodaiAC_MSG_RESULT(no))
12579543SruAC_LANG_POP(C++)])dnl
12655839Sasmodaidnl
12755839Sasmodaidnl
12855839SasmodaiAC_DEFUN(GROFF_SYS_ERRLIST,
12975584Sru[AC_MSG_CHECKING([for sys_errlist[] in <errno.h> or <stdio.h>])
13055839SasmodaiAC_TRY_COMPILE([#include <errno.h>
13155839Sasmodai#include <stdio.h>],
13255839Sasmodai[int k; k = (int)sys_errlist[0];],
13355839SasmodaiAC_MSG_RESULT(yes);AC_DEFINE(HAVE_SYS_ERRLIST),
13475584SruAC_MSG_RESULT(no))])dnl
13555839Sasmodaidnl
13655839Sasmodaidnl
13718099SpstAC_DEFUN(GROFF_OSFCN_H,
13879543Sru[AC_LANG_PUSH(C++)
13918099SpstAC_MSG_CHECKING([C++ <osfcn.h>])
14018099SpstAC_TRY_COMPILE([#include <osfcn.h>],
14155839Sasmodai[read(0, 0, 0); open(0, 0);],
14255839SasmodaiAC_MSG_RESULT(yes);AC_DEFINE(HAVE_CC_OSFCN_H),
14318099SpstAC_MSG_RESULT(no))
14479543SruAC_LANG_POP(C++)])dnl
14555839Sasmodaidnl
14655839Sasmodaidnl
14718099SpstAC_DEFUN(GROFF_LIMITS_H,
14879543Sru[AC_LANG_PUSH(C++)
14918099SpstAC_MSG_CHECKING([C++ <limits.h>])
15018099SpstAC_TRY_COMPILE([#include <limits.h>],
15118099Spst[int x = INT_MIN; int y = INT_MAX; int z = UCHAR_MAX;],
15255839SasmodaiAC_MSG_RESULT(yes);AC_DEFINE(HAVE_CC_LIMITS_H),
15355839SasmodaiAC_MSG_RESULT(no))
15479543SruAC_LANG_POP(C++)])dnl
15555839Sasmodaidnl
15655839Sasmodaidnl
15718099SpstAC_DEFUN(GROFF_TIME_T,
15879543Sru[AC_LANG_PUSH(C++)
15918099SpstAC_MSG_CHECKING([for declaration of time_t])
16018099SpstAC_TRY_COMPILE([#include <time.h>],
16155839Sasmodai[time_t t = time(0); struct tm *p = localtime(&t);],
16255839SasmodaiAC_MSG_RESULT(yes),
16318099SpstAC_MSG_RESULT(no);AC_DEFINE(LONG_FOR_TIME_T))
16479543SruAC_LANG_POP(C++)])dnl
16555839Sasmodaidnl
16655839Sasmodaidnl
16718099SpstAC_DEFUN(GROFF_STRUCT_EXCEPTION,
16818099Spst[AC_MSG_CHECKING([struct exception])
16918099SpstAC_TRY_COMPILE([#include <math.h>],
17018099Spst[struct exception e;],
17118099SpstAC_MSG_RESULT(yes);AC_DEFINE(HAVE_STRUCT_EXCEPTION),
17218099SpstAC_MSG_RESULT(no))])dnl
17355839Sasmodaidnl
17455839Sasmodaidnl
17518099SpstAC_DEFUN(GROFF_ARRAY_DELETE,
17679543Sru[AC_LANG_PUSH(C++)
17718099SpstAC_MSG_CHECKING([whether ANSI array delete syntax supported])
17818099SpstAC_TRY_COMPILE(,
17918099Spstchangequote(,)dnl
18018099Spstchar *p = new char[5]; delete [] p;changequote([,]),
18155839SasmodaiAC_MSG_RESULT(yes),
18255839SasmodaiAC_MSG_RESULT(no);AC_DEFINE(ARRAY_DELETE_NEEDS_SIZE))
18379543SruAC_LANG_POP(C++)])dnl
18418099Spstdnl
18555839Sasmodaidnl
18655839Sasmodaidnl
18718099SpstAC_DEFUN(GROFF_TRADITIONAL_CPP,
18879543Sru[AC_LANG_PUSH(C++)
18918099SpstAC_MSG_CHECKING([traditional preprocessor])
19018099SpstAC_TRY_COMPILE([#define name2(a,b) a/**/b],[int name2(foo,bar);],
19118099SpstAC_MSG_RESULT(yes);AC_DEFINE(TRADITIONAL_CPP),
19218099SpstAC_MSG_RESULT(no))
19379543SruAC_LANG_POP(C++)])dnl
19455839Sasmodaidnl
19555839Sasmodaidnl
19618099SpstAC_DEFUN(GROFF_WCOREFLAG,
19718099Spst[AC_MSG_CHECKING([w_coredump])
19855839SasmodaiAC_TRY_RUN([#include <sys/types.h>
19918099Spst#include <sys/wait.h>
20018099Spstmain()
20118099Spst{
20218099Spst#ifdef WCOREFLAG
20318099Spst  exit(1);
20418099Spst#else
20518099Spst  int i = 0;
20618099Spst  ((union wait *)&i)->w_coredump = 1;
20718099Spst  exit(i != 0200);
20818099Spst#endif
20955839Sasmodai}],
21055839SasmodaiAC_MSG_RESULT(yes);AC_DEFINE(WCOREFLAG,0200),
21155839SasmodaiAC_MSG_RESULT(no),
21218099SpstAC_MSG_RESULT(no))])dnl
21318099Spstdnl
21455839Sasmodaidnl
21518099SpstAC_DEFUN(GROFF_BROKEN_SPOOLER_FLAGS,
21618099Spst[AC_MSG_CHECKING([default value for grops -b option])
21718099Spsttest -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=7
21818099SpstAC_MSG_RESULT($BROKEN_SPOOLER_FLAGS)
21918099SpstAC_SUBST(BROKEN_SPOOLER_FLAGS)])dnl
22018099Spstdnl
22155839Sasmodaidnl
22218099SpstAC_DEFUN(GROFF_PAGE,
22318099Spst[AC_MSG_CHECKING([default paper size])
22455839Sasmodaiif test -z "$PAGE"; then
22518099Spst	descfile=
22655839Sasmodai	if test -r $prefix/share/groff/font/devps/DESC; then
22718099Spst		descfile=$prefix/share/groff/font/devps/DESC
22855839Sasmodai	elif test -r $prefix/lib/groff/font/devps/DESC; then
22918099Spst		descfile=$prefix/lib/groff/font/devps/DESC
23075584Sru	else
23175584Sru		for f in $prefix/share/groff/*/font/devps/DESC; do
23275584Sru			if test -r $f; then
23375584Sru				descfile=$f
23475584Sru				break
23575584Sru			fi
23675584Sru		done
23718099Spst	fi
23818099Spst	if test -n "$descfile" \
23955839Sasmodai	  && grep "^paperlength 841890" $descfile >/dev/null 2>&1; then
24018099Spst		PAGE=A4
24118099Spst	fi
24218099Spstfi
24355839Sasmodaiif test -z "$PAGE"; then
24418099Spst	dom=`awk '([$]1 == "dom" || [$]1 == "search") { print [$]2; exit}' \
24518099Spst	    /etc/resolv.conf 2>/dev/null`
24655839Sasmodai	if test -z "$dom"; then
24718099Spst		dom=`(domainname) 2>/dev/null | tr -d '+'`
24879543Sru		if test -z "$dom" \
24979543Sru		  || test "$dom" = '(none)'; then
25018099Spst			dom=`(hostname) 2>/dev/null | grep '\.'`
25118099Spst		fi
25218099Spst	fi
25318099Spstchangequote(,)dnl
25418099Spst	# If the top-level domain is two letters and it's not `us' or `ca'
25518099Spst	# then they probably use A4 paper.
25618099Spst	case "$dom" in
25718099Spst	*.[Uu][Ss]|*.[Cc][Aa]) ;;
25818099Spst	*.[A-Za-z][A-Za-z]) PAGE=A4 ;;
25918099Spst	esac
26018099Spstchangequote([,])dnl
26118099Spstfi
26218099Spsttest -n "$PAGE" || PAGE=letter
26318099SpstAC_MSG_RESULT($PAGE)
26418099SpstAC_SUBST(PAGE)])dnl
26518099Spstdnl
26655839Sasmodaidnl
26718099SpstAC_DEFUN(GROFF_CXX_CHECK,
26869626Sru[AC_REQUIRE([AC_PROG_CXX])
26979543SruAC_LANG_PUSH(C++)
27018099Spstif test "$cross_compiling" = no; then
27155839Sasmodai	AC_MSG_CHECKING([that C++ compiler can compile simple program])
27218099Spstfi
27318099SpstAC_TRY_RUN([int main() { return 0; }],
27418099SpstAC_MSG_RESULT(yes),
27555839SasmodaiAC_MSG_RESULT(no);AC_MSG_ERROR([a working C++ compiler is required]),
27655839Sasmodai:)
27718099Spstif test "$cross_compiling" = no; then
27855839Sasmodai	AC_MSG_CHECKING([that C++ static constructors and destructors are called])
27918099Spstfi
28018099SpstAC_TRY_RUN([
28118099Spstextern "C" {
28218099Spst  void _exit(int);
28318099Spst}
28418099Spstint i;
28518099Spststruct A {
28618099Spst  char dummy;
28718099Spst  A() { i = 1; }
28818099Spst  ~A() { if (i == 1) _exit(0); }
28918099Spst};
29018099SpstA a;
29118099Spstint main() { return 1; }
29218099Spst],
29318099SpstAC_MSG_RESULT(yes),
29455839SasmodaiAC_MSG_RESULT(no);AC_MSG_ERROR([a working C++ compiler is required]),
29555839Sasmodai:)
29618099SpstAC_MSG_CHECKING([that header files support C++])
29718099SpstAC_TRY_LINK([#include <stdio.h>],
29855839Sasmodai[fopen(0, 0);],
29955839SasmodaiAC_MSG_RESULT(yes),
30055839SasmodaiAC_MSG_RESULT(no);AC_MSG_ERROR([header files do not support C++ (if you are using a version of gcc/g++ earlier than 2.5, you should install libg++)]))
30179543SruAC_LANG_POP(C++)])dnl
30218099Spstdnl
30355839Sasmodaidnl
30418099SpstAC_DEFUN(GROFF_TMAC,
30555839Sasmodai[AC_MSG_CHECKING([for prefix of system macro packages])
30618099Spstsys_tmac_prefix=
30718099Spstsys_tmac_file_prefix=
30855839Sasmodaifor d in /usr/share/lib/tmac /usr/lib/tmac; do
30955839Sasmodai	for t in "" tmac.; do
31055839Sasmodai		for m in an s m; do
31118099Spst			f=$d/$t$m
31218099Spst			if test -z "$sys_tmac_prefix" \
31318099Spst			  && test -f $f \
31455839Sasmodai			  && grep '^\.if' $f >/dev/null 2>&1; then
31518099Spst				sys_tmac_prefix=$d/$t
31618099Spst				sys_tmac_file_prefix=$t
31718099Spst			fi
31818099Spst		done
31918099Spst	done
32018099Spstdone
32118099SpstAC_MSG_RESULT($sys_tmac_prefix)
32218099SpstAC_SUBST(sys_tmac_prefix)
32318099Spsttmac_wrap=
32418099SpstAC_MSG_CHECKING([which system macro packages should be made available])
32555839Sasmodaiif test "x$sys_tmac_file_prefix" = "xtmac."; then
32655839Sasmodai	for f in $sys_tmac_prefix*; do
32718099Spst		suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"`
32818099Spst		case "$suff" in
32955839Sasmodai		e) ;;
33018099Spst		*)
33155839Sasmodai			grep "Copyright.*Free Software Foundation" $f >/dev/null \
33255839Sasmodai			  || tmac_wrap="$tmac_wrap $suff" ;;
33318099Spst		esac 
33418099Spst	done
33555839Sasmodaielif test -n "$sys_tmac_prefix"; then
33618099Spst	files=`echo $sys_tmac_prefix*`
33718099Spst	grep "\\.so" $files >conftest.sol
33855839Sasmodai	for f in $files; do
33918099Spst		case "$f" in
34055839Sasmodai 		${sys_tmac_prefix}e) ;;
34118099Spst		*.me) ;;
34218099Spst		*/ms.*) ;;
34318099Spst		*)
34455839Sasmodai			b=`basename $f`
34555839Sasmodai			if grep "\\.so.*/$b\$" conftest.sol >/dev/null \
34655839Sasmodai			  || grep -l "Copyright.*Free Software Foundation" $f >/dev/null; then
34755839Sasmodai				:
34855839Sasmodai			else
34955839Sasmodai				suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"`
35055839Sasmodai				case "$suff" in
35155839Sasmodai				tmac.*) ;;
35255839Sasmodai				*) tmac_wrap="$tmac_wrap $suff" ;;
35355839Sasmodai				esac
35455839Sasmodai			fi
35518099Spst		esac
35618099Spst	done
35718099Spst	rm -f conftest.sol
35818099Spstfi
35918099SpstAC_MSG_RESULT([$tmac_wrap])
36069626SruAC_SUBST(tmac_wrap)])dnl
36155839Sasmodaidnl
36255839Sasmodaidnl
36318099SpstAC_DEFUN(GROFF_G,
36418099Spst[AC_MSG_CHECKING([for existing troff installation])
36555839Sasmodaiif test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then
36618099Spst	AC_MSG_RESULT(yes)
36718099Spst	g=g
36818099Spstelse
36918099Spst	AC_MSG_RESULT(no)
37018099Spst	g=
37118099Spstfi
37269626SruAC_SUBST(g)])dnl
37355839Sasmodaidnl
37455839Sasmodaidnl
37518099Spstdnl We need the path to install-sh to be absolute.
37655839Sasmodaidnl
37718099SpstAC_DEFUN(GROFF_INSTALL_SH,
37818099Spst[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
37918099Spstac_dir=`cd $ac_aux_dir; pwd`
38069626Sruac_install_sh="$ac_dir/install-sh -c"])dnl
38155839Sasmodaidnl
38255839Sasmodaidnl
38355839Sasmodaidnl At least one UNIX system, Apple Macintosh Rhapsody 5.5,
38455839Sasmodaidnl does not have -lm.
38555839Sasmodaidnl
38655839SasmodaiAC_DEFUN(GROFF_LIBM,
38755839Sasmodai[AC_CHECK_LIB(m,sin,LIBM=-lm)
38869626SruAC_SUBST(LIBM)])dnl
38969626Srudnl
39069626Srudnl
39169626Srudnl We need top_srcdir to be absolute.
39269626Srudnl
39369626SruAC_DEFUN(GROFF_SRCDIR,
39469626Sru[ac_srcdir_defaulted=no
39569626Srusrcdir=`cd $srcdir; pwd`])dnl
39669626Srudnl
39769626Srudnl
39869626Srudnl This simplifies Makefile rules.
39969626Srudnl
40069626SruAC_DEFUN(GROFF_BUILDDIR,
40169626Sru[top_builddir=`pwd`
40269626SruAC_SUBST(top_builddir)])dnl
40369626Srudnl
40469626Srudnl
40569626Srudnl Check for EBCDIC - stolen from the OS390 Unix LYNX port
40669626Srudnl
40769626SruAC_DEFUN(GROFF_EBCDIC,
40869626Sru[AC_MSG_CHECKING([whether character set is EBCDIC])
40969626SruAC_TRY_COMPILE(,
41069626Sru[/* Treat any failure as ASCII for compatibility with existing art.
41169626Sru    Use compile-time rather than run-time tests for cross-compiler
41269626Sru    tolerance. */
41369626Sru#if '0' != 240
41469626Srumake an error "Character set is not EBCDIC"
41569626Sru#endif],
41669626Srugroff_cv_ebcdic="yes"
41769626Sru TTYDEVDIRS="font/devcp1047"
41869626Sru AC_MSG_RESULT(yes)
41969626Sru AC_DEFINE(IS_EBCDIC_HOST),
42069626Srugroff_cv_ebcdic="no"
42169626Sru TTYDEVDIRS="font/devascii font/devlatin1 font/devutf8"
42269626Sru AC_MSG_RESULT(no))
42369626SruAC_SUBST(TTYDEVDIRS)])dnl
42469626Srudnl
42569626Srudnl
42669626Srudnl Check for OS/390 Unix.  We test for EBCDIC also -- the Linux port (with
42769626Srudnl gcc) to OS/390 uses ASCII internally.
42869626Srudnl
42969626SruAC_DEFUN(GROFF_OS390,
43079543Sru[if test "$groff_cv_ebcdic" = "yes"; then
43169626Sru	AC_MSG_CHECKING([for OS/390 Unix])
43269626Sru	case `uname` in
43369626Sru	OS/390)
43469626Sru		CFLAGS="$CFLAGS -D_ALL_SOURCE"
43569626Sru		AC_MSG_RESULT(yes) ;;
43669626Sru	*)
43769626Sru		AC_MSG_RESULT(no) ;;
43869626Sru	esac
43969626Srufi])dnl
44069626Srudnl
44169626Srudnl
44269626Srudnl Check whether we need a declaration for a function.
44369626Srudnl
44469626Srudnl Stolen from GNU bfd.
44569626Srudnl
44669626SruAC_DEFUN(GROFF_NEED_DECLARATION,
44769626Sru[AC_MSG_CHECKING([whether $1 must be declared])
44879543SruAC_LANG_PUSH(C++)
44969626SruAC_CACHE_VAL(groff_cv_decl_needed_$1,
45069626Sru[AC_TRY_COMPILE([
45169626Sru#include <stdio.h>
45269626Sru#ifdef HAVE_STRING_H
45369626Sru#include <string.h>
45479543Sru#endif
45569626Sru#ifdef HAVE_STRINGS_H
45669626Sru#include <strings.h>
45769626Sru#endif
45869626Sru#ifdef HAVE_STDLIB_H
45969626Sru#include <stdlib.h>
46069626Sru#endif
46169626Sru#ifdef HAVE_UNISTD_H
46269626Sru#include <unistd.h>
46369626Sru#endif
46469626Sru#ifdef HAVE_MATH_H
46569626Sru#include <math.h>
46669626Sru#endif],
46769626Sru[char *(*pfn) = (char *(*)) $1],
46869626Srugroff_cv_decl_needed_$1=no,
46969626Srugroff_cv_decl_needed_$1=yes)])
47069626SruAC_MSG_RESULT($groff_cv_decl_needed_$1)
47169626Sruif test $groff_cv_decl_needed_$1 = yes; then
47269626Sru	AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]))
47369626Srufi
47479543SruAC_LANG_POP(C++)])dnl
47579543Srudnl
47679543Srudnl
47779543Srudnl Check for mkstemp() and its function prototype.
47879543Srudnl
47979543SruAC_DEFUN(GROFF_MKSTEMP,
48079543Sru[AC_CHECK_FUNC(mkstemp,
48179543Sru[AC_DEFINE(HAVE_MKSTEMP)
48279543SruAC_MSG_CHECKING([for mkstemp prototype in <stdlib.h>])
48379543SruAC_EGREP_CPP(mkstemp,
48479543Sru[#include <stdlib.h>],
48579543SruAC_MSG_RESULT(yes);AC_DEFINE(HAVE_MKSTEMP_PROTO),
48679543SruAC_MSG_RESULT(no))])])
487