aclocal.m4 revision 18099
1dnl Autoconf macros for groff. 2dnl Copyright (C) 1989, 1990, 1991, 1992, 1995 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 20AC_DEFUN(GROFF_PRINT, 21[if test -z "$PSPRINT" 22then 23 AC_CHECK_PROGS(LPR,lpr) 24 AC_CHECK_PROGS(LP,lp) 25 if test -n "$LPR" && test -n "$LP" 26 then 27 # HP-UX provides an lpr command that emulates lpr using lp, 28 # but it doesn't have lpq; in this case we want to use lp 29 # rather than lpr. 30 AC_CHECK_PROGS(LPQ,lpq) 31 test -n "$LPQ" || LPR= 32 fi 33 if test -n "$LPR" 34 then 35 PSPRINT="$LPR" 36 elif test -n "$LP" 37 then 38 PSPRINT="$LP" 39 fi 40fi 41AC_SUBST(PSPRINT) 42AC_MSG_CHECKING([for command to use for printing PostScript files]) 43AC_MSG_RESULT($PSPRINT) 44# Figure out DVIPRINT from PSPRINT. 45AC_MSG_CHECKING([for command to use for printing dvi files]) 46if test -n "$PSPRINT" && test -z "$DVIPRINT" 47then 48 if test "X$PSPRINT" = "Xlpr" 49 then 50 DVIPRINT="lpr -d" 51 else 52 DVIPRINT="$PSPRINT" 53 fi 54fi 55AC_SUBST(DVIPRINT) 56AC_MSG_RESULT($DVIPRINT)])dnl 57dnl Bison generated parsers have problems with C++ compilers other than g++. 58dnl So byacc is preferred over bison. 59AC_DEFUN(GROFF_PROG_YACC, 60[AC_CHECK_PROGS(YACC, byacc 'bison -y', yacc)]) 61dnl GROFF_CSH_HACK(if hack present, if not present) 62AC_DEFUN(GROFF_CSH_HACK, 63[AC_MSG_CHECKING([for csh hash hack]) 64cat <<EOF >conftest.sh 65#!/bin/sh 66true || exit 0 67export PATH || exit 0 68exit 1 69EOF 70chmod +x conftest.sh 71if echo ./conftest.sh | (csh >/dev/null 2>&1) >/dev/null 2>&1 72then 73 AC_MSG_RESULT(yes); $1 74else 75 AC_MSG_RESULT(no); $2 76fi 77rm -f conftest.sh 78])dnl 79dnl From udodo!hans@relay.NL.net (Hans Zuidam) 80AC_DEFUN(GROFF_ISC_SYSV3, 81[AC_MSG_CHECKING([for ISC 3.x or 4.x]) 82changequote(,)dnl 83if grep '[34]\.' /usr/options/cb.name >/dev/null 2>&1 84changequote([,])dnl 85then 86 AC_MSG_RESULT(yes) 87 AC_DEFINE(_SYSV3) 88else 89 AC_MSG_RESULT(no) 90fi])dnl 91AC_DEFUN(GROFF_POSIX, 92[AC_MSG_CHECKING([whether -D_POSIX_SOURCE is necessary]) 93AC_LANG_SAVE 94AC_LANG_CPLUSPLUS 95AC_TRY_COMPILE([#include <stdio.h> 96extern "C" { void fileno(int); }],, 97AC_MSG_RESULT(yes);AC_DEFINE(_POSIX_SOURCE), 98AC_MSG_RESULT(no)) 99AC_LANG_RESTORE])dnl 100AC_DEFUN(GROFF_GETOPT, 101[AC_LANG_SAVE 102AC_LANG_CPLUSPLUS 103AC_MSG_CHECKING([declaration of getopt in stdlib.h]) 104AC_TRY_COMPILE( 105[#include <stdlib.h> 106extern "C" { void getopt(int); }],,AC_MSG_RESULT(no), 107AC_MSG_RESULT(yes);AC_DEFINE(STDLIB_H_DECLARES_GETOPT)) 108AC_MSG_CHECKING([declaration of getopt in unistd.h]) 109AC_TRY_COMPILE([#include <sys/types.h> 110#include <unistd.h> 111extern "C" { void getopt(int); }],,AC_MSG_RESULT(no), 112AC_MSG_RESULT(yes);AC_DEFINE(UNISTD_H_DECLARES_GETOPT)) 113AC_LANG_RESTORE])dnl 114AC_DEFUN(GROFF_PUTENV, 115[AC_LANG_SAVE 116AC_LANG_CPLUSPLUS 117AC_MSG_CHECKING([declaration of putenv]) 118AC_TRY_COMPILE([#include <stdlib.h> 119extern "C" { void putenv(int); }],,AC_MSG_RESULT(no), 120AC_MSG_RESULT(yes) 121AC_DEFINE(STDLIB_H_DECLARES_PUTENV)) 122AC_LANG_RESTORE])dnl 123AC_DEFUN(GROFF_POPEN, 124[AC_LANG_SAVE 125AC_LANG_CPLUSPLUS 126AC_MSG_CHECKING([declaration of popen]) 127AC_TRY_COMPILE([#include <stdio.h> 128extern "C" { void popen(int); }],,AC_MSG_RESULT(no), 129AC_MSG_RESULT(yes);AC_DEFINE(STDIO_H_DECLARES_POPEN)) 130AC_LANG_RESTORE])dnl 131AC_DEFUN(GROFF_PCLOSE, 132[AC_LANG_SAVE 133AC_LANG_CPLUSPLUS 134AC_MSG_CHECKING([declaration of pclose]) 135AC_TRY_COMPILE([#include <stdio.h> 136extern "C" { void pclose(int); }],,AC_MSG_RESULT(no), 137AC_MSG_RESULT(yes);AC_DEFINE(STDIO_H_DECLARES_PCLOSE)) 138AC_LANG_RESTORE])dnl 139AC_DEFUN(GROFF_OSFCN_H, 140[AC_LANG_SAVE 141AC_LANG_CPLUSPLUS 142AC_MSG_CHECKING([C++ <osfcn.h>]) 143AC_TRY_COMPILE([#include <osfcn.h>], 144[read(0, 0, 0); open(0, 0);],AC_MSG_RESULT(yes);AC_DEFINE(HAVE_CC_OSFCN_H), 145AC_MSG_RESULT(no)) 146AC_LANG_RESTORE])dnl 147AC_DEFUN(GROFF_LIMITS_H, 148[AC_LANG_SAVE 149AC_LANG_CPLUSPLUS 150AC_MSG_CHECKING([C++ <limits.h>]) 151AC_TRY_COMPILE([#include <limits.h>], 152[int x = INT_MIN; int y = INT_MAX; int z = UCHAR_MAX;], 153AC_MSG_RESULT(yes);AC_DEFINE(HAVE_CC_LIMITS_H),AC_MSG_RESULT(no)) 154AC_LANG_RESTORE])dnl 155AC_DEFUN(GROFF_TIME_T, 156[AC_LANG_SAVE 157AC_LANG_CPLUSPLUS 158AC_MSG_CHECKING([for declaration of time_t]) 159AC_TRY_COMPILE([#include <time.h>], 160[time_t t = time(0); struct tm *p = localtime(&t);],AC_MSG_RESULT(yes), 161AC_MSG_RESULT(no);AC_DEFINE(LONG_FOR_TIME_T)) 162AC_LANG_RESTORE])dnl 163AC_DEFUN(GROFF_STRUCT_EXCEPTION, 164[AC_MSG_CHECKING([struct exception]) 165AC_TRY_COMPILE([#include <math.h>], 166[struct exception e;], 167AC_MSG_RESULT(yes);AC_DEFINE(HAVE_STRUCT_EXCEPTION), 168AC_MSG_RESULT(no))])dnl 169AC_DEFUN(GROFF_ARRAY_DELETE, 170[AC_LANG_SAVE 171AC_LANG_CPLUSPLUS 172AC_MSG_CHECKING([whether ANSI array delete syntax supported]) 173AC_TRY_COMPILE(, 174changequote(,)dnl 175char *p = new char[5]; delete [] p;changequote([,]), 176AC_MSG_RESULT(yes),AC_MSG_RESULT(no);AC_DEFINE(ARRAY_DELETE_NEEDS_SIZE)) 177AC_LANG_RESTORE])dnl 178dnl 179AC_DEFUN(GROFF_TRADITIONAL_CPP, 180[AC_LANG_SAVE 181AC_LANG_CPLUSPLUS 182AC_MSG_CHECKING([traditional preprocessor]) 183AC_TRY_COMPILE([#define name2(a,b) a/**/b],[int name2(foo,bar);], 184AC_MSG_RESULT(yes);AC_DEFINE(TRADITIONAL_CPP), 185AC_MSG_RESULT(no)) 186AC_LANG_RESTORE])dnl 187 188AC_DEFUN(GROFF_WCOREFLAG, 189[AC_MSG_CHECKING([w_coredump]) 190AC_TRY_RUN([ 191#include <sys/types.h> 192#include <sys/wait.h> 193main() 194{ 195#ifdef WCOREFLAG 196 exit(1); 197#else 198 int i = 0; 199 ((union wait *)&i)->w_coredump = 1; 200 exit(i != 0200); 201#endif 202} 203],AC_MSG_RESULT(yes);AC_DEFINE(WCOREFLAG,0200),AC_MSG_RESULT(no), 204AC_MSG_RESULT(no))])dnl 205dnl 206AC_DEFUN(GROFF_BROKEN_SPOOLER_FLAGS, 207[AC_MSG_CHECKING([default value for grops -b option]) 208test -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=7 209AC_MSG_RESULT($BROKEN_SPOOLER_FLAGS) 210AC_SUBST(BROKEN_SPOOLER_FLAGS)])dnl 211dnl 212AC_DEFUN(GROFF_PAGE, 213[AC_MSG_CHECKING([default paper size]) 214if test -z "$PAGE" 215then 216 descfile= 217 if test -r $prefix/share/groff/font/devps/DESC 218 then 219 descfile=$prefix/share/groff/font/devps/DESC 220 elif test -r $prefix/lib/groff/font/devps/DESC 221 then 222 descfile=$prefix/lib/groff/font/devps/DESC 223 fi 224 if test -n "$descfile" \ 225 && grep "^paperlength 841890" $descfile >/dev/null 2>&1 226 then 227 PAGE=A4 228 else 229 PAGE=letter 230 fi 231fi 232if test -z "$PAGE" 233then 234 dom=`awk '([$]1 == "dom" || [$]1 == "search") { print [$]2; exit}' \ 235 /etc/resolv.conf 2>/dev/null` 236 237 if test -z "$dom" 238 then 239 dom=`(domainname) 2>/dev/null | tr -d '+'` 240 if test -z "$dom" 241 then 242 dom=`(hostname) 2>/dev/null | grep '\.'` 243 fi 244 fi 245 246changequote(,)dnl 247 # If the top-level domain is two letters and it's not `us' or `ca' 248 # then they probably use A4 paper. 249 case "$dom" in 250 *.[Uu][Ss]|*.[Cc][Aa]) ;; 251 *.[A-Za-z][A-Za-z]) PAGE=A4 ;; 252 esac 253changequote([,])dnl 254fi 255test -n "$PAGE" || PAGE=letter 256AC_MSG_RESULT($PAGE) 257AC_SUBST(PAGE)])dnl 258dnl 259AC_DEFUN(GROFF_CXX_CHECK, 260[AC_REQUIRE([AC_C_CROSS]) 261AC_REQUIRE([AC_PROG_CXX]) 262AC_LANG_SAVE 263AC_LANG_CPLUSPLUS 264if test "$cross_compiling" = no; then 265AC_MSG_CHECKING([that C++ compiler can compile simple program]) 266fi 267AC_TRY_RUN([int main() { return 0; }], 268AC_MSG_RESULT(yes), 269AC_MSG_RESULT(no) 270AC_MSG_ERROR([a working C++ compiler is required]),:) 271if test "$cross_compiling" = no; then 272AC_MSG_CHECKING([that C++ static constructors and destructors are called]) 273fi 274AC_TRY_RUN([ 275extern "C" { 276 void _exit(int); 277} 278int i; 279struct A { 280 char dummy; 281 A() { i = 1; } 282 ~A() { if (i == 1) _exit(0); } 283}; 284A a; 285int main() { return 1; } 286], 287AC_MSG_RESULT(yes), 288AC_MSG_RESULT(no) 289AC_MSG_ERROR([a working C++ compiler is required]),:) 290AC_MSG_CHECKING([that header files support C++]) 291AC_TRY_LINK([#include <stdio.h>], 292[fopen(0, 0);],AC_MSG_RESULT(yes), 293AC_MSG_RESULT(no) 294AC_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++)])) 295AC_LANG_RESTORE 296])dnl 297dnl 298AC_DEFUN(GROFF_TMAC, 299[ 300AC_MSG_CHECKING([for prefix of system macro packages]) 301sys_tmac_prefix= 302sys_tmac_file_prefix= 303for d in /usr/share/lib/tmac /usr/lib/tmac 304do 305 for t in "" tmac. 306 do 307 for m in an s m 308 do 309 f=$d/$t$m 310 if test -z "$sys_tmac_prefix" \ 311 && test -f $f \ 312 && grep '^\.if' $f >/dev/null 2>&1 313 then 314 sys_tmac_prefix=$d/$t 315 sys_tmac_file_prefix=$t 316 fi 317 done 318 done 319done 320AC_MSG_RESULT($sys_tmac_prefix) 321AC_SUBST(sys_tmac_prefix) 322tmac_wrap= 323AC_MSG_CHECKING([which system macro packages should be made available]) 324if test "x$sys_tmac_file_prefix" = "xtmac." 325then 326 for f in $sys_tmac_prefix* 327 do 328 suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"` 329 case "$suff" in 330 e);; 331 *) 332 grep "Copyright.*Free Software Foundation" $f >/dev/null \ 333 || tmac_wrap="$tmac_wrap $suff" 334 ;; 335 esac 336 done 337elif test -n "$sys_tmac_prefix" 338then 339 files=`echo $sys_tmac_prefix*` 340 grep "\\.so" $files >conftest.sol 341 for f in $files 342 do 343 case "$f" in 344 ${sys_tmac_prefix}e) ;; 345 *.me) ;; 346 */ms.*) ;; 347 *) 348 b=`basename $f` 349 if grep "\\.so.*/$b\$" conftest.sol >/dev/null \ 350 || grep -l "Copyright.*Free Software Foundation" $f >/dev/null 351 then 352 : 353 else 354 suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"` 355 case "$suff" in 356 tmac.*);; 357 *) tmac_wrap="$tmac_wrap $suff" ;; 358 esac 359 fi 360 esac 361 done 362 rm -f conftest.sol 363fi 364AC_MSG_RESULT([$tmac_wrap]) 365AC_SUBST(tmac_wrap) 366])dnl 367AC_DEFUN(GROFF_G, 368[AC_MSG_CHECKING([for existing troff installation]) 369if test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" \ 370 = x0 371then 372 AC_MSG_RESULT(yes) 373 g=g 374else 375 AC_MSG_RESULT(no) 376 g= 377fi 378AC_SUBST(g) 379])dnl 380dnl We need the path to install-sh to be absolute. 381AC_DEFUN(GROFF_INSTALL_SH, 382[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl 383ac_dir=`cd $ac_aux_dir; pwd` 384ac_install_sh="$ac_dir/install-sh -c" 385]) 386