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