summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorwl <wl>2006-01-03 23:57:03 +0000
committerwl <wl>2006-01-03 23:57:03 +0000
commitd934ff6d9368d954c0b532cd4c23f4d4c3591cce (patch)
tree0d41502d8780d600bc3ff86604bf05f6d2312c86 /m4
parent1768e1210ff633038445e4eafb3027d53712c2b4 (diff)
downloadgroff-d934ff6d9368d954c0b532cd4c23f4d4c3591cce.tar.gz
* m4/groff.m4: Renamed from aclocal.m4.
* m4/codeset.m4: New file, from gnulib. * m4/iconv.m4: New file, from gnulib. * m4/lib-ld.m4, m4/lib-link.m4, m4/lib-prefix.m4: New files, from gnulib. * config.rpath: New file, from gnulib. * config.guess, config.sub: New files, from gnulib. * Makefile.sub (M4MACROS): New variable. (configure): Fix typo. (aclocal.m4): New rule. (stamp-h.in): Depend on aclocal.m4. * configure.ac: Invoke AM_ICONV and AM_LANGINFO_CODESET. * Makefile.in (LIBICONV): New variable. (MDEFINES): Pass it to recursive makes. * src/preproc/preconv/preconv.cpp: Use HAVE_LANGINFO_CODESET and HAVE_ICONV instead of I18N macro. * src/preproc/preconv/Makefile.sub (EXTRA_LDFLAGS): New variable. * aclocal.m4, configure, src/include/config.hin: (Re)generated. * doc/Makefile.in (webpage.html): Simplify. * doc/Makefile.sub (webpage.html): Synchronize with doc/Makefile.in. * doc/webpage.ms, tmac/groff_www.man, tmac/www.tmac: Minor updates.
Diffstat (limited to 'm4')
-rw-r--r--m4/codeset.m421
-rw-r--r--m4/groff.m41205
-rw-r--r--m4/iconv.m4101
-rw-r--r--m4/lib-ld.m4110
-rw-r--r--m4/lib-link.m4554
-rw-r--r--m4/lib-prefix.m4185
6 files changed, 2176 insertions, 0 deletions
diff --git a/m4/codeset.m4 b/m4/codeset.m4
new file mode 100644
index 00000000..a6e67ec4
--- /dev/null
+++ b/m4/codeset.m4
@@ -0,0 +1,21 @@
+# codeset.m4 serial AM1 (gettext-0.10.40)
+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_LANGINFO_CODESET],
+[
+ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
+ [AC_TRY_LINK([#include <langinfo.h>],
+ [char* cs = nl_langinfo(CODESET);],
+ am_cv_langinfo_codeset=yes,
+ am_cv_langinfo_codeset=no)
+ ])
+ if test $am_cv_langinfo_codeset = yes; then
+ AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
+ [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
+ fi
+])
diff --git a/m4/groff.m4 b/m4/groff.m4
new file mode 100644
index 00000000..ce88f550
--- /dev/null
+++ b/m4/groff.m4
@@ -0,0 +1,1205 @@
+# Autoconf macros for groff.
+# Copyright (C) 1989-1995, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is part of groff.
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any later
+# version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with groff; see the file COPYING. If not, write to the Free Software
+# Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
+
+AC_DEFUN([GROFF_PRINT],
+ [if test -z "$PSPRINT"; then
+ AC_CHECK_PROGS([LPR], [lpr])
+ AC_CHECK_PROGS([LP], [lp])
+ if test -n "$LPR" && test -n "$LP"; then
+ # HP-UX provides an lpr command that emulates lpr using lp,
+ # but it doesn't have lpq; in this case we want to use lp
+ # rather than lpr.
+ AC_CHECK_PROGS([LPQ], [lpq])
+ test -n "$LPQ" || LPR=
+ fi
+ if test -n "$LPR"; then
+ PSPRINT="$LPR"
+ elif test -n "$LP"; then
+ PSPRINT="$LP"
+ fi
+ fi
+ AC_SUBST([PSPRINT])
+ AC_MSG_CHECKING([for command to use for printing PostScript files])
+ AC_MSG_RESULT([$PSPRINT])
+
+ # Figure out DVIPRINT from PSPRINT.
+ AC_MSG_CHECKING([for command to use for printing dvi files])
+ if test -n "$PSPRINT" && test -z "$DVIPRINT"; then
+ if test "x$PSPRINT" = "xlpr"; then
+ DVIPRINT="lpr -d"
+ else
+ DVIPRINT="$PSPRINT"
+ fi
+ fi
+ AC_SUBST([DVIPRINT])
+ AC_MSG_RESULT([$DVIPRINT])])
+
+# Bison generated parsers have problems with C++ compilers other than g++.
+# So byacc is preferred over bison.
+
+AC_DEFUN([GROFF_PROG_YACC],
+ [AC_CHECK_PROGS([YACC], [byacc 'bison -y'], [yacc])])
+
+# We need makeinfo 4.8 or newer.
+
+AC_DEFUN([GROFF_MAKEINFO],
+ [missing=
+ AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo])
+ if test -z "$MAKEINFO"; then
+ missing="\`makeinfo' is missing."
+ else
+ AC_MSG_CHECKING([for makeinfo version])
+ # We need an additional level of quoting to make sed's regexps work.
+ [makeinfo_version=`$MAKEINFO --version 2>&1 \
+ | sed -e 's/^.* \([^ ][^ ]*\)$/\1/' -e '1q'`]
+ AC_MSG_RESULT([$makeinfo_version])
+ # Consider only the first two numbers in version number string.
+ [makeinfo_version_major=`echo $makeinfo_version \
+ | sed 's/^\([0-9]*\).*$/\1/'`]
+ if test -z "$makeinfo_version_major"; then
+ makeinfo_version_major=0
+ makeinfo_version_minor=0
+ else
+ [makeinfo_version_minor=`echo $makeinfo_version \
+ | sed 's/^[^.][^.]*\(.*\)$/\1/'`]
+ # No minor version number at all?
+ if test -z "$makeinfo_version_minor"; then
+ makeinfo_version_minor=0
+ else
+ [makeinfo_version_minor=`echo $makeinfo_version_minor \
+ | sed 's/\.\([0-9]*\).*$/\1/'`]
+ if test -z "$makeinfo_version_minor"; then
+ makeinfo_version_minor=0
+ fi
+ fi
+ fi
+ fi
+ makeinfo_version_numeric=`expr $makeinfo_version_major '*' 1000 \
+ '+' $makeinfo_version_minor`
+ if test $makeinfo_version_numeric -lt 4008; then
+ missing="\`makeinfo' is too old."
+ fi
+
+ if test -n "$missing"; then
+ if test ! -f doc/groff.info \
+ || test ${srcdir}/doc/groff.texinfo -nt doc/groff.info; then
+ AC_MSG_ERROR($missing
+[Get the `texinfo' package version 4.8 or newer.])
+ else
+ AC_MSG_WARN($missing
+[Get the `texinfo' package version 4.8 or newer if you want to convert
+`groff.texinfo' into a PDF or HTML document.])
+ fi
+ fi
+ AC_SUBST([MAKEINFO])])
+
+# The following programs are needed for grohtml.
+
+AC_DEFUN([GROFF_HTML_PROGRAMS],
+ [AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
+ make_html=html
+ make_install_html=install_html
+
+ missing=
+ AC_FOREACH([groff_prog],
+ [pnmcut pnmcrop pnmtopng psselect pnmtops],
+ [AC_CHECK_PROG(groff_prog, groff_prog, [found], [missing])
+ if test $[]groff_prog = missing; then
+ missing="$missing \`groff_prog'"
+ fi;])
+
+ test "$GHOSTSCRIPT" = "missing" && missing="$missing \`gs'"
+
+ if test -n "$missing"; then
+ plural=`set $missing; test $[#] -gt 1 && echo s`
+ missing=`set $missing
+ missing=""
+ while test $[#] -gt 0
+ do
+ case $[#] in
+ 1) missing="$missing$[1]" ;;
+ 2) missing="$missing$[1] and " ;;
+ *) missing="$missing$[1], " ;;
+ esac
+ shift
+ done
+ echo $missing`
+
+ make_html=
+ make_install_html=
+
+ AC_MSG_WARN([missing program$plural:
+
+ The program$plural
+ $missing
+ cannot be found in the PATH.
+ Consequently, groff's HTML backend (grohtml) will not work properly;
+ therefore, it will neither be possible to prepare, nor to install,
+ documentation in HTML format.
+ ])
+ fi
+
+ AC_SUBST([make_html])
+ AC_SUBST([make_install_html])])
+
+# To produce PDF docs, we need both awk and ghostscript.
+
+AC_DEFUN([GROFF_PDFDOC_PROGRAMS],
+ [AC_REQUIRE([GROFF_AWK_PATH])
+ AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
+
+ make_pdfdoc=pdfdoc
+ make_install_pdfdoc=install_pdfdoc
+
+ missing=""
+ test "$AWK" = missing && missing="\`awk'"
+ test "$GHOSTSCRIPT" = missing && missing="$missing \`gs'"
+ if test -n "$missing"; then
+ plural=`set $missing; test $[#] -eq 2 && echo s`
+ test x$plural = xs \
+ && missing=`set $missing; echo "$[1] and $[2]"` \
+ || missing=`echo $missing`
+
+ make_pdfdoc=
+ make_install_pdfdoc=
+
+ AC_MSG_WARN([missing program$plural:
+
+ The program$plural $missing cannot be found in the PATH.
+ Consequently, groff's PDF formatter (pdfroff) will not work properly;
+ therefore, it will neither be possible to prepare, nor to install,
+ documentation in PDF format.
+ ])
+ fi
+
+ AC_SUBST([make_pdfdoc])
+ AC_SUBST([make_install_pdfdoc])])
+
+# Check whether pnmtops can handle the -nosetpage option.
+
+AC_DEFUN([GROFF_PNMTOPS_NOSETPAGE],
+ [AC_MSG_CHECKING([whether pnmtops can handle the -nosetpage option])
+ if echo P2 2 2 255 0 1 2 0 | pnmtops -nosetpage > /dev/null 2>&1 ; then
+ AC_MSG_RESULT([yes])
+ pnmtops_nosetpage="pnmtops -nosetpage"
+ else
+ AC_MSG_RESULT([no])
+ pnmtops_nosetpage="pnmtops"
+ fi
+ AC_SUBST([pnmtops_nosetpage])])
+
+# Check location of `gs'; allow `--with-gs=PROG' option to override.
+
+AC_DEFUN([GROFF_GHOSTSCRIPT_PATH],
+ [AC_REQUIRE([GROFF_GHOSTSCRIPT_PREFS])
+ AC_ARG_WITH([gs],
+ [AS_HELP_STRING([--with-gs=PROG],
+ [actual [/path/]name of ghostscript executable])],
+ [GHOSTSCRIPT=$withval],
+ [AC_CHECK_TOOLS(GHOSTSCRIPT, [$ALT_GHOSTSCRIPT_PROGS], [missing])])
+ test "$GHOSTSCRIPT" = "no" && GHOSTSCRIPT=missing])
+
+# Preferences for choice of `gs' program...
+# (allow --with-alt-gs="LIST" to override).
+
+AC_DEFUN([GROFF_GHOSTSCRIPT_PREFS],
+ [AC_ARG_WITH([alt-gs],
+ [AS_HELP_STRING([--with-alt-gs=LIST],
+ [alternative names for ghostscript executable])],
+ [ALT_GHOSTSCRIPT_PROGS="$withval"],
+ [ALT_GHOSTSCRIPT_PROGS="gs gswin32c gsos2"])
+ AC_SUBST([ALT_GHOSTSCRIPT_PROGS])])
+
+# Check location of `awk'; allow `--with-awk=PROG' option to override.
+
+AC_DEFUN([GROFF_AWK_PATH],
+ [AC_REQUIRE([GROFF_AWK_PREFS])
+ AC_ARG_WITH([awk],
+ [AS_HELP_STRING([--with-awk=PROG],
+ [actual [/path/]name of awk executable])],
+ [AWK=$withval],
+ [AC_CHECK_TOOLS(AWK, [$ALT_AWK_PROGS], [missing])])
+ test "$AWK" = "no" && AWK=missing])
+
+# Preferences for choice of `awk' program; allow --with-alt-awk="LIST"
+# to override.
+
+AC_DEFUN([GROFF_AWK_PREFS],
+ [AC_ARG_WITH([alt-awk],
+ [AS_HELP_STRING([--with-alt-awk=LIST],
+ [alternative names for awk executable])],
+ [ALT_AWK_PROGS="$withval"],
+ [ALT_AWK_PROGS="gawk mawk nawk awk"])
+ AC_SUBST([ALT_AWK_PROGS])])
+
+# GROFF_CSH_HACK(if hack present, if not present)
+
+AC_DEFUN([GROFF_CSH_HACK],
+ [AC_MSG_CHECKING([for csh hash hack])
+
+cat <<EOF >conftest.sh
+#! /bin/sh
+true || exit 0
+export PATH || exit 0
+exit 1
+EOF
+
+ chmod +x conftest.sh
+ if echo ./conftest.sh | (csh >/dev/null 2>&1) >/dev/null 2>&1; then
+ AC_MSG_RESULT([yes])
+ $1
+ else
+ AC_MSG_RESULT([no])
+ $2
+ fi
+ rm -f conftest.sh])
+
+# From udodo!hans@relay.NL.net (Hans Zuidam)
+
+AC_DEFUN([GROFF_ISC_SYSV3],
+ [AC_MSG_CHECKING([for ISC 3.x or 4.x])
+ if grep ['[34]\.'] /usr/options/cb.name >/dev/null 2>&1
+ then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([_SYSV3], [1], [Define if you have ISC 3.x or 4.x.])
+ else
+ AC_MSG_RESULT([no])
+ fi])
+
+AC_DEFUN([GROFF_POSIX],
+ [AC_MSG_CHECKING([whether -D_POSIX_SOURCE is necessary])
+ AC_LANG_PUSH([C++])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <stdio.h>
+extern "C" { void fileno(int); }
+
+ ]])
+ ],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE([_POSIX_SOURCE], [1],
+ [Define if -D_POSIX_SOURCE is necessary.])],
+ [AC_MSG_RESULT([no])])
+ AC_LANG_POP([C++])])
+
+# srand() of SunOS 4.1.3 has return type int instead of void
+
+AC_DEFUN([GROFF_SRAND],
+ [AC_LANG_PUSH([C++])
+ AC_MSG_CHECKING([for return type of srand])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <stdlib.h>
+extern "C" { void srand(unsigned int); }
+
+ ]])
+ ],
+ [AC_MSG_RESULT([void])
+ AC_DEFINE([RET_TYPE_SRAND_IS_VOID], [1],
+ [Define if srand() returns void not int.])],
+ [AC_MSG_RESULT([int])])
+ AC_LANG_POP([C++])])
+
+# In April 2005, autoconf's AC_TYPE_SIGNAL is still broken.
+
+AC_DEFUN([GROFF_TYPE_SIGNAL],
+ [AC_MSG_CHECKING([for return type of signal handlers])
+ for groff_declaration in \
+ 'extern "C" void (*signal (int, void (*)(int)))(int);' \
+ 'extern "C" void (*signal (int, void (*)(int)) throw ())(int);' \
+ 'void (*signal ()) ();'
+ do
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+# undef signal
+#endif
+$groff_declaration
+
+ ]],
+ [[
+
+int i;
+
+ ]])
+ ],
+ [break],
+ [continue])
+ done
+
+ if test -n "$groff_declaration"; then
+ AC_MSG_RESULT([void])
+ AC_DEFINE([RETSIGTYPE], [void],
+ [Define as the return type of signal handlers
+ (`int' or `void').])
+ else
+ AC_MSG_RESULT([int])
+ AC_DEFINE([RETSIGTYPE], [int],
+ [Define as the return type of signal handlers
+ (`int' or `void').])
+ fi])
+
+AC_DEFUN([GROFF_SYS_NERR],
+ [AC_LANG_PUSH([C++])
+ AC_MSG_CHECKING([for sys_nerr in <errno.h>, <stdio.h>, or <stdlib.h>])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+ ]],
+ [[
+
+int k;
+k = sys_nerr;
+
+ ]])
+ ],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_SYS_NERR], [1],
+ [Define if you have sys_nerr in <errno.h>, <stdio.h>, or <stdio.h>.])],
+ [AC_MSG_RESULT([no])])
+ AC_LANG_POP([C++])])
+
+AC_DEFUN([GROFF_SYS_ERRLIST],
+ [AC_MSG_CHECKING([for sys_errlist[] in <errno.h>, <stdio.h>, or <stdlib.h>])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+ ]],
+ [[
+
+int k;
+k = (int)sys_errlist[0];
+
+ ]])
+ ],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_SYS_ERRLIST], [1],
+ [Define if you have sys_errlist in <errno.h>, <stdio.h>, or <stdlib.h>.])],
+ [AC_MSG_RESULT([no])])])
+
+AC_DEFUN([GROFF_OSFCN_H],
+ [AC_LANG_PUSH([C++])
+ AC_MSG_CHECKING([C++ <osfcn.h>])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <osfcn.h>
+
+ ]],
+ [[
+
+read(0, 0, 0);
+open(0, 0);
+
+ ]])
+ ],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_CC_OSFCN_H], [1],
+ [Define if you have a C++ <osfcn.h>.])],
+ [AC_MSG_RESULT([no])])
+ AC_LANG_POP([C++])])
+
+AC_DEFUN([GROFF_LIMITS_H],
+ [AC_LANG_PUSH([C++])
+ AC_MSG_CHECKING([C++ <limits.h>])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <limits.h>
+
+ ]],
+ [[
+
+int x = INT_MIN;
+int y = INT_MAX;
+int z = UCHAR_MAX;
+
+ ]])
+ ],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_CC_LIMITS_H], [1],
+ [Define if you have a C++ <limits.h>.])],
+ [AC_MSG_RESULT([no])])
+ AC_LANG_POP([C++])])
+
+AC_DEFUN([GROFF_TIME_T],
+ [AC_LANG_PUSH([C++])
+ AC_MSG_CHECKING([for declaration of time_t])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <time.h>
+
+ ]],
+ [[
+
+time_t t = time(0);
+struct tm *p = localtime(&t);
+
+ ]])
+ ],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ AC_DEFINE([LONG_FOR_TIME_T], [1],
+ [Define if localtime() takes a long * not a time_t *.])])
+ AC_LANG_POP([C++])])
+
+AC_DEFUN([GROFF_STRUCT_EXCEPTION],
+ [AC_MSG_CHECKING([struct exception])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <math.h>
+
+ ]],
+ [[
+
+struct exception e;
+
+ ]])
+ ],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_STRUCT_EXCEPTION], [1],
+ [Define if <math.h> defines struct exception.])],
+ [AC_MSG_RESULT([no])])])
+
+AC_DEFUN([GROFF_ARRAY_DELETE],
+ [AC_LANG_PUSH([C++])
+ AC_MSG_CHECKING([whether ANSI array delete syntax is supported])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM(, [[
+
+char *p = new char[5];
+delete [] p;
+
+ ]])
+ ],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ AC_DEFINE([ARRAY_DELETE_NEEDS_SIZE], [1],
+ [Define if your C++ doesn't understand `delete []'.])])
+ AC_LANG_POP([C++])])
+
+AC_DEFUN([GROFF_TRADITIONAL_CPP],
+ [AC_LANG_PUSH([C++])
+ AC_MSG_CHECKING([traditional preprocessor])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#define name2(a, b) a/**/b
+
+ ]],
+ [[
+
+int name2(foo, bar);
+
+ ]])
+ ],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE([TRADITIONAL_CPP], [1],
+ [Define if your C++ compiler uses a traditional (Reiser) preprocessor.])],
+ [AC_MSG_RESULT([no])])
+ AC_LANG_POP([C++])])
+
+AC_DEFUN([GROFF_WCOREFLAG],
+ [AC_MSG_CHECKING([w_coredump])
+ AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <sys/types.h>
+#include <sys/wait.h>
+
+ ]],
+ [[
+
+main()
+{
+#ifdef WCOREFLAG
+ exit(1);
+#else
+ int i = 0;
+ ((union wait *)&i)->w_coredump = 1;
+ exit(i != 0200);
+#endif
+}
+
+ ]])
+ ],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE(WCOREFLAG, 0200,
+ [Define if the 0200 bit of the status returned by wait() indicates
+ whether a core image was produced for a process that was terminated
+ by a signal.])],
+ [AC_MSG_RESULT([no])],
+ [AC_MSG_RESULT([no])])])
+
+AC_DEFUN([GROFF_BROKEN_SPOOLER_FLAGS],
+ [AC_MSG_CHECKING([default value for grops -b option])
+ test -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=0
+ AC_MSG_RESULT([$BROKEN_SPOOLER_FLAGS])
+ AC_SUBST([BROKEN_SPOOLER_FLAGS])])
+
+AC_DEFUN([GROFF_PAGE],
+ [AC_MSG_CHECKING([default paper size])
+ groff_prefix=$prefix
+ test "x$prefix" = "xNONE" && groff_prefix=$ac_default_prefix
+ if test -z "$PAGE"; then
+ descfile=
+ if test -r $groff_prefix/share/groff/font/devps/DESC; then
+ descfile=$groff_prefix/share/groff/font/devps/DESC
+ elif test -r $groff_prefix/lib/groff/font/devps/DESC; then
+ descfile=$groff_prefix/lib/groff/font/devps/DESC
+ else
+ for f in $groff_prefix/share/groff/*/font/devps/DESC; do
+ if test -r $f; then
+ descfile=$f
+ break
+ fi
+ done
+ fi
+
+ if test -n "$descfile"; then
+ if grep ['^paperlength[ ]\+841890'] $descfile >/dev/null 2>&1; then
+ PAGE=A4
+ elif grep ['^papersize[ ]\+[aA]4'] $descfile >/dev/null 2>&1; then
+ PAGE=A4
+ fi
+ fi
+ fi
+
+ if test -z "$PAGE"; then
+ dom=`awk '([$]1 == "dom" || [$]1 == "search") { print [$]2; exit}' \
+ /etc/resolv.conf 2>/dev/null`
+ if test -z "$dom"; then
+ dom=`(domainname) 2>/dev/null | tr -d '+'`
+ if test -z "$dom" \
+ || test "$dom" = '(none)'; then
+ dom=`(hostname) 2>/dev/null | grep '\.'`
+ fi
+ fi
+ # If the top-level domain is two letters and it's not `us' or `ca'
+ # then they probably use A4 paper.
+ case "$dom" in
+ [*.[Uu][Ss]|*.[Cc][Aa])]
+ ;;
+ [*.[A-Za-z][A-Za-z])]
+ PAGE=A4 ;;
+ esac
+ fi
+
+ test -n "$PAGE" || PAGE=letter
+ if test "x$PAGE" = "xA4"; then
+ AC_DEFINE([PAGEA4], [1],
+ [Define if the printer's page size is A4.])
+ fi
+ AC_MSG_RESULT([$PAGE])
+ AC_SUBST([PAGE])])
+
+AC_DEFUN([GROFF_CXX_CHECK],
+ [AC_REQUIRE([AC_PROG_CXX])
+ AC_LANG_PUSH([C++])
+ if test "$cross_compiling" = no; then
+ AC_MSG_CHECKING([that C++ compiler can compile simple program])
+ fi
+ AC_RUN_IFELSE([
+ AC_LANG_SOURCE([[
+
+int main() {
+ return 0;
+}
+
+ ]])
+ ],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([a working C++ compiler is required])],
+ [:])
+
+ if test "$cross_compiling" = no; then
+ AC_MSG_CHECKING([that C++ static constructors and destructors are called])
+ fi
+ AC_RUN_IFELSE([
+ AC_LANG_SOURCE([[
+
+extern "C" {
+ void _exit(int);
+}
+
+int i;
+struct A {
+ char dummy;
+ A() { i = 1; }
+ ~A() { if (i == 1) _exit(0); }
+};
+
+A a;
+
+int main()
+{
+ return 1;
+}
+
+ ]])
+ ],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([a working C++ compiler is required])],
+ [:])
+
+ AC_MSG_CHECKING([that header files support C++])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <stdio.h>
+
+ ]],
+ [[
+
+fopen(0, 0);
+
+ ]])
+ ],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([header files do not support C++
+ (if you are using a version of gcc/g++ earlier than 2.5,
+ you should install libg++)])])
+ AC_LANG_POP([C++])])
+
+AC_DEFUN([GROFF_TMAC],
+ [AC_MSG_CHECKING([for prefix of system macro packages])
+ sys_tmac_prefix=
+ sys_tmac_file_prefix=
+ for d in /usr/share/lib/tmac /usr/lib/tmac; do
+ for t in "" tmac.; do
+ for m in an s m; do
+ f=$d/$t$m
+ if test -z "$sys_tmac_prefix" \
+ && test -f $f \
+ && grep '^\.if' $f >/dev/null 2>&1; then
+ sys_tmac_prefix=$d/$t
+ sys_tmac_file_prefix=$t
+ fi
+ done
+ done
+ done
+ AC_MSG_RESULT([$sys_tmac_prefix])
+ AC_SUBST([sys_tmac_prefix])
+
+ AC_MSG_CHECKING([which system macro packages should be made available])
+ tmac_wrap=
+ if test "x$sys_tmac_file_prefix" = "xtmac."; then
+ for f in $sys_tmac_prefix*; do
+ suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"`
+ case "$suff" in
+ e)
+ ;;
+ *)
+ grep "Copyright.*Free Software Foundation" $f >/dev/null \
+ || tmac_wrap="$tmac_wrap $suff" ;;
+ esac
+ done
+ elif test -n "$sys_tmac_prefix"; then
+ files=`echo $sys_tmac_prefix*`
+ grep "\\.so" $files >conftest.sol
+ for f in $files; do
+ case "$f" in
+ ${sys_tmac_prefix}e)
+ ;;
+ *.me)
+ ;;
+ */ms.*)
+ ;;
+ *)
+ b=`basename $f`
+ if grep "\\.so.*/$b\$" conftest.sol >/dev/null \
+ || grep -l "Copyright.*Free Software Foundation" $f >/dev/null; then
+ :
+ else
+ suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"`
+ case "$suff" in
+ tmac.*)
+ ;;
+ *)
+ tmac_wrap="$tmac_wrap $suff" ;;
+ esac
+ fi
+ esac
+ done
+ rm -f conftest.sol
+ fi
+ AC_MSG_RESULT([$tmac_wrap])
+ AC_SUBST([tmac_wrap])])
+
+AC_DEFUN([GROFF_G],
+ [AC_MSG_CHECKING([for existing troff installation])
+ if test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then
+ AC_MSG_RESULT([yes])
+ g=g
+ else
+ AC_MSG_RESULT([no])
+ g=
+ fi
+ AC_SUBST([g])])
+
+# We need the path to install-sh to be absolute.
+
+AC_DEFUN([GROFF_INSTALL_SH],
+ [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])
+ ac_dir=`cd $ac_aux_dir; pwd`
+ ac_install_sh="$ac_dir/install-sh -c"])
+
+# Test whether install-info is available.
+
+AC_DEFUN([GROFF_INSTALL_INFO],
+ [AC_CHECK_PROGS([INSTALL_INFO], [install-info], [:])])
+
+# At least one UNIX system, Apple Macintosh Rhapsody 5.5,
+# does not have -lm ...
+
+AC_DEFUN([GROFF_LIBM],
+ [AC_CHECK_LIB([m], [sin], [LIBM=-lm])
+ AC_SUBST([LIBM])])
+
+# ... while the MinGW implementation of GCC for Microsoft Win32
+# does not seem to have -lc.
+
+AC_DEFUN([GROFF_LIBC],
+ [AC_CHECK_LIB([c], [main], [LIBC=-lc])
+ AC_SUBST([LIBC])])
+
+# Check for EBCDIC -- stolen from the OS390 Unix LYNX port
+
+AC_DEFUN([GROFF_EBCDIC],
+ [AC_MSG_CHECKING([whether character set is EBCDIC])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+
+/* Treat any failure as ASCII for compatibility with existing art.
+ Use compile-time rather than run-time tests for cross-compiler
+ tolerance. */
+#if '0' != 240
+make an error "Character set is not EBCDIC"
+#endif
+
+ ]])
+ ],
+ [groff_cv_ebcdic="yes"
+ TTYDEVDIRS="font/devcp1047"
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(IS_EBCDIC_HOST, 1,
+ [Define if the host's encoding is EBCDIC.])],
+ [groff_cv_ebcdic="no"
+ TTYDEVDIRS="font/devascii font/devlatin1"
+ OTHERDEVDIRS="font/devlj4 font/devlbp"
+ AC_MSG_RESULT([no])])
+ AC_SUBST([TTYDEVDIRS])
+ AC_SUBST([OTHERDEVDIRS])])
+
+# Check for OS/390 Unix. We test for EBCDIC also -- the Linux port (with
+# gcc) to OS/390 uses ASCII internally.
+
+AC_DEFUN([GROFF_OS390],
+ [if test "$groff_cv_ebcdic" = "yes"; then
+ AC_MSG_CHECKING([for OS/390 Unix])
+ case `uname` in
+ OS/390)
+ CFLAGS="$CFLAGS -D_ALL_SOURCE"
+ AC_MSG_RESULT([yes]) ;;
+ *)
+ AC_MSG_RESULT([no]) ;;
+ esac
+ fi])
+
+# Check whether we need a declaration for a function.
+#
+# Stolen from GNU bfd.
+
+AC_DEFUN([GROFF_NEED_DECLARATION],
+ [AC_MSG_CHECKING([whether $1 must be declared])
+ AC_LANG_PUSH([C++])
+ AC_CACHE_VAL([groff_cv_decl_needed_$1],
+ [AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
+ ]],
+ [[
+
+#ifndef $1
+ char *p = (char *) $1;
+#endif
+
+ ]])
+ ],
+ [groff_cv_decl_needed_$1=no],
+ [groff_cv_decl_needed_$1=yes])])
+ AC_MSG_RESULT([$groff_cv_decl_needed_$1])
+ if test $groff_cv_decl_needed_$1 = yes; then
+ AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), [1],
+ [Define if your C++ doesn't declare ]$1[().])
+ fi
+ AC_LANG_POP([C++])])
+
+# If mkstemp() isn't available, use our own mkstemp.cpp file.
+
+AC_DEFUN([GROFF_MKSTEMP],
+ [AC_MSG_CHECKING([for mkstemp])
+ AC_LANG_PUSH([C++])
+ AC_LIBSOURCE([mkstemp.cpp])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <stdlib.h>
+#include <unistd.h>
+int (*f) (char *);
+
+ ]],
+ [[
+
+f = mkstemp;
+
+ ]])
+ ],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_MKSTEMP], [1], [Define if you have mkstemp().])],
+ [AC_MSG_RESULT([no])
+ _AC_LIBOBJ([mkstemp])])
+ AC_LANG_POP([C++])])
+
+# Test whether <inttypes.h> exists, doesn't clash with <sys/types.h>,
+# and declares uintmax_t. Taken from the fileutils package.
+
+AC_DEFUN([GROFF_INTTYPES_H],
+ [AC_LANG_PUSH([C++])
+ AC_MSG_CHECKING([C++ <inttypes.h>])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <sys/types.h>
+#include <inttypes.h>
+
+ ]],
+ [[
+
+uintmax_t i = (uintmax_t)-1;
+
+ ]])
+ ],
+ [groff_cv_header_inttypes_h=yes
+ AC_DEFINE([HAVE_CC_INTTYPES_H], [1],
+ [Define if you have a C++ <inttypes.h>.])],
+ [groff_cv_header_inttypes_h=no])
+ AC_MSG_RESULT([$groff_cv_header_inttypes_h])
+ AC_LANG_POP([C++])])
+
+# Test for working `unsigned long long'. Taken from the fileutils package.
+
+AC_DEFUN([GROFF_UNSIGNED_LONG_LONG],
+ [AC_LANG_PUSH([C++])
+ AC_MSG_CHECKING([for unsigned long long])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[
+
+unsigned long long ull = 1;
+int i = 63;
+unsigned long long ullmax = (unsigned long long)-1;
+
+ ]],
+ [[
+
+return ull << i | ull >> i | ullmax / ull | ullmax % ull;
+
+ ]])
+ ],
+ [groff_cv_type_unsigned_long_long=yes],
+ [groff_cv_type_unsigned_long_long=no])
+ AC_MSG_RESULT([$groff_cv_type_unsigned_long_long])
+ AC_LANG_POP([C++])])
+
+# Define uintmax_t to `unsigned long' or `unsigned long long'
+# if <inttypes.h> does not exist. Taken from the fileutils package.
+
+AC_DEFUN([GROFF_UINTMAX_T],
+ [AC_REQUIRE([GROFF_INTTYPES_H])
+ if test $groff_cv_header_inttypes_h = no; then
+ AC_REQUIRE([GROFF_UNSIGNED_LONG_LONG])
+ test $groff_cv_type_unsigned_long_long = yes \
+ && ac_type='unsigned long long' \
+ || ac_type='unsigned long'
+ AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type],
+ [Define uintmax_t to `unsigned long' or `unsigned long long' if
+ <inttypes.h> does not exist.])
+ fi])
+
+# Identify PATH_SEPARATOR character to use in GROFF_FONT_PATH and
+# GROFF_TMAC_PATH which is appropriate for the target system (POSIX=':',
+# MS-DOS/Win32=';').
+#
+# The logic to resolve this test is already encapsulated in
+# `${srcdir}/src/include/nonposix.h'.
+
+AC_DEFUN([GROFF_TARGET_PATH_SEPARATOR],
+ [AC_MSG_CHECKING([separator character to use in groff search paths])
+ cp ${srcdir}/src/include/nonposix.h conftest.h
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <ctype.h>
+#include "conftest.h"
+
+ ]],
+ [[
+
+#if PATH_SEP_CHAR == ';'
+make an error "Path separator is ';'"
+#endif
+
+ ]])
+ ],
+ [GROFF_PATH_SEPARATOR=":"],
+ [GROFF_PATH_SEPARATOR=";"])
+ AC_MSG_RESULT([$GROFF_PATH_SEPARATOR])
+ AC_SUBST(GROFF_PATH_SEPARATOR)])
+
+# Check for X11.
+
+AC_DEFUN([GROFF_X11],
+ [AC_REQUIRE([AC_PATH_XTRA])
+ groff_no_x=$no_x
+ if test -z "$groff_no_x"; then
+ OLDCFLAGS=$CFLAGS
+ OLDLDFLAGS=$LDFLAGS
+ OLDLIBS=$LIBS
+ CFLAGS="$CFLAGS $X_CFLAGS"
+ LDFLAGS="$LDFLAGS $X_LIBS"
+ LIBS="$LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
+
+ LIBS="$LIBS -lXaw"
+ AC_MSG_CHECKING([for Xaw library and header files])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <X11/Intrinsic.h>
+#include <X11/Xaw/Simple.h>
+
+ ]],
+ [])
+ ],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ groff_no_x="yes"])
+
+ LIBS="$LIBS -lXmu"
+ AC_MSG_CHECKING([for Xmu library and header files])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[
+
+#include <X11/Intrinsic.h>
+#include <X11/Xmu/Converters.h>
+
+ ]],
+ [])
+ ],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ groff_no_x="yes"])
+
+ CFLAGS=$OLDCFLAGS
+ LDFLAGS=$OLDLDFLAGS
+ LIBS=$OLDLIBS
+ fi
+
+ if test "x$groff_no_x" = "xyes"; then
+ AC_MSG_NOTICE([gxditview and xtotroff won't be built])
+ else
+ XDEVDIRS="font/devX75 font/devX75-12 font/devX100 font/devX100-12"
+ XPROGDIRS="src/devices/xditview src/utils/xtotroff"
+ XLIBDIRS="src/libs/libxutil"
+ fi
+
+ AC_SUBST([XDEVDIRS])
+ AC_SUBST([XPROGDIRS])
+ AC_SUBST([XLIBDIRS])])
+
+# Set up the `--with-appresdir' command line option.
+
+AC_DEFUN([GROFF_APPRESDIR_OPTION],
+ [AC_ARG_WITH([appresdir],
+ dnl Don't quote AS_HELP_STRING!
+ AS_HELP_STRING([--with-appresdir=DIR],
+ [X11 application resource files]))])
+
+# Get a default value for the application resource directory.
+#
+# We ignore the `XAPPLRES' and `XUSERFILESEARCHPATH' environment variables.
+#
+# The goal is to find the `root' of X11. Under most systems this is
+# `/usr/X11/lib'. Application default files are then in
+# `/usr/X11/lib/X11/app-defaults'.
+#
+# Based on autoconf's AC_PATH_X macro.
+
+AC_DEFUN([GROFF_APPRESDIR_DEFAULT],
+ [if test -z "$groff_no_x"; then
+ # Create an Imakefile, run `xmkmf', then `make'.
+ rm -f -r conftest.dir
+ if mkdir conftest.dir; then
+ cd conftest.dir
+ # Make sure to not put `make' in the Imakefile rules,
+ # since we grep it out.
+ cat >Imakefile <<'EOF'
+
+xlibdirs:
+ @echo 'groff_x_usrlibdir="${USRLIBDIR}"; groff_x_libdir="${LIBDIR}"'
+EOF
+
+ if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
+ # GNU make sometimes prints "make[1]: Entering...",
+ # which would confuse us.
+ eval `${MAKE-make} xlibdirs 2>/dev/null | grep -v make`
+
+ # Open Windows `xmkmf' reportedly sets LIBDIR instead of USRLIBDIR.
+ for groff_extension in a so sl; do
+ if test ! -f $groff_x_usrlibdir/libX11.$groff_extension &&
+ test -f $groff_x_libdir/libX11.$groff_extension; then
+ groff_x_usrlibdir=$groff_x_libdir
+ break
+ fi
+ done
+ fi
+
+ cd ..
+ rm -f -r conftest.dir
+ fi
+
+ # In case the test with `xmkmf' wasn't successful, try a suite of
+ # standard directories. Check `X11' before `X11Rn' because it is often
+ # a symlink to the current release.
+ groff_x_libdirs='
+ /usr/X11/lib
+ /usr/X11R6/lib
+ /usr/X11R5/lib
+ /usr/X11R4/lib
+
+ /usr/lib/X11
+ /usr/lib/X11R6
+ /usr/lib/X11R5
+ /usr/lib/X11R4
+
+ /usr/local/X11/lib
+ /usr/local/X11R6/lib
+ /usr/local/X11R5/lib
+ /usr/local/X11R4/lib
+
+ /usr/local/lib/X11
+ /usr/local/lib/X11R6
+ /usr/local/lib/X11R5
+ /usr/local/lib/X11R4
+
+ /usr/X386/lib
+ /usr/x386/lib
+ /usr/XFree86/lib/X11
+
+ /usr/lib
+ /usr/local/lib
+ /usr/unsupported/lib
+ /usr/athena/lib
+ /usr/local/x11r5/lib
+ /usr/lpp/Xamples/lib
+
+ /usr/openwin/lib
+ /usr/openwin/share/lib'
+
+ if test -z "$groff_x_usrlibdir"; then
+ # We only test whether libX11 exists.
+ for groff_dir in $groff_x_libdirs; do
+ for groff_extension in a so sl; do
+ if test ! -r $groff_dir/libX11.$groff_extension; then
+ groff_x_usrlibdir=$groff_dir
+ break 2
+ fi
+ done
+ done
+ fi
+
+ if test "x$with_appresdir" = "x"; then
+ appresdir=$groff_x_usrlibdir/X11/app-defaults
+ else
+ appresdir=$with_appresdir
+ fi
+ fi
+ AC_SUBST([appresdir])])
+
+
+# Emit warning if --with-appresdir hasn't been used.
+
+AC_DEFUN([GROFF_APPRESDIR_CHECK],
+ [if test -z "$groff_no_x"; then
+ if test "x$with_appresdir" = "x"; then
+ AC_MSG_NOTICE([
+
+ The application resource file for gxditview will be installed as
+
+ $appresdir/GXditview
+
+ (an existing file will be saved as `GXditview.old').
+ To install it into a different directory, say, `/etc/gxditview',
+ add `--with-appresdir=/etc/gxditview' to the configure script
+ command line options and rerun it. The environment variable
+ `APPLRESDIR' must then be set to `/etc/' (note the trailing slash),
+ omitting the `gxditview' part which is automatically appended by
+ the X11 searching routines for resource files. More details can be
+ found in the X(7) manual page.
+ ])
+ fi
+ fi])
diff --git a/m4/iconv.m4 b/m4/iconv.m4
new file mode 100644
index 00000000..654c4158
--- /dev/null
+++ b/m4/iconv.m4
@@ -0,0 +1,101 @@
+# iconv.m4 serial AM4 (gettext-0.11.3)
+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
+[
+ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+
+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+ dnl accordingly.
+ AC_LIB_LINKFLAGS_BODY([iconv])
+])
+
+AC_DEFUN([AM_ICONV_LINK],
+[
+ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+ dnl those with the standalone portable GNU libiconv installed).
+
+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+ dnl accordingly.
+ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+
+ dnl Add $INCICONV to CPPFLAGS before performing the following checks,
+ dnl because if the user has installed libiconv and not disabled its use
+ dnl via --without-libiconv-prefix, he wants to use it. The first
+ dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
+ am_save_CPPFLAGS="$CPPFLAGS"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
+
+ AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
+ am_cv_func_iconv="no, consider installing GNU libiconv"
+ am_cv_lib_iconv=no
+ AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+ [iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);],
+ am_cv_func_iconv=yes)
+ if test "$am_cv_func_iconv" != yes; then
+ am_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBICONV"
+ AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+ [iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);],
+ am_cv_lib_iconv=yes
+ am_cv_func_iconv=yes)
+ LIBS="$am_save_LIBS"
+ fi
+ ])
+ if test "$am_cv_func_iconv" = yes; then
+ AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
+ fi
+ if test "$am_cv_lib_iconv" = yes; then
+ AC_MSG_CHECKING([how to link with libiconv])
+ AC_MSG_RESULT([$LIBICONV])
+ else
+ dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
+ dnl either.
+ CPPFLAGS="$am_save_CPPFLAGS"
+ LIBICONV=
+ LTLIBICONV=
+ fi
+ AC_SUBST(LIBICONV)
+ AC_SUBST(LTLIBICONV)
+])
+
+AC_DEFUN([AM_ICONV],
+[
+ AM_ICONV_LINK
+ if test "$am_cv_func_iconv" = yes; then
+ AC_MSG_CHECKING([for iconv declaration])
+ AC_CACHE_VAL(am_cv_proto_iconv, [
+ AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
+ am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
+ am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+ AC_MSG_RESULT([$]{ac_t:-
+ }[$]am_cv_proto_iconv)
+ AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
+ [Define as const if the declaration of iconv() needs const.])
+ fi
+])
diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4
new file mode 100644
index 00000000..96c4e2c3
--- /dev/null
+++ b/m4/lib-ld.m4
@@ -0,0 +1,110 @@
+# lib-ld.m4 serial 3 (gettext-0.13)
+dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Subroutines of libtool.m4,
+dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
+dnl with libtool.m4.
+
+dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
+AC_DEFUN([AC_LIB_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ acl_cv_prog_gnu_ld=yes ;;
+*)
+ acl_cv_prog_gnu_ld=no ;;
+esac])
+with_gnu_ld=$acl_cv_prog_gnu_ld
+])
+
+dnl From libtool-1.4. Sets the variable LD.
+AC_DEFUN([AC_LIB_PROG_LD],
+[AC_ARG_WITH(gnu-ld,
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]* | [A-Za-z]:[\\/]*)]
+ [re_direlt='/[^/][^/]*/\.\./']
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(acl_cv_path_LD,
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ acl_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break ;;
+ *)
+ test "$with_gnu_ld" != yes && break ;;
+ esac
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_LIB_PROG_LD_GNU
+])
diff --git a/m4/lib-link.m4 b/m4/lib-link.m4
new file mode 100644
index 00000000..244a7791
--- /dev/null
+++ b/m4/lib-link.m4
@@ -0,0 +1,554 @@
+# lib-link.m4 serial 7 (gettext-0.15)
+dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_PREREQ(2.50)
+
+dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
+dnl augments the CPPFLAGS variable.
+AC_DEFUN([AC_LIB_LINKFLAGS],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+ define([Name],[translit([$1],[./-], [___])])
+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
+ AC_LIB_LINKFLAGS_BODY([$1], [$2])
+ ac_cv_lib[]Name[]_libs="$LIB[]NAME"
+ ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
+ ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
+ ])
+ LIB[]NAME="$ac_cv_lib[]Name[]_libs"
+ LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
+ INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+ AC_SUBST([LIB]NAME)
+ AC_SUBST([LTLIB]NAME)
+ dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
+ dnl results of this search when this library appears as a dependency.
+ HAVE_LIB[]NAME=yes
+ undefine([Name])
+ undefine([NAME])
+])
+
+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
+dnl searches for libname and the libraries corresponding to explicit and
+dnl implicit dependencies, together with the specified include files and
+dnl the ability to compile and link the specified testcode. If found, it
+dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
+dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
+dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
+dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
+AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+ define([Name],[translit([$1],[./-], [___])])
+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+
+ dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
+ dnl accordingly.
+ AC_LIB_LINKFLAGS_BODY([$1], [$2])
+
+ dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
+ dnl because if the user has installed lib[]Name and not disabled its use
+ dnl via --without-lib[]Name-prefix, he wants to use it.
+ ac_save_CPPFLAGS="$CPPFLAGS"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+
+ AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
+ ac_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIB[]NAME"
+ AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
+ LIBS="$ac_save_LIBS"
+ ])
+ if test "$ac_cv_lib[]Name" = yes; then
+ HAVE_LIB[]NAME=yes
+ AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
+ AC_MSG_CHECKING([how to link with lib[]$1])
+ AC_MSG_RESULT([$LIB[]NAME])
+ else
+ HAVE_LIB[]NAME=no
+ dnl If $LIB[]NAME didn't lead to a usable library, we don't need
+ dnl $INC[]NAME either.
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ LIB[]NAME=
+ LTLIB[]NAME=
+ fi
+ AC_SUBST([HAVE_LIB]NAME)
+ AC_SUBST([LIB]NAME)
+ AC_SUBST([LTLIB]NAME)
+ undefine([Name])
+ undefine([NAME])
+])
+
+dnl Determine the platform dependent parameters needed to use rpath:
+dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
+dnl hardcode_direct, hardcode_minus_L.
+AC_DEFUN([AC_LIB_RPATH],
+[
+ dnl Tell automake >= 1.10 to complain if config.rpath is missing.
+ m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
+ AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
+ AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
+ AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
+ AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
+ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+ . ./conftest.sh
+ rm -f ./conftest.sh
+ acl_cv_rpath=done
+ ])
+ wl="$acl_cv_wl"
+ libext="$acl_cv_libext"
+ shlibext="$acl_cv_shlibext"
+ hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+ hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+ hardcode_direct="$acl_cv_hardcode_direct"
+ hardcode_minus_L="$acl_cv_hardcode_minus_L"
+ dnl Determine whether the user wants rpath handling at all.
+ AC_ARG_ENABLE(rpath,
+ [ --disable-rpath do not hardcode runtime library paths],
+ :, enable_rpath=yes)
+])
+
+dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
+AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ dnl By default, look in $includedir and $libdir.
+ use_additional=yes
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ AC_LIB_ARG_WITH([lib$1-prefix],
+[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
+ --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
+[
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ fi
+ fi
+])
+ dnl Search the library and its dependencies in $additional_libdir and
+ dnl $LDFLAGS. Using breadth-first-seach.
+ LIB[]NAME=
+ LTLIB[]NAME=
+ INC[]NAME=
+ rpathdirs=
+ ltrpathdirs=
+ names_already_handled=
+ names_next_round='$1 $2'
+ while test -n "$names_next_round"; do
+ names_this_round="$names_next_round"
+ names_next_round=
+ for name in $names_this_round; do
+ already_handled=
+ for n in $names_already_handled; do
+ if test "$n" = "$name"; then
+ already_handled=yes
+ break
+ fi
+ done
+ if test -z "$already_handled"; then
+ names_already_handled="$names_already_handled $name"
+ dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
+ dnl or AC_LIB_HAVE_LINKFLAGS call.
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+ eval value=\"\$HAVE_LIB$uppername\"
+ if test -n "$value"; then
+ if test "$value" = yes; then
+ eval value=\"\$LIB$uppername\"
+ test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
+ eval value=\"\$LTLIB$uppername\"
+ test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
+ else
+ dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
+ dnl that this library doesn't exist. So just drop it.
+ :
+ fi
+ else
+ dnl Search the library lib$name in $additional_libdir and $LDFLAGS
+ dnl and the already constructed $LIBNAME/$LTLIBNAME.
+ found_dir=
+ found_la=
+ found_so=
+ found_a=
+ if test $use_additional = yes; then
+ if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
+ found_dir="$additional_libdir"
+ found_so="$additional_libdir/lib$name.$shlibext"
+ if test -f "$additional_libdir/lib$name.la"; then
+ found_la="$additional_libdir/lib$name.la"
+ fi
+ else
+ if test -f "$additional_libdir/lib$name.$libext"; then
+ found_dir="$additional_libdir"
+ found_a="$additional_libdir/lib$name.$libext"
+ if test -f "$additional_libdir/lib$name.la"; then
+ found_la="$additional_libdir/lib$name.la"
+ fi
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ for x in $LDFLAGS $LTLIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ case "$x" in
+ -L*)
+ dir=`echo "X$x" | sed -e 's/^X-L//'`
+ if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
+ found_dir="$dir"
+ found_so="$dir/lib$name.$shlibext"
+ if test -f "$dir/lib$name.la"; then
+ found_la="$dir/lib$name.la"
+ fi
+ else
+ if test -f "$dir/lib$name.$libext"; then
+ found_dir="$dir"
+ found_a="$dir/lib$name.$libext"
+ if test -f "$dir/lib$name.la"; then
+ found_la="$dir/lib$name.la"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ if test "X$found_dir" != "X"; then
+ break
+ fi
+ done
+ fi
+ if test "X$found_dir" != "X"; then
+ dnl Found the library.
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
+ if test "X$found_so" != "X"; then
+ dnl Linking with a shared library. We attempt to hardcode its
+ dnl directory into the executable's runpath, unless it's the
+ dnl standard /usr/lib.
+ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
+ dnl No hardcoding is needed.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ dnl Use an explicit option to hardcode DIR into the resulting
+ dnl binary.
+ dnl Potentially add DIR to ltrpathdirs.
+ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $found_dir"
+ fi
+ dnl The hardcoding into $LIBNAME is system dependent.
+ if test "$hardcode_direct" = yes; then
+ dnl Using DIR/libNAME.so during linking hardcodes DIR into the
+ dnl resulting binary.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+ dnl Use an explicit option to hardcode DIR into the resulting
+ dnl binary.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ dnl Potentially add DIR to rpathdirs.
+ dnl The rpathdirs will be appended to $LIBNAME at the end.
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $found_dir"
+ fi
+ else
+ dnl Rely on "-L$found_dir".
+ dnl But don't add it if it's already contained in the LDFLAGS
+ dnl or the already constructed $LIBNAME
+ haveit=
+ for x in $LDFLAGS $LIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
+ fi
+ if test "$hardcode_minus_L" != no; then
+ dnl FIXME: Not sure whether we should use
+ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+ dnl here.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
+ dnl here, because this doesn't fit in flags passed to the
+ dnl compiler. So give up. No hardcoding. This affects only
+ dnl very old systems.
+ dnl FIXME: Not sure whether we should use
+ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+ dnl here.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+ fi
+ fi
+ fi
+ fi
+ else
+ if test "X$found_a" != "X"; then
+ dnl Linking with a static library.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
+ else
+ dnl We shouldn't come here, but anyway it's good to have a
+ dnl fallback.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
+ fi
+ fi
+ dnl Assume the include files are nearby.
+ additional_includedir=
+ case "$found_dir" in
+ */$acl_libdirstem | */$acl_libdirstem/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+ additional_includedir="$basedir/include"
+ ;;
+ esac
+ if test "X$additional_includedir" != "X"; then
+ dnl Potentially add $additional_includedir to $INCNAME.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/include,
+ dnl 2. if it's /usr/local/include and we are using GCC on Linux,
+ dnl 3. if it's already present in $CPPFLAGS or the already
+ dnl constructed $INCNAME,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ for x in $CPPFLAGS $INC[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ dnl Really add $additional_includedir to $INCNAME.
+ INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ fi
+ dnl Look for dependencies.
+ if test -n "$found_la"; then
+ dnl Read the .la file. It defines the variables
+ dnl dlname, library_names, old_library, dependency_libs, current,
+ dnl age, revision, installed, dlopen, dlpreopen, libdir.
+ save_libdir="$libdir"
+ case "$found_la" in
+ */* | *\\*) . "$found_la" ;;
+ *) . "./$found_la" ;;
+ esac
+ libdir="$save_libdir"
+ dnl We use only dependency_libs.
+ for dep in $dependency_libs; do
+ case "$dep" in
+ -L*)
+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+ dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/lib,
+ dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
+ dnl 3. if it's already present in $LDFLAGS or the already
+ dnl constructed $LIBNAME,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+ haveit=
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ haveit=
+ for x in $LDFLAGS $LIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LIBNAME.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
+ fi
+ fi
+ haveit=
+ for x in $LDFLAGS $LTLIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LTLIBNAME.
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ ;;
+ -R*)
+ dir=`echo "X$dep" | sed -e 's/^X-R//'`
+ if test "$enable_rpath" != no; then
+ dnl Potentially add DIR to rpathdirs.
+ dnl The rpathdirs will be appended to $LIBNAME at the end.
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ dnl Potentially add DIR to ltrpathdirs.
+ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $dir"
+ fi
+ fi
+ ;;
+ -l*)
+ dnl Handle this in the next round.
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+ ;;
+ *.la)
+ dnl Handle this in the next round. Throw away the .la's
+ dnl directory; it is already contained in a preceding -L
+ dnl option.
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+ ;;
+ *)
+ dnl Most likely an immediate library name.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
+ ;;
+ esac
+ done
+ fi
+ else
+ dnl Didn't find the library; assume it is in the system directories
+ dnl known to the linker and runtime loader. (All the system
+ dnl directories known to the linker should also be known to the
+ dnl runtime loader, otherwise the system is severely misconfigured.)
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
+ fi
+ fi
+ fi
+ done
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n "$hardcode_libdir_separator"; then
+ dnl Weird platform: only the last -rpath option counts, the user must
+ dnl pass all path elements in one option. We can arrange that for a
+ dnl single library, but not when more than one $LIBNAMEs are used.
+ alldirs=
+ for found_dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
+ done
+ dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+ else
+ dnl The -rpath options are cumulative.
+ for found_dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$found_dir"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+ done
+ fi
+ fi
+ if test "X$ltrpathdirs" != "X"; then
+ dnl When using libtool, the option that works for both libraries and
+ dnl executables is -R. The -R options are cumulative.
+ for found_dir in $ltrpathdirs; do
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
+ done
+ fi
+])
+
+dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
+dnl unless already present in VAR.
+dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
+dnl contains two or three consecutive elements that belong together.
+AC_DEFUN([AC_LIB_APPENDTOVAR],
+[
+ for element in [$2]; do
+ haveit=
+ for x in $[$1]; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X$element"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ [$1]="${[$1]}${[$1]:+ }$element"
+ fi
+ done
+])
diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4
new file mode 100644
index 00000000..a8684e17
--- /dev/null
+++ b/m4/lib-prefix.m4
@@ -0,0 +1,185 @@
+# lib-prefix.m4 serial 5 (gettext-0.15)
+dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
+dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
+dnl require excessive bracketing.
+ifdef([AC_HELP_STRING],
+[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
+[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
+
+dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
+dnl to access previously installed libraries. The basic assumption is that
+dnl a user will want packages to use other packages he previously installed
+dnl with the same --prefix option.
+dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
+dnl libraries, but is otherwise very convenient.
+AC_DEFUN([AC_LIB_PREFIX],
+[
+ AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ dnl By default, look in $includedir and $libdir.
+ use_additional=yes
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ AC_LIB_ARG_WITH([lib-prefix],
+[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
+ --without-lib-prefix don't search for libraries in includedir and libdir],
+[
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ fi
+ fi
+])
+ if test $use_additional = yes; then
+ dnl Potentially add $additional_includedir to $CPPFLAGS.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/include,
+ dnl 2. if it's already present in $CPPFLAGS,
+ dnl 3. if it's /usr/local/include and we are using GCC on Linux,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ for x in $CPPFLAGS; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ dnl Really add $additional_includedir to $CPPFLAGS.
+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ dnl Potentially add $additional_libdir to $LDFLAGS.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/lib,
+ dnl 2. if it's already present in $LDFLAGS,
+ dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+ haveit=
+ for x in $LDFLAGS; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux*) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LDFLAGS.
+ LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ fi
+])
+
+dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
+dnl acl_final_exec_prefix, containing the values to which $prefix and
+dnl $exec_prefix will expand at the end of the configure script.
+AC_DEFUN([AC_LIB_PREPARE_PREFIX],
+[
+ dnl Unfortunately, prefix and exec_prefix get only finally determined
+ dnl at the end of configure.
+ if test "X$prefix" = "XNONE"; then
+ acl_final_prefix="$ac_default_prefix"
+ else
+ acl_final_prefix="$prefix"
+ fi
+ if test "X$exec_prefix" = "XNONE"; then
+ acl_final_exec_prefix='${prefix}'
+ else
+ acl_final_exec_prefix="$exec_prefix"
+ fi
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+ prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
+dnl variables prefix and exec_prefix bound to the values they will have
+dnl at the end of the configure script.
+AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
+[
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ $1
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
+dnl the basename of the libdir, either "lib" or "lib64".
+AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
+[
+ dnl There is no formal standard regarding lib and lib64. The current
+ dnl practice is that on a system supporting 32-bit and 64-bit instruction
+ dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
+ dnl libraries go under $prefix/lib. We determine the compiler's default
+ dnl mode by looking at the compiler's library search path. If at least
+ dnl of its elements ends in /lib64 or points to a directory whose absolute
+ dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
+ dnl default, namely "lib".
+ acl_libdirstem=lib
+ searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+ if test -n "$searchpath"; then
+ acl_save_IFS="${IFS= }"; IFS=":"
+ for searchdir in $searchpath; do
+ if test -d "$searchdir"; then
+ case "$searchdir" in
+ */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
+ *) searchdir=`cd "$searchdir" && pwd`
+ case "$searchdir" in
+ */lib64 ) acl_libdirstem=lib64 ;;
+ esac ;;
+ esac
+ fi
+ done
+ IFS="$acl_save_IFS"
+ fi
+])