1 # Autoconf macros for groff.
2 # Copyright (C) 1989-1995, 2001, 2002, 2003, 2004, 2005, 2006
3 # Free Software Foundation, Inc.
5 # This file is part of groff.
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
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
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.
21 AC_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
29 AC_CHECK_PROGS([LPQ], [lpq])
30 test -n "$LPQ" || LPR=
32 if test -n "$LPR"; then
34 elif test -n "$LP"; then
39 AC_MSG_CHECKING([for command to use for printing PostScript files])
40 AC_MSG_RESULT([$PSPRINT])
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
52 AC_MSG_RESULT([$DVIPRINT])])
54 # Bison generated parsers have problems with C++ compilers other than g++.
55 # So byacc is preferred over bison.
57 AC_DEFUN([GROFF_PROG_YACC],
58 [AC_CHECK_PROGS([YACC], [byacc 'bison -y'], [yacc])])
60 # We need makeinfo 4.8 or newer.
62 AC_DEFUN([GROFF_MAKEINFO],
64 AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo])
65 if test -z "$MAKEINFO"; then
66 missing="\`makeinfo' is missing."
68 AC_MSG_CHECKING([for makeinfo version])
69 # We need an additional level of quoting to make sed's regexps work.
70 [makeinfo_version=`$MAKEINFO --version 2>&1 \
71 | sed -e 's/^.* \([^ ][^ ]*\)$/\1/' -e '1q'`]
72 AC_MSG_RESULT([$makeinfo_version])
73 # Consider only the first two numbers in version number string.
74 makeinfo_version_major=`IFS=.; set x $makeinfo_version; echo 0${2}`
75 makeinfo_version_minor=`IFS=.; set x $makeinfo_version; echo 0${3}`
76 makeinfo_version_numeric=`
77 expr ${makeinfo_version_major}000 \+ ${makeinfo_version_minor}`
78 if test $makeinfo_version_numeric -lt 4008; then
79 missing="\`makeinfo' is too old."
83 if test -n "$missing"; then
84 infofile=doc/groff.info
85 test -f ${infofile} || infofile=${srcdir}/${infofile}
86 if test ! -f ${infofile} \
87 || test ${srcdir}/doc/groff.texinfo -nt ${infofile}; then
89 [Get the `texinfo' package version 4.8 or newer.])
92 [Get the `texinfo' package version 4.8 or newer if you want to convert
93 `groff.texinfo' into a PDF or HTML document.])
96 AC_SUBST([MAKEINFO])])
98 # The following programs are needed for grohtml.
100 AC_DEFUN([GROFF_HTML_PROGRAMS],
101 [AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
103 make_install_html=install_html
106 AC_FOREACH([groff_prog],
107 [pnmcut pnmcrop pnmtopng psselect pnmtops],
108 [AC_CHECK_PROG(groff_prog, groff_prog, [found], [missing])
109 if test $[]groff_prog = missing; then
110 missing="$missing \`groff_prog'"
113 test "$GHOSTSCRIPT" = "missing" && missing="$missing \`gs'"
115 if test -n "$missing"; then
116 plural=`set $missing; test $[#] -gt 1 && echo s`
117 missing=`set $missing
119 while test $[#] -gt 0
122 1) missing="$missing$[1]" ;;
123 2) missing="$missing$[1] and " ;;
124 *) missing="$missing$[1], " ;;
133 AC_MSG_WARN([missing program$plural:
137 cannot be found in the PATH.
138 Consequently, groff's HTML backend (grohtml) will not work properly;
139 therefore, it will neither be possible to prepare, nor to install,
140 documentation in HTML format.
144 AC_SUBST([make_html])
145 AC_SUBST([make_install_html])])
147 # To produce PDF docs, we need both awk and ghostscript.
149 AC_DEFUN([GROFF_PDFDOC_PROGRAMS],
150 [AC_REQUIRE([GROFF_AWK_PATH])
151 AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
154 make_install_pdfdoc=install_pdfdoc
157 test "$AWK" = missing && missing="\`awk'"
158 test "$GHOSTSCRIPT" = missing && missing="$missing \`gs'"
159 if test -n "$missing"; then
160 plural=`set $missing; test $[#] -eq 2 && echo s`
162 && missing=`set $missing; echo "$[1] and $[2]"` \
163 || missing=`echo $missing`
168 AC_MSG_WARN([missing program$plural:
170 The program$plural $missing cannot be found in the PATH.
171 Consequently, groff's PDF formatter (pdfroff) will not work properly;
172 therefore, it will neither be possible to prepare, nor to install,
173 documentation in PDF format.
177 AC_SUBST([make_pdfdoc])
178 AC_SUBST([make_install_pdfdoc])])
180 # Check whether pnmtops can handle the -nosetpage option.
182 AC_DEFUN([GROFF_PNMTOPS_NOSETPAGE],
183 [AC_MSG_CHECKING([whether pnmtops can handle the -nosetpage option])
184 if echo P2 2 2 255 0 1 2 0 | pnmtops -nosetpage > /dev/null 2>&1 ; then
186 pnmtops_nosetpage="pnmtops -nosetpage"
189 pnmtops_nosetpage="pnmtops"
191 AC_SUBST([pnmtops_nosetpage])])
193 # Check location of `gs'; allow `--with-gs=PROG' option to override.
195 AC_DEFUN([GROFF_GHOSTSCRIPT_PATH],
196 [AC_REQUIRE([GROFF_GHOSTSCRIPT_PREFS])
198 [AS_HELP_STRING([--with-gs=PROG],
199 [actual [/path/]name of ghostscript executable])],
200 [GHOSTSCRIPT=$withval],
201 [AC_CHECK_TOOLS(GHOSTSCRIPT, [$ALT_GHOSTSCRIPT_PROGS], [missing])])
202 test "$GHOSTSCRIPT" = "no" && GHOSTSCRIPT=missing])
204 # Preferences for choice of `gs' program...
205 # (allow --with-alt-gs="LIST" to override).
207 AC_DEFUN([GROFF_GHOSTSCRIPT_PREFS],
208 [AC_ARG_WITH([alt-gs],
209 [AS_HELP_STRING([--with-alt-gs=LIST],
210 [alternative names for ghostscript executable])],
211 [ALT_GHOSTSCRIPT_PROGS="$withval"],
212 [ALT_GHOSTSCRIPT_PROGS="gs gswin32c gsos2"])
213 AC_SUBST([ALT_GHOSTSCRIPT_PROGS])])
215 # Check location of `awk'; allow `--with-awk=PROG' option to override.
217 AC_DEFUN([GROFF_AWK_PATH],
218 [AC_REQUIRE([GROFF_AWK_PREFS])
220 [AS_HELP_STRING([--with-awk=PROG],
221 [actual [/path/]name of awk executable])],
223 [AC_CHECK_TOOLS(AWK, [$ALT_AWK_PROGS], [missing])])
224 test "$AWK" = "no" && AWK=missing])
226 # Preferences for choice of `awk' program; allow --with-alt-awk="LIST"
229 AC_DEFUN([GROFF_AWK_PREFS],
230 [AC_ARG_WITH([alt-awk],
231 [AS_HELP_STRING([--with-alt-awk=LIST],
232 [alternative names for awk executable])],
233 [ALT_AWK_PROGS="$withval"],
234 [ALT_AWK_PROGS="gawk mawk nawk awk"])
235 AC_SUBST([ALT_AWK_PROGS])])
237 # GROFF_CSH_HACK(if hack present, if not present)
239 AC_DEFUN([GROFF_CSH_HACK],
240 [AC_MSG_CHECKING([for csh hash hack])
242 cat <<EOF >conftest.sh
245 export PATH || exit 0
250 if echo ./conftest.sh | (csh >/dev/null 2>&1) >/dev/null 2>&1; then
259 # From udodo!hans@relay.NL.net (Hans Zuidam)
261 AC_DEFUN([GROFF_ISC_SYSV3],
262 [AC_MSG_CHECKING([for ISC 3.x or 4.x])
263 if grep ['[34]\.'] /usr/options/cb.name >/dev/null 2>&1
266 AC_DEFINE([_SYSV3], [1], [Define if you have ISC 3.x or 4.x.])
271 AC_DEFUN([GROFF_POSIX],
272 [AC_MSG_CHECKING([whether -D_POSIX_SOURCE is necessary])
278 extern "C" { void fileno(int); }
282 [AC_MSG_RESULT([yes])
283 AC_DEFINE([_POSIX_SOURCE], [1],
284 [Define if -D_POSIX_SOURCE is necessary.])],
285 [AC_MSG_RESULT([no])])
288 # srand() of SunOS 4.1.3 has return type int instead of void
290 AC_DEFUN([GROFF_SRAND],
292 AC_MSG_CHECKING([for return type of srand])
297 extern "C" { void srand(unsigned int); }
301 [AC_MSG_RESULT([void])
302 AC_DEFINE([RET_TYPE_SRAND_IS_VOID], [1],
303 [Define if srand() returns void not int.])],
304 [AC_MSG_RESULT([int])])
307 # In April 2005, autoconf's AC_TYPE_SIGNAL is still broken.
309 AC_DEFUN([GROFF_TYPE_SIGNAL],
310 [AC_MSG_CHECKING([for return type of signal handlers])
311 for groff_declaration in \
312 'extern "C" void (*signal (int, void (*)(int)))(int);' \
313 'extern "C" void (*signal (int, void (*)(int)) throw ())(int);' \
314 'void (*signal ()) ();'
319 #include <sys/types.h>
337 if test -n "$groff_declaration"; then
338 AC_MSG_RESULT([void])
339 AC_DEFINE([RETSIGTYPE], [void],
340 [Define as the return type of signal handlers
344 AC_DEFINE([RETSIGTYPE], [int],
345 [Define as the return type of signal handlers
349 AC_DEFUN([GROFF_SYS_NERR],
351 AC_MSG_CHECKING([for sys_nerr in <errno.h>, <stdio.h>, or <stdlib.h>])
367 [AC_MSG_RESULT([yes])
368 AC_DEFINE([HAVE_SYS_NERR], [1],
369 [Define if you have sys_nerr in <errno.h>, <stdio.h>, or <stdio.h>.])],
370 [AC_MSG_RESULT([no])])
373 AC_DEFUN([GROFF_SYS_ERRLIST],
374 [AC_MSG_CHECKING([for sys_errlist[] in <errno.h>, <stdio.h>, or <stdlib.h>])
386 k = (int)sys_errlist[0];
390 [AC_MSG_RESULT([yes])
391 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
392 [Define if you have sys_errlist in <errno.h>, <stdio.h>, or <stdlib.h>.])],
393 [AC_MSG_RESULT([no])])])
395 AC_DEFUN([GROFF_OSFCN_H],
397 AC_MSG_CHECKING([C++ <osfcn.h>])
411 [AC_MSG_RESULT([yes])
412 AC_DEFINE([HAVE_CC_OSFCN_H], [1],
413 [Define if you have a C++ <osfcn.h>.])],
414 [AC_MSG_RESULT([no])])
417 AC_DEFUN([GROFF_LIMITS_H],
419 AC_MSG_CHECKING([C++ <limits.h>])
434 [AC_MSG_RESULT([yes])
435 AC_DEFINE([HAVE_CC_LIMITS_H], [1],
436 [Define if you have a C++ <limits.h>.])],
437 [AC_MSG_RESULT([no])])
440 AC_DEFUN([GROFF_TIME_T],
442 AC_MSG_CHECKING([for declaration of time_t])
452 struct tm *p = localtime(&t);
456 [AC_MSG_RESULT([yes])],
458 AC_DEFINE([LONG_FOR_TIME_T], [1],
459 [Define if localtime() takes a long * not a time_t *.])])
462 AC_DEFUN([GROFF_STRUCT_EXCEPTION],
463 [AC_MSG_CHECKING([struct exception])
476 [AC_MSG_RESULT([yes])
477 AC_DEFINE([HAVE_STRUCT_EXCEPTION], [1],
478 [Define if <math.h> defines struct exception.])],
479 [AC_MSG_RESULT([no])])])
481 AC_DEFUN([GROFF_ARRAY_DELETE],
483 AC_MSG_CHECKING([whether ANSI array delete syntax is supported])
487 char *p = new char[5];
492 [AC_MSG_RESULT([yes])],
494 AC_DEFINE([ARRAY_DELETE_NEEDS_SIZE], [1],
495 [Define if your C++ doesn't understand `delete []'.])])
498 AC_DEFUN([GROFF_TRADITIONAL_CPP],
500 AC_MSG_CHECKING([traditional preprocessor])
504 #define name2(a, b) a/**/b
513 [AC_MSG_RESULT([yes])
514 AC_DEFINE([TRADITIONAL_CPP], [1],
515 [Define if your C++ compiler uses a traditional (Reiser) preprocessor.])],
516 [AC_MSG_RESULT([no])])
519 AC_DEFUN([GROFF_WCOREFLAG],
520 [AC_MSG_CHECKING([w_coredump])
524 #include <sys/types.h>
525 #include <sys/wait.h>
536 ((union wait *)&i)->w_coredump = 1;
543 [AC_MSG_RESULT([yes])
544 AC_DEFINE(WCOREFLAG, 0200,
545 [Define if the 0200 bit of the status returned by wait() indicates
546 whether a core image was produced for a process that was terminated
548 [AC_MSG_RESULT([no])],
549 [AC_MSG_RESULT([no])])])
551 AC_DEFUN([GROFF_BROKEN_SPOOLER_FLAGS],
552 [AC_MSG_CHECKING([default value for grops -b option])
553 test -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=0
554 AC_MSG_RESULT([$BROKEN_SPOOLER_FLAGS])
555 AC_SUBST([BROKEN_SPOOLER_FLAGS])])
557 AC_DEFUN([GROFF_PAGE],
558 [AC_MSG_CHECKING([default paper size])
560 test "x$prefix" = "xNONE" && groff_prefix=$ac_default_prefix
561 if test -z "$PAGE"; then
563 if test -r $groff_prefix/share/groff/font/devps/DESC; then
564 descfile=$groff_prefix/share/groff/font/devps/DESC
565 elif test -r $groff_prefix/lib/groff/font/devps/DESC; then
566 descfile=$groff_prefix/lib/groff/font/devps/DESC
568 for f in $groff_prefix/share/groff/*/font/devps/DESC; do
576 if test -n "$descfile"; then
577 if grep ['^paperlength[ ]\+841890'] $descfile >/dev/null 2>&1; then
579 elif grep ['^papersize[ ]\+[aA]4'] $descfile >/dev/null 2>&1; then
585 if test -z "$PAGE"; then
586 dom=`awk '([$]1 == "dom" || [$]1 == "search") { print [$]2; exit}' \
587 /etc/resolv.conf 2>/dev/null`
588 if test -z "$dom"; then
589 dom=`(domainname) 2>/dev/null | tr -d '+'`
591 || test "$dom" = '(none)'; then
592 dom=`(hostname) 2>/dev/null | grep '\.'`
595 # If the top-level domain is two letters and it's not `us' or `ca'
596 # then they probably use A4 paper.
598 [*.[Uu][Ss]|*.[Cc][Aa])]
600 [*.[A-Za-z][A-Za-z])]
605 test -n "$PAGE" || PAGE=letter
606 if test "x$PAGE" = "xA4"; then
607 AC_DEFINE([PAGEA4], [1],
608 [Define if the printer's page size is A4.])
610 AC_MSG_RESULT([$PAGE])
613 AC_DEFUN([GROFF_CXX_CHECK],
614 [AC_REQUIRE([AC_PROG_CXX])
616 if test "$cross_compiling" = no; then
617 AC_MSG_CHECKING([that C++ compiler can compile simple program])
628 [AC_MSG_RESULT([yes])],
630 AC_MSG_ERROR([a working C++ compiler is required])],
633 if test "$cross_compiling" = no; then
634 AC_MSG_CHECKING([that C++ static constructors and destructors are called])
647 ~A() { if (i == 1) _exit(0); }
659 [AC_MSG_RESULT([yes])],
661 AC_MSG_ERROR([a working C++ compiler is required])],
664 AC_MSG_CHECKING([that header files support C++])
677 [AC_MSG_RESULT([yes])],
679 AC_MSG_ERROR([header files do not support C++
680 (if you are using a version of gcc/g++ earlier than 2.5,
681 you should install libg++)])])
684 AC_DEFUN([GROFF_TMAC],
685 [AC_MSG_CHECKING([for prefix of system macro packages])
687 sys_tmac_file_prefix=
688 for d in /usr/share/lib/tmac /usr/lib/tmac; do
689 for t in "" tmac.; do
692 if test -z "$sys_tmac_prefix" \
694 && grep '^\.if' $f >/dev/null 2>&1; then
695 sys_tmac_prefix=$d/$t
696 sys_tmac_file_prefix=$t
701 AC_MSG_RESULT([$sys_tmac_prefix])
702 AC_SUBST([sys_tmac_prefix])
704 AC_MSG_CHECKING([which system macro packages should be made available])
706 if test "x$sys_tmac_file_prefix" = "xtmac."; then
707 for f in $sys_tmac_prefix*; do
708 suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"`
713 grep "Copyright.*Free Software Foundation" $f >/dev/null \
714 || tmac_wrap="$tmac_wrap $suff" ;;
717 elif test -n "$sys_tmac_prefix"; then
718 files=`echo $sys_tmac_prefix*`
719 grep "\\.so" $files >conftest.sol
730 if grep "\\.so.*/$b\$" conftest.sol >/dev/null \
731 || grep -l "Copyright.*Free Software Foundation" $f >/dev/null; then
734 suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"`
739 tmac_wrap="$tmac_wrap $suff" ;;
746 AC_MSG_RESULT([$tmac_wrap])
747 AC_SUBST([tmac_wrap])])
750 [AC_MSG_CHECKING([for existing troff installation])
751 if test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then
760 # We need the path to install-sh to be absolute.
762 AC_DEFUN([GROFF_INSTALL_SH],
763 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])
764 ac_dir=`cd $ac_aux_dir; pwd`
765 ac_install_sh="$ac_dir/install-sh -c"])
767 # Test whether install-info is available.
769 AC_DEFUN([GROFF_INSTALL_INFO],
770 [AC_CHECK_PROGS([INSTALL_INFO], [install-info], [:])])
772 # At least one UNIX system, Apple Macintosh Rhapsody 5.5,
773 # does not have -lm ...
775 AC_DEFUN([GROFF_LIBM],
776 [AC_CHECK_LIB([m], [sin], [LIBM=-lm])
779 # ... while the MinGW implementation of GCC for Microsoft Win32
780 # does not seem to have -lc.
782 AC_DEFUN([GROFF_LIBC],
783 [AC_CHECK_LIB([c], [main], [LIBC=-lc])
786 # Check for EBCDIC -- stolen from the OS390 Unix LYNX port
788 AC_DEFUN([GROFF_EBCDIC],
789 [AC_MSG_CHECKING([whether character set is EBCDIC])
793 /* Treat any failure as ASCII for compatibility with existing art.
794 Use compile-time rather than run-time tests for cross-compiler
797 make an error "Character set is not EBCDIC"
802 [groff_cv_ebcdic="yes"
803 TTYDEVDIRS="font/devcp1047"
805 AC_DEFINE(IS_EBCDIC_HOST, 1,
806 [Define if the host's encoding is EBCDIC.])],
807 [groff_cv_ebcdic="no"
808 TTYDEVDIRS="font/devascii font/devlatin1"
809 OTHERDEVDIRS="font/devlj4 font/devlbp"
810 AC_MSG_RESULT([no])])
811 AC_SUBST([TTYDEVDIRS])
812 AC_SUBST([OTHERDEVDIRS])])
814 # Check for OS/390 Unix. We test for EBCDIC also -- the Linux port (with
815 # gcc) to OS/390 uses ASCII internally.
817 AC_DEFUN([GROFF_OS390],
818 [if test "$groff_cv_ebcdic" = "yes"; then
819 AC_MSG_CHECKING([for OS/390 Unix])
822 CFLAGS="$CFLAGS -D_ALL_SOURCE"
823 AC_MSG_RESULT([yes]) ;;
825 AC_MSG_RESULT([no]) ;;
829 # Check whether we need a declaration for a function.
831 # Stolen from GNU bfd.
833 AC_DEFUN([GROFF_NEED_DECLARATION],
834 [AC_MSG_CHECKING([whether $1 must be declared])
836 AC_CACHE_VAL([groff_cv_decl_needed_$1],
844 #ifdef HAVE_STRINGS_H
850 #ifdef HAVE_SYS_TIME_H
851 #include <sys/time.h>
864 char *p = (char *) $1;
869 [groff_cv_decl_needed_$1=no],
870 [groff_cv_decl_needed_$1=yes])])
871 AC_MSG_RESULT([$groff_cv_decl_needed_$1])
872 if test $groff_cv_decl_needed_$1 = yes; then
873 AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), [1],
874 [Define if your C++ doesn't declare ]$1[().])
878 # If mkstemp() isn't available, use our own mkstemp.cpp file.
880 AC_DEFUN([GROFF_MKSTEMP],
881 [AC_MSG_CHECKING([for mkstemp])
883 AC_LIBSOURCE([mkstemp.cpp])
898 [AC_MSG_RESULT([yes])
899 AC_DEFINE([HAVE_MKSTEMP], [1], [Define if you have mkstemp().])],
901 _AC_LIBOBJ([mkstemp])])
904 # Test whether <inttypes.h> exists, doesn't clash with <sys/types.h>,
905 # and declares uintmax_t. Taken from the fileutils package.
907 AC_DEFUN([GROFF_INTTYPES_H],
909 AC_MSG_CHECKING([C++ <inttypes.h>])
913 #include <sys/types.h>
914 #include <inttypes.h>
919 uintmax_t i = (uintmax_t)-1;
923 [groff_cv_header_inttypes_h=yes
924 AC_DEFINE([HAVE_CC_INTTYPES_H], [1],
925 [Define if you have a C++ <inttypes.h>.])],
926 [groff_cv_header_inttypes_h=no])
927 AC_MSG_RESULT([$groff_cv_header_inttypes_h])
930 # Test for working `unsigned long long'. Taken from the fileutils package.
932 AC_DEFUN([GROFF_UNSIGNED_LONG_LONG],
934 AC_MSG_CHECKING([for unsigned long long])
938 unsigned long long ull = 1;
940 unsigned long long ullmax = (unsigned long long)-1;
945 return ull << i | ull >> i | ullmax / ull | ullmax % ull;
949 [groff_cv_type_unsigned_long_long=yes],
950 [groff_cv_type_unsigned_long_long=no])
951 AC_MSG_RESULT([$groff_cv_type_unsigned_long_long])
954 # Define uintmax_t to `unsigned long' or `unsigned long long'
955 # if <inttypes.h> does not exist. Taken from the fileutils package.
957 AC_DEFUN([GROFF_UINTMAX_T],
958 [AC_REQUIRE([GROFF_INTTYPES_H])
959 if test $groff_cv_header_inttypes_h = no; then
960 AC_REQUIRE([GROFF_UNSIGNED_LONG_LONG])
961 test $groff_cv_type_unsigned_long_long = yes \
962 && ac_type='unsigned long long' \
963 || ac_type='unsigned long'
964 AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type],
965 [Define uintmax_t to `unsigned long' or `unsigned long long' if
966 <inttypes.h> does not exist.])
969 # Identify PATH_SEPARATOR character to use in GROFF_FONT_PATH and
970 # GROFF_TMAC_PATH which is appropriate for the target system (POSIX=':',
973 # The logic to resolve this test is already encapsulated in
974 # `${srcdir}/src/include/nonposix.h'.
976 AC_DEFUN([GROFF_TARGET_PATH_SEPARATOR],
977 [AC_MSG_CHECKING([separator character to use in groff search paths])
978 cp ${srcdir}/src/include/nonposix.h conftest.h
983 #include "conftest.h"
988 #if PATH_SEP_CHAR == ';'
989 make an error "Path separator is ';'"
994 [GROFF_PATH_SEPARATOR=":"],
995 [GROFF_PATH_SEPARATOR=";"])
996 AC_MSG_RESULT([$GROFF_PATH_SEPARATOR])
997 AC_SUBST(GROFF_PATH_SEPARATOR)])
1001 AC_DEFUN([GROFF_X11],
1002 [AC_REQUIRE([AC_PATH_XTRA])
1004 if test -z "$groff_no_x"; then
1008 CFLAGS="$CFLAGS $X_CFLAGS"
1009 LDFLAGS="$LDFLAGS $X_LIBS"
1010 LIBS="$LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
1013 AC_MSG_CHECKING([for Xaw library and header files])
1017 #include <X11/Intrinsic.h>
1018 #include <X11/Xaw/Simple.h>
1023 [AC_MSG_RESULT([yes])],
1024 [AC_MSG_RESULT([no])
1028 AC_MSG_CHECKING([for Xmu library and header files])
1032 #include <X11/Intrinsic.h>
1033 #include <X11/Xmu/Converters.h>
1038 [AC_MSG_RESULT([yes])],
1039 [AC_MSG_RESULT([no])
1047 if test "x$groff_no_x" = "xyes"; then
1048 AC_MSG_NOTICE([gxditview and xtotroff won't be built])
1050 XDEVDIRS="font/devX75 font/devX75-12 font/devX100 font/devX100-12"
1051 XPROGDIRS="src/devices/xditview src/utils/xtotroff"
1052 XLIBDIRS="src/libs/libxutil"
1055 AC_SUBST([XDEVDIRS])
1056 AC_SUBST([XPROGDIRS])
1057 AC_SUBST([XLIBDIRS])])
1059 # Set up the `--with-appresdir' command line option.
1061 # Don't quote AS_HELP_STRING!
1062 AC_DEFUN([GROFF_APPRESDIR_OPTION],
1063 [AC_ARG_WITH([appresdir],
1064 AS_HELP_STRING([--with-appresdir=DIR],
1065 [X11 application resource files]))])
1067 # Get a default value for the application resource directory.
1069 # We ignore the `XAPPLRES' and `XUSERFILESEARCHPATH' environment variables.
1071 # The goal is to find the `root' of X11. Under most systems this is
1072 # `/usr/X11/lib'. Application default files are then in
1073 # `/usr/X11/lib/X11/app-defaults'.
1075 # Based on autoconf's AC_PATH_X macro.
1077 AC_DEFUN([GROFF_APPRESDIR_DEFAULT],
1078 [if test -z "$groff_no_x"; then
1079 # Create an Imakefile, run `xmkmf', then `make'.
1080 rm -f -r conftest.dir
1081 if mkdir conftest.dir; then
1083 # Make sure to not put `make' in the Imakefile rules,
1084 # since we grep it out.
1085 cat >Imakefile <<'EOF'
1088 @echo 'groff_x_usrlibdir="${USRLIBDIR}"; groff_x_libdir="${LIBDIR}"'
1091 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
1092 # GNU make sometimes prints "make[1]: Entering...",
1093 # which would confuse us.
1094 eval `${MAKE-make} xlibdirs 2>/dev/null | grep -v make`
1096 # Open Windows `xmkmf' reportedly sets LIBDIR instead of USRLIBDIR.
1097 for groff_extension in a so sl; do
1098 if test ! -f $groff_x_usrlibdir/libX11.$groff_extension &&
1099 test -f $groff_x_libdir/libX11.$groff_extension; then
1100 groff_x_usrlibdir=$groff_x_libdir
1107 rm -f -r conftest.dir
1110 # In case the test with `xmkmf' wasn't successful, try a suite of
1111 # standard directories. Check `X11' before `X11Rn' because it is often
1112 # a symlink to the current release.
1125 /usr/local/X11R6/lib
1126 /usr/local/X11R5/lib
1127 /usr/local/X11R4/lib
1130 /usr/local/lib/X11R6
1131 /usr/local/lib/X11R5
1132 /usr/local/lib/X11R4
1136 /usr/XFree86/lib/X11
1140 /usr/unsupported/lib
1142 /usr/local/x11r5/lib
1143 /usr/lpp/Xamples/lib
1146 /usr/openwin/share/lib'
1148 if test -z "$groff_x_usrlibdir"; then
1149 # We only test whether libX11 exists.
1150 for groff_dir in $groff_x_libdirs; do
1151 for groff_extension in a so sl; do
1152 if test ! -r $groff_dir/libX11.$groff_extension; then
1153 groff_x_usrlibdir=$groff_dir
1160 if test "x$with_appresdir" = "x"; then
1161 appresdir=$groff_x_usrlibdir/X11/app-defaults
1163 appresdir=$with_appresdir
1166 AC_SUBST([appresdir])])
1169 # Emit warning if --with-appresdir hasn't been used.
1171 AC_DEFUN([GROFF_APPRESDIR_CHECK],
1172 [if test -z "$groff_no_x"; then
1173 if test "x$with_appresdir" = "x"; then
1176 The application resource file for gxditview will be installed as
1178 $appresdir/GXditview
1180 (an existing file will be saved as `GXditview.old').
1181 To install it into a different directory, say, `/etc/gxditview',
1182 add `--with-appresdir=/etc/gxditview' to the configure script
1183 command line options and rerun it. The environment variable
1184 `APPLRESDIR' must then be set to `/etc/' (note the trailing slash),
1185 omitting the `gxditview' part which is automatically appended by
1186 the X11 searching routines for resource files. More details can be
1187 found in the X(7) manual page.