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