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, 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 # 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 # In April 2005, autoconf's AC_TYPE_SIGNAL is still broken.
271 AC_DEFUN([GROFF_TYPE_SIGNAL],
272 [AC_MSG_CHECKING([for return type of signal handlers])
273 for groff_declaration in \
274 'extern "C" void (*signal (int, void (*)(int)))(int);' \
275 'extern "C" void (*signal (int, void (*)(int)) throw ())(int);' \
276 'void (*signal ()) ();'
281 #include <sys/types.h>
299 if test -n "$groff_declaration"; then
300 AC_MSG_RESULT([void])
301 AC_DEFINE([RETSIGTYPE], [void],
302 [Define as the return type of signal handlers
306 AC_DEFINE([RETSIGTYPE], [int],
307 [Define as the return type of signal handlers
311 AC_DEFUN([GROFF_SYS_NERR],
313 AC_MSG_CHECKING([for sys_nerr in <errno.h>, <stdio.h>, or <stdlib.h>])
329 [AC_MSG_RESULT([yes])
330 AC_DEFINE([HAVE_SYS_NERR], [1],
331 [Define if you have sys_nerr in <errno.h>, <stdio.h>, or <stdio.h>.])],
332 [AC_MSG_RESULT([no])])
335 AC_DEFUN([GROFF_SYS_ERRLIST],
336 [AC_MSG_CHECKING([for sys_errlist[] in <errno.h>, <stdio.h>, or <stdlib.h>])
348 k = (int)sys_errlist[0];
352 [AC_MSG_RESULT([yes])
353 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
354 [Define if you have sys_errlist in <errno.h>, <stdio.h>, or <stdlib.h>.])],
355 [AC_MSG_RESULT([no])])])
357 AC_DEFUN([GROFF_OSFCN_H],
359 AC_MSG_CHECKING([C++ <osfcn.h>])
373 [AC_MSG_RESULT([yes])
374 AC_DEFINE([HAVE_CC_OSFCN_H], [1],
375 [Define if you have a C++ <osfcn.h>.])],
376 [AC_MSG_RESULT([no])])
379 AC_DEFUN([GROFF_LIMITS_H],
381 AC_MSG_CHECKING([C++ <limits.h>])
396 [AC_MSG_RESULT([yes])
397 AC_DEFINE([HAVE_CC_LIMITS_H], [1],
398 [Define if you have a C++ <limits.h>.])],
399 [AC_MSG_RESULT([no])])
402 AC_DEFUN([GROFF_TIME_T],
404 AC_MSG_CHECKING([for declaration of time_t])
414 struct tm *p = localtime(&t);
418 [AC_MSG_RESULT([yes])],
420 AC_DEFINE([LONG_FOR_TIME_T], [1],
421 [Define if localtime() takes a long * not a time_t *.])])
424 AC_DEFUN([GROFF_STRUCT_EXCEPTION],
425 [AC_MSG_CHECKING([struct exception])
438 [AC_MSG_RESULT([yes])
439 AC_DEFINE([HAVE_STRUCT_EXCEPTION], [1],
440 [Define if <math.h> defines struct exception.])],
441 [AC_MSG_RESULT([no])])])
443 AC_DEFUN([GROFF_ARRAY_DELETE],
445 AC_MSG_CHECKING([whether ANSI array delete syntax is supported])
449 char *p = new char[5];
454 [AC_MSG_RESULT([yes])],
456 AC_DEFINE([ARRAY_DELETE_NEEDS_SIZE], [1],
457 [Define if your C++ doesn't understand `delete []'.])])
460 AC_DEFUN([GROFF_TRADITIONAL_CPP],
462 AC_MSG_CHECKING([traditional preprocessor])
466 #define name2(a, b) a/**/b
475 [AC_MSG_RESULT([yes])
476 AC_DEFINE([TRADITIONAL_CPP], [1],
477 [Define if your C++ compiler uses a traditional (Reiser) preprocessor.])],
478 [AC_MSG_RESULT([no])])
481 AC_DEFUN([GROFF_WCOREFLAG],
482 [AC_MSG_CHECKING([w_coredump])
486 #include <sys/types.h>
487 #include <sys/wait.h>
498 ((union wait *)&i)->w_coredump = 1;
505 [AC_MSG_RESULT([yes])
506 AC_DEFINE(WCOREFLAG, 0200,
507 [Define if the 0200 bit of the status returned by wait() indicates
508 whether a core image was produced for a process that was terminated
510 [AC_MSG_RESULT([no])],
511 [AC_MSG_RESULT([no])])])
513 AC_DEFUN([GROFF_BROKEN_SPOOLER_FLAGS],
514 [AC_MSG_CHECKING([default value for grops -b option])
515 test -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=0
516 AC_MSG_RESULT([$BROKEN_SPOOLER_FLAGS])
517 AC_SUBST([BROKEN_SPOOLER_FLAGS])])
519 AC_DEFUN([GROFF_PAGE],
520 [AC_MSG_CHECKING([default paper size])
522 test "x$prefix" = "xNONE" && groff_prefix=$ac_default_prefix
523 if test -z "$PAGE"; then
525 if test -r $groff_prefix/share/groff/font/devps/DESC; then
526 descfile=$groff_prefix/share/groff/font/devps/DESC
527 elif test -r $groff_prefix/lib/groff/font/devps/DESC; then
528 descfile=$groff_prefix/lib/groff/font/devps/DESC
530 for f in $groff_prefix/share/groff/*/font/devps/DESC; do
538 if test -n "$descfile"; then
539 if grep ['^paperlength[ ]\+841890'] $descfile >/dev/null 2>&1; then
541 elif grep ['^papersize[ ]\+[aA]4'] $descfile >/dev/null 2>&1; then
547 if test -z "$PAGE"; then
548 dom=`awk '([$]1 == "dom" || [$]1 == "search") { print [$]2; exit}' \
549 /etc/resolv.conf 2>/dev/null`
550 if test -z "$dom"; then
551 dom=`(domainname) 2>/dev/null | tr -d '+'`
553 || test "$dom" = '(none)'; then
554 dom=`(hostname) 2>/dev/null | grep '\.'`
557 # If the top-level domain is two letters and it's not `us' or `ca'
558 # then they probably use A4 paper.
560 [*.[Uu][Ss]|*.[Cc][Aa])]
562 [*.[A-Za-z][A-Za-z])]
567 test -n "$PAGE" || PAGE=letter
568 if test "x$PAGE" = "xA4"; then
569 AC_DEFINE([PAGEA4], [1],
570 [Define if the printer's page size is A4.])
572 AC_MSG_RESULT([$PAGE])
575 AC_DEFUN([GROFF_CXX_CHECK],
576 [AC_REQUIRE([AC_PROG_CXX])
578 if test "$cross_compiling" = no; then
579 AC_MSG_CHECKING([that C++ compiler can compile simple program])
590 [AC_MSG_RESULT([yes])],
592 AC_MSG_ERROR([a working C++ compiler is required])],
595 if test "$cross_compiling" = no; then
596 AC_MSG_CHECKING([that C++ static constructors and destructors are called])
609 ~A() { if (i == 1) _exit(0); }
621 [AC_MSG_RESULT([yes])],
623 AC_MSG_ERROR([a working C++ compiler is required])],
626 AC_MSG_CHECKING([that header files support C++])
639 [AC_MSG_RESULT([yes])],
641 AC_MSG_ERROR([header files do not support C++
642 (if you are using a version of gcc/g++ earlier than 2.5,
643 you should install libg++)])])
646 AC_DEFUN([GROFF_TMAC],
647 [AC_MSG_CHECKING([for prefix of system macro packages])
649 sys_tmac_file_prefix=
650 for d in /usr/share/lib/tmac /usr/lib/tmac; do
651 for t in "" tmac.; do
654 if test -z "$sys_tmac_prefix" \
656 && grep '^\.if' $f >/dev/null 2>&1; then
657 sys_tmac_prefix=$d/$t
658 sys_tmac_file_prefix=$t
663 AC_MSG_RESULT([$sys_tmac_prefix])
664 AC_SUBST([sys_tmac_prefix])
666 AC_MSG_CHECKING([which system macro packages should be made available])
668 if test "x$sys_tmac_file_prefix" = "xtmac."; then
669 for f in $sys_tmac_prefix*; do
670 suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"`
675 grep "Copyright.*Free Software Foundation" $f >/dev/null \
676 || tmac_wrap="$tmac_wrap $suff" ;;
679 elif test -n "$sys_tmac_prefix"; then
680 files=`echo $sys_tmac_prefix*`
681 grep "\\.so" $files >conftest.sol
692 if grep "\\.so.*/$b\$" conftest.sol >/dev/null \
693 || grep -l "Copyright.*Free Software Foundation" $f >/dev/null; then
696 suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"`
701 tmac_wrap="$tmac_wrap $suff" ;;
708 AC_MSG_RESULT([$tmac_wrap])
709 AC_SUBST([tmac_wrap])])
712 [AC_MSG_CHECKING([for existing troff installation])
713 if test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then
722 # We need the path to install-sh to be absolute.
724 AC_DEFUN([GROFF_INSTALL_SH],
725 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])
726 ac_dir=`cd $ac_aux_dir; pwd`
727 ac_install_sh="$ac_dir/install-sh -c"])
729 # Test whether install-info is available.
731 AC_DEFUN([GROFF_INSTALL_INFO],
732 [AC_CHECK_PROGS([INSTALL_INFO], [install-info], [:])])
734 # At least one UNIX system, Apple Macintosh Rhapsody 5.5,
735 # does not have -lm ...
737 AC_DEFUN([GROFF_LIBM],
738 [AC_CHECK_LIB([m], [sin], [LIBM=-lm])
741 # ... while the MinGW implementation of GCC for Microsoft Win32
742 # does not seem to have -lc.
744 AC_DEFUN([GROFF_LIBC],
745 [AC_CHECK_LIB([c], [main], [LIBC=-lc])
748 # Check for EBCDIC -- stolen from the OS390 Unix LYNX port
750 AC_DEFUN([GROFF_EBCDIC],
751 [AC_MSG_CHECKING([whether character set is EBCDIC])
755 /* Treat any failure as ASCII for compatibility with existing art.
756 Use compile-time rather than run-time tests for cross-compiler
759 make an error "Character set is not EBCDIC"
764 [groff_cv_ebcdic="yes"
765 TTYDEVDIRS="font/devcp1047"
767 AC_DEFINE(IS_EBCDIC_HOST, 1,
768 [Define if the host's encoding is EBCDIC.])],
769 [groff_cv_ebcdic="no"
770 TTYDEVDIRS="font/devascii font/devlatin1"
771 OTHERDEVDIRS="font/devlj4 font/devlbp"
772 AC_MSG_RESULT([no])])
773 AC_SUBST([TTYDEVDIRS])
774 AC_SUBST([OTHERDEVDIRS])])
776 # Check for OS/390 Unix. We test for EBCDIC also -- the Linux port (with
777 # gcc) to OS/390 uses ASCII internally.
779 AC_DEFUN([GROFF_OS390],
780 [if test "$groff_cv_ebcdic" = "yes"; then
781 AC_MSG_CHECKING([for OS/390 Unix])
784 CFLAGS="$CFLAGS -D_ALL_SOURCE"
785 AC_MSG_RESULT([yes]) ;;
787 AC_MSG_RESULT([no]) ;;
791 # Check whether we need a declaration for a function.
793 # Stolen from GNU bfd.
795 AC_DEFUN([GROFF_NEED_DECLARATION],
796 [AC_MSG_CHECKING([whether $1 must be declared])
798 AC_CACHE_VAL([groff_cv_decl_needed_$1],
806 #ifdef HAVE_STRINGS_H
812 #ifdef HAVE_SYS_TIME_H
813 #include <sys/time.h>
826 char *p = (char *) $1;
831 [groff_cv_decl_needed_$1=no],
832 [groff_cv_decl_needed_$1=yes])])
833 AC_MSG_RESULT([$groff_cv_decl_needed_$1])
834 if test $groff_cv_decl_needed_$1 = yes; then
835 AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), [1],
836 [Define if your C++ doesn't declare ]$1[().])
840 # If mkstemp() isn't available, use our own mkstemp.cpp file.
842 AC_DEFUN([GROFF_MKSTEMP],
843 [AC_MSG_CHECKING([for mkstemp])
845 AC_LIBSOURCE([mkstemp.cpp])
860 [AC_MSG_RESULT([yes])
861 AC_DEFINE([HAVE_MKSTEMP], [1], [Define if you have mkstemp().])],
863 _AC_LIBOBJ([mkstemp])])
866 # Test whether <inttypes.h> exists, doesn't clash with <sys/types.h>,
867 # and declares uintmax_t. Taken from the fileutils package.
869 AC_DEFUN([GROFF_INTTYPES_H],
871 AC_MSG_CHECKING([C++ <inttypes.h>])
875 #include <sys/types.h>
876 #include <inttypes.h>
881 uintmax_t i = (uintmax_t)-1;
885 [groff_cv_header_inttypes_h=yes
886 AC_DEFINE([HAVE_CC_INTTYPES_H], [1],
887 [Define if you have a C++ <inttypes.h>.])],
888 [groff_cv_header_inttypes_h=no])
889 AC_MSG_RESULT([$groff_cv_header_inttypes_h])
892 # Test for working `unsigned long long'. Taken from the fileutils package.
894 AC_DEFUN([GROFF_UNSIGNED_LONG_LONG],
896 AC_MSG_CHECKING([for unsigned long long])
900 unsigned long long ull = 1;
902 unsigned long long ullmax = (unsigned long long)-1;
907 return ull << i | ull >> i | ullmax / ull | ullmax % ull;
911 [groff_cv_type_unsigned_long_long=yes],
912 [groff_cv_type_unsigned_long_long=no])
913 AC_MSG_RESULT([$groff_cv_type_unsigned_long_long])
916 # Define uintmax_t to `unsigned long' or `unsigned long long'
917 # if <inttypes.h> does not exist. Taken from the fileutils package.
919 AC_DEFUN([GROFF_UINTMAX_T],
920 [AC_REQUIRE([GROFF_INTTYPES_H])
921 if test $groff_cv_header_inttypes_h = no; then
922 AC_REQUIRE([GROFF_UNSIGNED_LONG_LONG])
923 test $groff_cv_type_unsigned_long_long = yes \
924 && ac_type='unsigned long long' \
925 || ac_type='unsigned long'
926 AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type],
927 [Define uintmax_t to `unsigned long' or `unsigned long long' if
928 <inttypes.h> does not exist.])
931 # Identify PATH_SEPARATOR character to use in GROFF_FONT_PATH and
932 # GROFF_TMAC_PATH which is appropriate for the target system (POSIX=':',
935 # The logic to resolve this test is already encapsulated in
936 # `${srcdir}/src/include/nonposix.h'.
938 AC_DEFUN([GROFF_TARGET_PATH_SEPARATOR],
939 [AC_MSG_CHECKING([separator character to use in groff search paths])
940 cp ${srcdir}/src/include/nonposix.h conftest.h
945 #include "conftest.h"
950 #if PATH_SEP_CHAR == ';'
951 make an error "Path separator is ';'"
956 [GROFF_PATH_SEPARATOR=":"],
957 [GROFF_PATH_SEPARATOR=";"])
958 AC_MSG_RESULT([$GROFF_PATH_SEPARATOR])
959 AC_SUBST(GROFF_PATH_SEPARATOR)])
963 AC_DEFUN([GROFF_X11],
964 [AC_REQUIRE([AC_PATH_XTRA])
966 if test -z "$groff_no_x"; then
970 CFLAGS="$CFLAGS $X_CFLAGS"
971 LDFLAGS="$LDFLAGS $X_LIBS"
972 LIBS="$LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
975 AC_MSG_CHECKING([for Xaw library and header files])
979 #include <X11/Intrinsic.h>
980 #include <X11/Xaw/Simple.h>
985 [AC_MSG_RESULT([yes])],
990 AC_MSG_CHECKING([for Xmu library and header files])
994 #include <X11/Intrinsic.h>
995 #include <X11/Xmu/Converters.h>
1000 [AC_MSG_RESULT([yes])],
1001 [AC_MSG_RESULT([no])
1009 if test "x$groff_no_x" = "xyes"; then
1010 AC_MSG_NOTICE([gxditview and xtotroff won't be built])
1012 XDEVDIRS="font/devX75 font/devX75-12 font/devX100 font/devX100-12"
1013 XPROGDIRS="src/devices/xditview src/utils/xtotroff"
1014 XLIBDIRS="src/libs/libxutil"
1017 AC_SUBST([XDEVDIRS])
1018 AC_SUBST([XPROGDIRS])
1019 AC_SUBST([XLIBDIRS])])
1021 # Set up the `--with-appresdir' command line option.
1023 AC_DEFUN([GROFF_APPRESDIR_OPTION],
1024 [AC_ARG_WITH([appresdir],
1025 dnl Don't quote AS_HELP_STRING!
1026 AS_HELP_STRING([--with-appresdir=DIR],
1027 [X11 application resource files]))])
1029 # Get a default value for the application resource directory.
1031 # We ignore the `XAPPLRES' and `XUSERFILESEARCHPATH' environment variables.
1033 # The goal is to find the `root' of X11. Under most systems this is
1034 # `/usr/X11/lib'. Application default files are then in
1035 # `/usr/X11/lib/X11/app-defaults'.
1037 # Based on autoconf's AC_PATH_X macro.
1039 AC_DEFUN([GROFF_APPRESDIR_DEFAULT],
1040 [if test -z "$groff_no_x"; then
1041 # Create an Imakefile, run `xmkmf', then `make'.
1042 rm -f -r conftest.dir
1043 if mkdir conftest.dir; then
1045 # Make sure to not put `make' in the Imakefile rules,
1046 # since we grep it out.
1047 cat >Imakefile <<'EOF'
1050 @echo 'groff_x_usrlibdir="${USRLIBDIR}"; groff_x_libdir="${LIBDIR}"'
1053 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
1054 # GNU make sometimes prints "make[1]: Entering...",
1055 # which would confuse us.
1056 eval `${MAKE-make} xlibdirs 2>/dev/null | grep -v make`
1058 # Open Windows `xmkmf' reportedly sets LIBDIR instead of USRLIBDIR.
1059 for groff_extension in a so sl; do
1060 if test ! -f $groff_x_usrlibdir/libX11.$groff_extension &&
1061 test -f $groff_x_libdir/libX11.$groff_extension; then
1062 groff_x_usrlibdir=$groff_x_libdir
1069 rm -f -r conftest.dir
1072 # In case the test with `xmkmf' wasn't successful, try a suite of
1073 # standard directories. Check `X11' before `X11Rn' because it is often
1074 # a symlink to the current release.
1087 /usr/local/X11R6/lib
1088 /usr/local/X11R5/lib
1089 /usr/local/X11R4/lib
1092 /usr/local/lib/X11R6
1093 /usr/local/lib/X11R5
1094 /usr/local/lib/X11R4
1098 /usr/XFree86/lib/X11
1102 /usr/unsupported/lib
1104 /usr/local/x11r5/lib
1105 /usr/lpp/Xamples/lib
1108 /usr/openwin/share/lib'
1110 if test -z "$groff_x_usrlibdir"; then
1111 # We only test whether libX11 exists.
1112 for groff_dir in $groff_x_libdirs; do
1113 for groff_extension in a so sl; do
1114 if test ! -r $groff_dir/libX11.$groff_extension; then
1115 groff_x_usrlibdir=$groff_dir
1122 if test "x$with_appresdir" = "x"; then
1123 appresdir=$groff_x_usrlibdir/X11/app-defaults
1125 appresdir=$with_appresdir
1128 AC_SUBST([appresdir])])
1131 # Emit warning if --with-appresdir hasn't been used.
1133 AC_DEFUN([GROFF_APPRESDIR_CHECK],
1134 [if test -z "$groff_no_x"; then
1135 if test "x$with_appresdir" = "x"; then
1138 The application resource file for gxditview will be installed as
1140 $appresdir/GXditview
1142 (an existing file will be saved as `GXditview.old').
1143 To install it into a different directory, say, `/etc/gxditview',
1144 add `--with-appresdir=/etc/gxditview' to the configure script
1145 command line options and rerun it. The environment variable
1146 `APPLRESDIR' must then be set to `/etc/' (note the trailing slash),
1147 omitting the `gxditview' part which is automatically appended by
1148 the X11 searching routines for resource files. More details can be
1149 found in the X(7) manual page.