aclocal.m4 revision 114402
1dnl Autoconf macros for groff. 2dnl Copyright (C) 1989-1995, 2001, 2002 Free Software Foundation, Inc. 3dnl 4dnl This file is part of groff. 5dnl 6dnl groff is free software; you can redistribute it and/or modify it under 7dnl the terms of the GNU General Public License as published by the Free 8dnl Software Foundation; either version 2, or (at your option) any later 9dnl version. 10dnl 11dnl groff is distributed in the hope that it will be useful, but WITHOUT ANY 12dnl WARRANTY; without even the implied warranty of MERCHANTABILITY or 13dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14dnl for more details. 15dnl 16dnl You should have received a copy of the GNU General Public License along 17dnl with groff; see the file COPYING. If not, write to the Free Software 18dnl Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19dnl 20dnl 21AC_DEFUN(GROFF_PRINT, 22[if test -z "$PSPRINT"; then 23 AC_CHECK_PROGS(LPR,lpr) 24 AC_CHECK_PROGS(LP,lp) 25 if test -n "$LPR" && test -n "$LP"; then 26 # HP-UX provides an lpr command that emulates lpr using lp, 27 # but it doesn't have lpq; in this case we want to use lp 28 # rather than lpr. 29 AC_CHECK_PROGS(LPQ,lpq) 30 test -n "$LPQ" || LPR= 31 fi 32 if test -n "$LPR"; then 33 PSPRINT="$LPR" 34 elif test -n "$LP"; then 35 PSPRINT="$LP" 36 fi 37fi 38AC_SUBST(PSPRINT) 39AC_MSG_CHECKING([for command to use for printing PostScript files]) 40AC_MSG_RESULT($PSPRINT) 41# Figure out DVIPRINT from PSPRINT. 42AC_MSG_CHECKING([for command to use for printing dvi files]) 43if test -n "$PSPRINT" && test -z "$DVIPRINT"; then 44 if test "X$PSPRINT" = "Xlpr"; then 45 DVIPRINT="lpr -d" 46 else 47 DVIPRINT="$PSPRINT" 48 fi 49fi 50AC_SUBST(DVIPRINT) 51AC_MSG_RESULT($DVIPRINT)])dnl 52dnl 53dnl 54dnl Bison generated parsers have problems with C++ compilers other than g++. 55dnl So byacc is preferred over bison. 56dnl 57AC_DEFUN(GROFF_PROG_YACC, 58[AC_CHECK_PROGS(YACC, byacc 'bison -y', yacc)])dnl 59dnl 60dnl 61dnl The following programs are needed for grohtml. 62dnl 63AC_DEFUN(GROFF_HTML_PROGRAMS, 64[make_html=html 65make_install_html=install_html 66missing= 67AC_CHECK_PROG(pnmcut, pnmcut, found, missing) 68if test $pnmcut = missing; then 69 missing="$missing pnmcut" 70fi 71AC_CHECK_PROG(pnmcrop, pnmcrop, found, missing) 72if test $pnmcrop = missing; then 73 missing="$missing pnmcrop" 74fi 75AC_CHECK_PROG(pnmtopng, pnmtopng, found, missing) 76if test $pnmtopng = missing; then 77 missing="$missing pnmtopng" 78fi 79AC_CHECK_PROG(gs, gs gsos2, found, missing) 80if test $gs = missing; then 81 missing="$missing gs" 82fi 83AC_CHECK_PROG(psselect, psselect, found, missing) 84if test $psselect = missing; then 85 missing="$missing psselect" 86fi 87AC_CHECK_PROG(pnmtops, pnmtops, found, missing) 88if test $pnmtops = missing; then 89 missing="$missing pnmtops" 90fi 91if test -n "$missing"; then 92 cnt=0 93 for i in $missing 94 do 95 cnt=`expr $cnt + 1` 96 eval "prog$cnt=$i" 97 done 98 plural="s" 99 case $cnt in 100 1) 101 plural="" 102 progs="\`$prog1'" ;; 103 2) 104 progs="\`$prog1' and \`$prog2'" ;; 105 3) 106 progs="\`$prog1', \`$prog2', and \`$prog3'" ;; 107 4) 108 progs="\`$prog1', \`$prog2', \`$prog3', and \`$prog4'" ;; 109 5) 110 progs="\`$prog1', \`$prog2', \`$prog3', \`$prog4', and \`$prog5'" ;; 111 6) 112 progs="\`$prog1', \`$prog2', \`$prog3', \`$prog4', \`$prog5', and \`$prog6'" ;; 113 esac 114 make_html= 115 make_install_html= 116 AC_MSG_WARN([ 117 118 The program$plural 119 $progs 120 can't be found in the path, thus the HTML backend of groff (grohtml) 121 won't work properly. Consequently, no documentation in HTML format 122 is built and installed. 123]) 124fi 125AC_SUBST(make_html) 126AC_SUBST(make_install_html)])dnl 127dnl 128dnl check to see whether pnmtops can handle the -nosetpage option 129dnl 130AC_DEFUN(GROFF_PNMTOPS_NOSETPAGE, 131[AC_MSG_CHECKING([whether pnmtops can handle the -nosetpage option]) 132if echo P2 2 2 255 0 1 2 0 | pnmtops -nosetpage > /dev/null 2>&1 ; then 133 AC_MSG_RESULT(yes) 134 pnmtops_nosetpage="pnmtops -nosetpage" 135else 136 AC_MSG_RESULT(no) 137 pnmtops_nosetpage="pnmtops" 138fi 139AC_SUBST(pnmtops_nosetpage) 140])dnl 141dnl 142dnl 143dnl GROFF_CSH_HACK(if hack present, if not present) 144dnl 145AC_DEFUN(GROFF_CSH_HACK, 146[AC_MSG_CHECKING([for csh hash hack]) 147cat <<EOF >conftest.sh 148#!/bin/sh 149true || exit 0 150export PATH || exit 0 151exit 1 152EOF 153chmod +x conftest.sh 154if echo ./conftest.sh | (csh >/dev/null 2>&1) >/dev/null 2>&1; then 155 AC_MSG_RESULT(yes); $1 156else 157 AC_MSG_RESULT(no); $2 158fi 159rm -f conftest.sh])dnl 160dnl 161dnl 162dnl From udodo!hans@relay.NL.net (Hans Zuidam) 163dnl 164AC_DEFUN(GROFF_ISC_SYSV3, 165[AC_MSG_CHECKING([for ISC 3.x or 4.x]) 166changequote(,)dnl 167if grep '[34]\.' /usr/options/cb.name >/dev/null 2>&1 168changequote([,])dnl 169then 170 AC_MSG_RESULT(yes) 171 AC_DEFINE(_SYSV3, 1, 172 [Define if you have ISC 3.x or 4.x.]) 173else 174 AC_MSG_RESULT(no) 175fi])dnl 176dnl 177dnl 178AC_DEFUN(GROFF_POSIX, 179[AC_MSG_CHECKING([whether -D_POSIX_SOURCE is necessary]) 180AC_LANG_PUSH(C++) 181AC_TRY_COMPILE([#include <stdio.h> 182extern "C" { void fileno(int); }],, 183AC_MSG_RESULT(yes);AC_DEFINE(_POSIX_SOURCE, 1, 184 [Define if -D_POSIX_SOURCE is necessary.]), 185AC_MSG_RESULT(no)) 186AC_LANG_POP(C++)])dnl 187dnl 188dnl 189dnl srand() of SunOS 4.1.3 has return type int instead of void 190dnl 191AC_DEFUN(GROFF_SRAND, 192[AC_LANG_PUSH(C++) 193AC_MSG_CHECKING([for return type of srand]) 194AC_TRY_COMPILE([#include <stdlib.h> 195extern "C" { void srand(unsigned int); }],, 196AC_MSG_RESULT(void);AC_DEFINE(RET_TYPE_SRAND_IS_VOID, 1, 197 [Define if srand() returns void not int.]), 198AC_MSG_RESULT(int)) 199AC_LANG_POP(C++)])dnl 200dnl 201dnl 202AC_DEFUN(GROFF_SYS_NERR, 203[AC_LANG_PUSH(C++) 204AC_MSG_CHECKING([for sys_nerr in <errno.h> or <stdio.h>]) 205AC_TRY_COMPILE([#include <errno.h> 206#include <stdio.h>], 207[int k; k = sys_nerr;], 208AC_MSG_RESULT(yes);AC_DEFINE(HAVE_SYS_NERR, 1, 209 [Define if you have sysnerr in <errno.h> or 210 <stdio.h>.]), 211AC_MSG_RESULT(no)) 212AC_LANG_POP(C++)])dnl 213dnl 214dnl 215AC_DEFUN(GROFF_SYS_ERRLIST, 216[AC_MSG_CHECKING([for sys_errlist[] in <errno.h> or <stdio.h>]) 217AC_TRY_COMPILE([#include <errno.h> 218#include <stdio.h>], 219[int k; k = (int)sys_errlist[0];], 220AC_MSG_RESULT(yes);AC_DEFINE(HAVE_SYS_ERRLIST, 1, 221 [Define if you have sys_errlist in <errno.h> 222 or in <stdio.h>.]), 223AC_MSG_RESULT(no))])dnl 224dnl 225dnl 226AC_DEFUN(GROFF_OSFCN_H, 227[AC_LANG_PUSH(C++) 228AC_MSG_CHECKING([C++ <osfcn.h>]) 229AC_TRY_COMPILE([#include <osfcn.h>], 230[read(0, 0, 0); open(0, 0);], 231AC_MSG_RESULT(yes);AC_DEFINE(HAVE_CC_OSFCN_H, 1, 232 [Define if you have a C++ <osfcn.h>.]), 233AC_MSG_RESULT(no)) 234AC_LANG_POP(C++)])dnl 235dnl 236dnl 237AC_DEFUN(GROFF_LIMITS_H, 238[AC_LANG_PUSH(C++) 239AC_MSG_CHECKING([C++ <limits.h>]) 240AC_TRY_COMPILE([#include <limits.h>], 241[int x = INT_MIN; int y = INT_MAX; int z = UCHAR_MAX;], 242AC_MSG_RESULT(yes);AC_DEFINE(HAVE_CC_LIMITS_H, 1, 243 [Define if you have a C++ <limits.h>.]), 244AC_MSG_RESULT(no)) 245AC_LANG_POP(C++)])dnl 246dnl 247dnl 248AC_DEFUN(GROFF_STDINT_H, 249[AC_LANG_PUSH(C++) 250AC_MSG_CHECKING([C++ <stdint.h>]) 251AC_TRY_COMPILE([#include <stdint.h>], 252[uint32_t x; int32_t y;], 253AC_MSG_RESULT(yes);AC_DEFINE(HAVE_CC_STDINT_H, 1, 254 [Define if you have a C++ <stdint.h>.]), 255AC_MSG_RESULT(no)) 256AC_LANG_POP(C++)])dnl 257dnl 258dnl 259AC_DEFUN(GROFF_TIME_T, 260[AC_LANG_PUSH(C++) 261AC_MSG_CHECKING([for declaration of time_t]) 262AC_TRY_COMPILE([#include <time.h>], 263[time_t t = time(0); struct tm *p = localtime(&t);], 264AC_MSG_RESULT(yes), 265AC_MSG_RESULT(no);AC_DEFINE(LONG_FOR_TIME_T, 1, 266 [Define if localtime() takes a long * not a 267 time_t *.])) 268AC_LANG_POP(C++)])dnl 269dnl 270dnl 271AC_DEFUN(GROFF_STRUCT_EXCEPTION, 272[AC_MSG_CHECKING([struct exception]) 273AC_TRY_COMPILE([#include <math.h>], 274[struct exception e;], 275AC_MSG_RESULT(yes);AC_DEFINE(HAVE_STRUCT_EXCEPTION, 1, 276 [Define if <math.h> defines struct exception.]), 277AC_MSG_RESULT(no))])dnl 278dnl 279dnl 280AC_DEFUN(GROFF_ARRAY_DELETE, 281[AC_LANG_PUSH(C++) 282AC_MSG_CHECKING([whether ANSI array delete syntax supported]) 283AC_TRY_COMPILE(, [char *p = new char[5]; delete [] p;], 284AC_MSG_RESULT(yes), 285AC_MSG_RESULT(no);AC_DEFINE(ARRAY_DELETE_NEEDS_SIZE, 1, 286 [Define if your C++ doesn't understand 287 `delete []'.])) 288AC_LANG_POP(C++)])dnl 289dnl 290dnl 291dnl 292AC_DEFUN(GROFF_TRADITIONAL_CPP, 293[AC_LANG_PUSH(C++) 294AC_MSG_CHECKING([traditional preprocessor]) 295AC_TRY_COMPILE([#define name2(a,b) a/**/b],[int name2(foo,bar);], 296AC_MSG_RESULT(yes);AC_DEFINE(TRADITIONAL_CPP, 1, 297 [Define if your C++ compiler uses a 298 traditional (Reiser) preprocessor.]), 299AC_MSG_RESULT(no)) 300AC_LANG_POP(C++)])dnl 301dnl 302dnl 303AC_DEFUN(GROFF_WCOREFLAG, 304[AC_MSG_CHECKING([w_coredump]) 305AC_TRY_RUN([#include <sys/types.h> 306#include <sys/wait.h> 307main() 308{ 309#ifdef WCOREFLAG 310 exit(1); 311#else 312 int i = 0; 313 ((union wait *)&i)->w_coredump = 1; 314 exit(i != 0200); 315#endif 316}], 317AC_MSG_RESULT(yes);AC_DEFINE(WCOREFLAG, 0200, 318 [Define if the 0200 bit of the status returned 319 by wait() indicates whether a core image was 320 produced for a process that was terminated by 321 a signal.]), 322AC_MSG_RESULT(no), 323AC_MSG_RESULT(no))])dnl 324dnl 325dnl 326AC_DEFUN(GROFF_BROKEN_SPOOLER_FLAGS, 327[AC_MSG_CHECKING([default value for grops -b option]) 328test -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=7 329AC_MSG_RESULT($BROKEN_SPOOLER_FLAGS) 330AC_SUBST(BROKEN_SPOOLER_FLAGS)])dnl 331dnl 332dnl 333AC_DEFUN(GROFF_PAGE, 334[AC_MSG_CHECKING([default paper size]) 335groff_prefix=$prefix 336test "x$prefix" = xNONE && groff_prefix=$ac_default_prefix 337if test -z "$PAGE"; then 338 descfile= 339 if test -r $groff_prefix/share/groff/font/devps/DESC; then 340 descfile=$groff_prefix/share/groff/font/devps/DESC 341 elif test -r $groff_prefix/lib/groff/font/devps/DESC; then 342 descfile=$groff_prefix/lib/groff/font/devps/DESC 343 else 344 for f in $groff_prefix/share/groff/*/font/devps/DESC; do 345 if test -r $f; then 346 descfile=$f 347 break 348 fi 349 done 350 fi 351 if test -n "$descfile"; then 352changequote(,)dnl 353 if grep '^paperlength[ ]\+841890' $descfile 354 >/dev/null 2>&1; then 355 PAGE=A4 356 elif grep '^papersize[ ]\+[aA]4' $descfile \ 357 >/dev/null 2>&1; then 358 PAGE=A4 359 fi 360changequote([,])dnl 361 fi 362fi 363if test -z "$PAGE"; then 364 dom=`awk '([$]1 == "dom" || [$]1 == "search") { print [$]2; exit}' \ 365 /etc/resolv.conf 2>/dev/null` 366 if test -z "$dom"; then 367 dom=`(domainname) 2>/dev/null | tr -d '+'` 368 if test -z "$dom" \ 369 || test "$dom" = '(none)'; then 370 dom=`(hostname) 2>/dev/null | grep '\.'` 371 fi 372 fi 373changequote(,)dnl 374 # If the top-level domain is two letters and it's not `us' or `ca' 375 # then they probably use A4 paper. 376 case "$dom" in 377 *.[Uu][Ss]|*.[Cc][Aa]) ;; 378 *.[A-Za-z][A-Za-z]) PAGE=A4 ;; 379 esac 380changequote([,])dnl 381fi 382test -n "$PAGE" || PAGE=letter 383if test "x$PAGE" = "xA4"; then 384 AC_DEFINE(PAGEA4, 1, 385 [Define if the printer's page size is A4.]) 386fi 387AC_MSG_RESULT($PAGE) 388AC_SUBST(PAGE)])dnl 389dnl 390dnl 391AC_DEFUN(GROFF_CXX_CHECK, 392[AC_REQUIRE([AC_PROG_CXX]) 393AC_LANG_PUSH(C++) 394if test "$cross_compiling" = no; then 395 AC_MSG_CHECKING([that C++ compiler can compile simple program]) 396fi 397AC_TRY_RUN([int main() { return 0; }], 398AC_MSG_RESULT(yes), 399AC_MSG_RESULT(no);AC_MSG_ERROR([a working C++ compiler is required]), 400:) 401if test "$cross_compiling" = no; then 402 AC_MSG_CHECKING([that C++ static constructors and destructors are called]) 403fi 404AC_TRY_RUN([ 405extern "C" { 406 void _exit(int); 407} 408int i; 409struct A { 410 char dummy; 411 A() { i = 1; } 412 ~A() { if (i == 1) _exit(0); } 413}; 414A a; 415int main() { return 1; } 416], 417AC_MSG_RESULT(yes), 418AC_MSG_RESULT(no);AC_MSG_ERROR([a working C++ compiler is required]), 419:) 420AC_MSG_CHECKING([that header files support C++]) 421AC_TRY_LINK([#include <stdio.h>], 422[fopen(0, 0);], 423AC_MSG_RESULT(yes), 424AC_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++)])) 425AC_LANG_POP(C++)])dnl 426dnl 427dnl 428AC_DEFUN(GROFF_TMAC, 429[AC_MSG_CHECKING([for prefix of system macro packages]) 430sys_tmac_prefix= 431sys_tmac_file_prefix= 432for d in /usr/share/lib/tmac /usr/lib/tmac; do 433 for t in "" tmac.; do 434 for m in an s m; do 435 f=$d/$t$m 436 if test -z "$sys_tmac_prefix" \ 437 && test -f $f \ 438 && grep '^\.if' $f >/dev/null 2>&1; then 439 sys_tmac_prefix=$d/$t 440 sys_tmac_file_prefix=$t 441 fi 442 done 443 done 444done 445AC_MSG_RESULT($sys_tmac_prefix) 446AC_SUBST(sys_tmac_prefix) 447tmac_wrap= 448AC_MSG_CHECKING([which system macro packages should be made available]) 449if test "x$sys_tmac_file_prefix" = "xtmac."; then 450 for f in $sys_tmac_prefix*; do 451 suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"` 452 case "$suff" in 453 e) ;; 454 *) 455 grep "Copyright.*Free Software Foundation" $f >/dev/null \ 456 || tmac_wrap="$tmac_wrap $suff" ;; 457 esac 458 done 459elif test -n "$sys_tmac_prefix"; then 460 files=`echo $sys_tmac_prefix*` 461 grep "\\.so" $files >conftest.sol 462 for f in $files; do 463 case "$f" in 464 ${sys_tmac_prefix}e) ;; 465 *.me) ;; 466 */ms.*) ;; 467 *) 468 b=`basename $f` 469 if grep "\\.so.*/$b\$" conftest.sol >/dev/null \ 470 || grep -l "Copyright.*Free Software Foundation" $f >/dev/null; then 471 : 472 else 473 suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"` 474 case "$suff" in 475 tmac.*) ;; 476 *) tmac_wrap="$tmac_wrap $suff" ;; 477 esac 478 fi 479 esac 480 done 481 rm -f conftest.sol 482fi 483AC_MSG_RESULT([$tmac_wrap]) 484AC_SUBST(tmac_wrap)])dnl 485dnl 486dnl 487AC_DEFUN(GROFF_G, 488[AC_MSG_CHECKING([for existing troff installation]) 489if test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then 490 AC_MSG_RESULT(yes) 491 g=g 492else 493 AC_MSG_RESULT(no) 494 g= 495fi 496AC_SUBST(g)])dnl 497dnl 498dnl 499dnl We need the path to install-sh to be absolute. 500dnl 501AC_DEFUN(GROFF_INSTALL_SH, 502[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl 503ac_dir=`cd $ac_aux_dir; pwd` 504ac_install_sh="$ac_dir/install-sh -c"])dnl 505dnl 506dnl 507dnl Test whether install-info is available. 508dnl 509AC_DEFUN(GROFF_INSTALL_INFO, 510[AC_CHECK_PROGS(INSTALL_INFO, install-info, :)])dnl 511dnl 512dnl 513dnl At least one UNIX system, Apple Macintosh Rhapsody 5.5, 514dnl does not have -lm. 515dnl 516AC_DEFUN(GROFF_LIBM, 517[AC_CHECK_LIB(m,sin,LIBM=-lm) 518AC_SUBST(LIBM)])dnl 519dnl 520dnl 521dnl We need top_srcdir to be absolute. 522dnl 523AC_DEFUN(GROFF_SRCDIR, 524[ac_srcdir_defaulted=no 525srcdir=`cd $srcdir; pwd`])dnl 526dnl 527dnl 528dnl This simplifies Makefile rules. 529dnl 530AC_DEFUN(GROFF_BUILDDIR, 531[groff_top_builddir=`pwd` 532AC_SUBST(groff_top_builddir)])dnl 533dnl 534dnl 535dnl Check for EBCDIC - stolen from the OS390 Unix LYNX port 536dnl 537AC_DEFUN(GROFF_EBCDIC, 538[AC_MSG_CHECKING([whether character set is EBCDIC]) 539AC_TRY_COMPILE(, 540[/* Treat any failure as ASCII for compatibility with existing art. 541 Use compile-time rather than run-time tests for cross-compiler 542 tolerance. */ 543#if '0' != 240 544make an error "Character set is not EBCDIC" 545#endif], 546groff_cv_ebcdic="yes" 547 TTYDEVDIRS="font/devcp1047" 548 AC_MSG_RESULT(yes) 549 AC_DEFINE(IS_EBCDIC_HOST, 1, 550 [Define if the host's encoding is EBCDIC.]), 551groff_cv_ebcdic="no" 552 TTYDEVDIRS="font/devascii font/devlatin1" 553 OTHERDEVDIRS="font/devlj4 font/devlbp" 554 AC_MSG_RESULT(no)) 555AC_SUBST(TTYDEVDIRS) 556AC_SUBST(OTHERDEVDIRS)])dnl 557dnl 558dnl 559dnl Check for OS/390 Unix. We test for EBCDIC also -- the Linux port (with 560dnl gcc) to OS/390 uses ASCII internally. 561dnl 562AC_DEFUN(GROFF_OS390, 563[if test "$groff_cv_ebcdic" = "yes"; then 564 AC_MSG_CHECKING([for OS/390 Unix]) 565 case `uname` in 566 OS/390) 567 CFLAGS="$CFLAGS -D_ALL_SOURCE" 568 AC_MSG_RESULT(yes) ;; 569 *) 570 AC_MSG_RESULT(no) ;; 571 esac 572fi])dnl 573dnl 574dnl 575dnl Check whether we need a declaration for a function. 576dnl 577dnl Stolen from GNU bfd. 578dnl 579AC_DEFUN(GROFF_NEED_DECLARATION, 580[AC_MSG_CHECKING([whether $1 must be declared]) 581AC_LANG_PUSH(C++) 582AC_CACHE_VAL(groff_cv_decl_needed_$1, 583[AC_TRY_COMPILE([ 584#include <stdio.h> 585#ifdef HAVE_STRING_H 586#include <string.h> 587#endif 588#ifdef HAVE_STRINGS_H 589#include <strings.h> 590#endif 591#ifdef HAVE_STDLIB_H 592#include <stdlib.h> 593#endif 594#ifdef HAVE_SYS_TIME_H 595#include <sys/time.h> 596#endif 597#ifdef HAVE_UNISTD_H 598#include <unistd.h> 599#endif 600#ifdef HAVE_MATH_H 601#include <math.h> 602#endif], 603[#ifndef $1 604 char *p = (char *) $1; 605#endif], 606groff_cv_decl_needed_$1=no, 607groff_cv_decl_needed_$1=yes)]) 608AC_MSG_RESULT($groff_cv_decl_needed_$1) 609if test $groff_cv_decl_needed_$1 = yes; then 610 AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1, 611 [Define if your C++ doesn't declare ]$1[().]) 612fi 613AC_LANG_POP(C++)])dnl 614dnl 615dnl 616dnl If mkstemp() isn't available, use our own mkstemp.cpp file. 617dnl 618AC_DEFUN(GROFF_MKSTEMP, 619[AC_MSG_CHECKING([for mkstemp]) 620AC_LANG_PUSH(C++) 621AC_LIBSOURCE(mkstemp.cpp) 622AC_TRY_LINK([#include <stdlib.h> 623#include <unistd.h> 624int (*f) (char *);], 625[f = mkstemp;], 626AC_MSG_RESULT(yes);AC_DEFINE(HAVE_MKSTEMP, 1, 627 [Define if you have mkstemp().]), 628AC_MSG_RESULT(no);_AC_LIBOBJ(mkstemp)) 629AC_LANG_POP(C++)])dnl 630dnl 631dnl 632dnl Test whether <inttypes.h> exists, doesn't clash with <sys/types.h>, 633dnl and declares uintmax_t. Taken from the fileutils package. 634dnl 635AC_DEFUN(GROFF_INTTYPES_H, 636[AC_LANG_PUSH(C++) 637AC_MSG_CHECKING([for inttypes.h]) 638AC_TRY_COMPILE([#include <sys/types.h> 639#include <inttypes.h>], 640[uintmax_t i = (uintmax_t)-1;], 641groff_cv_header_inttypes_h=yes, 642groff_cv_header_inttypes_h=no) 643AC_MSG_RESULT($groff_cv_header_inttypes_h) 644AC_LANG_POP(C++)])dnl 645dnl 646dnl 647dnl Test for working `unsigned long long'. Taken from the fileutils package. 648dnl 649AC_DEFUN(GROFF_UNSIGNED_LONG_LONG, 650[AC_LANG_PUSH(C++) 651AC_MSG_CHECKING([for unsigned long long]) 652AC_TRY_LINK([unsigned long long ull = 1; int i = 63;], 653[unsigned long long ullmax = (unsigned long long)-1; 654return ull << i | ull >> i | ullmax / ull | ullmax % ull;], 655groff_cv_type_unsigned_long_long=yes, 656groff_cv_type_unsigned_long_long=no) 657AC_MSG_RESULT($groff_cv_type_unsigned_long_long) 658AC_LANG_POP(C++)])dnl 659dnl 660dnl 661dnl Define uintmax_t to `unsigned long' or `unsigned long long' 662dnl if <inttypes.h> does not exist. Taken from the fileutils package. 663dnl 664AC_DEFUN(GROFF_UINTMAX_T, 665[AC_REQUIRE([GROFF_INTTYPES_H]) 666if test $groff_cv_header_inttypes_h = no; then 667 AC_REQUIRE([GROFF_UNSIGNED_LONG_LONG]) 668 test $groff_cv_type_unsigned_long_long = yes \ 669 && ac_type='unsigned long long' \ 670 || ac_type='unsigned long' 671 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, 672 [Define uintmax_t to `unsigned long' or 673 `unsigned long long' if <inttypes.h> does not 674 exist.]) 675fi])dnl 676