1 # Autoconf macros for groff.
2 # Copyright (C) 1989-1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
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 3 of the License, or
10 # (at your option) any later version.
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
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 AC_DEFUN([GROFF_PRINT],
21 [if test -z "$PSPRINT"; then
22 AC_CHECK_PROGS([LPR], [lpr])
23 AC_CHECK_PROGS([LP], [lp])
24 if test -n "$LPR" && test -n "$LP"; then
25 # HP-UX provides an lpr command that emulates lpr using lp,
26 # but it doesn't have lpq; in this case we want to use lp
28 AC_CHECK_PROGS([LPQ], [lpq])
29 test -n "$LPQ" || LPR=
31 if test -n "$LPR"; then
33 elif test -n "$LP"; then
38 AC_MSG_CHECKING([for command to use for printing PostScript files])
39 AC_MSG_RESULT([$PSPRINT])
41 # Figure out DVIPRINT from PSPRINT.
42 AC_MSG_CHECKING([for command to use for printing dvi files])
43 if test -n "$PSPRINT" && test -z "$DVIPRINT"; then
44 if test "x$PSPRINT" = "xlpr"; then
51 AC_MSG_RESULT([$DVIPRINT])])
53 # Bison generated parsers have problems with C++ compilers other than g++.
54 # So byacc is preferred over bison.
56 AC_DEFUN([GROFF_PROG_YACC],
57 [AC_CHECK_PROGS([YACC], [byacc 'bison -y'], [yacc])])
59 # We need makeinfo 4.8 or newer.
61 AC_DEFUN([GROFF_MAKEINFO],
63 AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo])
64 if test -z "$MAKEINFO"; then
65 missing="\`makeinfo' is missing."
67 AC_MSG_CHECKING([for makeinfo version])
68 # We need an additional level of quoting to make sed's regexps work.
69 [makeinfo_version=`$MAKEINFO --version 2>&1 \
70 | sed -e 's/^.* \([^ ][^ ]*\)$/\1/' -e '1q'`]
71 AC_MSG_RESULT([$makeinfo_version])
72 # Consider only the first two numbers in version number string.
73 makeinfo_version_major=`IFS=.; set x $makeinfo_version; echo 0${2}`
74 makeinfo_version_minor=`IFS=.; set x $makeinfo_version; echo 0${3}`
75 makeinfo_version_numeric=`
76 expr ${makeinfo_version_major}000 \+ ${makeinfo_version_minor}`
77 if test $makeinfo_version_numeric -lt 4008; then
78 missing="\`makeinfo' is too old."
82 if test -n "$missing"; then
83 infofile=doc/groff.info
84 test -f ${infofile} || infofile=${srcdir}/${infofile}
85 if test ! -f ${infofile} \
86 || test ${srcdir}/doc/groff.texinfo -nt ${infofile}; then
88 [Get the `texinfo' package version 4.8 or newer.])
91 [Get the `texinfo' package version 4.8 or newer if you want to convert
92 `groff.texinfo' into a PDF or HTML document.])
95 AC_SUBST([MAKEINFO])])
97 # The following programs are needed for grohtml.
99 AC_DEFUN([GROFF_HTML_PROGRAMS],
100 [AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
102 make_install_html=install_html
105 AC_FOREACH([groff_prog],
106 [pnmcut pnmcrop pnmtopng psselect pnmtops],
107 [AC_CHECK_PROG(groff_prog, groff_prog, [found], [missing])
108 if test $[]groff_prog = missing; then
109 missing="$missing \`groff_prog'"
112 test "$GHOSTSCRIPT" = "missing" && missing="$missing \`gs'"
114 if test -n "$missing"; then
115 plural=`set $missing; test $[#] -gt 1 && echo s`
116 missing=`set $missing
118 while test $[#] -gt 0
121 1) missing="$missing$[1]" ;;
122 2) missing="$missing$[1] and " ;;
123 *) missing="$missing$[1], " ;;
132 AC_MSG_WARN([missing program$plural:
136 cannot be found in the PATH.
137 Consequently, groff's HTML backend (grohtml) will not work properly;
138 therefore, it will neither be possible to prepare, nor to install,
139 documentation in HTML format.
143 AC_SUBST([make_html])
144 AC_SUBST([make_install_html])])
146 # To produce PDF docs, we need both awk and ghostscript.
148 AC_DEFUN([GROFF_PDFDOC_PROGRAMS],
149 [AC_REQUIRE([GROFF_AWK_PATH])
150 AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
153 make_install_pdfdoc=install_pdfdoc
156 test "$AWK" = missing && missing="\`awk'"
157 test "$GHOSTSCRIPT" = missing && missing="$missing \`gs'"
158 if test -n "$missing"; then
159 plural=`set $missing; test $[#] -eq 2 && echo s`
161 && missing=`set $missing; echo "$[1] and $[2]"` \
162 || missing=`echo $missing`
167 AC_MSG_WARN([missing program$plural:
169 The program$plural $missing cannot be found in the PATH.
170 Consequently, groff's PDF formatter (pdfroff) will not work properly;
171 therefore, it will neither be possible to prepare, nor to install,
172 documentation in PDF format.
176 AC_SUBST([make_pdfdoc])
177 AC_SUBST([make_install_pdfdoc])])
179 # Check whether pnmtops can handle the -nosetpage option.
181 AC_DEFUN([GROFF_PNMTOPS_NOSETPAGE],
182 [AC_MSG_CHECKING([whether pnmtops can handle the -nosetpage option])
183 if echo P2 2 2 255 0 1 2 0 | pnmtops -nosetpage > /dev/null 2>&1 ; then
185 pnmtops_nosetpage="pnmtops -nosetpage"
188 pnmtops_nosetpage="pnmtops"
190 AC_SUBST([pnmtops_nosetpage])])
192 # Check location of `gs'; allow `--with-gs=PROG' option to override.
194 AC_DEFUN([GROFF_GHOSTSCRIPT_PATH],
195 [AC_REQUIRE([GROFF_GHOSTSCRIPT_PREFS])
197 [AS_HELP_STRING([--with-gs=PROG],
198 [actual [/path/]name of ghostscript executable])],
199 [GHOSTSCRIPT=$withval],
200 [AC_CHECK_TOOLS(GHOSTSCRIPT, [$ALT_GHOSTSCRIPT_PROGS], [missing])])
201 test "$GHOSTSCRIPT" = "no" && GHOSTSCRIPT=missing])
203 # Preferences for choice of `gs' program...
204 # (allow --with-alt-gs="LIST" to override).
206 AC_DEFUN([GROFF_GHOSTSCRIPT_PREFS],
207 [AC_ARG_WITH([alt-gs],
208 [AS_HELP_STRING([--with-alt-gs=LIST],
209 [alternative names for ghostscript executable])],
210 [ALT_GHOSTSCRIPT_PROGS="$withval"],
211 [ALT_GHOSTSCRIPT_PROGS="gs gswin32c gsos2"])
212 AC_SUBST([ALT_GHOSTSCRIPT_PROGS])])
214 # Check location of `awk'; allow `--with-awk=PROG' option to override.
216 AC_DEFUN([GROFF_AWK_PATH],
217 [AC_REQUIRE([GROFF_AWK_PREFS])
219 [AS_HELP_STRING([--with-awk=PROG],
220 [actual [/path/]name of awk executable])],
222 [AC_CHECK_TOOLS(AWK, [$ALT_AWK_PROGS], [missing])])
223 test "$AWK" = "no" && AWK=missing])
225 # Preferences for choice of `awk' program; allow --with-alt-awk="LIST"
228 AC_DEFUN([GROFF_AWK_PREFS],
229 [AC_ARG_WITH([alt-awk],
230 [AS_HELP_STRING([--with-alt-awk=LIST],
231 [alternative names for awk executable])],
232 [ALT_AWK_PROGS="$withval"],
233 [ALT_AWK_PROGS="gawk mawk nawk awk"])
234 AC_SUBST([ALT_AWK_PROGS])])
236 # GROFF_CSH_HACK(if hack present, if not present)
238 AC_DEFUN([GROFF_CSH_HACK],
239 [AC_MSG_CHECKING([for csh hash hack])
241 cat <<EOF >conftest.sh
244 export PATH || exit 0
249 if echo ./conftest.sh | (csh >/dev/null 2>&1) >/dev/null 2>&1; then
258 # From udodo!hans@relay.NL.net (Hans Zuidam)
260 AC_DEFUN([GROFF_ISC_SYSV3],
261 [AC_MSG_CHECKING([for ISC 3.x or 4.x])
262 if grep ['[34]\.'] /usr/options/cb.name >/dev/null 2>&1
265 AC_DEFINE([_SYSV3], [1], [Define if you have ISC 3.x or 4.x.])
270 AC_DEFUN([GROFF_POSIX],
271 [AC_MSG_CHECKING([whether -D_POSIX_SOURCE is necessary])
277 extern "C" { void fileno(int); }
281 [AC_MSG_RESULT([yes])
282 AC_DEFINE([_POSIX_SOURCE], [1],
283 [Define if -D_POSIX_SOURCE is necessary.])],
284 [AC_MSG_RESULT([no])])
287 # srand() of SunOS 4.1.3 has return type int instead of void
289 AC_DEFUN([GROFF_SRAND],
291 AC_MSG_CHECKING([for return type of srand])
296 extern "C" { void srand(unsigned int); }
300 [AC_MSG_RESULT([void])
301 AC_DEFINE([RET_TYPE_SRAND_IS_VOID], [1],
302 [Define if srand() returns void not int.])],
303 [AC_MSG_RESULT([int])])
306 # In April 2005, autoconf's AC_TYPE_SIGNAL is still broken.
308 AC_DEFUN([GROFF_TYPE_SIGNAL],
309 [AC_MSG_CHECKING([for return type of signal handlers])
310 for groff_declaration in \
311 'extern "C" void (*signal (int, void (*)(int)))(int);' \
312 'extern "C" void (*signal (int, void (*)(int)) throw ())(int);' \
313 'void (*signal ()) ();'
318 #include <sys/types.h>
336 if test -n "$groff_declaration"; then
337 AC_MSG_RESULT([void])
338 AC_DEFINE([RETSIGTYPE], [void],
339 [Define as the return type of signal handlers
343 AC_DEFINE([RETSIGTYPE], [int],
344 [Define as the return type of signal handlers
348 AC_DEFUN([GROFF_SYS_NERR],
350 AC_MSG_CHECKING([for sys_nerr in <errno.h>, <stdio.h>, or <stdlib.h>])
366 [AC_MSG_RESULT([yes])
367 AC_DEFINE([HAVE_SYS_NERR], [1],
368 [Define if you have sys_nerr in <errno.h>, <stdio.h>, or <stdio.h>.])],
369 [AC_MSG_RESULT([no])])
372 AC_DEFUN([GROFF_SYS_ERRLIST],
373 [AC_MSG_CHECKING([for sys_errlist[] in <errno.h>, <stdio.h>, or <stdlib.h>])
385 k = (int)sys_errlist[0];
389 [AC_MSG_RESULT([yes])
390 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
391 [Define if you have sys_errlist in <errno.h>, <stdio.h>, or <stdlib.h>.])],
392 [AC_MSG_RESULT([no])])])
394 AC_DEFUN([GROFF_OSFCN_H],
396 AC_MSG_CHECKING([C++ <osfcn.h>])
410 [AC_MSG_RESULT([yes])
411 AC_DEFINE([HAVE_CC_OSFCN_H], [1],
412 [Define if you have a C++ <osfcn.h>.])],
413 [AC_MSG_RESULT([no])])
416 AC_DEFUN([GROFF_LIMITS_H],
418 AC_MSG_CHECKING([C++ <limits.h>])
433 [AC_MSG_RESULT([yes])
434 AC_DEFINE([HAVE_CC_LIMITS_H], [1],
435 [Define if you have a C++ <limits.h>.])],
436 [AC_MSG_RESULT([no])])
439 AC_DEFUN([GROFF_TIME_T],
441 AC_MSG_CHECKING([for declaration of time_t])
451 struct tm *p = localtime(&t);
455 [AC_MSG_RESULT([yes])],
457 AC_DEFINE([LONG_FOR_TIME_T], [1],
458 [Define if localtime() takes a long * not a time_t *.])])
461 AC_DEFUN([GROFF_STRUCT_EXCEPTION],
462 [AC_MSG_CHECKING([struct exception])
475 [AC_MSG_RESULT([yes])
476 AC_DEFINE([HAVE_STRUCT_EXCEPTION], [1],
477 [Define if <math.h> defines struct exception.])],
478 [AC_MSG_RESULT([no])])])
480 AC_DEFUN([GROFF_ARRAY_DELETE],
482 AC_MSG_CHECKING([whether ANSI array delete syntax is supported])
486 char *p = new char[5];
491 [AC_MSG_RESULT([yes])],
493 AC_DEFINE([ARRAY_DELETE_NEEDS_SIZE], [1],
494 [Define if your C++ doesn't understand `delete []'.])])
497 AC_DEFUN([GROFF_TRADITIONAL_CPP],
499 AC_MSG_CHECKING([traditional preprocessor])
503 #define name2(a, b) a/**/b
512 [AC_MSG_RESULT([yes])
513 AC_DEFINE([TRADITIONAL_CPP], [1],
514 [Define if your C++ compiler uses a traditional (Reiser) preprocessor.])],
515 [AC_MSG_RESULT([no])])
518 AC_DEFUN([GROFF_WCOREFLAG],
519 [AC_MSG_CHECKING([w_coredump])
523 #include <sys/types.h>
524 #include <sys/wait.h>
535 ((union wait *)&i)->w_coredump = 1;
542 [AC_MSG_RESULT([yes])
543 AC_DEFINE(WCOREFLAG, 0200,
544 [Define if the 0200 bit of the status returned by wait() indicates
545 whether a core image was produced for a process that was terminated
547 [AC_MSG_RESULT([no])],
548 [AC_MSG_RESULT([no])])])
550 AC_DEFUN([GROFF_BROKEN_SPOOLER_FLAGS],
551 [AC_MSG_CHECKING([default value for grops -b option])
552 test -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=0
553 AC_MSG_RESULT([$BROKEN_SPOOLER_FLAGS])
554 AC_SUBST([BROKEN_SPOOLER_FLAGS])])
556 AC_DEFUN([GROFF_PAGE],
557 [AC_MSG_CHECKING([default paper size])
559 test "x$prefix" = "xNONE" && groff_prefix=$ac_default_prefix
560 if test -z "$PAGE"; then
562 if test -r $groff_prefix/share/groff/font/devps/DESC; then
563 descfile=$groff_prefix/share/groff/font/devps/DESC
564 elif test -r $groff_prefix/lib/groff/font/devps/DESC; then
565 descfile=$groff_prefix/lib/groff/font/devps/DESC
567 for f in $groff_prefix/share/groff/*/font/devps/DESC; do
575 if test -n "$descfile"; then
576 if grep ['^paperlength[ ]\+841890'] $descfile >/dev/null 2>&1; then
578 elif grep ['^papersize[ ]\+[aA]4'] $descfile >/dev/null 2>&1; then
584 if test -z "$PAGE"; then
585 dom=`awk '([$]1 == "dom" || [$]1 == "search") { print [$]2; exit}' \
586 /etc/resolv.conf 2>/dev/null`
587 if test -z "$dom"; then
588 dom=`(domainname) 2>/dev/null | tr -d '+'`
590 || test "$dom" = '(none)'; then
591 dom=`(hostname) 2>/dev/null | grep '\.'`
594 # If the top-level domain is two letters and it's not `us' or `ca'
595 # then they probably use A4 paper.
597 [*.[Uu][Ss]|*.[Cc][Aa])]
599 [*.[A-Za-z][A-Za-z])]
604 test -n "$PAGE" || PAGE=letter
605 if test "x$PAGE" = "xA4"; then
606 AC_DEFINE([PAGEA4], [1],
607 [Define if the printer's page size is A4.])
609 AC_MSG_RESULT([$PAGE])
612 AC_DEFUN([GROFF_CXX_CHECK],
613 [AC_REQUIRE([AC_PROG_CXX])
615 if test "$cross_compiling" = no; then
616 AC_MSG_CHECKING([that C++ compiler can compile simple program])
627 [AC_MSG_RESULT([yes])],
629 AC_MSG_ERROR([a working C++ compiler is required])],
632 if test "$cross_compiling" = no; then
633 AC_MSG_CHECKING([that C++ static constructors and destructors are called])
646 ~A() { if (i == 1) _exit(0); }
658 [AC_MSG_RESULT([yes])],
660 AC_MSG_ERROR([a working C++ compiler is required])],
663 AC_MSG_CHECKING([that header files support C++])
676 [AC_MSG_RESULT([yes])],
678 AC_MSG_ERROR([header files do not support C++
679 (if you are using a version of gcc/g++ earlier than 2.5,
680 you should install libg++)])])
683 AC_DEFUN([GROFF_TMAC],
684 [AC_MSG_CHECKING([for prefix of system macro packages])
686 sys_tmac_file_prefix=
687 for d in /usr/share/lib/tmac /usr/lib/tmac; do
688 for t in "" tmac.; do
691 if test -z "$sys_tmac_prefix" \
693 && grep '^\.if' $f >/dev/null 2>&1; then
694 sys_tmac_prefix=$d/$t
695 sys_tmac_file_prefix=$t
700 AC_MSG_RESULT([$sys_tmac_prefix])
701 AC_SUBST([sys_tmac_prefix])
703 AC_MSG_CHECKING([which system macro packages should be made available])
705 if test "x$sys_tmac_file_prefix" = "xtmac."; then
706 for f in $sys_tmac_prefix*; do
707 suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"`
712 grep "Copyright.*Free Software Foundation" $f >/dev/null \
713 || tmac_wrap="$tmac_wrap $suff" ;;
716 elif test -n "$sys_tmac_prefix"; then
717 files=`echo $sys_tmac_prefix*`
718 grep "\\.so" $files >conftest.sol
729 if grep "\\.so.*/$b\$" conftest.sol >/dev/null \
730 || grep -l "Copyright.*Free Software Foundation" $f >/dev/null; then
733 suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"`
738 tmac_wrap="$tmac_wrap $suff" ;;
745 AC_MSG_RESULT([$tmac_wrap])
746 AC_SUBST([tmac_wrap])])
749 [AC_MSG_CHECKING([for existing troff installation])
750 if test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then
759 # We need the path to install-sh to be absolute.
761 AC_DEFUN([GROFF_INSTALL_SH],
762 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])
763 ac_dir=`cd $ac_aux_dir; pwd`
764 ac_install_sh="$ac_dir/install-sh -c"])
766 # Test whether install-info is available.
768 AC_DEFUN([GROFF_INSTALL_INFO],
769 [AC_CHECK_PROGS([INSTALL_INFO], [install-info], [:])])
771 # At least one UNIX system, Apple Macintosh Rhapsody 5.5,
772 # does not have -lm ...
774 AC_DEFUN([GROFF_LIBM],
775 [AC_CHECK_LIB([m], [sin], [LIBM=-lm])
778 # ... while the MinGW implementation of GCC for Microsoft Win32
779 # does not seem to have -lc.
781 AC_DEFUN([GROFF_LIBC],
782 [AC_CHECK_LIB([c], [main], [LIBC=-lc])
785 # Check for EBCDIC -- stolen from the OS390 Unix LYNX port
787 AC_DEFUN([GROFF_EBCDIC],
788 [AC_MSG_CHECKING([whether character set is EBCDIC])
792 /* Treat any failure as ASCII for compatibility with existing art.
793 Use compile-time rather than run-time tests for cross-compiler
796 make an error "Character set is not EBCDIC"
801 [groff_cv_ebcdic="yes"
802 TTYDEVDIRS="font/devcp1047"
804 AC_DEFINE(IS_EBCDIC_HOST, 1,
805 [Define if the host's encoding is EBCDIC.])],
806 [groff_cv_ebcdic="no"
807 TTYDEVDIRS="font/devascii font/devlatin1"
808 OTHERDEVDIRS="font/devlj4 font/devlbp"
809 AC_MSG_RESULT([no])])
810 AC_SUBST([TTYDEVDIRS])
811 AC_SUBST([OTHERDEVDIRS])])
813 # Check for OS/390 Unix. We test for EBCDIC also -- the Linux port (with
814 # gcc) to OS/390 uses ASCII internally.
816 AC_DEFUN([GROFF_OS390],
817 [if test "$groff_cv_ebcdic" = "yes"; then
818 AC_MSG_CHECKING([for OS/390 Unix])
821 CFLAGS="$CFLAGS -D_ALL_SOURCE"
822 AC_MSG_RESULT([yes]) ;;
824 AC_MSG_RESULT([no]) ;;
828 # Check whether we need a declaration for a function.
830 # Stolen from GNU bfd.
832 AC_DEFUN([GROFF_NEED_DECLARATION],
833 [AC_MSG_CHECKING([whether $1 must be declared])
835 AC_CACHE_VAL([groff_cv_decl_needed_$1],
843 #ifdef HAVE_STRINGS_H
849 #ifdef HAVE_SYS_TIME_H
850 #include <sys/time.h>
863 char *p = (char *) $1;
868 [groff_cv_decl_needed_$1=no],
869 [groff_cv_decl_needed_$1=yes])])
870 AC_MSG_RESULT([$groff_cv_decl_needed_$1])
871 if test $groff_cv_decl_needed_$1 = yes; then
872 AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), [1],
873 [Define if your C++ doesn't declare ]$1[().])
877 # If mkstemp() isn't available, use our own mkstemp.cpp file.
879 AC_DEFUN([GROFF_MKSTEMP],
880 [AC_MSG_CHECKING([for mkstemp])
882 AC_LIBSOURCE([mkstemp.cpp])
897 [AC_MSG_RESULT([yes])
898 AC_DEFINE([HAVE_MKSTEMP], [1], [Define if you have mkstemp().])],
900 _AC_LIBOBJ([mkstemp])])
903 # Test whether <inttypes.h> exists, doesn't clash with <sys/types.h>,
904 # and declares uintmax_t. Taken from the fileutils package.
906 AC_DEFUN([GROFF_INTTYPES_H],
908 AC_MSG_CHECKING([C++ <inttypes.h>])
912 #include <sys/types.h>
913 #include <inttypes.h>
918 uintmax_t i = (uintmax_t)-1;
922 [groff_cv_header_inttypes_h=yes
923 AC_DEFINE([HAVE_CC_INTTYPES_H], [1],
924 [Define if you have a C++ <inttypes.h>.])],
925 [groff_cv_header_inttypes_h=no])
926 AC_MSG_RESULT([$groff_cv_header_inttypes_h])
929 # Test for working `unsigned long long'. Taken from the fileutils package.
931 AC_DEFUN([GROFF_UNSIGNED_LONG_LONG],
933 AC_MSG_CHECKING([for unsigned long long])
937 unsigned long long ull = 1;
939 unsigned long long ullmax = (unsigned long long)-1;
944 return ull << i | ull >> i | ullmax / ull | ullmax % ull;
948 [groff_cv_type_unsigned_long_long=yes],
949 [groff_cv_type_unsigned_long_long=no])
950 AC_MSG_RESULT([$groff_cv_type_unsigned_long_long])
953 # Define uintmax_t to `unsigned long' or `unsigned long long'
954 # if <inttypes.h> does not exist. Taken from the fileutils package.
956 AC_DEFUN([GROFF_UINTMAX_T],
957 [AC_REQUIRE([GROFF_INTTYPES_H])
958 if test $groff_cv_header_inttypes_h = no; then
959 AC_REQUIRE([GROFF_UNSIGNED_LONG_LONG])
960 test $groff_cv_type_unsigned_long_long = yes \
961 && ac_type='unsigned long long' \
962 || ac_type='unsigned long'
963 AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type],
964 [Define uintmax_t to `unsigned long' or `unsigned long long' if
965 <inttypes.h> does not exist.])
968 # Identify PATH_SEPARATOR character to use in GROFF_FONT_PATH and
969 # GROFF_TMAC_PATH which is appropriate for the target system (POSIX=':',
972 # The logic to resolve this test is already encapsulated in
973 # `${srcdir}/src/include/nonposix.h'.
975 AC_DEFUN([GROFF_TARGET_PATH_SEPARATOR],
976 [AC_MSG_CHECKING([separator character to use in groff search paths])
977 cp ${srcdir}/src/include/nonposix.h conftest.h
982 #include "conftest.h"
987 #if PATH_SEP_CHAR == ';'
988 make an error "Path separator is ';'"
993 [GROFF_PATH_SEPARATOR=":"],
994 [GROFF_PATH_SEPARATOR=";"])
995 AC_MSG_RESULT([$GROFF_PATH_SEPARATOR])
996 AC_SUBST(GROFF_PATH_SEPARATOR)])
1000 AC_DEFUN([GROFF_X11],
1001 [AC_REQUIRE([AC_PATH_XTRA])
1003 if test -z "$groff_no_x"; then
1007 CFLAGS="$CFLAGS $X_CFLAGS"
1008 LDFLAGS="$LDFLAGS $X_LIBS"
1009 LIBS="$LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
1012 AC_MSG_CHECKING([for Xaw library and header files])
1016 #include <X11/Intrinsic.h>
1017 #include <X11/Xaw/Simple.h>
1022 [AC_MSG_RESULT([yes])],
1023 [AC_MSG_RESULT([no])
1027 AC_MSG_CHECKING([for Xmu library and header files])
1031 #include <X11/Intrinsic.h>
1032 #include <X11/Xmu/Converters.h>
1037 [AC_MSG_RESULT([yes])],
1038 [AC_MSG_RESULT([no])
1046 if test "x$groff_no_x" = "xyes"; then
1047 AC_MSG_NOTICE([gxditview and xtotroff won't be built])
1049 XDEVDIRS="font/devX75 font/devX75-12 font/devX100 font/devX100-12"
1050 XPROGDIRS="src/devices/xditview src/utils/xtotroff"
1051 XLIBDIRS="src/libs/libxutil"
1054 AC_SUBST([XDEVDIRS])
1055 AC_SUBST([XPROGDIRS])
1056 AC_SUBST([XLIBDIRS])])
1058 # Set up the `--with-appresdir' command line option.
1060 # Don't quote AS_HELP_STRING!
1061 AC_DEFUN([GROFF_APPRESDIR_OPTION],
1062 [AC_ARG_WITH([appresdir],
1063 AS_HELP_STRING([--with-appresdir=DIR],
1064 [X11 application resource files]))])
1066 # Get a default value for the application resource directory.
1068 # We ignore the `XAPPLRES' and `XUSERFILESEARCHPATH' environment variables.
1070 # The goal is to find the `root' of X11. Under most systems this is
1071 # `/usr/X11/lib'. Application default files are then in
1072 # `/usr/X11/lib/X11/app-defaults'.
1074 # Based on autoconf's AC_PATH_X macro.
1076 AC_DEFUN([GROFF_APPRESDIR_DEFAULT],
1077 [if test -z "$groff_no_x"; then
1078 # Create an Imakefile, run `xmkmf', then `make'.
1079 rm -f -r conftest.dir
1080 if mkdir conftest.dir; then
1082 # Make sure to not put `make' in the Imakefile rules,
1083 # since we grep it out.
1084 cat >Imakefile <<'EOF'
1087 @echo 'groff_x_usrlibdir="${USRLIBDIR}"; groff_x_libdir="${LIBDIR}"'
1090 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
1091 # GNU make sometimes prints "make[1]: Entering...",
1092 # which would confuse us.
1093 eval `${MAKE-make} xlibdirs 2>/dev/null | grep -v make`
1095 # Open Windows `xmkmf' reportedly sets LIBDIR instead of USRLIBDIR.
1096 for groff_extension in a so sl; do
1097 if test ! -f $groff_x_usrlibdir/libX11.$groff_extension &&
1098 test -f $groff_x_libdir/libX11.$groff_extension; then
1099 groff_x_usrlibdir=$groff_x_libdir
1106 rm -f -r conftest.dir
1109 # In case the test with `xmkmf' wasn't successful, try a suite of
1110 # standard directories. Check `X11' before `X11Rn' because it is often
1111 # a symlink to the current release.
1124 /usr/local/X11R6/lib
1125 /usr/local/X11R5/lib
1126 /usr/local/X11R4/lib
1129 /usr/local/lib/X11R6
1130 /usr/local/lib/X11R5
1131 /usr/local/lib/X11R4
1135 /usr/XFree86/lib/X11
1139 /usr/unsupported/lib
1141 /usr/local/x11r5/lib
1142 /usr/lpp/Xamples/lib
1145 /usr/openwin/share/lib'
1147 if test -z "$groff_x_usrlibdir"; then
1148 # We only test whether libX11 exists.
1149 for groff_dir in $groff_x_libdirs; do
1150 for groff_extension in a so sl; do
1151 if test ! -r $groff_dir/libX11.$groff_extension; then
1152 groff_x_usrlibdir=$groff_dir
1159 if test "x$with_appresdir" = "x"; then
1160 appresdir=$groff_x_usrlibdir/X11/app-defaults
1162 appresdir=$with_appresdir
1165 AC_SUBST([appresdir])])
1168 # Emit warning if --with-appresdir hasn't been used.
1170 AC_DEFUN([GROFF_APPRESDIR_CHECK],
1171 [if test -z "$groff_no_x"; then
1172 if test "x$with_appresdir" = "x"; then
1175 The application resource files for gxditview will be installed as
1177 $appresdir/GXditview
1181 $appresdir/GXditview-color
1183 (existing files will be saved by appending `.old' to the file
1186 To install them into a different directory, say, `/etc/gxditview',
1187 add `--with-appresdir=/etc/gxditview' to the configure script
1188 command line options and rerun it. The environment variable
1189 `APPLRESDIR' must then be set to `/etc/' (note the trailing slash),
1190 omitting the `gxditview' part which is automatically appended by
1191 the X11 searching routines for resource files. More details can be
1192 found in the X(7) manual page.