xref: /openbsd/gnu/usr.bin/texinfo/configure.ac (revision a1acfa9b)
1# Process this file with autoconf to produce a configure script.
2# $Id: configure.ac,v 1.1.1.2 2006/07/17 16:03:10 espie Exp $
3#
4# This file is free software; as a special exception the author gives
5# unlimited permission to copy and/or distribute it, with or without
6# modifications, as long as this notice is preserved.
7#
8# This program is distributed in the hope that it will be useful, but
9# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11#
12AC_PREREQ(2.59)# Minimum Autoconf version required.
13#
14AC_INIT([GNU Texinfo], [4.8])
15AC_CONFIG_HEADERS(config.h:config.in)# Keep filename to 8.3 for MS-DOS.
16AC_CONFIG_SRCDIR([makeinfo/makeinfo.c])
17AM_INIT_AUTOMAKE([dist-bzip2])
18
19# When the Texinfo source is imported into other repositories
20# (NetBSD and TeX Live), timestamps are generally not preserved.  This
21# causes lots of annoyance, so --enable-maintainer-mode.  Sorry.
22AM_MAINTAINER_MODE
23
24# Checks for programs.
25AC_PROG_CC
26AC_PROG_GCC_TRADITIONAL
27AC_PROG_INSTALL
28AC_PROG_MAKE_SET
29AC_PROG_RANLIB
30AM_MISSING_PROG(HELP2MAN, help2man)
31
32AC_ISC_POSIX
33AC_MINIX
34
35# Needed on sysV68 for sigblock, sigsetmask.  But check for it in libc first.
36AC_CHECK_FUNC(sigblock, , AC_CHECK_LIB(bsd, sigblock))
37
38# Checks for header files.
39AC_HEADER_STAT
40AC_HEADER_STDC
41AC_CHECK_HEADERS(fcntl.h io.h limits.h pwd.h string.h strings.h \
42  termcap.h termio.h termios.h unistd.h \
43  sys/fcntl.h sys/file.h sys/stream.h sys/time.h sys/ttold.h sys/wait.h)
44
45# sys/ptem.h requires sys/stream.h for mblk_t on Solaris.
46AC_CHECK_HEADERS([sys/ptem.h],,,
47[#if HAVE_SYS_STREAM_H
48#include <sys/stream.h>
49#endif
50])
51
52AC_SYS_POSIX_TERMIOS
53AC_HEADER_TIOCGWINSZ
54
55# Checks for typedefs, structures, and compiler characteristics.
56AC_TYPE_OFF_T
57AC_TYPE_SIGNAL
58AC_C_CONST
59AC_STRUCT_TM
60
61# Checks for function declarations.
62AC_CHECK_DECLS([memchr, strcoll, strerror])
63
64# Checks for library functions.
65AC_FUNC_ALLOCA
66AC_FUNC_STRCOLL
67AC_FUNC_VPRINTF
68# in theory only pre-sysvr3 systems needed this and it's not likely
69# that anyone compiling new texinfo still has such a thing? we'll see.
70# AC_FUNC_SETVBUF_REVERSED
71AC_CHECK_FUNCS(bzero getcwd memset setvbuf sigaction sigprocmask \
72               sigsetmask strchr)
73AC_REPLACE_FUNCS(memcpy memmove strdup strerror)
74
75# strcasecmp and strncasecmp, gnulib-style.
76gl_STRCASE
77
78# We want to recognize djgpp to avoid the useless warning about no
79# term library.
80AC_CANONICAL_BUILD
81
82# We need to run some of our own binaries, most notably makedoc, but as
83# long as we have this process, we also use our own makeinfo and
84# install-info.
85#
86# This means that if we are cross compiling, we have to configure the
87# package twice: once with the native compiler (this is done in a
88# subdirectory $native_tools), and once with the cross compiler.
89# The former is invoked automatically here, with --host=$build.
90# $native_tools is also added to SUBDIRS in the main Makefile.am,
91# so that make compiles the native tools first.
92#
93if test "$cross_compiling" = no; then
94  native_tools=
95else
96  native_tools=tools
97  test -d "$native_tools" || mkdir "$native_tools"
98  confdir=`(cd "$srcdir";pwd)`
99  # Make sure the secondary configure won't fail with
100  # "error: source directory already configured".
101  rm -f config.status
102  AC_MSG_NOTICE([[Doing configure of native tools (${build}).]])
103  cd "$native_tools" || exit 1
104  # Run secondary configure in alternate environment or
105  # it gets the wrong CC etc.  env -i gives this build host configure
106  # a clean environment.
107  env -i CC="${BUILD_CC}" AR="${BUILD_AR}" RANLIB="${BUILD_RANLIB}" \
108      PATH="${PATH}" \
109      tools_only=1 \
110    ${confdir}/configure --build=${build} --host=${build} \
111                         --disable-rpath --disable-nls
112  cd .. || exit 1
113  AC_MSG_NOTICE([[Continuing with main configure (${host}).]])
114fi
115AC_SUBST(native_tools)
116AM_CONDITIONAL(TOOLS_ONLY, [[test "x$tools_only" = x1]])
117
118# Some GNU/Linux systems (e.g., SuSE 4.3, 1996) don't have curses, but
119# rather ncurses.  So we check for it.
120TERMLIBS=
121# Check for termlib before termcap because Solaris termcap needs libucb.
122TERMLIB_VARIANTS="ncurses curses termlib termcap terminfo"
123for termlib in ${TERMLIB_VARIANTS}; do
124  AC_CHECK_LIB(${termlib}, tgetent,
125     [TERMLIBS="${TERMLIBS} -l${termlib}"; break])
126done
127# don't bother warning on djgpp, it doesn't have a term library, it
128# ports each termcap-needing program separately according to its needs.
129if test -z "$TERMLIBS" && echo "$build" | grep -v djgpp >/dev/null; then
130  AC_MSG_WARN([probably need a terminal library, one of: ${TERMLIB_VARIANTS}])
131fi
132
133# Checks for variables.
134# HP-UX 9 (at least) needs -lncurses which defines termcap variables PC etc.
135AC_MSG_CHECKING(for library with termcap variables)
136AC_CACHE_VAL(ac_cv_var_ospeed,
137oldLIBS=$LIBS
138for trylib in $termlib ${TERMLIB_VARIANTS}; do
139   if test "x$trylib" != "x$termlib"; then
140     LIBS="$oldLIBS -l$termlib -l$trylib"
141   else
142     LIBS="$oldLIBS -l$termlib"
143   fi
144   AC_TRY_LINK(,
145[#ifdef HAVE_NCURSES_TERMCAP_H
146#include <ncurses/termcap.h>
147#else
148#ifdef HAVE_TERMCAP_H
149#include <termcap.h>
150#else
151#undef PC
152char *BC;
153char **UP;
154char PC;
155short ospeed;
156#endif
157#endif
158/* Make sure all variables actually exist.  AIX 4.3 has ospeed but no BC.
159   --Andreas Ley <andy@rz.uni-karlsruhe.de> 24 Aug 2000.  */
160BC++;
161UP++;
162PC++;
163return ospeed != 0;
164], ac_cv_var_ospeed=$trylib; break)
165done
166LIBS=$oldLIBS
167)
168AC_MSG_RESULT($ac_cv_var_ospeed)
169if test -n "$ac_cv_var_ospeed" \
170   && test "x$termlib" != "x$ac_cv_var_ospeed"; then
171  TERMLIBS="${TERMLIBS} -l${ac_cv_var_ospeed}"
172fi
173AC_SUBST(TERMLIBS)#
174
175# Do not use <ncurses/termcap.h> unless we're linking with ncurses.
176# Must come after the termlib tests.
177if test "x$termlib" = xncurses; then
178  # Use AC_CHECK_HEADERS so the HAVE_*_H symbol gets defined.
179  AC_CHECK_HEADERS(ncurses/termcap.h)
180fi
181
182# gnulib.
183gl_FUNC_MKSTEMP
184
185# For teTeX and TeX Live.
186AC_CANONICAL_HOST
187AC_ARG_ENABLE(multiplatform,
188  [  --enable-multiplatform      put executables in bin/PLATFORM])
189# if enable_multiplatform is set in the environment, use that.
190test "x$enable_multiplatform" = xyes \
191&& test "x$bindir" = 'x${exec_prefix}/bin' \
192&& bindir="$bindir/$host"
193
194# Taken from the example in
195# http://www.gnu.org/software/automake/manual/html_node/Conditionals.html.
196AC_ARG_ENABLE(install-warnings,
197  [  --disable-install-warnings  omit make install warnings about TeX files],
198  [case "${enableval}" in
199     yes) install_warnings=true ;;
200      no) install_warnings=false ;;
201       *) AC_MSG_ERROR(bad value ${enableval} for --enable-install-warnings) ;;
202   esac],
203   [install_warnings=true])
204AM_CONDITIONAL(INSTALL_WARNINGS,
205   test x"$install_warnings" = xtrue || test x"$install_warnings" = xyes)
206
207# i18n support.  To update to a new version of gettext, run:
208# gettextize -f -c --intl
209AM_GNU_GETTEXT_VERSION(0.14.1)
210AM_GNU_GETTEXT()
211
212AC_CONFIG_FILES([
213  Makefile
214  doc/Makefile
215  info/Makefile
216  intl/Makefile
217  lib/Makefile
218  m4/Makefile
219  makeinfo/Makefile
220  makeinfo/tests/Makefile
221  po/Makefile.in
222  util/Makefile
223])
224AC_OUTPUT
225