1 # Autoconf macros for groff.
2 # Copyright (C) 1989-1995, 2001, 2002, 2003, 2004, 2005
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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 # The following programs are needed for grohtml.
62 AC_DEFUN([GROFF_HTML_PROGRAMS],
63 [AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
65 make_install_html=install_html
68 AC_FOREACH([groff_prog],
69 [pnmcut pnmcrop pnmtopng psselect pnmtops],
70 [AC_CHECK_PROG(groff_prog, groff_prog, [found], [missing])
71 if test $[]groff_prog = missing; then
72 missing="$missing \`groff_prog'"
75 test "$GHOSTSCRIPT" = "missing" && missing="$missing \`gs'"
77 if test -n "$missing"; then
78 plural=`set $missing; test $[#] -gt 1 && echo s`
84 1) missing="$missing$[1]" ;;
85 2) missing="$missing$[1] and " ;;
86 *) missing="$missing$[1], " ;;
95 AC_MSG_WARN([missing program$plural:
99 cannot be found in the PATH.
100 Consequently, groff's HTML backend (grohtml) will not work properly;
101 therefore, it will neither be possible to prepare, nor to install,
102 documentation in HTML format.
106 AC_SUBST([make_html])
107 AC_SUBST([make_install_html])])
109 # To produce PDF docs, we need both awk and ghostscript.
111 AC_DEFUN([GROFF_PDFDOC_PROGRAMS],
112 [AC_REQUIRE([GROFF_AWK_PATH])
113 AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
116 make_install_pdfdoc=install_pdfdoc
119 test "$AWK" = missing && missing="\`awk'"
120 test "$GHOSTSCRIPT" = missing && missing="$missing \`gs'"
121 if test -n "$missing"; then
122 plural=`set $missing; test $[#] -eq 2 && echo s`
124 && missing=`set $missing; echo "$[1] and $[2]"` \
125 || missing=`echo $missing`
130 AC_MSG_WARN([missing program$plural:
132 The program$plural $missing cannot be found in the PATH.
133 Consequently, groff's PDF formatter (pdfroff) will not work properly;
134 therefore, it will neither be possible to prepare, nor to install,
135 documentation in PDF format.
139 AC_SUBST([make_pdfdoc])
140 AC_SUBST([make_install_pdfdoc])])
142 # Check whether pnmtops can handle the -nosetpage option.
144 AC_DEFUN([GROFF_PNMTOPS_NOSETPAGE],
145 [AC_MSG_CHECKING([whether pnmtops can handle the -nosetpage option])
146 if echo P2 2 2 255 0 1 2 0 | pnmtops -nosetpage > /dev/null 2>&1 ; then
148 pnmtops_nosetpage="pnmtops -nosetpage"
151 pnmtops_nosetpage="pnmtops"
153 AC_SUBST([pnmtops_nosetpage])])
155 # Check location of `gs'; allow `--with-gs=PROG' option to override.
157 AC_DEFUN([GROFF_GHOSTSCRIPT_PATH],
158 [AC_REQUIRE([GROFF_GHOSTSCRIPT_PREFS])
160 [AS_HELP_STRING([--with-gs=PROG],
161 [actual [/path/]name of ghostscript executable])],
162 [GHOSTSCRIPT=$withval],
163 [AC_CHECK_TOOLS(GHOSTSCRIPT, [$ALT_GHOSTSCRIPT_PROGS], [missing])])
164 test "$GHOSTSCRIPT" = "no" && GHOSTSCRIPT=missing])
166 # Preferences for choice of `gs' program...
167 # (allow --with-alt-gs="LIST" to override).
169 AC_DEFUN([GROFF_GHOSTSCRIPT_PREFS],
170 [AC_ARG_WITH([alt-gs],
171 [AS_HELP_STRING([--with-alt-gs=LIST],
172 [alternative names for ghostscript executable])],
173 [ALT_GHOSTSCRIPT_PROGS="$withval"],
174 [ALT_GHOSTSCRIPT_PROGS="gs gswin32c gsos2"])
175 AC_SUBST([ALT_GHOSTSCRIPT_PROGS])])
177 # Check location of `awk'; allow `--with-awk=PROG' option to override.
179 AC_DEFUN([GROFF_AWK_PATH],
180 [AC_REQUIRE([GROFF_AWK_PREFS])
182 [AS_HELP_STRING([--with-awk=PROG],
183 [actual [/path/]name of awk executable])],
185 [AC_CHECK_TOOLS(AWK, [$ALT_AWK_PROGS], [missing])])
186 test "$AWK" = "no" && AWK=missing])
188 # Preferences for choice of `awk' program; allow --with-alt-awk="LIST"
191 AC_DEFUN([GROFF_AWK_PREFS],
192 [AC_ARG_WITH([alt-awk],
193 [AS_HELP_STRING([--with-alt-awk=LIST],
194 [alternative names for awk executable])],
195 [ALT_AWK_PROGS="$withval"],
196 [ALT_AWK_PROGS="gawk mawk nawk awk"])
197 AC_SUBST([ALT_AWK_PROGS])])
199 # GROFF_CSH_HACK(if hack present, if not present)
201 AC_DEFUN([GROFF_CSH_HACK],
202 [AC_MSG_CHECKING([for csh hash hack])
204 cat <<EOF >conftest.sh
207 export PATH || exit 0
212 if echo ./conftest.sh | (csh >/dev/null 2>&1) >/dev/null 2>&1; then
221 # From udodo!hans@relay.NL.net (Hans Zuidam)
223 AC_DEFUN([GROFF_ISC_SYSV3],
224 [AC_MSG_CHECKING([for ISC 3.x or 4.x])
225 if grep ['[34]\.'] /usr/options/cb.name >/dev/null 2>&1
228 AC_DEFINE([_SYSV3], [1], [Define if you have ISC 3.x or 4.x.])
233 AC_DEFUN([GROFF_POSIX],
234 [AC_MSG_CHECKING([whether -D_POSIX_SOURCE is necessary])
240 extern "C" { void fileno(int); }
244 [AC_MSG_RESULT([yes])
245 AC_DEFINE([_POSIX_SOURCE], [1],
246 [Define if -D_POSIX_SOURCE is necessary.])],
247 [AC_MSG_RESULT([no])])
250 # srand() of SunOS 4.1.3 has return type int instead of void
252 AC_DEFUN([GROFF_SRAND],
254 AC_MSG_CHECKING([for return type of srand])
259 extern "C" { void srand(unsigned int); }
263 [AC_MSG_RESULT([void])
264 AC_DEFINE([RET_TYPE_SRAND_IS_VOID], [1],
265 [Define if srand() returns void not int.])],
266 [AC_MSG_RESULT([int])])
269 AC_DEFUN([GROFF_SYS_NERR],
271 AC_MSG_CHECKING([for sys_nerr in <errno.h>, <stdio.h>, or <stdlib.h>])
287 [AC_MSG_RESULT([yes])
288 AC_DEFINE([HAVE_SYS_NERR], [1],
289 [Define if you have sys_nerr in <errno.h>, <stdio.h>, or <stdio.h>.])],
290 [AC_MSG_RESULT([no])])
293 AC_DEFUN([GROFF_SYS_ERRLIST],
294 [AC_MSG_CHECKING([for sys_errlist[] in <errno.h>, <stdio.h>, or <stdlib.h>])
306 k = (int)sys_errlist[0];
310 [AC_MSG_RESULT([yes])
311 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
312 [Define if you have sys_errlist in <errno.h>, <stdio.h>, or <stdlib.h>.])],
313 [AC_MSG_RESULT([no])])])
315 AC_DEFUN([GROFF_OSFCN_H],
317 AC_MSG_CHECKING([C++ <osfcn.h>])
331 [AC_MSG_RESULT([yes])
332 AC_DEFINE([HAVE_CC_OSFCN_H], [1],
333 [Define if you have a C++ <osfcn.h>.])],
334 [AC_MSG_RESULT([no])])
337 AC_DEFUN([GROFF_LIMITS_H],
339 AC_MSG_CHECKING([C++ <limits.h>])
354 [AC_MSG_RESULT([yes])
355 AC_DEFINE([HAVE_CC_LIMITS_H], [1],
356 [Define if you have a C++ <limits.h>.])],
357 [AC_MSG_RESULT([no])])
360 AC_DEFUN([GROFF_TIME_T],
362 AC_MSG_CHECKING([for declaration of time_t])
372 struct tm *p = localtime(&t);
376 [AC_MSG_RESULT([yes])],
378 AC_DEFINE([LONG_FOR_TIME_T], [1],
379 [Define if localtime() takes a long * not a time_t *.])])
382 AC_DEFUN([GROFF_STRUCT_EXCEPTION],
383 [AC_MSG_CHECKING([struct exception])
396 [AC_MSG_RESULT([yes])
397 AC_DEFINE([HAVE_STRUCT_EXCEPTION], [1],
398 [Define if <math.h> defines struct exception.])],
399 [AC_MSG_RESULT([no])])])
401 AC_DEFUN([GROFF_ARRAY_DELETE],
403 AC_MSG_CHECKING([whether ANSI array delete syntax is supported])
407 char *p = new char[5];
412 [AC_MSG_RESULT([yes])],
414 AC_DEFINE([ARRAY_DELETE_NEEDS_SIZE], [1],
415 [Define if your C++ doesn't understand `delete []'.])])
418 AC_DEFUN([GROFF_TRADITIONAL_CPP],
420 AC_MSG_CHECKING([traditional preprocessor])
424 #define name2(a, b) a/**/b
433 [AC_MSG_RESULT([yes])
434 AC_DEFINE([TRADITIONAL_CPP], [1],
435 [Define if your C++ compiler uses a traditional (Reiser) preprocessor.])],
436 [AC_MSG_RESULT([no])])
439 AC_DEFUN([GROFF_WCOREFLAG],
440 [AC_MSG_CHECKING([w_coredump])
444 #include <sys/types.h>
445 #include <sys/wait.h>
456 ((union wait *)&i)->w_coredump = 1;
463 [AC_MSG_RESULT([yes])
464 AC_DEFINE(WCOREFLAG, 0200,
465 [Define if the 0200 bit of the status returned by wait() indicates
466 whether a core image was produced for a process that was terminated
468 [AC_MSG_RESULT([no])],
469 [AC_MSG_RESULT([no])])])
471 AC_DEFUN([GROFF_BROKEN_SPOOLER_FLAGS],
472 [AC_MSG_CHECKING([default value for grops -b option])
473 test -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=0
474 AC_MSG_RESULT([$BROKEN_SPOOLER_FLAGS])
475 AC_SUBST([BROKEN_SPOOLER_FLAGS])])
477 AC_DEFUN([GROFF_PAGE],
478 [AC_MSG_CHECKING([default paper size])
480 test "x$prefix" = "xNONE" && groff_prefix=$ac_default_prefix
481 if test -z "$PAGE"; then
483 if test -r $groff_prefix/share/groff/font/devps/DESC; then
484 descfile=$groff_prefix/share/groff/font/devps/DESC
485 elif test -r $groff_prefix/lib/groff/font/devps/DESC; then
486 descfile=$groff_prefix/lib/groff/font/devps/DESC
488 for f in $groff_prefix/share/groff/*/font/devps/DESC; do
496 if test -n "$descfile"; then
497 if grep ['^paperlength[ ]\+841890'] $descfile >/dev/null 2>&1; then
499 elif grep ['^papersize[ ]\+[aA]4'] $descfile >/dev/null 2>&1; then
505 if test -z "$PAGE"; then
506 dom=`awk '([$]1 == "dom" || [$]1 == "search") { print [$]2; exit}' \
507 /etc/resolv.conf 2>/dev/null`
508 if test -z "$dom"; then
509 dom=`(domainname) 2>/dev/null | tr -d '+'`
511 || test "$dom" = '(none)'; then
512 dom=`(hostname) 2>/dev/null | grep '\.'`
515 # If the top-level domain is two letters and it's not `us' or `ca'
516 # then they probably use A4 paper.
518 [*.[Uu][Ss]|*.[Cc][Aa])]
520 [*.[A-Za-z][A-Za-z])]
525 test -n "$PAGE" || PAGE=letter
526 if test "x$PAGE" = "xA4"; then
527 AC_DEFINE([PAGEA4], [1],
528 [Define if the printer's page size is A4.])
530 AC_MSG_RESULT([$PAGE])
533 AC_DEFUN([GROFF_CXX_CHECK],
534 [AC_REQUIRE([AC_PROG_CXX])
536 if test "$cross_compiling" = no; then
537 AC_MSG_CHECKING([that C++ compiler can compile simple program])
548 [AC_MSG_RESULT([yes])],
550 AC_MSG_ERROR([a working C++ compiler is required])],
553 if test "$cross_compiling" = no; then
554 AC_MSG_CHECKING([that C++ static constructors and destructors are called])
567 ~A() { if (i == 1) _exit(0); }
579 [AC_MSG_RESULT([yes])],
581 AC_MSG_ERROR([a working C++ compiler is required])],
584 AC_MSG_CHECKING([that header files support C++])
597 [AC_MSG_RESULT([yes])],
599 AC_MSG_ERROR([header files do not support C++
600 (if you are using a version of gcc/g++ earlier than 2.5,
601 you should install libg++)])])
604 AC_DEFUN([GROFF_TMAC],
605 [AC_MSG_CHECKING([for prefix of system macro packages])
607 sys_tmac_file_prefix=
608 for d in /usr/share/lib/tmac /usr/lib/tmac; do
609 for t in "" tmac.; do
612 if test -z "$sys_tmac_prefix" \
614 && grep '^\.if' $f >/dev/null 2>&1; then
615 sys_tmac_prefix=$d/$t
616 sys_tmac_file_prefix=$t
621 AC_MSG_RESULT([$sys_tmac_prefix])
622 AC_SUBST([sys_tmac_prefix])
624 AC_MSG_CHECKING([which system macro packages should be made available])
626 if test "x$sys_tmac_file_prefix" = "xtmac."; then
627 for f in $sys_tmac_prefix*; do
628 suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"`
633 grep "Copyright.*Free Software Foundation" $f >/dev/null \
634 || tmac_wrap="$tmac_wrap $suff" ;;
637 elif test -n "$sys_tmac_prefix"; then
638 files=`echo $sys_tmac_prefix*`
639 grep "\\.so" $files >conftest.sol
650 if grep "\\.so.*/$b\$" conftest.sol >/dev/null \
651 || grep -l "Copyright.*Free Software Foundation" $f >/dev/null; then
654 suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"`
659 tmac_wrap="$tmac_wrap $suff" ;;
666 AC_MSG_RESULT([$tmac_wrap])
667 AC_SUBST([tmac_wrap])])
670 [AC_MSG_CHECKING([for existing troff installation])
671 if test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then
680 # We need the path to install-sh to be absolute.
682 AC_DEFUN([GROFF_INSTALL_SH],
683 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])
684 ac_dir=`cd $ac_aux_dir; pwd`
685 ac_install_sh="$ac_dir/install-sh -c"])
687 # Test whether install-info is available.
689 AC_DEFUN([GROFF_INSTALL_INFO],
690 [AC_CHECK_PROGS([INSTALL_INFO], [install-info], [:])])
692 # At least one UNIX system, Apple Macintosh Rhapsody 5.5,
693 # does not have -lm ...
695 AC_DEFUN([GROFF_LIBM],
696 [AC_CHECK_LIB([m], [sin], [LIBM=-lm])
699 # ... while the MinGW implementation of GCC for Microsoft Win32
700 # does not seem to have -lc.
702 AC_DEFUN([GROFF_LIBC],
703 [AC_CHECK_LIB([c], [main], [LIBC=-lc])
706 # Check for EBCDIC -- stolen from the OS390 Unix LYNX port
708 AC_DEFUN([GROFF_EBCDIC],
709 [AC_MSG_CHECKING([whether character set is EBCDIC])
713 /* Treat any failure as ASCII for compatibility with existing art.
714 Use compile-time rather than run-time tests for cross-compiler
717 make an error "Character set is not EBCDIC"
722 [groff_cv_ebcdic="yes"
723 TTYDEVDIRS="font/devcp1047"
725 AC_DEFINE(IS_EBCDIC_HOST, 1,
726 [Define if the host's encoding is EBCDIC.])],
727 [groff_cv_ebcdic="no"
728 TTYDEVDIRS="font/devascii font/devlatin1"
729 OTHERDEVDIRS="font/devlj4 font/devlbp"
730 AC_MSG_RESULT([no])])
731 AC_SUBST([TTYDEVDIRS])
732 AC_SUBST([OTHERDEVDIRS])])
734 # Check for OS/390 Unix. We test for EBCDIC also -- the Linux port (with
735 # gcc) to OS/390 uses ASCII internally.
737 AC_DEFUN([GROFF_OS390],
738 [if test "$groff_cv_ebcdic" = "yes"; then
739 AC_MSG_CHECKING([for OS/390 Unix])
742 CFLAGS="$CFLAGS -D_ALL_SOURCE"
743 AC_MSG_RESULT([yes]) ;;
745 AC_MSG_RESULT([no]) ;;
749 # Check whether we need a declaration for a function.
751 # Stolen from GNU bfd.
753 AC_DEFUN([GROFF_NEED_DECLARATION],
754 [AC_MSG_CHECKING([whether $1 must be declared])
756 AC_CACHE_VAL([groff_cv_decl_needed_$1],
764 #ifdef HAVE_STRINGS_H
770 #ifdef HAVE_SYS_TIME_H
771 #include <sys/time.h>
784 char *p = (char *) $1;
789 [groff_cv_decl_needed_$1=no],
790 [groff_cv_decl_needed_$1=yes])])
791 AC_MSG_RESULT([$groff_cv_decl_needed_$1])
792 if test $groff_cv_decl_needed_$1 = yes; then
793 AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), [1],
794 [Define if your C++ doesn't declare ]$1[().])
798 # If mkstemp() isn't available, use our own mkstemp.cpp file.
800 AC_DEFUN([GROFF_MKSTEMP],
801 [AC_MSG_CHECKING([for mkstemp])
803 AC_LIBSOURCE([mkstemp.cpp])
818 [AC_MSG_RESULT([yes])
819 AC_DEFINE([HAVE_MKSTEMP], [1], [Define if you have mkstemp().])],
821 _AC_LIBOBJ([mkstemp])])
824 # Test whether <inttypes.h> exists, doesn't clash with <sys/types.h>,
825 # and declares uintmax_t. Taken from the fileutils package.
827 AC_DEFUN([GROFF_INTTYPES_H],
829 AC_MSG_CHECKING([C++ <inttypes.h>])
833 #include <sys/types.h>
834 #include <inttypes.h>
839 uintmax_t i = (uintmax_t)-1;
843 [groff_cv_header_inttypes_h=yes
844 AC_DEFINE([HAVE_CC_INTTYPES_H], [1],
845 [Define if you have a C++ <inttypes.h>.])],
846 [groff_cv_header_inttypes_h=no])
847 AC_MSG_RESULT([$groff_cv_header_inttypes_h])
850 # Test for working `unsigned long long'. Taken from the fileutils package.
852 AC_DEFUN([GROFF_UNSIGNED_LONG_LONG],
854 AC_MSG_CHECKING([for unsigned long long])
858 unsigned long long ull = 1;
860 unsigned long long ullmax = (unsigned long long)-1;
865 return ull << i | ull >> i | ullmax / ull | ullmax % ull;
869 [groff_cv_type_unsigned_long_long=yes],
870 [groff_cv_type_unsigned_long_long=no])
871 AC_MSG_RESULT([$groff_cv_type_unsigned_long_long])
874 # Define uintmax_t to `unsigned long' or `unsigned long long'
875 # if <inttypes.h> does not exist. Taken from the fileutils package.
877 AC_DEFUN([GROFF_UINTMAX_T],
878 [AC_REQUIRE([GROFF_INTTYPES_H])
879 if test $groff_cv_header_inttypes_h = no; then
880 AC_REQUIRE([GROFF_UNSIGNED_LONG_LONG])
881 test $groff_cv_type_unsigned_long_long = yes \
882 && ac_type='unsigned long long' \
883 || ac_type='unsigned long'
884 AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type],
885 [Define uintmax_t to `unsigned long' or `unsigned long long' if
886 <inttypes.h> does not exist.])
889 # Identify PATH_SEPARATOR character to use in GROFF_FONT_PATH and
890 # GROFF_TMAC_PATH which is appropriate for the target system (POSIX=':',
893 # The logic to resolve this test is already encapsulated in
894 # `${srcdir}/src/include/nonposix.h'.
896 AC_DEFUN([GROFF_TARGET_PATH_SEPARATOR],
897 [AC_MSG_CHECKING([separator character to use in groff search paths])
898 cp ${srcdir}/src/include/nonposix.h conftest.h
903 #include "conftest.h"
908 #if PATH_SEP_CHAR == ';'
909 make an error "Path separator is ';'"
914 [GROFF_PATH_SEPARATOR=":"],
915 [GROFF_PATH_SEPARATOR=";"])
916 AC_MSG_RESULT([$GROFF_PATH_SEPARATOR])
917 AC_SUBST(GROFF_PATH_SEPARATOR)])
921 AC_DEFUN([GROFF_X11],
922 [AC_REQUIRE([AC_PATH_XTRA])
924 if test -z "$groff_no_x"; then
928 CFLAGS="$CFLAGS $X_CFLAGS"
929 LDFLAGS="$LDFLAGS $X_LIBS"
930 LIBS="$LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
933 AC_MSG_CHECKING([for Xaw library and header files])
937 #include <X11/Intrinsic.h>
938 #include <X11/Xaw/Simple.h>
943 [AC_MSG_RESULT([yes])],
948 AC_MSG_CHECKING([for Xmu library and header files])
952 #include <X11/Intrinsic.h>
953 #include <X11/Xmu/Converters.h>
958 [AC_MSG_RESULT([yes])],
967 if test "x$groff_no_x" = "xyes"; then
968 AC_MSG_NOTICE([gxditview and xtotroff won't be built])
970 XDEVDIRS="font/devX75 font/devX75-12 font/devX100 font/devX100-12"
971 XPROGDIRS="src/devices/xditview src/utils/xtotroff"
972 XLIBDIRS="src/libs/libxutil"
976 AC_SUBST([XPROGDIRS])
977 AC_SUBST([XLIBDIRS])])
979 # Set up the `--with-appresdir' command line option.
981 AC_DEFUN([GROFF_APPRESDIR_OPTION],
982 [AC_ARG_WITH([appresdir],
983 dnl Don't quote AS_HELP_STRING!
984 AS_HELP_STRING([--with-appresdir=DIR],
985 [X11 application resource files]))])
987 # Get a default value for the application resource directory.
989 # We ignore the `XAPPLRES' and `XUSERFILESEARCHPATH' environment variables.
991 # The goal is to find the `root' of X11. Under most systems this is
992 # `/usr/X11/lib'. Application default files are then in
993 # `/usr/X11/lib/X11/app-defaults'.
995 # Based on autoconf's AC_PATH_X macro.
997 AC_DEFUN([GROFF_APPRESDIR_DEFAULT],
998 [if test -z "$groff_no_x"; then
999 # Create an Imakefile, run `xmkmf', then `make'.
1000 rm -f -r conftest.dir
1001 if mkdir conftest.dir; then
1003 # Make sure to not put `make' in the Imakefile rules,
1004 # since we grep it out.
1005 cat >Imakefile <<'EOF'
1008 @echo 'groff_x_usrlibdir="${USRLIBDIR}"; groff_x_libdir="${LIBDIR}"'
1011 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
1012 # GNU make sometimes prints "make[1]: Entering...",
1013 # which would confuse us.
1014 eval `${MAKE-make} xlibdirs 2>/dev/null | grep -v make`
1016 # Open Windows `xmkmf' reportedly sets LIBDIR instead of USRLIBDIR.
1017 for groff_extension in a so sl; do
1018 if test ! -f $groff_x_usrlibdir/libX11.$groff_extension &&
1019 test -f $groff_x_libdir/libX11.$groff_extension; then
1020 groff_x_usrlibdir=$groff_x_libdir
1027 rm -f -r conftest.dir
1030 # In case the test with `xmkmf' wasn't successful, try a suite of
1031 # standard directories. Check `X11' before `X11Rn' because it is often
1032 # a symlink to the current release.
1045 /usr/local/X11R6/lib
1046 /usr/local/X11R5/lib
1047 /usr/local/X11R4/lib
1050 /usr/local/lib/X11R6
1051 /usr/local/lib/X11R5
1052 /usr/local/lib/X11R4
1056 /usr/XFree86/lib/X11
1060 /usr/unsupported/lib
1062 /usr/local/x11r5/lib
1063 /usr/lpp/Xamples/lib
1066 /usr/openwin/share/lib'
1068 if test -z "$groff_x_usrlibdir"; then
1069 # We only test whether libX11 exists.
1070 for groff_dir in $groff_x_libdirs; do
1071 for groff_extension in a so sl; do
1072 if test ! -r $groff_dir/libX11.$groff_extension; then
1073 groff_x_usrlibdir=$groff_dir
1080 if test "x$with_appresdir" = "x"; then
1081 appresdir=$groff_x_usrlibdir/X11/app-defaults
1083 appresdir=$with_appresdir
1086 AC_SUBST([appresdir])])
1089 # Emit warning if --with-appresdir hasn't been used.
1091 AC_DEFUN([GROFF_APPRESDIR_CHECK],
1092 [if test -z "$groff_no_x"; then
1093 if test "x$with_appresdir" = "x"; then
1096 The application resource file for gxditview will be installed as
1098 $appresdir/GXditview
1100 (an existing file will be saved as `GXditview.old').
1101 To install it into a different directory, say, `/etc/gxditview',
1102 add `--with-appresdir=/etc/gxditview' to the configure script
1103 command line options and rerun it. The environment variable
1104 `APPLRESDIR' must then be set to `/etc/' (note the trailing slash),
1105 omitting the `gxditview' part which is automatically appended by
1106 the X11 searching routines for resource files. More details can be
1107 found in the X(7) manual page.