aclocal.m4 revision 151497
1151497Sru# Autoconf macros for groff. 2151497Sru# Copyright (C) 1989-1995, 2001, 2002, 2003, 2004, 2005 3151497Sru# Free Software Foundation, Inc. 4151497Sru# 5151497Sru# This file is part of groff. 6151497Sru# 7151497Sru# groff is free software; you can redistribute it and/or modify it under 8151497Sru# the terms of the GNU General Public License as published by the Free 9151497Sru# Software Foundation; either version 2, or (at your option) any later 10151497Sru# version. 11151497Sru# 12151497Sru# groff is distributed in the hope that it will be useful, but WITHOUT ANY 13151497Sru# WARRANTY; without even the implied warranty of MERCHANTABILITY or 14151497Sru# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15151497Sru# for more details. 16151497Sru# 17151497Sru# You should have received a copy of the GNU General Public License along 18151497Sru# with groff; see the file COPYING. If not, write to the Free Software 19151497Sru# Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. 20104862Sru 21151497SruAC_DEFUN([GROFF_PRINT], 22151497Sru [if test -z "$PSPRINT"; then 23151497Sru AC_CHECK_PROGS([LPR], [lpr]) 24151497Sru AC_CHECK_PROGS([LP], [lp]) 25151497Sru if test -n "$LPR" && test -n "$LP"; then 26151497Sru # HP-UX provides an lpr command that emulates lpr using lp, 27151497Sru # but it doesn't have lpq; in this case we want to use lp 28151497Sru # rather than lpr. 29151497Sru AC_CHECK_PROGS([LPQ], [lpq]) 30151497Sru test -n "$LPQ" || LPR= 31151497Sru fi 32151497Sru if test -n "$LPR"; then 33151497Sru PSPRINT="$LPR" 34151497Sru elif test -n "$LP"; then 35151497Sru PSPRINT="$LP" 36151497Sru fi 37151497Sru fi 38151497Sru AC_SUBST([PSPRINT]) 39151497Sru AC_MSG_CHECKING([for command to use for printing PostScript files]) 40151497Sru AC_MSG_RESULT([$PSPRINT]) 41151497Sru 42151497Sru # Figure out DVIPRINT from PSPRINT. 43151497Sru AC_MSG_CHECKING([for command to use for printing dvi files]) 44151497Sru if test -n "$PSPRINT" && test -z "$DVIPRINT"; then 45151497Sru if test "x$PSPRINT" = "xlpr"; then 46151497Sru DVIPRINT="lpr -d" 47151497Sru else 48151497Sru DVIPRINT="$PSPRINT" 49151497Sru fi 50151497Sru fi 51151497Sru AC_SUBST([DVIPRINT]) 52151497Sru AC_MSG_RESULT([$DVIPRINT])]) 53151497Sru 54151497Sru# Bison generated parsers have problems with C++ compilers other than g++. 55151497Sru# So byacc is preferred over bison. 56151497Sru 57151497SruAC_DEFUN([GROFF_PROG_YACC], 58151497Sru [AC_CHECK_PROGS([YACC], [byacc 'bison -y'], [yacc])]) 59151497Sru 60151497Sru# The following programs are needed for grohtml. 61151497Sru 62151497SruAC_DEFUN([GROFF_HTML_PROGRAMS], 63151497Sru [AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH]) 64151497Sru make_html=html 65151497Sru make_install_html=install_html 66151497Sru 67151497Sru missing= 68151497Sru AC_FOREACH([groff_prog], 69151497Sru [pnmcut pnmcrop pnmtopng psselect pnmtops], 70151497Sru [AC_CHECK_PROG(groff_prog, groff_prog, [found], [missing]) 71151497Sru if test $[]groff_prog = missing; then 72151497Sru missing="$missing \`groff_prog'" 73151497Sru fi;]) 74151497Sru 75151497Sru test "$GHOSTSCRIPT" = "missing" && missing="$missing \`gs'" 76151497Sru 77151497Sru if test -n "$missing"; then 78151497Sru plural=`set $missing; test $[#] -gt 1 && echo s` 79151497Sru missing=`set $missing 80151497Sru missing="" 81151497Sru while test $[#] -gt 0 82151497Sru do 83151497Sru case $[#] in 84151497Sru 1) missing="$missing$[1]" ;; 85151497Sru 2) missing="$missing$[1] and " ;; 86151497Sru *) missing="$missing$[1], " ;; 87151497Sru esac 88151497Sru shift 89151497Sru done 90151497Sru echo $missing` 91151497Sru 92151497Sru make_html= 93151497Sru make_install_html= 94151497Sru 95151497Sru AC_MSG_WARN([missing program$plural: 96151497Sru 97114402Sru The program$plural 98151497Sru $missing 99151497Sru cannot be found in the PATH. 100151497Sru Consequently, groff's HTML backend (grohtml) will not work properly; 101151497Sru therefore, it will neither be possible to prepare, nor to install, 102151497Sru documentation in HTML format. 103151497Sru ]) 104151497Sru fi 105151497Sru 106151497Sru AC_SUBST([make_html]) 107151497Sru AC_SUBST([make_install_html])]) 108151497Sru 109151497Sru# To produce PDF docs, we need both awk and ghostscript. 110151497Sru 111151497SruAC_DEFUN([GROFF_PDFDOC_PROGRAMS], 112151497Sru [AC_REQUIRE([GROFF_AWK_PATH]) 113151497Sru AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH]) 114151497Sru 115151497Sru make_pdfdoc=pdfdoc 116151497Sru make_install_pdfdoc=install_pdfdoc 117151497Sru 118151497Sru missing="" 119151497Sru test "$AWK" = missing && missing="\`awk'" 120151497Sru test "$GHOSTSCRIPT" = missing && missing="$missing \`gs'" 121151497Sru if test -n "$missing"; then 122151497Sru plural=`set $missing; test $[#] -eq 2 && echo s` 123151497Sru test x$plural = xs \ 124151497Sru && missing=`set $missing; echo "$[1] and $[2]"` \ 125151497Sru || missing=`echo $missing` 126151497Sru 127151497Sru make_pdfdoc= 128151497Sru make_install_pdfdoc= 129151497Sru 130151497Sru AC_MSG_WARN([missing program$plural: 131151497Sru 132151497Sru The program$plural $missing cannot be found in the PATH. 133151497Sru Consequently, groff's PDF formatter (pdfroff) will not work properly; 134151497Sru therefore, it will neither be possible to prepare, nor to install, 135151497Sru documentation in PDF format. 136151497Sru ]) 137151497Sru fi 138151497Sru 139151497Sru AC_SUBST([make_pdfdoc]) 140151497Sru AC_SUBST([make_install_pdfdoc])]) 141151497Sru 142151497Sru# Check whether pnmtops can handle the -nosetpage option. 143151497Sru 144151497SruAC_DEFUN([GROFF_PNMTOPS_NOSETPAGE], 145151497Sru [AC_MSG_CHECKING([whether pnmtops can handle the -nosetpage option]) 146151497Sru if echo P2 2 2 255 0 1 2 0 | pnmtops -nosetpage > /dev/null 2>&1 ; then 147151497Sru AC_MSG_RESULT([yes]) 148151497Sru pnmtops_nosetpage="pnmtops -nosetpage" 149151497Sru else 150151497Sru AC_MSG_RESULT([no]) 151151497Sru pnmtops_nosetpage="pnmtops" 152151497Sru fi 153151497Sru AC_SUBST([pnmtops_nosetpage])]) 154151497Sru 155151497Sru# Check location of `gs'; allow `--with-gs=PROG' option to override. 156151497Sru 157151497SruAC_DEFUN([GROFF_GHOSTSCRIPT_PATH], 158151497Sru [AC_REQUIRE([GROFF_GHOSTSCRIPT_PREFS]) 159151497Sru AC_ARG_WITH([gs], 160151497Sru [AS_HELP_STRING([--with-gs=PROG], 161151497Sru [actual [/path/]name of ghostscript executable])], 162151497Sru [GHOSTSCRIPT=$withval], 163151497Sru [AC_CHECK_TOOLS(GHOSTSCRIPT, [$ALT_GHOSTSCRIPT_PROGS], [missing])]) 164151497Sru test "$GHOSTSCRIPT" = "no" && GHOSTSCRIPT=missing]) 165151497Sru 166151497Sru# Preferences for choice of `gs' program... 167151497Sru# (allow --with-alt-gs="LIST" to override). 168151497Sru 169151497SruAC_DEFUN([GROFF_GHOSTSCRIPT_PREFS], 170151497Sru [AC_ARG_WITH([alt-gs], 171151497Sru [AS_HELP_STRING([--with-alt-gs=LIST], 172151497Sru [alternative names for ghostscript executable])], 173151497Sru [ALT_GHOSTSCRIPT_PROGS="$withval"], 174151497Sru [ALT_GHOSTSCRIPT_PROGS="gs gswin32c gsos2"]) 175151497Sru AC_SUBST([ALT_GHOSTSCRIPT_PROGS])]) 176151497Sru 177151497Sru# Check location of `awk'; allow `--with-awk=PROG' option to override. 178151497Sru 179151497SruAC_DEFUN([GROFF_AWK_PATH], 180151497Sru [AC_REQUIRE([GROFF_AWK_PREFS]) 181151497Sru AC_ARG_WITH([awk], 182151497Sru [AS_HELP_STRING([--with-awk=PROG], 183151497Sru [actual [/path/]name of awk executable])], 184151497Sru [AWK=$withval], 185151497Sru [AC_CHECK_TOOLS(AWK, [$ALT_AWK_PROGS], [missing])]) 186151497Sru test "$AWK" = "no" && AWK=missing]) 187151497Sru 188151497Sru# Preferences for choice of `awk' program; allow --with-alt-awk="LIST" 189151497Sru# to override. 190151497Sru 191151497SruAC_DEFUN([GROFF_AWK_PREFS], 192151497Sru [AC_ARG_WITH([alt-awk], 193151497Sru [AS_HELP_STRING([--with-alt-awk=LIST], 194151497Sru [alternative names for awk executable])], 195151497Sru [ALT_AWK_PROGS="$withval"], 196151497Sru [ALT_AWK_PROGS="gawk mawk nawk awk"]) 197151497Sru AC_SUBST([ALT_AWK_PROGS])]) 198151497Sru 199151497Sru# GROFF_CSH_HACK(if hack present, if not present) 200151497Sru 201151497SruAC_DEFUN([GROFF_CSH_HACK], 202151497Sru [AC_MSG_CHECKING([for csh hash hack]) 203151497Sru 20418099Spstcat <<EOF >conftest.sh 205151497Sru#! /bin/sh 20618099Spsttrue || exit 0 20718099Spstexport PATH || exit 0 20818099Spstexit 1 20918099SpstEOF 210151497Sru 211151497Sru chmod +x conftest.sh 212151497Sru if echo ./conftest.sh | (csh >/dev/null 2>&1) >/dev/null 2>&1; then 213151497Sru AC_MSG_RESULT([yes]) 214151497Sru $1 215151497Sru else 216151497Sru AC_MSG_RESULT([no]) 217151497Sru $2 218151497Sru fi 219151497Sru rm -f conftest.sh]) 220151497Sru 221151497Sru# From udodo!hans@relay.NL.net (Hans Zuidam) 222151497Sru 223151497SruAC_DEFUN([GROFF_ISC_SYSV3], 224151497Sru [AC_MSG_CHECKING([for ISC 3.x or 4.x]) 225151497Sru if grep ['[34]\.'] /usr/options/cb.name >/dev/null 2>&1 226151497Sru then 227151497Sru AC_MSG_RESULT([yes]) 228151497Sru AC_DEFINE([_SYSV3], [1], [Define if you have ISC 3.x or 4.x.]) 229151497Sru else 230151497Sru AC_MSG_RESULT([no]) 231151497Sru fi]) 232151497Sru 233151497SruAC_DEFUN([GROFF_POSIX], 234151497Sru [AC_MSG_CHECKING([whether -D_POSIX_SOURCE is necessary]) 235151497Sru AC_LANG_PUSH([C++]) 236151497Sru AC_COMPILE_IFELSE([ 237151497Sru AC_LANG_PROGRAM([[ 238151497Sru 239151497Sru#include <stdio.h> 240151497Sruextern "C" { void fileno(int); } 241151497Sru 242151497Sru ]]) 243151497Sru ], 244151497Sru [AC_MSG_RESULT([yes]) 245151497Sru AC_DEFINE([_POSIX_SOURCE], [1], 246151497Sru [Define if -D_POSIX_SOURCE is necessary.])], 247151497Sru [AC_MSG_RESULT([no])]) 248151497Sru AC_LANG_POP([C++])]) 249151497Sru 250151497Sru# srand() of SunOS 4.1.3 has return type int instead of void 251151497Sru 252151497SruAC_DEFUN([GROFF_SRAND], 253151497Sru [AC_LANG_PUSH([C++]) 254151497Sru AC_MSG_CHECKING([for return type of srand]) 255151497Sru AC_COMPILE_IFELSE([ 256151497Sru AC_LANG_PROGRAM([[ 257151497Sru 258151497Sru#include <stdlib.h> 259151497Sruextern "C" { void srand(unsigned int); } 260151497Sru 261151497Sru ]]) 262151497Sru ], 263151497Sru [AC_MSG_RESULT([void]) 264151497Sru AC_DEFINE([RET_TYPE_SRAND_IS_VOID], [1], 265151497Sru [Define if srand() returns void not int.])], 266151497Sru [AC_MSG_RESULT([int])]) 267151497Sru AC_LANG_POP([C++])]) 268151497Sru 269151497Sru# In April 2005, autoconf's AC_TYPE_SIGNAL is still broken. 270151497Sru 271151497SruAC_DEFUN([GROFF_TYPE_SIGNAL], 272151497Sru [AC_MSG_CHECKING([for return type of signal handlers]) 273151497Sru for groff_declaration in \ 274151497Sru 'extern "C" void (*signal (int, void (*)(int)))(int);' \ 275151497Sru 'extern "C" void (*signal (int, void (*)(int)) throw ())(int);' \ 276151497Sru 'void (*signal ()) ();' 277151497Sru do 278151497Sru AC_COMPILE_IFELSE([ 279151497Sru AC_LANG_PROGRAM([[ 280151497Sru 281151497Sru#include <sys/types.h> 282151497Sru#include <signal.h> 283151497Sru#ifdef signal 284151497Sru# undef signal 285151497Sru#endif 286151497Sru$groff_declaration 287151497Sru 288151497Sru ]], 289151497Sru [[ 290151497Sru 291151497Sruint i; 292151497Sru 293151497Sru ]]) 294151497Sru ], 295151497Sru [break], 296151497Sru [continue]) 297151497Sru done 298151497Sru 299151497Sru if test -n "$groff_declaration"; then 300151497Sru AC_MSG_RESULT([void]) 301151497Sru AC_DEFINE([RETSIGTYPE], [void], 302151497Sru [Define as the return type of signal handlers 303151497Sru (`int' or `void').]) 304151497Sru else 305151497Sru AC_MSG_RESULT([int]) 306151497Sru AC_DEFINE([RETSIGTYPE], [int], 307151497Sru [Define as the return type of signal handlers 308151497Sru (`int' or `void').]) 309151497Sru fi]) 310151497Sru 311151497SruAC_DEFUN([GROFF_SYS_NERR], 312151497Sru [AC_LANG_PUSH([C++]) 313151497Sru AC_MSG_CHECKING([for sys_nerr in <errno.h>, <stdio.h>, or <stdlib.h>]) 314151497Sru AC_COMPILE_IFELSE([ 315151497Sru AC_LANG_PROGRAM([[ 316151497Sru 317151497Sru#include <errno.h> 318151497Sru#include <stdio.h> 319151497Sru#include <stdlib.h> 320151497Sru 321151497Sru ]], 322151497Sru [[ 323151497Sru 324151497Sruint k; 325151497Sruk = sys_nerr; 326151497Sru 327151497Sru ]]) 328151497Sru ], 329151497Sru [AC_MSG_RESULT([yes]) 330151497Sru AC_DEFINE([HAVE_SYS_NERR], [1], 331151497Sru [Define if you have sys_nerr in <errno.h>, <stdio.h>, or <stdio.h>.])], 332151497Sru [AC_MSG_RESULT([no])]) 333151497Sru AC_LANG_POP([C++])]) 334151497Sru 335151497SruAC_DEFUN([GROFF_SYS_ERRLIST], 336151497Sru [AC_MSG_CHECKING([for sys_errlist[] in <errno.h>, <stdio.h>, or <stdlib.h>]) 337151497Sru AC_COMPILE_IFELSE([ 338151497Sru AC_LANG_PROGRAM([[ 339151497Sru 340151497Sru#include <errno.h> 341151497Sru#include <stdio.h> 342151497Sru#include <stdlib.h> 343151497Sru 344151497Sru ]], 345151497Sru [[ 346151497Sru 347151497Sruint k; 348151497Sruk = (int)sys_errlist[0]; 349151497Sru 350151497Sru ]]) 351151497Sru ], 352151497Sru [AC_MSG_RESULT([yes]) 353151497Sru AC_DEFINE([HAVE_SYS_ERRLIST], [1], 354151497Sru [Define if you have sys_errlist in <errno.h>, <stdio.h>, or <stdlib.h>.])], 355151497Sru [AC_MSG_RESULT([no])])]) 356151497Sru 357151497SruAC_DEFUN([GROFF_OSFCN_H], 358151497Sru [AC_LANG_PUSH([C++]) 359151497Sru AC_MSG_CHECKING([C++ <osfcn.h>]) 360151497Sru AC_COMPILE_IFELSE([ 361151497Sru AC_LANG_PROGRAM([[ 362151497Sru 363151497Sru#include <osfcn.h> 364151497Sru 365151497Sru ]], 366151497Sru [[ 367151497Sru 368151497Sruread(0, 0, 0); 369151497Sruopen(0, 0); 370151497Sru 371151497Sru ]]) 372151497Sru ], 373151497Sru [AC_MSG_RESULT([yes]) 374151497Sru AC_DEFINE([HAVE_CC_OSFCN_H], [1], 375151497Sru [Define if you have a C++ <osfcn.h>.])], 376151497Sru [AC_MSG_RESULT([no])]) 377151497Sru AC_LANG_POP([C++])]) 378151497Sru 379151497SruAC_DEFUN([GROFF_LIMITS_H], 380151497Sru [AC_LANG_PUSH([C++]) 381151497Sru AC_MSG_CHECKING([C++ <limits.h>]) 382151497Sru AC_COMPILE_IFELSE([ 383151497Sru AC_LANG_PROGRAM([[ 384151497Sru 385151497Sru#include <limits.h> 386151497Sru 387151497Sru ]], 388151497Sru [[ 389151497Sru 390151497Sruint x = INT_MIN; 391151497Sruint y = INT_MAX; 392151497Sruint z = UCHAR_MAX; 393151497Sru 394151497Sru ]]) 395151497Sru ], 396151497Sru [AC_MSG_RESULT([yes]) 397151497Sru AC_DEFINE([HAVE_CC_LIMITS_H], [1], 398151497Sru [Define if you have a C++ <limits.h>.])], 399151497Sru [AC_MSG_RESULT([no])]) 400151497Sru AC_LANG_POP([C++])]) 401151497Sru 402151497SruAC_DEFUN([GROFF_TIME_T], 403151497Sru [AC_LANG_PUSH([C++]) 404151497Sru AC_MSG_CHECKING([for declaration of time_t]) 405151497Sru AC_COMPILE_IFELSE([ 406151497Sru AC_LANG_PROGRAM([[ 407151497Sru 408151497Sru#include <time.h> 409151497Sru 410151497Sru ]], 411151497Sru [[ 412151497Sru 413151497Srutime_t t = time(0); 414151497Srustruct tm *p = localtime(&t); 415151497Sru 416151497Sru ]]) 417151497Sru ], 418151497Sru [AC_MSG_RESULT([yes])], 419151497Sru [AC_MSG_RESULT([no]) 420151497Sru AC_DEFINE([LONG_FOR_TIME_T], [1], 421151497Sru [Define if localtime() takes a long * not a time_t *.])]) 422151497Sru AC_LANG_POP([C++])]) 423151497Sru 424151497SruAC_DEFUN([GROFF_STRUCT_EXCEPTION], 425151497Sru [AC_MSG_CHECKING([struct exception]) 426151497Sru AC_COMPILE_IFELSE([ 427151497Sru AC_LANG_PROGRAM([[ 428151497Sru 429151497Sru#include <math.h> 430151497Sru 431151497Sru ]], 432151497Sru [[ 433151497Sru 434151497Srustruct exception e; 435151497Sru 436151497Sru ]]) 437151497Sru ], 438151497Sru [AC_MSG_RESULT([yes]) 439151497Sru AC_DEFINE([HAVE_STRUCT_EXCEPTION], [1], 440151497Sru [Define if <math.h> defines struct exception.])], 441151497Sru [AC_MSG_RESULT([no])])]) 442151497Sru 443151497SruAC_DEFUN([GROFF_ARRAY_DELETE], 444151497Sru [AC_LANG_PUSH([C++]) 445151497Sru AC_MSG_CHECKING([whether ANSI array delete syntax is supported]) 446151497Sru AC_COMPILE_IFELSE([ 447151497Sru AC_LANG_PROGRAM(, [[ 448151497Sru 449151497Sruchar *p = new char[5]; 450151497Srudelete [] p; 451151497Sru 452151497Sru ]]) 453151497Sru ], 454151497Sru [AC_MSG_RESULT([yes])], 455151497Sru [AC_MSG_RESULT([no]) 456151497Sru AC_DEFINE([ARRAY_DELETE_NEEDS_SIZE], [1], 457151497Sru [Define if your C++ doesn't understand `delete []'.])]) 458151497Sru AC_LANG_POP([C++])]) 459151497Sru 460151497SruAC_DEFUN([GROFF_TRADITIONAL_CPP], 461151497Sru [AC_LANG_PUSH([C++]) 462151497Sru AC_MSG_CHECKING([traditional preprocessor]) 463151497Sru AC_COMPILE_IFELSE([ 464151497Sru AC_LANG_PROGRAM([[ 465151497Sru 466151497Sru#define name2(a, b) a/**/b 467151497Sru 468151497Sru ]], 469151497Sru [[ 470151497Sru 471151497Sruint name2(foo, bar); 472151497Sru 473151497Sru ]]) 474151497Sru ], 475151497Sru [AC_MSG_RESULT([yes]) 476151497Sru AC_DEFINE([TRADITIONAL_CPP], [1], 477151497Sru [Define if your C++ compiler uses a traditional (Reiser) preprocessor.])], 478151497Sru [AC_MSG_RESULT([no])]) 479151497Sru AC_LANG_POP([C++])]) 480151497Sru 481151497SruAC_DEFUN([GROFF_WCOREFLAG], 482151497Sru [AC_MSG_CHECKING([w_coredump]) 483151497Sru AC_RUN_IFELSE([ 484151497Sru AC_LANG_PROGRAM([[ 485151497Sru 486151497Sru#include <sys/types.h> 48718099Spst#include <sys/wait.h> 488151497Sru 489151497Sru ]], 490151497Sru [[ 491151497Sru 49218099Spstmain() 49318099Spst{ 49418099Spst#ifdef WCOREFLAG 49518099Spst exit(1); 49618099Spst#else 49718099Spst int i = 0; 49818099Spst ((union wait *)&i)->w_coredump = 1; 49918099Spst exit(i != 0200); 50018099Spst#endif 501151497Sru} 502151497Sru 503151497Sru ]]) 504151497Sru ], 505151497Sru [AC_MSG_RESULT([yes]) 506151497Sru AC_DEFINE(WCOREFLAG, 0200, 507151497Sru [Define if the 0200 bit of the status returned by wait() indicates 508151497Sru whether a core image was produced for a process that was terminated 509151497Sru by a signal.])], 510151497Sru [AC_MSG_RESULT([no])], 511151497Sru [AC_MSG_RESULT([no])])]) 512151497Sru 513151497SruAC_DEFUN([GROFF_BROKEN_SPOOLER_FLAGS], 514151497Sru [AC_MSG_CHECKING([default value for grops -b option]) 515151497Sru test -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=0 516151497Sru AC_MSG_RESULT([$BROKEN_SPOOLER_FLAGS]) 517151497Sru AC_SUBST([BROKEN_SPOOLER_FLAGS])]) 518151497Sru 519151497SruAC_DEFUN([GROFF_PAGE], 520151497Sru [AC_MSG_CHECKING([default paper size]) 521151497Sru groff_prefix=$prefix 522151497Sru test "x$prefix" = "xNONE" && groff_prefix=$ac_default_prefix 523151497Sru if test -z "$PAGE"; then 524151497Sru descfile= 525151497Sru if test -r $groff_prefix/share/groff/font/devps/DESC; then 526151497Sru descfile=$groff_prefix/share/groff/font/devps/DESC 527151497Sru elif test -r $groff_prefix/lib/groff/font/devps/DESC; then 528151497Sru descfile=$groff_prefix/lib/groff/font/devps/DESC 529151497Sru else 530151497Sru for f in $groff_prefix/share/groff/*/font/devps/DESC; do 531151497Sru if test -r $f; then 532151497Sru descfile=$f 533151497Sru break 534151497Sru fi 535151497Sru done 536151497Sru fi 537151497Sru 538151497Sru if test -n "$descfile"; then 539151497Sru if grep ['^paperlength[ ]\+841890'] $descfile >/dev/null 2>&1; then 540151497Sru PAGE=A4 541151497Sru elif grep ['^papersize[ ]\+[aA]4'] $descfile >/dev/null 2>&1; then 542151497Sru PAGE=A4 543151497Sru fi 544151497Sru fi 545151497Sru fi 546151497Sru 547151497Sru if test -z "$PAGE"; then 548151497Sru dom=`awk '([$]1 == "dom" || [$]1 == "search") { print [$]2; exit}' \ 549151497Sru /etc/resolv.conf 2>/dev/null` 550151497Sru if test -z "$dom"; then 551151497Sru dom=`(domainname) 2>/dev/null | tr -d '+'` 552151497Sru if test -z "$dom" \ 553151497Sru || test "$dom" = '(none)'; then 554151497Sru dom=`(hostname) 2>/dev/null | grep '\.'` 555151497Sru fi 556151497Sru fi 557151497Sru # If the top-level domain is two letters and it's not `us' or `ca' 558151497Sru # then they probably use A4 paper. 559151497Sru case "$dom" in 560151497Sru [*.[Uu][Ss]|*.[Cc][Aa])] 561151497Sru ;; 562151497Sru [*.[A-Za-z][A-Za-z])] 563151497Sru PAGE=A4 ;; 564151497Sru esac 565151497Sru fi 566151497Sru 567151497Sru test -n "$PAGE" || PAGE=letter 568151497Sru if test "x$PAGE" = "xA4"; then 569151497Sru AC_DEFINE([PAGEA4], [1], 570151497Sru [Define if the printer's page size is A4.]) 571151497Sru fi 572151497Sru AC_MSG_RESULT([$PAGE]) 573151497Sru AC_SUBST([PAGE])]) 574151497Sru 575151497SruAC_DEFUN([GROFF_CXX_CHECK], 576151497Sru [AC_REQUIRE([AC_PROG_CXX]) 577151497Sru AC_LANG_PUSH([C++]) 578151497Sru if test "$cross_compiling" = no; then 579151497Sru AC_MSG_CHECKING([that C++ compiler can compile simple program]) 580151497Sru fi 581151497Sru AC_RUN_IFELSE([ 582151497Sru AC_LANG_SOURCE([[ 583151497Sru 584151497Sruint main() { 585151497Sru return 0; 586151497Sru} 587151497Sru 588151497Sru ]]) 589151497Sru ], 590151497Sru [AC_MSG_RESULT([yes])], 591151497Sru [AC_MSG_RESULT([no]) 592151497Sru AC_MSG_ERROR([a working C++ compiler is required])], 593151497Sru [:]) 594151497Sru 595151497Sru if test "$cross_compiling" = no; then 596151497Sru AC_MSG_CHECKING([that C++ static constructors and destructors are called]) 597151497Sru fi 598151497Sru AC_RUN_IFELSE([ 599151497Sru AC_LANG_SOURCE([[ 600151497Sru 60118099Spstextern "C" { 60218099Spst void _exit(int); 60318099Spst} 604151497Sru 60518099Spstint i; 60618099Spststruct A { 60718099Spst char dummy; 60818099Spst A() { i = 1; } 60918099Spst ~A() { if (i == 1) _exit(0); } 61018099Spst}; 611151497Sru 61218099SpstA a; 613151497Sru 614151497Sruint main() 615151497Sru{ 616151497Sru return 1; 617151497Sru} 618151497Sru 619151497Sru ]]) 620151497Sru ], 621151497Sru [AC_MSG_RESULT([yes])], 622151497Sru [AC_MSG_RESULT([no]) 623151497Sru AC_MSG_ERROR([a working C++ compiler is required])], 624151497Sru [:]) 625151497Sru 626151497Sru AC_MSG_CHECKING([that header files support C++]) 627151497Sru AC_LINK_IFELSE([ 628151497Sru AC_LANG_PROGRAM([[ 629151497Sru 630151497Sru#include <stdio.h> 631151497Sru 632151497Sru ]], 633151497Sru [[ 634151497Sru 635151497Srufopen(0, 0); 636151497Sru 637151497Sru ]]) 638151497Sru ], 639151497Sru [AC_MSG_RESULT([yes])], 640151497Sru [AC_MSG_RESULT([no]) 641151497Sru AC_MSG_ERROR([header files do not support C++ 642151497Sru (if you are using a version of gcc/g++ earlier than 2.5, 643151497Sru you should install libg++)])]) 644151497Sru AC_LANG_POP([C++])]) 645151497Sru 646151497SruAC_DEFUN([GROFF_TMAC], 647151497Sru [AC_MSG_CHECKING([for prefix of system macro packages]) 648151497Sru sys_tmac_prefix= 649151497Sru sys_tmac_file_prefix= 650151497Sru for d in /usr/share/lib/tmac /usr/lib/tmac; do 651151497Sru for t in "" tmac.; do 652151497Sru for m in an s m; do 653151497Sru f=$d/$t$m 654151497Sru if test -z "$sys_tmac_prefix" \ 655151497Sru && test -f $f \ 656151497Sru && grep '^\.if' $f >/dev/null 2>&1; then 657151497Sru sys_tmac_prefix=$d/$t 658151497Sru sys_tmac_file_prefix=$t 659151497Sru fi 660151497Sru done 661151497Sru done 662151497Sru done 663151497Sru AC_MSG_RESULT([$sys_tmac_prefix]) 664151497Sru AC_SUBST([sys_tmac_prefix]) 665151497Sru 666151497Sru AC_MSG_CHECKING([which system macro packages should be made available]) 667151497Sru tmac_wrap= 668151497Sru if test "x$sys_tmac_file_prefix" = "xtmac."; then 669151497Sru for f in $sys_tmac_prefix*; do 670151497Sru suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"` 671151497Sru case "$suff" in 672151497Sru e) 673151497Sru ;; 674151497Sru *) 675151497Sru grep "Copyright.*Free Software Foundation" $f >/dev/null \ 676151497Sru || tmac_wrap="$tmac_wrap $suff" ;; 677151497Sru esac 678151497Sru done 679151497Sru elif test -n "$sys_tmac_prefix"; then 680151497Sru files=`echo $sys_tmac_prefix*` 681151497Sru grep "\\.so" $files >conftest.sol 682151497Sru for f in $files; do 683151497Sru case "$f" in 684151497Sru ${sys_tmac_prefix}e) 685151497Sru ;; 686151497Sru *.me) 687151497Sru ;; 688151497Sru */ms.*) 689151497Sru ;; 690151497Sru *) 691151497Sru b=`basename $f` 692151497Sru if grep "\\.so.*/$b\$" conftest.sol >/dev/null \ 693151497Sru || grep -l "Copyright.*Free Software Foundation" $f >/dev/null; then 694151497Sru : 695151497Sru else 696151497Sru suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"` 697151497Sru case "$suff" in 698151497Sru tmac.*) 699151497Sru ;; 700151497Sru *) 701151497Sru tmac_wrap="$tmac_wrap $suff" ;; 702151497Sru esac 703151497Sru fi 704151497Sru esac 705151497Sru done 706151497Sru rm -f conftest.sol 707151497Sru fi 708151497Sru AC_MSG_RESULT([$tmac_wrap]) 709151497Sru AC_SUBST([tmac_wrap])]) 710151497Sru 711151497SruAC_DEFUN([GROFF_G], 712151497Sru [AC_MSG_CHECKING([for existing troff installation]) 713151497Sru if test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then 714151497Sru AC_MSG_RESULT([yes]) 715151497Sru g=g 716151497Sru else 717151497Sru AC_MSG_RESULT([no]) 718151497Sru g= 719151497Sru fi 720151497Sru AC_SUBST([g])]) 721151497Sru 722151497Sru# We need the path to install-sh to be absolute. 723151497Sru 724151497SruAC_DEFUN([GROFF_INSTALL_SH], 725151497Sru [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) 726151497Sru ac_dir=`cd $ac_aux_dir; pwd` 727151497Sru ac_install_sh="$ac_dir/install-sh -c"]) 728151497Sru 729151497Sru# Test whether install-info is available. 730151497Sru 731151497SruAC_DEFUN([GROFF_INSTALL_INFO], 732151497Sru [AC_CHECK_PROGS([INSTALL_INFO], [install-info], [:])]) 733151497Sru 734151497Sru# At least one UNIX system, Apple Macintosh Rhapsody 5.5, 735151497Sru# does not have -lm ... 736151497Sru 737151497SruAC_DEFUN([GROFF_LIBM], 738151497Sru [AC_CHECK_LIB([m], [sin], [LIBM=-lm]) 739151497Sru AC_SUBST([LIBM])]) 740151497Sru 741151497Sru# ... while the MinGW implementation of GCC for Microsoft Win32 742151497Sru# does not seem to have -lc. 743151497Sru 744151497SruAC_DEFUN([GROFF_LIBC], 745151497Sru [AC_CHECK_LIB([c], [main], [LIBC=-lc]) 746151497Sru AC_SUBST([LIBC])]) 747151497Sru 748151497Sru# Check for EBCDIC -- stolen from the OS390 Unix LYNX port 749151497Sru 750151497SruAC_DEFUN([GROFF_EBCDIC], 751151497Sru [AC_MSG_CHECKING([whether character set is EBCDIC]) 752151497Sru AC_COMPILE_IFELSE([ 753151497Sru AC_LANG_PROGRAM([[ 754151497Sru 755151497Sru/* Treat any failure as ASCII for compatibility with existing art. 756151497Sru Use compile-time rather than run-time tests for cross-compiler 757151497Sru tolerance. */ 75869626Sru#if '0' != 240 75969626Srumake an error "Character set is not EBCDIC" 760151497Sru#endif 761151497Sru 762151497Sru ]]) 763151497Sru ], 764151497Sru [groff_cv_ebcdic="yes" 765151497Sru TTYDEVDIRS="font/devcp1047" 766151497Sru AC_MSG_RESULT([yes]) 767151497Sru AC_DEFINE(IS_EBCDIC_HOST, 1, 768151497Sru [Define if the host's encoding is EBCDIC.])], 769151497Sru [groff_cv_ebcdic="no" 770151497Sru TTYDEVDIRS="font/devascii font/devlatin1" 771151497Sru OTHERDEVDIRS="font/devlj4 font/devlbp" 772151497Sru AC_MSG_RESULT([no])]) 773151497Sru AC_SUBST([TTYDEVDIRS]) 774151497Sru AC_SUBST([OTHERDEVDIRS])]) 775151497Sru 776151497Sru# Check for OS/390 Unix. We test for EBCDIC also -- the Linux port (with 777151497Sru# gcc) to OS/390 uses ASCII internally. 778151497Sru 779151497SruAC_DEFUN([GROFF_OS390], 780151497Sru [if test "$groff_cv_ebcdic" = "yes"; then 781151497Sru AC_MSG_CHECKING([for OS/390 Unix]) 782151497Sru case `uname` in 783151497Sru OS/390) 784151497Sru CFLAGS="$CFLAGS -D_ALL_SOURCE" 785151497Sru AC_MSG_RESULT([yes]) ;; 786151497Sru *) 787151497Sru AC_MSG_RESULT([no]) ;; 788151497Sru esac 789151497Sru fi]) 790151497Sru 791151497Sru# Check whether we need a declaration for a function. 792151497Sru# 793151497Sru# Stolen from GNU bfd. 794151497Sru 795151497SruAC_DEFUN([GROFF_NEED_DECLARATION], 796151497Sru [AC_MSG_CHECKING([whether $1 must be declared]) 797151497Sru AC_LANG_PUSH([C++]) 798151497Sru AC_CACHE_VAL([groff_cv_decl_needed_$1], 799151497Sru [AC_COMPILE_IFELSE([ 800151497Sru AC_LANG_PROGRAM([[ 801151497Sru 80269626Sru#include <stdio.h> 80369626Sru#ifdef HAVE_STRING_H 80469626Sru#include <string.h> 80579543Sru#endif 80669626Sru#ifdef HAVE_STRINGS_H 80769626Sru#include <strings.h> 80869626Sru#endif 80969626Sru#ifdef HAVE_STDLIB_H 81069626Sru#include <stdlib.h> 81169626Sru#endif 812104862Sru#ifdef HAVE_SYS_TIME_H 813104862Sru#include <sys/time.h> 814104862Sru#endif 81569626Sru#ifdef HAVE_UNISTD_H 81669626Sru#include <unistd.h> 81769626Sru#endif 81869626Sru#ifdef HAVE_MATH_H 81969626Sru#include <math.h> 820151497Sru#endif 821151497Sru 822151497Sru ]], 823151497Sru [[ 824151497Sru 825151497Sru#ifndef $1 826104862Sru char *p = (char *) $1; 827151497Sru#endif 828151497Sru 829151497Sru ]]) 830151497Sru ], 831151497Sru [groff_cv_decl_needed_$1=no], 832151497Sru [groff_cv_decl_needed_$1=yes])]) 833151497Sru AC_MSG_RESULT([$groff_cv_decl_needed_$1]) 834151497Sru if test $groff_cv_decl_needed_$1 = yes; then 835151497Sru AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), [1], 836151497Sru [Define if your C++ doesn't declare ]$1[().]) 837151497Sru fi 838151497Sru AC_LANG_POP([C++])]) 839151497Sru 840151497Sru# If mkstemp() isn't available, use our own mkstemp.cpp file. 841151497Sru 842151497SruAC_DEFUN([GROFF_MKSTEMP], 843151497Sru [AC_MSG_CHECKING([for mkstemp]) 844151497Sru AC_LANG_PUSH([C++]) 845151497Sru AC_LIBSOURCE([mkstemp.cpp]) 846151497Sru AC_LINK_IFELSE([ 847151497Sru AC_LANG_PROGRAM([[ 848151497Sru 849151497Sru#include <stdlib.h> 850104862Sru#include <unistd.h> 851151497Sruint (*f) (char *); 852151497Sru 853151497Sru ]], 854151497Sru [[ 855151497Sru 856151497Sruf = mkstemp; 857151497Sru 858151497Sru ]]) 859151497Sru ], 860151497Sru [AC_MSG_RESULT([yes]) 861151497Sru AC_DEFINE([HAVE_MKSTEMP], [1], [Define if you have mkstemp().])], 862151497Sru [AC_MSG_RESULT([no]) 863151497Sru _AC_LIBOBJ([mkstemp])]) 864151497Sru AC_LANG_POP([C++])]) 865151497Sru 866151497Sru# Test whether <inttypes.h> exists, doesn't clash with <sys/types.h>, 867151497Sru# and declares uintmax_t. Taken from the fileutils package. 868151497Sru 869151497SruAC_DEFUN([GROFF_INTTYPES_H], 870151497Sru [AC_LANG_PUSH([C++]) 871151497Sru AC_MSG_CHECKING([C++ <inttypes.h>]) 872151497Sru AC_COMPILE_IFELSE([ 873151497Sru AC_LANG_PROGRAM([[ 874151497Sru 875151497Sru#include <sys/types.h> 876151497Sru#include <inttypes.h> 877151497Sru 878151497Sru ]], 879151497Sru [[ 880151497Sru 881151497Sruuintmax_t i = (uintmax_t)-1; 882151497Sru 883151497Sru ]]) 884151497Sru ], 885151497Sru [groff_cv_header_inttypes_h=yes 886151497Sru AC_DEFINE([HAVE_CC_INTTYPES_H], [1], 887151497Sru [Define if you have a C++ <inttypes.h>.])], 888151497Sru [groff_cv_header_inttypes_h=no]) 889151497Sru AC_MSG_RESULT([$groff_cv_header_inttypes_h]) 890151497Sru AC_LANG_POP([C++])]) 891151497Sru 892151497Sru# Test for working `unsigned long long'. Taken from the fileutils package. 893151497Sru 894151497SruAC_DEFUN([GROFF_UNSIGNED_LONG_LONG], 895151497Sru [AC_LANG_PUSH([C++]) 896151497Sru AC_MSG_CHECKING([for unsigned long long]) 897151497Sru AC_LINK_IFELSE([ 898151497Sru AC_LANG_PROGRAM([[ 899151497Sru 900151497Sruunsigned long long ull = 1; 901151497Sruint i = 63; 902151497Sruunsigned long long ullmax = (unsigned long long)-1; 903151497Sru 904151497Sru ]], 905151497Sru [[ 906151497Sru 907151497Srureturn ull << i | ull >> i | ullmax / ull | ullmax % ull; 908151497Sru 909151497Sru ]]) 910151497Sru ], 911151497Sru [groff_cv_type_unsigned_long_long=yes], 912151497Sru [groff_cv_type_unsigned_long_long=no]) 913151497Sru AC_MSG_RESULT([$groff_cv_type_unsigned_long_long]) 914151497Sru AC_LANG_POP([C++])]) 915151497Sru 916151497Sru# Define uintmax_t to `unsigned long' or `unsigned long long' 917151497Sru# if <inttypes.h> does not exist. Taken from the fileutils package. 918151497Sru 919151497SruAC_DEFUN([GROFF_UINTMAX_T], 920151497Sru [AC_REQUIRE([GROFF_INTTYPES_H]) 921151497Sru if test $groff_cv_header_inttypes_h = no; then 922151497Sru AC_REQUIRE([GROFF_UNSIGNED_LONG_LONG]) 923151497Sru test $groff_cv_type_unsigned_long_long = yes \ 924104862Sru && ac_type='unsigned long long' \ 925104862Sru || ac_type='unsigned long' 926151497Sru AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type], 927151497Sru [Define uintmax_t to `unsigned long' or `unsigned long long' if 928151497Sru <inttypes.h> does not exist.]) 929151497Sru fi]) 930151497Sru 931151497Sru# Identify PATH_SEPARATOR character to use in GROFF_FONT_PATH and 932151497Sru# GROFF_TMAC_PATH which is appropriate for the target system (POSIX=':', 933151497Sru# MS-DOS/Win32=';'). 934151497Sru# 935151497Sru# The logic to resolve this test is already encapsulated in 936151497Sru# `${srcdir}/src/include/nonposix.h'. 937151497Sru 938151497SruAC_DEFUN([GROFF_TARGET_PATH_SEPARATOR], 939151497Sru [AC_MSG_CHECKING([separator character to use in groff search paths]) 940151497Sru cp ${srcdir}/src/include/nonposix.h conftest.h 941151497Sru AC_COMPILE_IFELSE([ 942151497Sru AC_LANG_PROGRAM([[ 943151497Sru 944151497Sru#include <ctype.h> 945151497Sru#include "conftest.h" 946151497Sru 947151497Sru ]], 948151497Sru [[ 949151497Sru 950151497Sru#if PATH_SEP_CHAR == ';' 951151497Srumake an error "Path separator is ';'" 952151497Sru#endif 953151497Sru 954151497Sru ]]) 955151497Sru ], 956151497Sru [GROFF_PATH_SEPARATOR=":"], 957151497Sru [GROFF_PATH_SEPARATOR=";"]) 958151497Sru AC_MSG_RESULT([$GROFF_PATH_SEPARATOR]) 959151497Sru AC_SUBST(GROFF_PATH_SEPARATOR)]) 960151497Sru 961151497Sru# Check for X11. 962151497Sru 963151497SruAC_DEFUN([GROFF_X11], 964151497Sru [AC_REQUIRE([AC_PATH_XTRA]) 965151497Sru groff_no_x=$no_x 966151497Sru if test -z "$groff_no_x"; then 967151497Sru OLDCFLAGS=$CFLAGS 968151497Sru OLDLDFLAGS=$LDFLAGS 969151497Sru OLDLIBS=$LIBS 970151497Sru CFLAGS="$CFLAGS $X_CFLAGS" 971151497Sru LDFLAGS="$LDFLAGS $X_LIBS" 972151497Sru LIBS="$LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS" 973151497Sru 974151497Sru LIBS="$LIBS -lXaw" 975151497Sru AC_MSG_CHECKING([for Xaw library and header files]) 976151497Sru AC_LINK_IFELSE([ 977151497Sru AC_LANG_PROGRAM([[ 978151497Sru 979151497Sru#include <X11/Intrinsic.h> 980151497Sru#include <X11/Xaw/Simple.h> 981151497Sru 982151497Sru ]], 983151497Sru []) 984151497Sru ], 985151497Sru [AC_MSG_RESULT([yes])], 986151497Sru [AC_MSG_RESULT([no]) 987151497Sru groff_no_x="yes"]) 988151497Sru 989151497Sru LIBS="$LIBS -lXmu" 990151497Sru AC_MSG_CHECKING([for Xmu library and header files]) 991151497Sru AC_LINK_IFELSE([ 992151497Sru AC_LANG_PROGRAM([[ 993151497Sru 994151497Sru#include <X11/Intrinsic.h> 995151497Sru#include <X11/Xmu/Converters.h> 996151497Sru 997151497Sru ]], 998151497Sru []) 999151497Sru ], 1000151497Sru [AC_MSG_RESULT([yes])], 1001151497Sru [AC_MSG_RESULT([no]) 1002151497Sru groff_no_x="yes"]) 1003151497Sru 1004151497Sru CFLAGS=$OLDCFLAGS 1005151497Sru LDFLAGS=$OLDLDFLAGS 1006151497Sru LIBS=$OLDLIBS 1007151497Sru fi 1008151497Sru 1009151497Sru if test "x$groff_no_x" = "xyes"; then 1010151497Sru AC_MSG_NOTICE([gxditview and xtotroff won't be built]) 1011151497Sru else 1012151497Sru XDEVDIRS="font/devX75 font/devX75-12 font/devX100 font/devX100-12" 1013151497Sru XPROGDIRS="src/devices/xditview src/utils/xtotroff" 1014151497Sru XLIBDIRS="src/libs/libxutil" 1015151497Sru fi 1016151497Sru 1017151497Sru AC_SUBST([XDEVDIRS]) 1018151497Sru AC_SUBST([XPROGDIRS]) 1019151497Sru AC_SUBST([XLIBDIRS])]) 1020151497Sru 1021151497Sru# Set up the `--with-appresdir' command line option. 1022151497Sru 1023151497SruAC_DEFUN([GROFF_APPRESDIR_OPTION], 1024151497Sru [AC_ARG_WITH([appresdir], 1025151497Sru dnl Don't quote AS_HELP_STRING! 1026151497Sru AS_HELP_STRING([--with-appresdir=DIR], 1027151497Sru [X11 application resource files]))]) 1028151497Sru 1029151497Sru# Get a default value for the application resource directory. 1030151497Sru# 1031151497Sru# We ignore the `XAPPLRES' and `XUSERFILESEARCHPATH' environment variables. 1032151497Sru# 1033151497Sru# The goal is to find the `root' of X11. Under most systems this is 1034151497Sru# `/usr/X11/lib'. Application default files are then in 1035151497Sru# `/usr/X11/lib/X11/app-defaults'. 1036151497Sru# 1037151497Sru# Based on autoconf's AC_PATH_X macro. 1038151497Sru 1039151497SruAC_DEFUN([GROFF_APPRESDIR_DEFAULT], 1040151497Sru [if test -z "$groff_no_x"; then 1041151497Sru # Create an Imakefile, run `xmkmf', then `make'. 1042151497Sru rm -f -r conftest.dir 1043151497Sru if mkdir conftest.dir; then 1044151497Sru cd conftest.dir 1045151497Sru # Make sure to not put `make' in the Imakefile rules, 1046151497Sru # since we grep it out. 1047151497Sru cat >Imakefile <<'EOF' 1048151497Sru 1049151497Sruxlibdirs: 1050151497Sru @echo 'groff_x_usrlibdir="${USRLIBDIR}"; groff_x_libdir="${LIBDIR}"' 1051151497SruEOF 1052151497Sru 1053151497Sru if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then 1054151497Sru # GNU make sometimes prints "make[1]: Entering...", 1055151497Sru # which would confuse us. 1056151497Sru eval `${MAKE-make} xlibdirs 2>/dev/null | grep -v make` 1057151497Sru 1058151497Sru # Open Windows `xmkmf' reportedly sets LIBDIR instead of USRLIBDIR. 1059151497Sru for groff_extension in a so sl; do 1060151497Sru if test ! -f $groff_x_usrlibdir/libX11.$groff_extension && 1061151497Sru test -f $groff_x_libdir/libX11.$groff_extension; then 1062151497Sru groff_x_usrlibdir=$groff_x_libdir 1063151497Sru break 1064151497Sru fi 1065151497Sru done 1066151497Sru fi 1067151497Sru 1068151497Sru cd .. 1069151497Sru rm -f -r conftest.dir 1070151497Sru fi 1071151497Sru 1072151497Sru # In case the test with `xmkmf' wasn't successful, try a suite of 1073151497Sru # standard directories. Check `X11' before `X11Rn' because it is often 1074151497Sru # a symlink to the current release. 1075151497Sru groff_x_libdirs=' 1076151497Sru /usr/X11/lib 1077151497Sru /usr/X11R6/lib 1078151497Sru /usr/X11R5/lib 1079151497Sru /usr/X11R4/lib 1080151497Sru 1081151497Sru /usr/lib/X11 1082151497Sru /usr/lib/X11R6 1083151497Sru /usr/lib/X11R5 1084151497Sru /usr/lib/X11R4 1085151497Sru 1086151497Sru /usr/local/X11/lib 1087151497Sru /usr/local/X11R6/lib 1088151497Sru /usr/local/X11R5/lib 1089151497Sru /usr/local/X11R4/lib 1090151497Sru 1091151497Sru /usr/local/lib/X11 1092151497Sru /usr/local/lib/X11R6 1093151497Sru /usr/local/lib/X11R5 1094151497Sru /usr/local/lib/X11R4 1095151497Sru 1096151497Sru /usr/X386/lib 1097151497Sru /usr/x386/lib 1098151497Sru /usr/XFree86/lib/X11 1099151497Sru 1100151497Sru /usr/lib 1101151497Sru /usr/local/lib 1102151497Sru /usr/unsupported/lib 1103151497Sru /usr/athena/lib 1104151497Sru /usr/local/x11r5/lib 1105151497Sru /usr/lpp/Xamples/lib 1106151497Sru 1107151497Sru /usr/openwin/lib 1108151497Sru /usr/openwin/share/lib' 1109151497Sru 1110151497Sru if test -z "$groff_x_usrlibdir"; then 1111151497Sru # We only test whether libX11 exists. 1112151497Sru for groff_dir in $groff_x_libdirs; do 1113151497Sru for groff_extension in a so sl; do 1114151497Sru if test ! -r $groff_dir/libX11.$groff_extension; then 1115151497Sru groff_x_usrlibdir=$groff_dir 1116151497Sru break 2 1117151497Sru fi 1118151497Sru done 1119151497Sru done 1120151497Sru fi 1121151497Sru 1122151497Sru if test "x$with_appresdir" = "x"; then 1123151497Sru appresdir=$groff_x_usrlibdir/X11/app-defaults 1124151497Sru else 1125151497Sru appresdir=$with_appresdir 1126151497Sru fi 1127151497Sru fi 1128151497Sru AC_SUBST([appresdir])]) 1129151497Sru 1130151497Sru 1131151497Sru# Emit warning if --with-appresdir hasn't been used. 1132151497Sru 1133151497SruAC_DEFUN([GROFF_APPRESDIR_CHECK], 1134151497Sru [if test -z "$groff_no_x"; then 1135151497Sru if test "x$with_appresdir" = "x"; then 1136151497Sru AC_MSG_NOTICE([ 1137151497Sru 1138151497Sru The application resource file for gxditview will be installed as 1139151497Sru 1140151497Sru $appresdir/GXditview 1141151497Sru 1142151497Sru (an existing file will be saved as `GXditview.old'). 1143151497Sru To install it into a different directory, say, `/etc/gxditview', 1144151497Sru add `--with-appresdir=/etc/gxditview' to the configure script 1145151497Sru command line options and rerun it. The environment variable 1146151497Sru `APPLRESDIR' must then be set to `/etc/' (note the trailing slash), 1147151497Sru omitting the `gxditview' part which is automatically appended by 1148151497Sru the X11 searching routines for resource files. More details can be 1149151497Sru found in the X(7) manual page. 1150151497Sru ]) 1151151497Sru fi 1152151497Sru fi]) 1153