aclocal.m4 revision 151497
1# Autoconf macros for groff. 2# Copyright (C) 1989-1995, 2001, 2002, 2003, 2004, 2005 3# Free Software Foundation, Inc. 4# 5# This file is part of groff. 6# 7# groff is free software; you can redistribute it and/or modify it under 8# the terms of the GNU General Public License as published by the Free 9# Software Foundation; either version 2, or (at your option) any later 10# version. 11# 12# groff is distributed in the hope that it will be useful, but WITHOUT ANY 13# WARRANTY; without even the implied warranty of MERCHANTABILITY or 14# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15# for more details. 16# 17# You should have received a copy of the GNU General Public License along 18# with groff; see the file COPYING. If not, write to the Free Software 19# Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. 20 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 37 fi 38 AC_SUBST([PSPRINT]) 39 AC_MSG_CHECKING([for command to use for printing PostScript files]) 40 AC_MSG_RESULT([$PSPRINT]) 41 42 # Figure out DVIPRINT from PSPRINT. 43 AC_MSG_CHECKING([for command to use for printing dvi files]) 44 if test -n "$PSPRINT" && test -z "$DVIPRINT"; then 45 if test "x$PSPRINT" = "xlpr"; then 46 DVIPRINT="lpr -d" 47 else 48 DVIPRINT="$PSPRINT" 49 fi 50 fi 51 AC_SUBST([DVIPRINT]) 52 AC_MSG_RESULT([$DVIPRINT])]) 53 54# Bison generated parsers have problems with C++ compilers other than g++. 55# So byacc is preferred over bison. 56 57AC_DEFUN([GROFF_PROG_YACC], 58 [AC_CHECK_PROGS([YACC], [byacc 'bison -y'], [yacc])]) 59 60# The following programs are needed for grohtml. 61 62AC_DEFUN([GROFF_HTML_PROGRAMS], 63 [AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH]) 64 make_html=html 65 make_install_html=install_html 66 67 missing= 68 AC_FOREACH([groff_prog], 69 [pnmcut pnmcrop pnmtopng psselect pnmtops], 70 [AC_CHECK_PROG(groff_prog, groff_prog, [found], [missing]) 71 if test $[]groff_prog = missing; then 72 missing="$missing \`groff_prog'" 73 fi;]) 74 75 test "$GHOSTSCRIPT" = "missing" && missing="$missing \`gs'" 76 77 if test -n "$missing"; then 78 plural=`set $missing; test $[#] -gt 1 && echo s` 79 missing=`set $missing 80 missing="" 81 while test $[#] -gt 0 82 do 83 case $[#] in 84 1) missing="$missing$[1]" ;; 85 2) missing="$missing$[1] and " ;; 86 *) missing="$missing$[1], " ;; 87 esac 88 shift 89 done 90 echo $missing` 91 92 make_html= 93 make_install_html= 94 95 AC_MSG_WARN([missing program$plural: 96 97 The program$plural 98 $missing 99 cannot be found in the PATH. 100 Consequently, groff's HTML backend (grohtml) will not work properly; 101 therefore, it will neither be possible to prepare, nor to install, 102 documentation in HTML format. 103 ]) 104 fi 105 106 AC_SUBST([make_html]) 107 AC_SUBST([make_install_html])]) 108 109# To produce PDF docs, we need both awk and ghostscript. 110 111AC_DEFUN([GROFF_PDFDOC_PROGRAMS], 112 [AC_REQUIRE([GROFF_AWK_PATH]) 113 AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH]) 114 115 make_pdfdoc=pdfdoc 116 make_install_pdfdoc=install_pdfdoc 117 118 missing="" 119 test "$AWK" = missing && missing="\`awk'" 120 test "$GHOSTSCRIPT" = missing && missing="$missing \`gs'" 121 if test -n "$missing"; then 122 plural=`set $missing; test $[#] -eq 2 && echo s` 123 test x$plural = xs \ 124 && missing=`set $missing; echo "$[1] and $[2]"` \ 125 || missing=`echo $missing` 126 127 make_pdfdoc= 128 make_install_pdfdoc= 129 130 AC_MSG_WARN([missing program$plural: 131 132 The program$plural $missing cannot be found in the PATH. 133 Consequently, groff's PDF formatter (pdfroff) will not work properly; 134 therefore, it will neither be possible to prepare, nor to install, 135 documentation in PDF format. 136 ]) 137 fi 138 139 AC_SUBST([make_pdfdoc]) 140 AC_SUBST([make_install_pdfdoc])]) 141 142# Check whether pnmtops can handle the -nosetpage option. 143 144AC_DEFUN([GROFF_PNMTOPS_NOSETPAGE], 145 [AC_MSG_CHECKING([whether pnmtops can handle the -nosetpage option]) 146 if echo P2 2 2 255 0 1 2 0 | pnmtops -nosetpage > /dev/null 2>&1 ; then 147 AC_MSG_RESULT([yes]) 148 pnmtops_nosetpage="pnmtops -nosetpage" 149 else 150 AC_MSG_RESULT([no]) 151 pnmtops_nosetpage="pnmtops" 152 fi 153 AC_SUBST([pnmtops_nosetpage])]) 154 155# Check location of `gs'; allow `--with-gs=PROG' option to override. 156 157AC_DEFUN([GROFF_GHOSTSCRIPT_PATH], 158 [AC_REQUIRE([GROFF_GHOSTSCRIPT_PREFS]) 159 AC_ARG_WITH([gs], 160 [AS_HELP_STRING([--with-gs=PROG], 161 [actual [/path/]name of ghostscript executable])], 162 [GHOSTSCRIPT=$withval], 163 [AC_CHECK_TOOLS(GHOSTSCRIPT, [$ALT_GHOSTSCRIPT_PROGS], [missing])]) 164 test "$GHOSTSCRIPT" = "no" && GHOSTSCRIPT=missing]) 165 166# Preferences for choice of `gs' program... 167# (allow --with-alt-gs="LIST" to override). 168 169AC_DEFUN([GROFF_GHOSTSCRIPT_PREFS], 170 [AC_ARG_WITH([alt-gs], 171 [AS_HELP_STRING([--with-alt-gs=LIST], 172 [alternative names for ghostscript executable])], 173 [ALT_GHOSTSCRIPT_PROGS="$withval"], 174 [ALT_GHOSTSCRIPT_PROGS="gs gswin32c gsos2"]) 175 AC_SUBST([ALT_GHOSTSCRIPT_PROGS])]) 176 177# Check location of `awk'; allow `--with-awk=PROG' option to override. 178 179AC_DEFUN([GROFF_AWK_PATH], 180 [AC_REQUIRE([GROFF_AWK_PREFS]) 181 AC_ARG_WITH([awk], 182 [AS_HELP_STRING([--with-awk=PROG], 183 [actual [/path/]name of awk executable])], 184 [AWK=$withval], 185 [AC_CHECK_TOOLS(AWK, [$ALT_AWK_PROGS], [missing])]) 186 test "$AWK" = "no" && AWK=missing]) 187 188# Preferences for choice of `awk' program; allow --with-alt-awk="LIST" 189# to override. 190 191AC_DEFUN([GROFF_AWK_PREFS], 192 [AC_ARG_WITH([alt-awk], 193 [AS_HELP_STRING([--with-alt-awk=LIST], 194 [alternative names for awk executable])], 195 [ALT_AWK_PROGS="$withval"], 196 [ALT_AWK_PROGS="gawk mawk nawk awk"]) 197 AC_SUBST([ALT_AWK_PROGS])]) 198 199# GROFF_CSH_HACK(if hack present, if not present) 200 201AC_DEFUN([GROFF_CSH_HACK], 202 [AC_MSG_CHECKING([for csh hash hack]) 203 204cat <<EOF >conftest.sh 205#! /bin/sh 206true || exit 0 207export PATH || exit 0 208exit 1 209EOF 210 211 chmod +x conftest.sh 212 if echo ./conftest.sh | (csh >/dev/null 2>&1) >/dev/null 2>&1; then 213 AC_MSG_RESULT([yes]) 214 $1 215 else 216 AC_MSG_RESULT([no]) 217 $2 218 fi 219 rm -f conftest.sh]) 220 221# From udodo!hans@relay.NL.net (Hans Zuidam) 222 223AC_DEFUN([GROFF_ISC_SYSV3], 224 [AC_MSG_CHECKING([for ISC 3.x or 4.x]) 225 if grep ['[34]\.'] /usr/options/cb.name >/dev/null 2>&1 226 then 227 AC_MSG_RESULT([yes]) 228 AC_DEFINE([_SYSV3], [1], [Define if you have ISC 3.x or 4.x.]) 229 else 230 AC_MSG_RESULT([no]) 231 fi]) 232 233AC_DEFUN([GROFF_POSIX], 234 [AC_MSG_CHECKING([whether -D_POSIX_SOURCE is necessary]) 235 AC_LANG_PUSH([C++]) 236 AC_COMPILE_IFELSE([ 237 AC_LANG_PROGRAM([[ 238 239#include <stdio.h> 240extern "C" { void fileno(int); } 241 242 ]]) 243 ], 244 [AC_MSG_RESULT([yes]) 245 AC_DEFINE([_POSIX_SOURCE], [1], 246 [Define if -D_POSIX_SOURCE is necessary.])], 247 [AC_MSG_RESULT([no])]) 248 AC_LANG_POP([C++])]) 249 250# srand() of SunOS 4.1.3 has return type int instead of void 251 252AC_DEFUN([GROFF_SRAND], 253 [AC_LANG_PUSH([C++]) 254 AC_MSG_CHECKING([for return type of srand]) 255 AC_COMPILE_IFELSE([ 256 AC_LANG_PROGRAM([[ 257 258#include <stdlib.h> 259extern "C" { void srand(unsigned int); } 260 261 ]]) 262 ], 263 [AC_MSG_RESULT([void]) 264 AC_DEFINE([RET_TYPE_SRAND_IS_VOID], [1], 265 [Define if srand() returns void not int.])], 266 [AC_MSG_RESULT([int])]) 267 AC_LANG_POP([C++])]) 268 269# In April 2005, autoconf's AC_TYPE_SIGNAL is still broken. 270 271AC_DEFUN([GROFF_TYPE_SIGNAL], 272 [AC_MSG_CHECKING([for return type of signal handlers]) 273 for groff_declaration in \ 274 'extern "C" void (*signal (int, void (*)(int)))(int);' \ 275 'extern "C" void (*signal (int, void (*)(int)) throw ())(int);' \ 276 'void (*signal ()) ();' 277 do 278 AC_COMPILE_IFELSE([ 279 AC_LANG_PROGRAM([[ 280 281#include <sys/types.h> 282#include <signal.h> 283#ifdef signal 284# undef signal 285#endif 286$groff_declaration 287 288 ]], 289 [[ 290 291int i; 292 293 ]]) 294 ], 295 [break], 296 [continue]) 297 done 298 299 if test -n "$groff_declaration"; then 300 AC_MSG_RESULT([void]) 301 AC_DEFINE([RETSIGTYPE], [void], 302 [Define as the return type of signal handlers 303 (`int' or `void').]) 304 else 305 AC_MSG_RESULT([int]) 306 AC_DEFINE([RETSIGTYPE], [int], 307 [Define as the return type of signal handlers 308 (`int' or `void').]) 309 fi]) 310 311AC_DEFUN([GROFF_SYS_NERR], 312 [AC_LANG_PUSH([C++]) 313 AC_MSG_CHECKING([for sys_nerr in <errno.h>, <stdio.h>, or <stdlib.h>]) 314 AC_COMPILE_IFELSE([ 315 AC_LANG_PROGRAM([[ 316 317#include <errno.h> 318#include <stdio.h> 319#include <stdlib.h> 320 321 ]], 322 [[ 323 324int k; 325k = sys_nerr; 326 327 ]]) 328 ], 329 [AC_MSG_RESULT([yes]) 330 AC_DEFINE([HAVE_SYS_NERR], [1], 331 [Define if you have sys_nerr in <errno.h>, <stdio.h>, or <stdio.h>.])], 332 [AC_MSG_RESULT([no])]) 333 AC_LANG_POP([C++])]) 334 335AC_DEFUN([GROFF_SYS_ERRLIST], 336 [AC_MSG_CHECKING([for sys_errlist[] in <errno.h>, <stdio.h>, or <stdlib.h>]) 337 AC_COMPILE_IFELSE([ 338 AC_LANG_PROGRAM([[ 339 340#include <errno.h> 341#include <stdio.h> 342#include <stdlib.h> 343 344 ]], 345 [[ 346 347int k; 348k = (int)sys_errlist[0]; 349 350 ]]) 351 ], 352 [AC_MSG_RESULT([yes]) 353 AC_DEFINE([HAVE_SYS_ERRLIST], [1], 354 [Define if you have sys_errlist in <errno.h>, <stdio.h>, or <stdlib.h>.])], 355 [AC_MSG_RESULT([no])])]) 356 357AC_DEFUN([GROFF_OSFCN_H], 358 [AC_LANG_PUSH([C++]) 359 AC_MSG_CHECKING([C++ <osfcn.h>]) 360 AC_COMPILE_IFELSE([ 361 AC_LANG_PROGRAM([[ 362 363#include <osfcn.h> 364 365 ]], 366 [[ 367 368read(0, 0, 0); 369open(0, 0); 370 371 ]]) 372 ], 373 [AC_MSG_RESULT([yes]) 374 AC_DEFINE([HAVE_CC_OSFCN_H], [1], 375 [Define if you have a C++ <osfcn.h>.])], 376 [AC_MSG_RESULT([no])]) 377 AC_LANG_POP([C++])]) 378 379AC_DEFUN([GROFF_LIMITS_H], 380 [AC_LANG_PUSH([C++]) 381 AC_MSG_CHECKING([C++ <limits.h>]) 382 AC_COMPILE_IFELSE([ 383 AC_LANG_PROGRAM([[ 384 385#include <limits.h> 386 387 ]], 388 [[ 389 390int x = INT_MIN; 391int y = INT_MAX; 392int z = UCHAR_MAX; 393 394 ]]) 395 ], 396 [AC_MSG_RESULT([yes]) 397 AC_DEFINE([HAVE_CC_LIMITS_H], [1], 398 [Define if you have a C++ <limits.h>.])], 399 [AC_MSG_RESULT([no])]) 400 AC_LANG_POP([C++])]) 401 402AC_DEFUN([GROFF_TIME_T], 403 [AC_LANG_PUSH([C++]) 404 AC_MSG_CHECKING([for declaration of time_t]) 405 AC_COMPILE_IFELSE([ 406 AC_LANG_PROGRAM([[ 407 408#include <time.h> 409 410 ]], 411 [[ 412 413time_t t = time(0); 414struct tm *p = localtime(&t); 415 416 ]]) 417 ], 418 [AC_MSG_RESULT([yes])], 419 [AC_MSG_RESULT([no]) 420 AC_DEFINE([LONG_FOR_TIME_T], [1], 421 [Define if localtime() takes a long * not a time_t *.])]) 422 AC_LANG_POP([C++])]) 423 424AC_DEFUN([GROFF_STRUCT_EXCEPTION], 425 [AC_MSG_CHECKING([struct exception]) 426 AC_COMPILE_IFELSE([ 427 AC_LANG_PROGRAM([[ 428 429#include <math.h> 430 431 ]], 432 [[ 433 434struct exception e; 435 436 ]]) 437 ], 438 [AC_MSG_RESULT([yes]) 439 AC_DEFINE([HAVE_STRUCT_EXCEPTION], [1], 440 [Define if <math.h> defines struct exception.])], 441 [AC_MSG_RESULT([no])])]) 442 443AC_DEFUN([GROFF_ARRAY_DELETE], 444 [AC_LANG_PUSH([C++]) 445 AC_MSG_CHECKING([whether ANSI array delete syntax is supported]) 446 AC_COMPILE_IFELSE([ 447 AC_LANG_PROGRAM(, [[ 448 449char *p = new char[5]; 450delete [] p; 451 452 ]]) 453 ], 454 [AC_MSG_RESULT([yes])], 455 [AC_MSG_RESULT([no]) 456 AC_DEFINE([ARRAY_DELETE_NEEDS_SIZE], [1], 457 [Define if your C++ doesn't understand `delete []'.])]) 458 AC_LANG_POP([C++])]) 459 460AC_DEFUN([GROFF_TRADITIONAL_CPP], 461 [AC_LANG_PUSH([C++]) 462 AC_MSG_CHECKING([traditional preprocessor]) 463 AC_COMPILE_IFELSE([ 464 AC_LANG_PROGRAM([[ 465 466#define name2(a, b) a/**/b 467 468 ]], 469 [[ 470 471int name2(foo, bar); 472 473 ]]) 474 ], 475 [AC_MSG_RESULT([yes]) 476 AC_DEFINE([TRADITIONAL_CPP], [1], 477 [Define if your C++ compiler uses a traditional (Reiser) preprocessor.])], 478 [AC_MSG_RESULT([no])]) 479 AC_LANG_POP([C++])]) 480 481AC_DEFUN([GROFF_WCOREFLAG], 482 [AC_MSG_CHECKING([w_coredump]) 483 AC_RUN_IFELSE([ 484 AC_LANG_PROGRAM([[ 485 486#include <sys/types.h> 487#include <sys/wait.h> 488 489 ]], 490 [[ 491 492main() 493{ 494#ifdef WCOREFLAG 495 exit(1); 496#else 497 int i = 0; 498 ((union wait *)&i)->w_coredump = 1; 499 exit(i != 0200); 500#endif 501} 502 503 ]]) 504 ], 505 [AC_MSG_RESULT([yes]) 506 AC_DEFINE(WCOREFLAG, 0200, 507 [Define if the 0200 bit of the status returned by wait() indicates 508 whether a core image was produced for a process that was terminated 509 by a signal.])], 510 [AC_MSG_RESULT([no])], 511 [AC_MSG_RESULT([no])])]) 512 513AC_DEFUN([GROFF_BROKEN_SPOOLER_FLAGS], 514 [AC_MSG_CHECKING([default value for grops -b option]) 515 test -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=0 516 AC_MSG_RESULT([$BROKEN_SPOOLER_FLAGS]) 517 AC_SUBST([BROKEN_SPOOLER_FLAGS])]) 518 519AC_DEFUN([GROFF_PAGE], 520 [AC_MSG_CHECKING([default paper size]) 521 groff_prefix=$prefix 522 test "x$prefix" = "xNONE" && groff_prefix=$ac_default_prefix 523 if test -z "$PAGE"; then 524 descfile= 525 if test -r $groff_prefix/share/groff/font/devps/DESC; then 526 descfile=$groff_prefix/share/groff/font/devps/DESC 527 elif test -r $groff_prefix/lib/groff/font/devps/DESC; then 528 descfile=$groff_prefix/lib/groff/font/devps/DESC 529 else 530 for f in $groff_prefix/share/groff/*/font/devps/DESC; do 531 if test -r $f; then 532 descfile=$f 533 break 534 fi 535 done 536 fi 537 538 if test -n "$descfile"; then 539 if grep ['^paperlength[ ]\+841890'] $descfile >/dev/null 2>&1; then 540 PAGE=A4 541 elif grep ['^papersize[ ]\+[aA]4'] $descfile >/dev/null 2>&1; then 542 PAGE=A4 543 fi 544 fi 545 fi 546 547 if test -z "$PAGE"; then 548 dom=`awk '([$]1 == "dom" || [$]1 == "search") { print [$]2; exit}' \ 549 /etc/resolv.conf 2>/dev/null` 550 if test -z "$dom"; then 551 dom=`(domainname) 2>/dev/null | tr -d '+'` 552 if test -z "$dom" \ 553 || test "$dom" = '(none)'; then 554 dom=`(hostname) 2>/dev/null | grep '\.'` 555 fi 556 fi 557 # If the top-level domain is two letters and it's not `us' or `ca' 558 # then they probably use A4 paper. 559 case "$dom" in 560 [*.[Uu][Ss]|*.[Cc][Aa])] 561 ;; 562 [*.[A-Za-z][A-Za-z])] 563 PAGE=A4 ;; 564 esac 565 fi 566 567 test -n "$PAGE" || PAGE=letter 568 if test "x$PAGE" = "xA4"; then 569 AC_DEFINE([PAGEA4], [1], 570 [Define if the printer's page size is A4.]) 571 fi 572 AC_MSG_RESULT([$PAGE]) 573 AC_SUBST([PAGE])]) 574 575AC_DEFUN([GROFF_CXX_CHECK], 576 [AC_REQUIRE([AC_PROG_CXX]) 577 AC_LANG_PUSH([C++]) 578 if test "$cross_compiling" = no; then 579 AC_MSG_CHECKING([that C++ compiler can compile simple program]) 580 fi 581 AC_RUN_IFELSE([ 582 AC_LANG_SOURCE([[ 583 584int main() { 585 return 0; 586} 587 588 ]]) 589 ], 590 [AC_MSG_RESULT([yes])], 591 [AC_MSG_RESULT([no]) 592 AC_MSG_ERROR([a working C++ compiler is required])], 593 [:]) 594 595 if test "$cross_compiling" = no; then 596 AC_MSG_CHECKING([that C++ static constructors and destructors are called]) 597 fi 598 AC_RUN_IFELSE([ 599 AC_LANG_SOURCE([[ 600 601extern "C" { 602 void _exit(int); 603} 604 605int i; 606struct A { 607 char dummy; 608 A() { i = 1; } 609 ~A() { if (i == 1) _exit(0); } 610}; 611 612A a; 613 614int main() 615{ 616 return 1; 617} 618 619 ]]) 620 ], 621 [AC_MSG_RESULT([yes])], 622 [AC_MSG_RESULT([no]) 623 AC_MSG_ERROR([a working C++ compiler is required])], 624 [:]) 625 626 AC_MSG_CHECKING([that header files support C++]) 627 AC_LINK_IFELSE([ 628 AC_LANG_PROGRAM([[ 629 630#include <stdio.h> 631 632 ]], 633 [[ 634 635fopen(0, 0); 636 637 ]]) 638 ], 639 [AC_MSG_RESULT([yes])], 640 [AC_MSG_RESULT([no]) 641 AC_MSG_ERROR([header files do not support C++ 642 (if you are using a version of gcc/g++ earlier than 2.5, 643 you should install libg++)])]) 644 AC_LANG_POP([C++])]) 645 646AC_DEFUN([GROFF_TMAC], 647 [AC_MSG_CHECKING([for prefix of system macro packages]) 648 sys_tmac_prefix= 649 sys_tmac_file_prefix= 650 for d in /usr/share/lib/tmac /usr/lib/tmac; do 651 for t in "" tmac.; do 652 for m in an s m; do 653 f=$d/$t$m 654 if test -z "$sys_tmac_prefix" \ 655 && test -f $f \ 656 && grep '^\.if' $f >/dev/null 2>&1; then 657 sys_tmac_prefix=$d/$t 658 sys_tmac_file_prefix=$t 659 fi 660 done 661 done 662 done 663 AC_MSG_RESULT([$sys_tmac_prefix]) 664 AC_SUBST([sys_tmac_prefix]) 665 666 AC_MSG_CHECKING([which system macro packages should be made available]) 667 tmac_wrap= 668 if test "x$sys_tmac_file_prefix" = "xtmac."; then 669 for f in $sys_tmac_prefix*; do 670 suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"` 671 case "$suff" in 672 e) 673 ;; 674 *) 675 grep "Copyright.*Free Software Foundation" $f >/dev/null \ 676 || tmac_wrap="$tmac_wrap $suff" ;; 677 esac 678 done 679 elif test -n "$sys_tmac_prefix"; then 680 files=`echo $sys_tmac_prefix*` 681 grep "\\.so" $files >conftest.sol 682 for f in $files; do 683 case "$f" in 684 ${sys_tmac_prefix}e) 685 ;; 686 *.me) 687 ;; 688 */ms.*) 689 ;; 690 *) 691 b=`basename $f` 692 if grep "\\.so.*/$b\$" conftest.sol >/dev/null \ 693 || grep -l "Copyright.*Free Software Foundation" $f >/dev/null; then 694 : 695 else 696 suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"` 697 case "$suff" in 698 tmac.*) 699 ;; 700 *) 701 tmac_wrap="$tmac_wrap $suff" ;; 702 esac 703 fi 704 esac 705 done 706 rm -f conftest.sol 707 fi 708 AC_MSG_RESULT([$tmac_wrap]) 709 AC_SUBST([tmac_wrap])]) 710 711AC_DEFUN([GROFF_G], 712 [AC_MSG_CHECKING([for existing troff installation]) 713 if test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then 714 AC_MSG_RESULT([yes]) 715 g=g 716 else 717 AC_MSG_RESULT([no]) 718 g= 719 fi 720 AC_SUBST([g])]) 721 722# We need the path to install-sh to be absolute. 723 724AC_DEFUN([GROFF_INSTALL_SH], 725 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) 726 ac_dir=`cd $ac_aux_dir; pwd` 727 ac_install_sh="$ac_dir/install-sh -c"]) 728 729# Test whether install-info is available. 730 731AC_DEFUN([GROFF_INSTALL_INFO], 732 [AC_CHECK_PROGS([INSTALL_INFO], [install-info], [:])]) 733 734# At least one UNIX system, Apple Macintosh Rhapsody 5.5, 735# does not have -lm ... 736 737AC_DEFUN([GROFF_LIBM], 738 [AC_CHECK_LIB([m], [sin], [LIBM=-lm]) 739 AC_SUBST([LIBM])]) 740 741# ... while the MinGW implementation of GCC for Microsoft Win32 742# does not seem to have -lc. 743 744AC_DEFUN([GROFF_LIBC], 745 [AC_CHECK_LIB([c], [main], [LIBC=-lc]) 746 AC_SUBST([LIBC])]) 747 748# Check for EBCDIC -- stolen from the OS390 Unix LYNX port 749 750AC_DEFUN([GROFF_EBCDIC], 751 [AC_MSG_CHECKING([whether character set is EBCDIC]) 752 AC_COMPILE_IFELSE([ 753 AC_LANG_PROGRAM([[ 754 755/* Treat any failure as ASCII for compatibility with existing art. 756 Use compile-time rather than run-time tests for cross-compiler 757 tolerance. */ 758#if '0' != 240 759make an error "Character set is not EBCDIC" 760#endif 761 762 ]]) 763 ], 764 [groff_cv_ebcdic="yes" 765 TTYDEVDIRS="font/devcp1047" 766 AC_MSG_RESULT([yes]) 767 AC_DEFINE(IS_EBCDIC_HOST, 1, 768 [Define if the host's encoding is EBCDIC.])], 769 [groff_cv_ebcdic="no" 770 TTYDEVDIRS="font/devascii font/devlatin1" 771 OTHERDEVDIRS="font/devlj4 font/devlbp" 772 AC_MSG_RESULT([no])]) 773 AC_SUBST([TTYDEVDIRS]) 774 AC_SUBST([OTHERDEVDIRS])]) 775 776# Check for OS/390 Unix. We test for EBCDIC also -- the Linux port (with 777# gcc) to OS/390 uses ASCII internally. 778 779AC_DEFUN([GROFF_OS390], 780 [if test "$groff_cv_ebcdic" = "yes"; then 781 AC_MSG_CHECKING([for OS/390 Unix]) 782 case `uname` in 783 OS/390) 784 CFLAGS="$CFLAGS -D_ALL_SOURCE" 785 AC_MSG_RESULT([yes]) ;; 786 *) 787 AC_MSG_RESULT([no]) ;; 788 esac 789 fi]) 790 791# Check whether we need a declaration for a function. 792# 793# Stolen from GNU bfd. 794 795AC_DEFUN([GROFF_NEED_DECLARATION], 796 [AC_MSG_CHECKING([whether $1 must be declared]) 797 AC_LANG_PUSH([C++]) 798 AC_CACHE_VAL([groff_cv_decl_needed_$1], 799 [AC_COMPILE_IFELSE([ 800 AC_LANG_PROGRAM([[ 801 802#include <stdio.h> 803#ifdef HAVE_STRING_H 804#include <string.h> 805#endif 806#ifdef HAVE_STRINGS_H 807#include <strings.h> 808#endif 809#ifdef HAVE_STDLIB_H 810#include <stdlib.h> 811#endif 812#ifdef HAVE_SYS_TIME_H 813#include <sys/time.h> 814#endif 815#ifdef HAVE_UNISTD_H 816#include <unistd.h> 817#endif 818#ifdef HAVE_MATH_H 819#include <math.h> 820#endif 821 822 ]], 823 [[ 824 825#ifndef $1 826 char *p = (char *) $1; 827#endif 828 829 ]]) 830 ], 831 [groff_cv_decl_needed_$1=no], 832 [groff_cv_decl_needed_$1=yes])]) 833 AC_MSG_RESULT([$groff_cv_decl_needed_$1]) 834 if test $groff_cv_decl_needed_$1 = yes; then 835 AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), [1], 836 [Define if your C++ doesn't declare ]$1[().]) 837 fi 838 AC_LANG_POP([C++])]) 839 840# If mkstemp() isn't available, use our own mkstemp.cpp file. 841 842AC_DEFUN([GROFF_MKSTEMP], 843 [AC_MSG_CHECKING([for mkstemp]) 844 AC_LANG_PUSH([C++]) 845 AC_LIBSOURCE([mkstemp.cpp]) 846 AC_LINK_IFELSE([ 847 AC_LANG_PROGRAM([[ 848 849#include <stdlib.h> 850#include <unistd.h> 851int (*f) (char *); 852 853 ]], 854 [[ 855 856f = mkstemp; 857 858 ]]) 859 ], 860 [AC_MSG_RESULT([yes]) 861 AC_DEFINE([HAVE_MKSTEMP], [1], [Define if you have mkstemp().])], 862 [AC_MSG_RESULT([no]) 863 _AC_LIBOBJ([mkstemp])]) 864 AC_LANG_POP([C++])]) 865 866# Test whether <inttypes.h> exists, doesn't clash with <sys/types.h>, 867# and declares uintmax_t. Taken from the fileutils package. 868 869AC_DEFUN([GROFF_INTTYPES_H], 870 [AC_LANG_PUSH([C++]) 871 AC_MSG_CHECKING([C++ <inttypes.h>]) 872 AC_COMPILE_IFELSE([ 873 AC_LANG_PROGRAM([[ 874 875#include <sys/types.h> 876#include <inttypes.h> 877 878 ]], 879 [[ 880 881uintmax_t i = (uintmax_t)-1; 882 883 ]]) 884 ], 885 [groff_cv_header_inttypes_h=yes 886 AC_DEFINE([HAVE_CC_INTTYPES_H], [1], 887 [Define if you have a C++ <inttypes.h>.])], 888 [groff_cv_header_inttypes_h=no]) 889 AC_MSG_RESULT([$groff_cv_header_inttypes_h]) 890 AC_LANG_POP([C++])]) 891 892# Test for working `unsigned long long'. Taken from the fileutils package. 893 894AC_DEFUN([GROFF_UNSIGNED_LONG_LONG], 895 [AC_LANG_PUSH([C++]) 896 AC_MSG_CHECKING([for unsigned long long]) 897 AC_LINK_IFELSE([ 898 AC_LANG_PROGRAM([[ 899 900unsigned long long ull = 1; 901int i = 63; 902unsigned long long ullmax = (unsigned long long)-1; 903 904 ]], 905 [[ 906 907return ull << i | ull >> i | ullmax / ull | ullmax % ull; 908 909 ]]) 910 ], 911 [groff_cv_type_unsigned_long_long=yes], 912 [groff_cv_type_unsigned_long_long=no]) 913 AC_MSG_RESULT([$groff_cv_type_unsigned_long_long]) 914 AC_LANG_POP([C++])]) 915 916# Define uintmax_t to `unsigned long' or `unsigned long long' 917# if <inttypes.h> does not exist. Taken from the fileutils package. 918 919AC_DEFUN([GROFF_UINTMAX_T], 920 [AC_REQUIRE([GROFF_INTTYPES_H]) 921 if test $groff_cv_header_inttypes_h = no; then 922 AC_REQUIRE([GROFF_UNSIGNED_LONG_LONG]) 923 test $groff_cv_type_unsigned_long_long = yes \ 924 && ac_type='unsigned long long' \ 925 || ac_type='unsigned long' 926 AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type], 927 [Define uintmax_t to `unsigned long' or `unsigned long long' if 928 <inttypes.h> does not exist.]) 929 fi]) 930 931# Identify PATH_SEPARATOR character to use in GROFF_FONT_PATH and 932# GROFF_TMAC_PATH which is appropriate for the target system (POSIX=':', 933# MS-DOS/Win32=';'). 934# 935# The logic to resolve this test is already encapsulated in 936# `${srcdir}/src/include/nonposix.h'. 937 938AC_DEFUN([GROFF_TARGET_PATH_SEPARATOR], 939 [AC_MSG_CHECKING([separator character to use in groff search paths]) 940 cp ${srcdir}/src/include/nonposix.h conftest.h 941 AC_COMPILE_IFELSE([ 942 AC_LANG_PROGRAM([[ 943 944#include <ctype.h> 945#include "conftest.h" 946 947 ]], 948 [[ 949 950#if PATH_SEP_CHAR == ';' 951make an error "Path separator is ';'" 952#endif 953 954 ]]) 955 ], 956 [GROFF_PATH_SEPARATOR=":"], 957 [GROFF_PATH_SEPARATOR=";"]) 958 AC_MSG_RESULT([$GROFF_PATH_SEPARATOR]) 959 AC_SUBST(GROFF_PATH_SEPARATOR)]) 960 961# Check for X11. 962 963AC_DEFUN([GROFF_X11], 964 [AC_REQUIRE([AC_PATH_XTRA]) 965 groff_no_x=$no_x 966 if test -z "$groff_no_x"; then 967 OLDCFLAGS=$CFLAGS 968 OLDLDFLAGS=$LDFLAGS 969 OLDLIBS=$LIBS 970 CFLAGS="$CFLAGS $X_CFLAGS" 971 LDFLAGS="$LDFLAGS $X_LIBS" 972 LIBS="$LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS" 973 974 LIBS="$LIBS -lXaw" 975 AC_MSG_CHECKING([for Xaw library and header files]) 976 AC_LINK_IFELSE([ 977 AC_LANG_PROGRAM([[ 978 979#include <X11/Intrinsic.h> 980#include <X11/Xaw/Simple.h> 981 982 ]], 983 []) 984 ], 985 [AC_MSG_RESULT([yes])], 986 [AC_MSG_RESULT([no]) 987 groff_no_x="yes"]) 988 989 LIBS="$LIBS -lXmu" 990 AC_MSG_CHECKING([for Xmu library and header files]) 991 AC_LINK_IFELSE([ 992 AC_LANG_PROGRAM([[ 993 994#include <X11/Intrinsic.h> 995#include <X11/Xmu/Converters.h> 996 997 ]], 998 []) 999 ], 1000 [AC_MSG_RESULT([yes])], 1001 [AC_MSG_RESULT([no]) 1002 groff_no_x="yes"]) 1003 1004 CFLAGS=$OLDCFLAGS 1005 LDFLAGS=$OLDLDFLAGS 1006 LIBS=$OLDLIBS 1007 fi 1008 1009 if test "x$groff_no_x" = "xyes"; then 1010 AC_MSG_NOTICE([gxditview and xtotroff won't be built]) 1011 else 1012 XDEVDIRS="font/devX75 font/devX75-12 font/devX100 font/devX100-12" 1013 XPROGDIRS="src/devices/xditview src/utils/xtotroff" 1014 XLIBDIRS="src/libs/libxutil" 1015 fi 1016 1017 AC_SUBST([XDEVDIRS]) 1018 AC_SUBST([XPROGDIRS]) 1019 AC_SUBST([XLIBDIRS])]) 1020 1021# Set up the `--with-appresdir' command line option. 1022 1023AC_DEFUN([GROFF_APPRESDIR_OPTION], 1024 [AC_ARG_WITH([appresdir], 1025 dnl Don't quote AS_HELP_STRING! 1026 AS_HELP_STRING([--with-appresdir=DIR], 1027 [X11 application resource files]))]) 1028 1029# Get a default value for the application resource directory. 1030# 1031# We ignore the `XAPPLRES' and `XUSERFILESEARCHPATH' environment variables. 1032# 1033# The goal is to find the `root' of X11. Under most systems this is 1034# `/usr/X11/lib'. Application default files are then in 1035# `/usr/X11/lib/X11/app-defaults'. 1036# 1037# Based on autoconf's AC_PATH_X macro. 1038 1039AC_DEFUN([GROFF_APPRESDIR_DEFAULT], 1040 [if test -z "$groff_no_x"; then 1041 # Create an Imakefile, run `xmkmf', then `make'. 1042 rm -f -r conftest.dir 1043 if mkdir conftest.dir; then 1044 cd conftest.dir 1045 # Make sure to not put `make' in the Imakefile rules, 1046 # since we grep it out. 1047 cat >Imakefile <<'EOF' 1048 1049xlibdirs: 1050 @echo 'groff_x_usrlibdir="${USRLIBDIR}"; groff_x_libdir="${LIBDIR}"' 1051EOF 1052 1053 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then 1054 # GNU make sometimes prints "make[1]: Entering...", 1055 # which would confuse us. 1056 eval `${MAKE-make} xlibdirs 2>/dev/null | grep -v make` 1057 1058 # Open Windows `xmkmf' reportedly sets LIBDIR instead of USRLIBDIR. 1059 for groff_extension in a so sl; do 1060 if test ! -f $groff_x_usrlibdir/libX11.$groff_extension && 1061 test -f $groff_x_libdir/libX11.$groff_extension; then 1062 groff_x_usrlibdir=$groff_x_libdir 1063 break 1064 fi 1065 done 1066 fi 1067 1068 cd .. 1069 rm -f -r conftest.dir 1070 fi 1071 1072 # In case the test with `xmkmf' wasn't successful, try a suite of 1073 # standard directories. Check `X11' before `X11Rn' because it is often 1074 # a symlink to the current release. 1075 groff_x_libdirs=' 1076 /usr/X11/lib 1077 /usr/X11R6/lib 1078 /usr/X11R5/lib 1079 /usr/X11R4/lib 1080 1081 /usr/lib/X11 1082 /usr/lib/X11R6 1083 /usr/lib/X11R5 1084 /usr/lib/X11R4 1085 1086 /usr/local/X11/lib 1087 /usr/local/X11R6/lib 1088 /usr/local/X11R5/lib 1089 /usr/local/X11R4/lib 1090 1091 /usr/local/lib/X11 1092 /usr/local/lib/X11R6 1093 /usr/local/lib/X11R5 1094 /usr/local/lib/X11R4 1095 1096 /usr/X386/lib 1097 /usr/x386/lib 1098 /usr/XFree86/lib/X11 1099 1100 /usr/lib 1101 /usr/local/lib 1102 /usr/unsupported/lib 1103 /usr/athena/lib 1104 /usr/local/x11r5/lib 1105 /usr/lpp/Xamples/lib 1106 1107 /usr/openwin/lib 1108 /usr/openwin/share/lib' 1109 1110 if test -z "$groff_x_usrlibdir"; then 1111 # We only test whether libX11 exists. 1112 for groff_dir in $groff_x_libdirs; do 1113 for groff_extension in a so sl; do 1114 if test ! -r $groff_dir/libX11.$groff_extension; then 1115 groff_x_usrlibdir=$groff_dir 1116 break 2 1117 fi 1118 done 1119 done 1120 fi 1121 1122 if test "x$with_appresdir" = "x"; then 1123 appresdir=$groff_x_usrlibdir/X11/app-defaults 1124 else 1125 appresdir=$with_appresdir 1126 fi 1127 fi 1128 AC_SUBST([appresdir])]) 1129 1130 1131# Emit warning if --with-appresdir hasn't been used. 1132 1133AC_DEFUN([GROFF_APPRESDIR_CHECK], 1134 [if test -z "$groff_no_x"; then 1135 if test "x$with_appresdir" = "x"; then 1136 AC_MSG_NOTICE([ 1137 1138 The application resource file for gxditview will be installed as 1139 1140 $appresdir/GXditview 1141 1142 (an existing file will be saved as `GXditview.old'). 1143 To install it into a different directory, say, `/etc/gxditview', 1144 add `--with-appresdir=/etc/gxditview' to the configure script 1145 command line options and rerun it. The environment variable 1146 `APPLRESDIR' must then be set to `/etc/' (note the trailing slash), 1147 omitting the `gxditview' part which is automatically appended by 1148 the X11 searching routines for resource files. More details can be 1149 found in the X(7) manual page. 1150 ]) 1151 fi 1152 fi]) 1153