aclocal.m4 revision 69626
118099Spstdnl Autoconf macros for groff. 218099Spstdnl Copyright (C) 1989, 1990, 1991, 1992, 1995 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]) 9718099SpstAC_LANG_SAVE 9818099SpstAC_LANG_CPLUSPLUS 9918099SpstAC_TRY_COMPILE([#include <stdio.h> 10018099Spstextern "C" { void fileno(int); }],, 10118099SpstAC_MSG_RESULT(yes);AC_DEFINE(_POSIX_SOURCE), 10218099SpstAC_MSG_RESULT(no)) 10318099SpstAC_LANG_RESTORE])dnl 10455839Sasmodaidnl 10555839Sasmodaidnl 10669626Srudnl srand() of SunOS 4.1.3 has return type int instead of void 10755839Sasmodaidnl 10869626SruAC_DEFUN(GROFF_SRAND, 10918099Spst[AC_LANG_SAVE 11018099SpstAC_LANG_CPLUSPLUS 11169626SruAC_MSG_CHECKING([for return type of srand]) 11218099SpstAC_TRY_COMPILE([#include <stdlib.h> 11369626Sruextern "C" { void srand(unsigned int); }],, 11469626SruAC_MSG_RESULT(void);AC_DEFINE(RET_TYPE_SRAND_IS_VOID), 11569626SruAC_MSG_RESULT(int)) 11618099SpstAC_LANG_RESTORE])dnl 11755839Sasmodaidnl 11855839Sasmodaidnl 11955839SasmodaiAC_DEFUN(GROFF_SYS_NERR, 12055839Sasmodai[AC_LANG_SAVE 12155839SasmodaiAC_LANG_CPLUSPLUS 12255839SasmodaiAC_MSG_CHECKING([for sys_nerr in <errno.h> or <stdio.h>]) 12355839SasmodaiAC_TRY_COMPILE([#include <errno.h> 12455839Sasmodai#include <stdio.h>], 12555839Sasmodai[int k; k = sys_nerr;], 12655839SasmodaiAC_MSG_RESULT(yes);AC_DEFINE(HAVE_SYS_NERR), 12755839SasmodaiAC_MSG_RESULT(no)) 12855839SasmodaiAC_LANG_RESTORE])dnl 12955839Sasmodaidnl 13055839Sasmodaidnl 13155839SasmodaiAC_DEFUN(GROFF_SYS_ERRLIST, 13255839Sasmodai[AC_LANG_SAVE 13355839SasmodaiAC_LANG_CPLUSPLUS 13455839SasmodaiAC_MSG_CHECKING([for sys_errlist[] in <errno.h> or <stdio.h>]) 13555839SasmodaiAC_TRY_COMPILE([#include <errno.h> 13655839Sasmodai#include <stdio.h>], 13755839Sasmodai[int k; k = (int)sys_errlist[0];], 13855839SasmodaiAC_MSG_RESULT(yes);AC_DEFINE(HAVE_SYS_ERRLIST), 13955839SasmodaiAC_MSG_RESULT(no)) 14055839SasmodaiAC_LANG_RESTORE])dnl 14155839Sasmodaidnl 14255839Sasmodaidnl 14318099SpstAC_DEFUN(GROFF_OSFCN_H, 14418099Spst[AC_LANG_SAVE 14518099SpstAC_LANG_CPLUSPLUS 14618099SpstAC_MSG_CHECKING([C++ <osfcn.h>]) 14718099SpstAC_TRY_COMPILE([#include <osfcn.h>], 14855839Sasmodai[read(0, 0, 0); open(0, 0);], 14955839SasmodaiAC_MSG_RESULT(yes);AC_DEFINE(HAVE_CC_OSFCN_H), 15018099SpstAC_MSG_RESULT(no)) 15118099SpstAC_LANG_RESTORE])dnl 15255839Sasmodaidnl 15355839Sasmodaidnl 15418099SpstAC_DEFUN(GROFF_LIMITS_H, 15518099Spst[AC_LANG_SAVE 15618099SpstAC_LANG_CPLUSPLUS 15718099SpstAC_MSG_CHECKING([C++ <limits.h>]) 15818099SpstAC_TRY_COMPILE([#include <limits.h>], 15918099Spst[int x = INT_MIN; int y = INT_MAX; int z = UCHAR_MAX;], 16055839SasmodaiAC_MSG_RESULT(yes);AC_DEFINE(HAVE_CC_LIMITS_H), 16155839SasmodaiAC_MSG_RESULT(no)) 16218099SpstAC_LANG_RESTORE])dnl 16355839Sasmodaidnl 16455839Sasmodaidnl 16518099SpstAC_DEFUN(GROFF_TIME_T, 16618099Spst[AC_LANG_SAVE 16718099SpstAC_LANG_CPLUSPLUS 16818099SpstAC_MSG_CHECKING([for declaration of time_t]) 16918099SpstAC_TRY_COMPILE([#include <time.h>], 17055839Sasmodai[time_t t = time(0); struct tm *p = localtime(&t);], 17155839SasmodaiAC_MSG_RESULT(yes), 17218099SpstAC_MSG_RESULT(no);AC_DEFINE(LONG_FOR_TIME_T)) 17318099SpstAC_LANG_RESTORE])dnl 17455839Sasmodaidnl 17555839Sasmodaidnl 17618099SpstAC_DEFUN(GROFF_STRUCT_EXCEPTION, 17718099Spst[AC_MSG_CHECKING([struct exception]) 17818099SpstAC_TRY_COMPILE([#include <math.h>], 17918099Spst[struct exception e;], 18018099SpstAC_MSG_RESULT(yes);AC_DEFINE(HAVE_STRUCT_EXCEPTION), 18118099SpstAC_MSG_RESULT(no))])dnl 18255839Sasmodaidnl 18355839Sasmodaidnl 18418099SpstAC_DEFUN(GROFF_ARRAY_DELETE, 18518099Spst[AC_LANG_SAVE 18618099SpstAC_LANG_CPLUSPLUS 18718099SpstAC_MSG_CHECKING([whether ANSI array delete syntax supported]) 18818099SpstAC_TRY_COMPILE(, 18918099Spstchangequote(,)dnl 19018099Spstchar *p = new char[5]; delete [] p;changequote([,]), 19155839SasmodaiAC_MSG_RESULT(yes), 19255839SasmodaiAC_MSG_RESULT(no);AC_DEFINE(ARRAY_DELETE_NEEDS_SIZE)) 19318099SpstAC_LANG_RESTORE])dnl 19418099Spstdnl 19555839Sasmodaidnl 19655839Sasmodaidnl 19718099SpstAC_DEFUN(GROFF_TRADITIONAL_CPP, 19818099Spst[AC_LANG_SAVE 19918099SpstAC_LANG_CPLUSPLUS 20018099SpstAC_MSG_CHECKING([traditional preprocessor]) 20118099SpstAC_TRY_COMPILE([#define name2(a,b) a/**/b],[int name2(foo,bar);], 20218099SpstAC_MSG_RESULT(yes);AC_DEFINE(TRADITIONAL_CPP), 20318099SpstAC_MSG_RESULT(no)) 20418099SpstAC_LANG_RESTORE])dnl 20555839Sasmodaidnl 20655839Sasmodaidnl 20718099SpstAC_DEFUN(GROFF_WCOREFLAG, 20818099Spst[AC_MSG_CHECKING([w_coredump]) 20955839SasmodaiAC_TRY_RUN([#include <sys/types.h> 21018099Spst#include <sys/wait.h> 21118099Spstmain() 21218099Spst{ 21318099Spst#ifdef WCOREFLAG 21418099Spst exit(1); 21518099Spst#else 21618099Spst int i = 0; 21718099Spst ((union wait *)&i)->w_coredump = 1; 21818099Spst exit(i != 0200); 21918099Spst#endif 22055839Sasmodai}], 22155839SasmodaiAC_MSG_RESULT(yes);AC_DEFINE(WCOREFLAG,0200), 22255839SasmodaiAC_MSG_RESULT(no), 22318099SpstAC_MSG_RESULT(no))])dnl 22418099Spstdnl 22555839Sasmodaidnl 22618099SpstAC_DEFUN(GROFF_BROKEN_SPOOLER_FLAGS, 22718099Spst[AC_MSG_CHECKING([default value for grops -b option]) 22818099Spsttest -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=7 22918099SpstAC_MSG_RESULT($BROKEN_SPOOLER_FLAGS) 23018099SpstAC_SUBST(BROKEN_SPOOLER_FLAGS)])dnl 23118099Spstdnl 23255839Sasmodaidnl 23318099SpstAC_DEFUN(GROFF_PAGE, 23418099Spst[AC_MSG_CHECKING([default paper size]) 23555839Sasmodaiif test -z "$PAGE"; then 23618099Spst descfile= 23755839Sasmodai if test -r $prefix/share/groff/font/devps/DESC; then 23818099Spst descfile=$prefix/share/groff/font/devps/DESC 23955839Sasmodai elif test -r $prefix/lib/groff/font/devps/DESC; then 24018099Spst descfile=$prefix/lib/groff/font/devps/DESC 24118099Spst fi 24218099Spst if test -n "$descfile" \ 24355839Sasmodai && grep "^paperlength 841890" $descfile >/dev/null 2>&1; then 24418099Spst PAGE=A4 24518099Spst else 24618099Spst PAGE=letter 24718099Spst fi 24818099Spstfi 24955839Sasmodaiif test -z "$PAGE"; then 25018099Spst dom=`awk '([$]1 == "dom" || [$]1 == "search") { print [$]2; exit}' \ 25118099Spst /etc/resolv.conf 2>/dev/null` 25255839Sasmodai if test -z "$dom"; then 25318099Spst dom=`(domainname) 2>/dev/null | tr -d '+'` 25455839Sasmodai if test -z "$dom"; then 25518099Spst dom=`(hostname) 2>/dev/null | grep '\.'` 25618099Spst fi 25718099Spst fi 25818099Spstchangequote(,)dnl 25918099Spst # If the top-level domain is two letters and it's not `us' or `ca' 26018099Spst # then they probably use A4 paper. 26118099Spst case "$dom" in 26218099Spst *.[Uu][Ss]|*.[Cc][Aa]) ;; 26318099Spst *.[A-Za-z][A-Za-z]) PAGE=A4 ;; 26418099Spst esac 26518099Spstchangequote([,])dnl 26618099Spstfi 26718099Spsttest -n "$PAGE" || PAGE=letter 26818099SpstAC_MSG_RESULT($PAGE) 26918099SpstAC_SUBST(PAGE)])dnl 27018099Spstdnl 27155839Sasmodaidnl 27218099SpstAC_DEFUN(GROFF_CXX_CHECK, 27369626Sru[AC_REQUIRE([AC_PROG_CXX]) 27418099SpstAC_LANG_SAVE 27518099SpstAC_LANG_CPLUSPLUS 27618099Spstif test "$cross_compiling" = no; then 27755839Sasmodai AC_MSG_CHECKING([that C++ compiler can compile simple program]) 27818099Spstfi 27918099SpstAC_TRY_RUN([int main() { return 0; }], 28018099SpstAC_MSG_RESULT(yes), 28155839SasmodaiAC_MSG_RESULT(no);AC_MSG_ERROR([a working C++ compiler is required]), 28255839Sasmodai:) 28318099Spstif test "$cross_compiling" = no; then 28455839Sasmodai AC_MSG_CHECKING([that C++ static constructors and destructors are called]) 28518099Spstfi 28618099SpstAC_TRY_RUN([ 28718099Spstextern "C" { 28818099Spst void _exit(int); 28918099Spst} 29018099Spstint i; 29118099Spststruct A { 29218099Spst char dummy; 29318099Spst A() { i = 1; } 29418099Spst ~A() { if (i == 1) _exit(0); } 29518099Spst}; 29618099SpstA a; 29718099Spstint main() { return 1; } 29818099Spst], 29918099SpstAC_MSG_RESULT(yes), 30055839SasmodaiAC_MSG_RESULT(no);AC_MSG_ERROR([a working C++ compiler is required]), 30155839Sasmodai:) 30218099SpstAC_MSG_CHECKING([that header files support C++]) 30318099SpstAC_TRY_LINK([#include <stdio.h>], 30455839Sasmodai[fopen(0, 0);], 30555839SasmodaiAC_MSG_RESULT(yes), 30655839SasmodaiAC_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++)])) 30769626SruAC_LANG_RESTORE])dnl 30818099Spstdnl 30955839Sasmodaidnl 31018099SpstAC_DEFUN(GROFF_TMAC, 31155839Sasmodai[AC_MSG_CHECKING([for prefix of system macro packages]) 31218099Spstsys_tmac_prefix= 31318099Spstsys_tmac_file_prefix= 31455839Sasmodaifor d in /usr/share/lib/tmac /usr/lib/tmac; do 31555839Sasmodai for t in "" tmac.; do 31655839Sasmodai for m in an s m; do 31718099Spst f=$d/$t$m 31818099Spst if test -z "$sys_tmac_prefix" \ 31918099Spst && test -f $f \ 32055839Sasmodai && grep '^\.if' $f >/dev/null 2>&1; then 32118099Spst sys_tmac_prefix=$d/$t 32218099Spst sys_tmac_file_prefix=$t 32318099Spst fi 32418099Spst done 32518099Spst done 32618099Spstdone 32718099SpstAC_MSG_RESULT($sys_tmac_prefix) 32818099SpstAC_SUBST(sys_tmac_prefix) 32918099Spsttmac_wrap= 33018099SpstAC_MSG_CHECKING([which system macro packages should be made available]) 33155839Sasmodaiif test "x$sys_tmac_file_prefix" = "xtmac."; then 33255839Sasmodai for f in $sys_tmac_prefix*; do 33318099Spst suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"` 33418099Spst case "$suff" in 33555839Sasmodai e) ;; 33618099Spst *) 33755839Sasmodai grep "Copyright.*Free Software Foundation" $f >/dev/null \ 33855839Sasmodai || tmac_wrap="$tmac_wrap $suff" ;; 33918099Spst esac 34018099Spst done 34155839Sasmodaielif test -n "$sys_tmac_prefix"; then 34218099Spst files=`echo $sys_tmac_prefix*` 34318099Spst grep "\\.so" $files >conftest.sol 34455839Sasmodai for f in $files; do 34518099Spst case "$f" in 34655839Sasmodai ${sys_tmac_prefix}e) ;; 34718099Spst *.me) ;; 34818099Spst */ms.*) ;; 34918099Spst *) 35055839Sasmodai b=`basename $f` 35155839Sasmodai if grep "\\.so.*/$b\$" conftest.sol >/dev/null \ 35255839Sasmodai || grep -l "Copyright.*Free Software Foundation" $f >/dev/null; then 35355839Sasmodai : 35455839Sasmodai else 35555839Sasmodai suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"` 35655839Sasmodai case "$suff" in 35755839Sasmodai tmac.*) ;; 35855839Sasmodai *) tmac_wrap="$tmac_wrap $suff" ;; 35955839Sasmodai esac 36055839Sasmodai fi 36118099Spst esac 36218099Spst done 36318099Spst rm -f conftest.sol 36418099Spstfi 36518099SpstAC_MSG_RESULT([$tmac_wrap]) 36669626SruAC_SUBST(tmac_wrap)])dnl 36755839Sasmodaidnl 36855839Sasmodaidnl 36918099SpstAC_DEFUN(GROFF_G, 37018099Spst[AC_MSG_CHECKING([for existing troff installation]) 37155839Sasmodaiif test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then 37218099Spst AC_MSG_RESULT(yes) 37318099Spst g=g 37418099Spstelse 37518099Spst AC_MSG_RESULT(no) 37618099Spst g= 37718099Spstfi 37869626SruAC_SUBST(g)])dnl 37955839Sasmodaidnl 38055839Sasmodaidnl 38118099Spstdnl We need the path to install-sh to be absolute. 38255839Sasmodaidnl 38318099SpstAC_DEFUN(GROFF_INSTALL_SH, 38418099Spst[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl 38518099Spstac_dir=`cd $ac_aux_dir; pwd` 38669626Sruac_install_sh="$ac_dir/install-sh -c"])dnl 38755839Sasmodaidnl 38855839Sasmodaidnl 38955839Sasmodaidnl At least one UNIX system, Apple Macintosh Rhapsody 5.5, 39055839Sasmodaidnl does not have -lm. 39155839Sasmodaidnl 39255839SasmodaiAC_DEFUN(GROFF_LIBM, 39355839Sasmodai[AC_CHECK_LIB(m,sin,LIBM=-lm) 39469626SruAC_SUBST(LIBM)])dnl 39569626Srudnl 39669626Srudnl 39769626Srudnl We need top_srcdir to be absolute. 39869626Srudnl 39969626SruAC_DEFUN(GROFF_SRCDIR, 40069626Sru[ac_srcdir_defaulted=no 40169626Srusrcdir=`cd $srcdir; pwd`])dnl 40269626Srudnl 40369626Srudnl 40469626Srudnl This simplifies Makefile rules. 40569626Srudnl 40669626SruAC_DEFUN(GROFF_BUILDDIR, 40769626Sru[top_builddir=`pwd` 40869626SruAC_SUBST(top_builddir)])dnl 40969626Srudnl 41069626Srudnl 41169626Srudnl Check for EBCDIC - stolen from the OS390 Unix LYNX port 41269626Srudnl 41369626SruAC_DEFUN(GROFF_EBCDIC, 41469626Sru[AC_MSG_CHECKING([whether character set is EBCDIC]) 41569626SruAC_TRY_COMPILE(, 41669626Sru[/* Treat any failure as ASCII for compatibility with existing art. 41769626Sru Use compile-time rather than run-time tests for cross-compiler 41869626Sru tolerance. */ 41969626Sru#if '0' != 240 42069626Srumake an error "Character set is not EBCDIC" 42169626Sru#endif], 42269626Srugroff_cv_ebcdic="yes" 42369626Sru TTYDEVDIRS="font/devcp1047" 42469626Sru AC_MSG_RESULT(yes) 42569626Sru AC_DEFINE(IS_EBCDIC_HOST), 42669626Srugroff_cv_ebcdic="no" 42769626Sru TTYDEVDIRS="font/devascii font/devlatin1 font/devutf8" 42869626Sru AC_MSG_RESULT(no)) 42969626SruAC_SUBST(TTYDEVDIRS)])dnl 43069626Srudnl 43169626Srudnl 43269626Srudnl Check for OS/390 Unix. We test for EBCDIC also -- the Linux port (with 43369626Srudnl gcc) to OS/390 uses ASCII internally. 43469626Srudnl 43569626SruAC_DEFUN(GROFF_OS390, 43669626Sru[groff_cv_os390="no" 43769626Sruif test "$groff_cv_ebcdic" = "yes"; then 43869626Sru AC_MSG_CHECKING([for OS/390 Unix]) 43969626Sru case `uname` in 44069626Sru OS/390) 44169626Sru CFLAGS="$CFLAGS -D_ALL_SOURCE" 44269626Sru groff_cv_os390="yes" 44369626Sru AC_MSG_RESULT(yes) ;; 44469626Sru *) 44569626Sru AC_MSG_RESULT(no) ;; 44669626Sru esac 44769626Srufi])dnl 44869626Srudnl 44969626Srudnl 45069626Srudnl Finally, we must modify a base function of autoconf to replace the 45169626Srudnl ASCII char `012' with its generic equivalent `\n' if we run under 45269626Srudnl OS/390 Unix -- unfortunately, not all `tr' variants understand `\n', 45369626Srudnl so this hack is necessary. 45469626Srudnl 45569626Srudefine([AC_OUTPUT_MAKE_DEFS], 45669626Sru[# Transform confdefs.h into DEFS. 45769626Srudnl Using a here document instead of a string reduces the quoting nightmare. 45869626Sru# Protect against shell expansion while executing Makefile rules. 45969626Sru# Protect against Makefile macro expansion. 46069626Srucat > conftest.defs <<\EOF 46169626Sruchangequote(<<, >>)dnl 46269626Srus%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g 46369626Srus%[ `~<<#>>$^&*(){}\\|;'"<>?]%\\&%g 46469626Srus%\[%\\&%g 46569626Srus%\]%\\&%g 46669626Srus%\$%$$%g 46769626Sruchangequote([, ])dnl 46869626SruEOF 46969626Sruif test "$groff_cv_os390" = "yes"; then 47069626Sru DEFS=`sed -f conftest.defs confdefs.h | tr '\n' ' '` 47169626Sruelse 47269626Sru DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` 47369626Srufi 47469626Srurm -f conftest.defs 47569626Sru])dnl 47669626Srudnl 47769626Srudnl 47869626Srudnl Check whether we need a declaration for a function. 47969626Srudnl 48069626Srudnl Stolen from GNU bfd. 48169626Srudnl 48269626SruAC_DEFUN(GROFF_NEED_DECLARATION, 48369626Sru[AC_MSG_CHECKING([whether $1 must be declared]) 48469626SruAC_LANG_SAVE 48569626SruAC_LANG_CPLUSPLUS 48669626SruAC_CACHE_VAL(groff_cv_decl_needed_$1, 48769626Sru[AC_TRY_COMPILE([ 48869626Sru#include <stdio.h> 48969626Sru#ifdef HAVE_STRING_H 49069626Sru#include <string.h> 49169626Sru#else 49269626Sru#ifdef HAVE_STRINGS_H 49369626Sru#include <strings.h> 49469626Sru#endif 49569626Sru#endif 49669626Sru#ifdef HAVE_STDLIB_H 49769626Sru#include <stdlib.h> 49869626Sru#endif 49969626Sru#ifdef HAVE_UNISTD_H 50069626Sru#include <unistd.h> 50169626Sru#endif 50269626Sru#ifdef HAVE_MATH_H 50369626Sru#include <math.h> 50469626Sru#endif], 50569626Sru[char *(*pfn) = (char *(*)) $1], 50669626Srugroff_cv_decl_needed_$1=no, 50769626Srugroff_cv_decl_needed_$1=yes)]) 50869626SruAC_MSG_RESULT($groff_cv_decl_needed_$1) 50969626Sruif test $groff_cv_decl_needed_$1 = yes; then 51069626Sru AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z])) 51169626Srufi 51269626SruAC_LANG_RESTORE])dnl 513