aclocal.m4 revision 114402
118099Spstdnl Autoconf macros for groff. 2104862Srudnl Copyright (C) 1989-1995, 2001, 2002 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 61104862Srudnl The following programs are needed for grohtml. 62104862Srudnl 63104862SruAC_DEFUN(GROFF_HTML_PROGRAMS, 64104862Sru[make_html=html 65104862Srumake_install_html=install_html 66114402Srumissing= 67104862SruAC_CHECK_PROG(pnmcut, pnmcut, found, missing) 68114402Sruif test $pnmcut = missing; then 69114402Sru missing="$missing pnmcut" 70114402Srufi 71104862SruAC_CHECK_PROG(pnmcrop, pnmcrop, found, missing) 72114402Sruif test $pnmcrop = missing; then 73114402Sru missing="$missing pnmcrop" 74114402Srufi 75104862SruAC_CHECK_PROG(pnmtopng, pnmtopng, found, missing) 76114402Sruif test $pnmtopng = missing; then 77114402Sru missing="$missing pnmtopng" 78114402Srufi 79104862SruAC_CHECK_PROG(gs, gs gsos2, found, missing) 80114402Sruif test $gs = missing; then 81114402Sru missing="$missing gs" 82114402Srufi 83104862SruAC_CHECK_PROG(psselect, psselect, found, missing) 84114402Sruif test $psselect = missing; then 85114402Sru missing="$missing psselect" 86114402Srufi 87114402SruAC_CHECK_PROG(pnmtops, pnmtops, found, missing) 88114402Sruif test $pnmtops = missing; then 89114402Sru missing="$missing pnmtops" 90114402Srufi 91114402Sruif test -n "$missing"; then 92114402Sru cnt=0 93114402Sru for i in $missing 94114402Sru do 95114402Sru cnt=`expr $cnt + 1` 96114402Sru eval "prog$cnt=$i" 97114402Sru done 98114402Sru plural="s" 99114402Sru case $cnt in 100114402Sru 1) 101114402Sru plural="" 102114402Sru progs="\`$prog1'" ;; 103114402Sru 2) 104114402Sru progs="\`$prog1' and \`$prog2'" ;; 105114402Sru 3) 106114402Sru progs="\`$prog1', \`$prog2', and \`$prog3'" ;; 107114402Sru 4) 108114402Sru progs="\`$prog1', \`$prog2', \`$prog3', and \`$prog4'" ;; 109114402Sru 5) 110114402Sru progs="\`$prog1', \`$prog2', \`$prog3', \`$prog4', and \`$prog5'" ;; 111114402Sru 6) 112114402Sru progs="\`$prog1', \`$prog2', \`$prog3', \`$prog4', \`$prog5', and \`$prog6'" ;; 113114402Sru esac 114104862Sru make_html= 115104862Sru make_install_html= 116104862Sru AC_MSG_WARN([ 117104862Sru 118114402Sru The program$plural 119114402Sru $progs 120114402Sru can't be found in the path, thus the HTML backend of groff (grohtml) 121114402Sru won't work properly. Consequently, no documentation in HTML format 122114402Sru is built and installed. 123114402Sru]) 124114402Srufi 125104862SruAC_SUBST(make_html) 126104862SruAC_SUBST(make_install_html)])dnl 127104862Srudnl 128114402Srudnl check to see whether pnmtops can handle the -nosetpage option 129104862Srudnl 130114402SruAC_DEFUN(GROFF_PNMTOPS_NOSETPAGE, 131114402Sru[AC_MSG_CHECKING([whether pnmtops can handle the -nosetpage option]) 132114402Sruif echo P2 2 2 255 0 1 2 0 | pnmtops -nosetpage > /dev/null 2>&1 ; then 133114402Sru AC_MSG_RESULT(yes) 134114402Sru pnmtops_nosetpage="pnmtops -nosetpage" 135114402Sruelse 136114402Sru AC_MSG_RESULT(no) 137114402Sru pnmtops_nosetpage="pnmtops" 138114402Srufi 139114402SruAC_SUBST(pnmtops_nosetpage) 140114402Sru])dnl 141114402Srudnl 142114402Srudnl 14318099Spstdnl GROFF_CSH_HACK(if hack present, if not present) 14455839Sasmodaidnl 14518099SpstAC_DEFUN(GROFF_CSH_HACK, 14618099Spst[AC_MSG_CHECKING([for csh hash hack]) 14718099Spstcat <<EOF >conftest.sh 14818099Spst#!/bin/sh 14918099Spsttrue || exit 0 15018099Spstexport PATH || exit 0 15118099Spstexit 1 15218099SpstEOF 15318099Spstchmod +x conftest.sh 15455839Sasmodaiif echo ./conftest.sh | (csh >/dev/null 2>&1) >/dev/null 2>&1; then 15518099Spst AC_MSG_RESULT(yes); $1 15618099Spstelse 15718099Spst AC_MSG_RESULT(no); $2 15818099Spstfi 15955839Sasmodairm -f conftest.sh])dnl 16055839Sasmodaidnl 16155839Sasmodaidnl 16218099Spstdnl From udodo!hans@relay.NL.net (Hans Zuidam) 16355839Sasmodaidnl 16418099SpstAC_DEFUN(GROFF_ISC_SYSV3, 16518099Spst[AC_MSG_CHECKING([for ISC 3.x or 4.x]) 16618099Spstchangequote(,)dnl 16718099Spstif grep '[34]\.' /usr/options/cb.name >/dev/null 2>&1 16818099Spstchangequote([,])dnl 16918099Spstthen 17018099Spst AC_MSG_RESULT(yes) 171104862Sru AC_DEFINE(_SYSV3, 1, 172104862Sru [Define if you have ISC 3.x or 4.x.]) 17318099Spstelse 17418099Spst AC_MSG_RESULT(no) 17518099Spstfi])dnl 17655839Sasmodaidnl 17755839Sasmodaidnl 17818099SpstAC_DEFUN(GROFF_POSIX, 17918099Spst[AC_MSG_CHECKING([whether -D_POSIX_SOURCE is necessary]) 18079543SruAC_LANG_PUSH(C++) 18118099SpstAC_TRY_COMPILE([#include <stdio.h> 18218099Spstextern "C" { void fileno(int); }],, 183104862SruAC_MSG_RESULT(yes);AC_DEFINE(_POSIX_SOURCE, 1, 184104862Sru [Define if -D_POSIX_SOURCE is necessary.]), 18518099SpstAC_MSG_RESULT(no)) 18679543SruAC_LANG_POP(C++)])dnl 18755839Sasmodaidnl 18855839Sasmodaidnl 18969626Srudnl srand() of SunOS 4.1.3 has return type int instead of void 19055839Sasmodaidnl 19169626SruAC_DEFUN(GROFF_SRAND, 19279543Sru[AC_LANG_PUSH(C++) 19369626SruAC_MSG_CHECKING([for return type of srand]) 19418099SpstAC_TRY_COMPILE([#include <stdlib.h> 19569626Sruextern "C" { void srand(unsigned int); }],, 196104862SruAC_MSG_RESULT(void);AC_DEFINE(RET_TYPE_SRAND_IS_VOID, 1, 197104862Sru [Define if srand() returns void not int.]), 19869626SruAC_MSG_RESULT(int)) 19979543SruAC_LANG_POP(C++)])dnl 20055839Sasmodaidnl 20155839Sasmodaidnl 20255839SasmodaiAC_DEFUN(GROFF_SYS_NERR, 20379543Sru[AC_LANG_PUSH(C++) 20455839SasmodaiAC_MSG_CHECKING([for sys_nerr in <errno.h> or <stdio.h>]) 20555839SasmodaiAC_TRY_COMPILE([#include <errno.h> 20655839Sasmodai#include <stdio.h>], 20755839Sasmodai[int k; k = sys_nerr;], 208104862SruAC_MSG_RESULT(yes);AC_DEFINE(HAVE_SYS_NERR, 1, 209104862Sru [Define if you have sysnerr in <errno.h> or 210104862Sru <stdio.h>.]), 21155839SasmodaiAC_MSG_RESULT(no)) 21279543SruAC_LANG_POP(C++)])dnl 21355839Sasmodaidnl 21455839Sasmodaidnl 21555839SasmodaiAC_DEFUN(GROFF_SYS_ERRLIST, 21675584Sru[AC_MSG_CHECKING([for sys_errlist[] in <errno.h> or <stdio.h>]) 21755839SasmodaiAC_TRY_COMPILE([#include <errno.h> 21855839Sasmodai#include <stdio.h>], 21955839Sasmodai[int k; k = (int)sys_errlist[0];], 220104862SruAC_MSG_RESULT(yes);AC_DEFINE(HAVE_SYS_ERRLIST, 1, 221104862Sru [Define if you have sys_errlist in <errno.h> 222104862Sru or in <stdio.h>.]), 22375584SruAC_MSG_RESULT(no))])dnl 22455839Sasmodaidnl 22555839Sasmodaidnl 22618099SpstAC_DEFUN(GROFF_OSFCN_H, 22779543Sru[AC_LANG_PUSH(C++) 22818099SpstAC_MSG_CHECKING([C++ <osfcn.h>]) 22918099SpstAC_TRY_COMPILE([#include <osfcn.h>], 23055839Sasmodai[read(0, 0, 0); open(0, 0);], 231104862SruAC_MSG_RESULT(yes);AC_DEFINE(HAVE_CC_OSFCN_H, 1, 232104862Sru [Define if you have a C++ <osfcn.h>.]), 23318099SpstAC_MSG_RESULT(no)) 23479543SruAC_LANG_POP(C++)])dnl 23555839Sasmodaidnl 23655839Sasmodaidnl 23718099SpstAC_DEFUN(GROFF_LIMITS_H, 23879543Sru[AC_LANG_PUSH(C++) 23918099SpstAC_MSG_CHECKING([C++ <limits.h>]) 24018099SpstAC_TRY_COMPILE([#include <limits.h>], 24118099Spst[int x = INT_MIN; int y = INT_MAX; int z = UCHAR_MAX;], 242104862SruAC_MSG_RESULT(yes);AC_DEFINE(HAVE_CC_LIMITS_H, 1, 243104862Sru [Define if you have a C++ <limits.h>.]), 24455839SasmodaiAC_MSG_RESULT(no)) 24579543SruAC_LANG_POP(C++)])dnl 24655839Sasmodaidnl 24755839Sasmodaidnl 248114402SruAC_DEFUN(GROFF_STDINT_H, 249114402Sru[AC_LANG_PUSH(C++) 250114402SruAC_MSG_CHECKING([C++ <stdint.h>]) 251114402SruAC_TRY_COMPILE([#include <stdint.h>], 252114402Sru[uint32_t x; int32_t y;], 253114402SruAC_MSG_RESULT(yes);AC_DEFINE(HAVE_CC_STDINT_H, 1, 254114402Sru [Define if you have a C++ <stdint.h>.]), 255114402SruAC_MSG_RESULT(no)) 256114402SruAC_LANG_POP(C++)])dnl 257114402Srudnl 258114402Srudnl 25918099SpstAC_DEFUN(GROFF_TIME_T, 26079543Sru[AC_LANG_PUSH(C++) 26118099SpstAC_MSG_CHECKING([for declaration of time_t]) 26218099SpstAC_TRY_COMPILE([#include <time.h>], 26355839Sasmodai[time_t t = time(0); struct tm *p = localtime(&t);], 26455839SasmodaiAC_MSG_RESULT(yes), 265104862SruAC_MSG_RESULT(no);AC_DEFINE(LONG_FOR_TIME_T, 1, 266104862Sru [Define if localtime() takes a long * not a 267104862Sru time_t *.])) 26879543SruAC_LANG_POP(C++)])dnl 26955839Sasmodaidnl 27055839Sasmodaidnl 27118099SpstAC_DEFUN(GROFF_STRUCT_EXCEPTION, 27218099Spst[AC_MSG_CHECKING([struct exception]) 27318099SpstAC_TRY_COMPILE([#include <math.h>], 27418099Spst[struct exception e;], 275104862SruAC_MSG_RESULT(yes);AC_DEFINE(HAVE_STRUCT_EXCEPTION, 1, 276104862Sru [Define if <math.h> defines struct exception.]), 27718099SpstAC_MSG_RESULT(no))])dnl 27855839Sasmodaidnl 27955839Sasmodaidnl 28018099SpstAC_DEFUN(GROFF_ARRAY_DELETE, 28179543Sru[AC_LANG_PUSH(C++) 28218099SpstAC_MSG_CHECKING([whether ANSI array delete syntax supported]) 283104862SruAC_TRY_COMPILE(, [char *p = new char[5]; delete [] p;], 28455839SasmodaiAC_MSG_RESULT(yes), 285104862SruAC_MSG_RESULT(no);AC_DEFINE(ARRAY_DELETE_NEEDS_SIZE, 1, 286104862Sru [Define if your C++ doesn't understand 287104862Sru `delete []'.])) 28879543SruAC_LANG_POP(C++)])dnl 28918099Spstdnl 29055839Sasmodaidnl 29155839Sasmodaidnl 29218099SpstAC_DEFUN(GROFF_TRADITIONAL_CPP, 29379543Sru[AC_LANG_PUSH(C++) 29418099SpstAC_MSG_CHECKING([traditional preprocessor]) 29518099SpstAC_TRY_COMPILE([#define name2(a,b) a/**/b],[int name2(foo,bar);], 296104862SruAC_MSG_RESULT(yes);AC_DEFINE(TRADITIONAL_CPP, 1, 297104862Sru [Define if your C++ compiler uses a 298104862Sru traditional (Reiser) preprocessor.]), 29918099SpstAC_MSG_RESULT(no)) 30079543SruAC_LANG_POP(C++)])dnl 30155839Sasmodaidnl 30255839Sasmodaidnl 30318099SpstAC_DEFUN(GROFF_WCOREFLAG, 30418099Spst[AC_MSG_CHECKING([w_coredump]) 30555839SasmodaiAC_TRY_RUN([#include <sys/types.h> 30618099Spst#include <sys/wait.h> 30718099Spstmain() 30818099Spst{ 30918099Spst#ifdef WCOREFLAG 31018099Spst exit(1); 31118099Spst#else 31218099Spst int i = 0; 31318099Spst ((union wait *)&i)->w_coredump = 1; 31418099Spst exit(i != 0200); 31518099Spst#endif 31655839Sasmodai}], 317104862SruAC_MSG_RESULT(yes);AC_DEFINE(WCOREFLAG, 0200, 318104862Sru [Define if the 0200 bit of the status returned 319104862Sru by wait() indicates whether a core image was 320104862Sru produced for a process that was terminated by 321104862Sru a signal.]), 32255839SasmodaiAC_MSG_RESULT(no), 32318099SpstAC_MSG_RESULT(no))])dnl 32418099Spstdnl 32555839Sasmodaidnl 32618099SpstAC_DEFUN(GROFF_BROKEN_SPOOLER_FLAGS, 32718099Spst[AC_MSG_CHECKING([default value for grops -b option]) 32818099Spsttest -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=7 32918099SpstAC_MSG_RESULT($BROKEN_SPOOLER_FLAGS) 33018099SpstAC_SUBST(BROKEN_SPOOLER_FLAGS)])dnl 33118099Spstdnl 33255839Sasmodaidnl 33318099SpstAC_DEFUN(GROFF_PAGE, 33418099Spst[AC_MSG_CHECKING([default paper size]) 335104862Srugroff_prefix=$prefix 336104862Srutest "x$prefix" = xNONE && groff_prefix=$ac_default_prefix 33755839Sasmodaiif test -z "$PAGE"; then 33818099Spst descfile= 339104862Sru if test -r $groff_prefix/share/groff/font/devps/DESC; then 340104862Sru descfile=$groff_prefix/share/groff/font/devps/DESC 341104862Sru elif test -r $groff_prefix/lib/groff/font/devps/DESC; then 342104862Sru descfile=$groff_prefix/lib/groff/font/devps/DESC 34375584Sru else 344104862Sru for f in $groff_prefix/share/groff/*/font/devps/DESC; do 34575584Sru if test -r $f; then 34675584Sru descfile=$f 34775584Sru break 34875584Sru fi 34975584Sru done 35018099Spst fi 351104862Sru if test -n "$descfile"; then 352104862Sruchangequote(,)dnl 353104862Sru if grep '^paperlength[ ]\+841890' $descfile 354104862Sru >/dev/null 2>&1; then 355104862Sru PAGE=A4 356104862Sru elif grep '^papersize[ ]\+[aA]4' $descfile \ 357104862Sru >/dev/null 2>&1; then 358104862Sru PAGE=A4 359104862Sru fi 360104862Sruchangequote([,])dnl 36118099Spst fi 36218099Spstfi 36355839Sasmodaiif test -z "$PAGE"; then 36418099Spst dom=`awk '([$]1 == "dom" || [$]1 == "search") { print [$]2; exit}' \ 36518099Spst /etc/resolv.conf 2>/dev/null` 36655839Sasmodai if test -z "$dom"; then 36718099Spst dom=`(domainname) 2>/dev/null | tr -d '+'` 36879543Sru if test -z "$dom" \ 36979543Sru || test "$dom" = '(none)'; then 37018099Spst dom=`(hostname) 2>/dev/null | grep '\.'` 37118099Spst fi 37218099Spst fi 37318099Spstchangequote(,)dnl 37418099Spst # If the top-level domain is two letters and it's not `us' or `ca' 37518099Spst # then they probably use A4 paper. 37618099Spst case "$dom" in 37718099Spst *.[Uu][Ss]|*.[Cc][Aa]) ;; 37818099Spst *.[A-Za-z][A-Za-z]) PAGE=A4 ;; 37918099Spst esac 38018099Spstchangequote([,])dnl 38118099Spstfi 38218099Spsttest -n "$PAGE" || PAGE=letter 383104862Sruif test "x$PAGE" = "xA4"; then 384104862Sru AC_DEFINE(PAGEA4, 1, 385104862Sru [Define if the printer's page size is A4.]) 386104862Srufi 38718099SpstAC_MSG_RESULT($PAGE) 38818099SpstAC_SUBST(PAGE)])dnl 38918099Spstdnl 39055839Sasmodaidnl 39118099SpstAC_DEFUN(GROFF_CXX_CHECK, 39269626Sru[AC_REQUIRE([AC_PROG_CXX]) 39379543SruAC_LANG_PUSH(C++) 39418099Spstif test "$cross_compiling" = no; then 39555839Sasmodai AC_MSG_CHECKING([that C++ compiler can compile simple program]) 39618099Spstfi 39718099SpstAC_TRY_RUN([int main() { return 0; }], 39818099SpstAC_MSG_RESULT(yes), 39955839SasmodaiAC_MSG_RESULT(no);AC_MSG_ERROR([a working C++ compiler is required]), 40055839Sasmodai:) 40118099Spstif test "$cross_compiling" = no; then 40255839Sasmodai AC_MSG_CHECKING([that C++ static constructors and destructors are called]) 40318099Spstfi 40418099SpstAC_TRY_RUN([ 40518099Spstextern "C" { 40618099Spst void _exit(int); 40718099Spst} 40818099Spstint i; 40918099Spststruct A { 41018099Spst char dummy; 41118099Spst A() { i = 1; } 41218099Spst ~A() { if (i == 1) _exit(0); } 41318099Spst}; 41418099SpstA a; 41518099Spstint main() { return 1; } 41618099Spst], 41718099SpstAC_MSG_RESULT(yes), 41855839SasmodaiAC_MSG_RESULT(no);AC_MSG_ERROR([a working C++ compiler is required]), 41955839Sasmodai:) 42018099SpstAC_MSG_CHECKING([that header files support C++]) 42118099SpstAC_TRY_LINK([#include <stdio.h>], 42255839Sasmodai[fopen(0, 0);], 42355839SasmodaiAC_MSG_RESULT(yes), 42455839SasmodaiAC_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++)])) 42579543SruAC_LANG_POP(C++)])dnl 42618099Spstdnl 42755839Sasmodaidnl 42818099SpstAC_DEFUN(GROFF_TMAC, 42955839Sasmodai[AC_MSG_CHECKING([for prefix of system macro packages]) 43018099Spstsys_tmac_prefix= 43118099Spstsys_tmac_file_prefix= 43255839Sasmodaifor d in /usr/share/lib/tmac /usr/lib/tmac; do 43355839Sasmodai for t in "" tmac.; do 43455839Sasmodai for m in an s m; do 43518099Spst f=$d/$t$m 43618099Spst if test -z "$sys_tmac_prefix" \ 43718099Spst && test -f $f \ 43855839Sasmodai && grep '^\.if' $f >/dev/null 2>&1; then 43918099Spst sys_tmac_prefix=$d/$t 44018099Spst sys_tmac_file_prefix=$t 44118099Spst fi 44218099Spst done 44318099Spst done 44418099Spstdone 44518099SpstAC_MSG_RESULT($sys_tmac_prefix) 44618099SpstAC_SUBST(sys_tmac_prefix) 44718099Spsttmac_wrap= 44818099SpstAC_MSG_CHECKING([which system macro packages should be made available]) 44955839Sasmodaiif test "x$sys_tmac_file_prefix" = "xtmac."; then 45055839Sasmodai for f in $sys_tmac_prefix*; do 45118099Spst suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"` 45218099Spst case "$suff" in 45355839Sasmodai e) ;; 45418099Spst *) 45555839Sasmodai grep "Copyright.*Free Software Foundation" $f >/dev/null \ 45655839Sasmodai || tmac_wrap="$tmac_wrap $suff" ;; 45718099Spst esac 45818099Spst done 45955839Sasmodaielif test -n "$sys_tmac_prefix"; then 46018099Spst files=`echo $sys_tmac_prefix*` 46118099Spst grep "\\.so" $files >conftest.sol 46255839Sasmodai for f in $files; do 46318099Spst case "$f" in 46455839Sasmodai ${sys_tmac_prefix}e) ;; 46518099Spst *.me) ;; 46618099Spst */ms.*) ;; 46718099Spst *) 46855839Sasmodai b=`basename $f` 46955839Sasmodai if grep "\\.so.*/$b\$" conftest.sol >/dev/null \ 47055839Sasmodai || grep -l "Copyright.*Free Software Foundation" $f >/dev/null; then 47155839Sasmodai : 47255839Sasmodai else 47355839Sasmodai suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"` 47455839Sasmodai case "$suff" in 47555839Sasmodai tmac.*) ;; 47655839Sasmodai *) tmac_wrap="$tmac_wrap $suff" ;; 47755839Sasmodai esac 47855839Sasmodai fi 47918099Spst esac 48018099Spst done 48118099Spst rm -f conftest.sol 48218099Spstfi 48318099SpstAC_MSG_RESULT([$tmac_wrap]) 48469626SruAC_SUBST(tmac_wrap)])dnl 48555839Sasmodaidnl 48655839Sasmodaidnl 48718099SpstAC_DEFUN(GROFF_G, 48818099Spst[AC_MSG_CHECKING([for existing troff installation]) 48955839Sasmodaiif test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then 49018099Spst AC_MSG_RESULT(yes) 49118099Spst g=g 49218099Spstelse 49318099Spst AC_MSG_RESULT(no) 49418099Spst g= 49518099Spstfi 49669626SruAC_SUBST(g)])dnl 49755839Sasmodaidnl 49855839Sasmodaidnl 49918099Spstdnl We need the path to install-sh to be absolute. 50055839Sasmodaidnl 50118099SpstAC_DEFUN(GROFF_INSTALL_SH, 50218099Spst[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl 50318099Spstac_dir=`cd $ac_aux_dir; pwd` 50469626Sruac_install_sh="$ac_dir/install-sh -c"])dnl 50555839Sasmodaidnl 50655839Sasmodaidnl 507104862Srudnl Test whether install-info is available. 508104862Srudnl 509104862SruAC_DEFUN(GROFF_INSTALL_INFO, 510104862Sru[AC_CHECK_PROGS(INSTALL_INFO, install-info, :)])dnl 511104862Srudnl 512104862Srudnl 51355839Sasmodaidnl At least one UNIX system, Apple Macintosh Rhapsody 5.5, 51455839Sasmodaidnl does not have -lm. 51555839Sasmodaidnl 51655839SasmodaiAC_DEFUN(GROFF_LIBM, 51755839Sasmodai[AC_CHECK_LIB(m,sin,LIBM=-lm) 51869626SruAC_SUBST(LIBM)])dnl 51969626Srudnl 52069626Srudnl 52169626Srudnl We need top_srcdir to be absolute. 52269626Srudnl 52369626SruAC_DEFUN(GROFF_SRCDIR, 52469626Sru[ac_srcdir_defaulted=no 52569626Srusrcdir=`cd $srcdir; pwd`])dnl 52669626Srudnl 52769626Srudnl 52869626Srudnl This simplifies Makefile rules. 52969626Srudnl 53069626SruAC_DEFUN(GROFF_BUILDDIR, 531104862Sru[groff_top_builddir=`pwd` 532104862SruAC_SUBST(groff_top_builddir)])dnl 53369626Srudnl 53469626Srudnl 53569626Srudnl Check for EBCDIC - stolen from the OS390 Unix LYNX port 53669626Srudnl 53769626SruAC_DEFUN(GROFF_EBCDIC, 53869626Sru[AC_MSG_CHECKING([whether character set is EBCDIC]) 53969626SruAC_TRY_COMPILE(, 54069626Sru[/* Treat any failure as ASCII for compatibility with existing art. 54169626Sru Use compile-time rather than run-time tests for cross-compiler 54269626Sru tolerance. */ 54369626Sru#if '0' != 240 54469626Srumake an error "Character set is not EBCDIC" 54569626Sru#endif], 54669626Srugroff_cv_ebcdic="yes" 54769626Sru TTYDEVDIRS="font/devcp1047" 54869626Sru AC_MSG_RESULT(yes) 549104862Sru AC_DEFINE(IS_EBCDIC_HOST, 1, 550104862Sru [Define if the host's encoding is EBCDIC.]), 55169626Srugroff_cv_ebcdic="no" 552104862Sru TTYDEVDIRS="font/devascii font/devlatin1" 553104862Sru OTHERDEVDIRS="font/devlj4 font/devlbp" 55469626Sru AC_MSG_RESULT(no)) 555104862SruAC_SUBST(TTYDEVDIRS) 556104862SruAC_SUBST(OTHERDEVDIRS)])dnl 55769626Srudnl 55869626Srudnl 55969626Srudnl Check for OS/390 Unix. We test for EBCDIC also -- the Linux port (with 56069626Srudnl gcc) to OS/390 uses ASCII internally. 56169626Srudnl 56269626SruAC_DEFUN(GROFF_OS390, 56379543Sru[if test "$groff_cv_ebcdic" = "yes"; then 56469626Sru AC_MSG_CHECKING([for OS/390 Unix]) 56569626Sru case `uname` in 56669626Sru OS/390) 56769626Sru CFLAGS="$CFLAGS -D_ALL_SOURCE" 56869626Sru AC_MSG_RESULT(yes) ;; 56969626Sru *) 57069626Sru AC_MSG_RESULT(no) ;; 57169626Sru esac 57269626Srufi])dnl 57369626Srudnl 57469626Srudnl 57569626Srudnl Check whether we need a declaration for a function. 57669626Srudnl 57769626Srudnl Stolen from GNU bfd. 57869626Srudnl 57969626SruAC_DEFUN(GROFF_NEED_DECLARATION, 58069626Sru[AC_MSG_CHECKING([whether $1 must be declared]) 58179543SruAC_LANG_PUSH(C++) 58269626SruAC_CACHE_VAL(groff_cv_decl_needed_$1, 58369626Sru[AC_TRY_COMPILE([ 58469626Sru#include <stdio.h> 58569626Sru#ifdef HAVE_STRING_H 58669626Sru#include <string.h> 58779543Sru#endif 58869626Sru#ifdef HAVE_STRINGS_H 58969626Sru#include <strings.h> 59069626Sru#endif 59169626Sru#ifdef HAVE_STDLIB_H 59269626Sru#include <stdlib.h> 59369626Sru#endif 594104862Sru#ifdef HAVE_SYS_TIME_H 595104862Sru#include <sys/time.h> 596104862Sru#endif 59769626Sru#ifdef HAVE_UNISTD_H 59869626Sru#include <unistd.h> 59969626Sru#endif 60069626Sru#ifdef HAVE_MATH_H 60169626Sru#include <math.h> 60269626Sru#endif], 603104862Sru[#ifndef $1 604104862Sru char *p = (char *) $1; 605104862Sru#endif], 60669626Srugroff_cv_decl_needed_$1=no, 60769626Srugroff_cv_decl_needed_$1=yes)]) 60869626SruAC_MSG_RESULT($groff_cv_decl_needed_$1) 60969626Sruif test $groff_cv_decl_needed_$1 = yes; then 610104862Sru AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1, 611104862Sru [Define if your C++ doesn't declare ]$1[().]) 61269626Srufi 61379543SruAC_LANG_POP(C++)])dnl 61479543Srudnl 61579543Srudnl 616114402Srudnl If mkstemp() isn't available, use our own mkstemp.cpp file. 61779543Srudnl 61879543SruAC_DEFUN(GROFF_MKSTEMP, 619104862Sru[AC_MSG_CHECKING([for mkstemp]) 620104862SruAC_LANG_PUSH(C++) 621114402SruAC_LIBSOURCE(mkstemp.cpp) 622104862SruAC_TRY_LINK([#include <stdlib.h> 623104862Sru#include <unistd.h> 624104862Sruint (*f) (char *);], 625104862Sru[f = mkstemp;], 626104862SruAC_MSG_RESULT(yes);AC_DEFINE(HAVE_MKSTEMP, 1, 627104862Sru [Define if you have mkstemp().]), 628104862SruAC_MSG_RESULT(no);_AC_LIBOBJ(mkstemp)) 629104862SruAC_LANG_POP(C++)])dnl 630104862Srudnl 631104862Srudnl 632104862Srudnl Test whether <inttypes.h> exists, doesn't clash with <sys/types.h>, 633104862Srudnl and declares uintmax_t. Taken from the fileutils package. 634104862Srudnl 635104862SruAC_DEFUN(GROFF_INTTYPES_H, 636104862Sru[AC_LANG_PUSH(C++) 637104862SruAC_MSG_CHECKING([for inttypes.h]) 638104862SruAC_TRY_COMPILE([#include <sys/types.h> 639104862Sru#include <inttypes.h>], 640104862Sru[uintmax_t i = (uintmax_t)-1;], 641104862Srugroff_cv_header_inttypes_h=yes, 642104862Srugroff_cv_header_inttypes_h=no) 643104862SruAC_MSG_RESULT($groff_cv_header_inttypes_h) 644104862SruAC_LANG_POP(C++)])dnl 645104862Srudnl 646104862Srudnl 647104862Srudnl Test for working `unsigned long long'. Taken from the fileutils package. 648104862Srudnl 649104862SruAC_DEFUN(GROFF_UNSIGNED_LONG_LONG, 650104862Sru[AC_LANG_PUSH(C++) 651104862SruAC_MSG_CHECKING([for unsigned long long]) 652104862SruAC_TRY_LINK([unsigned long long ull = 1; int i = 63;], 653104862Sru[unsigned long long ullmax = (unsigned long long)-1; 654104862Srureturn ull << i | ull >> i | ullmax / ull | ullmax % ull;], 655104862Srugroff_cv_type_unsigned_long_long=yes, 656104862Srugroff_cv_type_unsigned_long_long=no) 657104862SruAC_MSG_RESULT($groff_cv_type_unsigned_long_long) 658104862SruAC_LANG_POP(C++)])dnl 659104862Srudnl 660104862Srudnl 661104862Srudnl Define uintmax_t to `unsigned long' or `unsigned long long' 662104862Srudnl if <inttypes.h> does not exist. Taken from the fileutils package. 663104862Srudnl 664104862SruAC_DEFUN(GROFF_UINTMAX_T, 665104862Sru[AC_REQUIRE([GROFF_INTTYPES_H]) 666104862Sruif test $groff_cv_header_inttypes_h = no; then 667104862Sru AC_REQUIRE([GROFF_UNSIGNED_LONG_LONG]) 668104862Sru test $groff_cv_type_unsigned_long_long = yes \ 669104862Sru && ac_type='unsigned long long' \ 670104862Sru || ac_type='unsigned long' 671104862Sru AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, 672104862Sru [Define uintmax_t to `unsigned long' or 673104862Sru `unsigned long long' if <inttypes.h> does not 674104862Sru exist.]) 675104862Srufi])dnl 676