1dnl Configuration for the gettext-tools directory of GNU gettext
2dnl Copyright (C) 1995-1999, 2000-2006 Free Software Foundation, Inc.
3dnl
4dnl This program is free software; you can redistribute it and/or modify
5dnl it under the terms of the GNU General Public License as published by
6dnl the Free Software Foundation; either version 2, or (at your option)
7dnl any later version.
8dnl
9dnl This program is distributed in the hope that it will be useful,
10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12dnl GNU General Public License for more details.
13dnl
14dnl You should have received a copy of the GNU General Public License
15dnl along with this program; if not, write to the Free Software Foundation,
16dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18dnl Process this file with autoconf to produce a configure script.
19
20AC_PREREQ([2.59])
21AC_INIT
22AC_CONFIG_SRCDIR(src/msgfmt.c)
23AC_CONFIG_AUX_DIR(../build-aux)
24. $srcdir/../version.sh
25AM_INIT_AUTOMAKE(gettext-tools, $VERSION_NUMBER)
26AM_CONFIG_HEADER(config.h)
27
28dnl Installation directories.
29test "$docdir" != '${datarootdir}/doc/${PACKAGE}' || docdir='${datarootdir}/doc/gettext'
30
31dnl Checks for programs.
32AC_PROG_CC
33AC_PROG_INSTALL
34AC_PROG_YACC
35
36gt_JAVA_CHOICE
37
38gt_GCJ
39if test -n "$HAVE_GCJ" && test "$JAVA_CHOICE" = yes; then
40  BUILDJAVAEXE=yes
41else
42  BUILDJAVAEXE=no
43fi
44AC_SUBST(BUILDJAVAEXE)
45
46gt_JAVAEXEC
47gt_JAVACOMP([1.3])
48AC_CHECK_PROG(JAR, jar, jar)
49if test -n "$HAVE_JAVACOMP" && test -n "$JAR" && test "$JAVA_CHOICE" != no; then
50  BUILDJAVA=yes
51else
52  BUILDJAVA=no
53fi
54AC_SUBST(BUILDJAVA)
55if test -n "$HAVE_JAVAEXEC" && test $BUILDJAVA = yes; then
56  TESTJAVA=yes
57else
58  TESTJAVA=no
59fi
60AC_SUBST(TESTJAVA)
61
62gt_CSHARPCOMP
63if test -n "$HAVE_CSHARPCOMP" && test "$CSHARP_CHOICE" != no; then
64  BUILDCSHARP=yes
65else
66  BUILDCSHARP=no
67fi
68AC_SUBST(BUILDCSHARP)
69
70gt_CSHARPEXEC([csharpexec-test.exe], [$srcdir/m4])
71if test -n "$HAVE_CSHARPEXEC" && test $BUILDCSHARP = yes; then
72  TESTCSHARP=yes
73else
74  TESTCSHARP=no
75fi
76AC_SUBST(TESTCSHARP)
77
78dnl Check for host type.
79AC_CANONICAL_HOST
80
81dnl Checks for compiler output filename suffixes.
82AC_OBJEXT
83AC_EXEEXT
84
85dnl Make sure we see all GNU and Solaris extensions.
86gl_EARLY
87gtpo_EARLY
88
89dnl Check for build configuration.
90gl_WOE32_DLL
91AC_LIBTOOL_WIN32_DLL
92AC_PROG_LIBTOOL
93case "$host_os" in
94  # On Cygwin, without -no-undefined, a warning is emitted and only a static
95  # library is built.
96  beos* | mingw* | cygwin*) LTNOUNDEF='-no-undefined' ;;
97  *) LTNOUNDEF='' ;;
98esac
99AC_SUBST([LTNOUNDEF])
100
101dnl Checks for libraries.
102
103dnl These are the only lines required to internationalize the package.
104dnl (OK, not quite, the AC_CONFIG_FILES has also some parts.)
105AM_GNU_GETTEXT(use-libtool, need-ngettext)
106
107dnl This line internationalizes the bison generated parsers.
108BISON_I18N
109
110dnl Test whether msgmerge must be linked against libm. This is the case on
111dnl most systems; but BeOS has all <math.h> functions in libc and doesn't have
112dnl a libm.
113MSGMERGE_LIBM=?
114AC_TRY_LINK([#include <math.h>], [static double x; x = ceil(x); x = sqrt(x);],
115  [MSGMERGE_LIBM=])
116if test "$MSGMERGE_LIBM" = "?"; then
117  save_LIBS="$LIBS" 
118  LIBS="$LIBS -lm"
119  AC_TRY_LINK([#include <math.h>], [static double x; x = ceil(x); x = sqrt(x);],
120    [MSGMERGE_LIBM="-lm"])
121  LIBS="$save_LIBS"
122fi
123if test "$MSGMERGE_LIBM" = "?"; then
124  MSGMERGE_LIBM=
125fi
126AC_SUBST([MSGMERGE_LIBM])
127
128dnl Test for compiler flags needed to support OpenMP.
129gt_OPENMP
130
131dnl Checks for header files, functions and declarations.
132gl_INIT
133gtpo_INIT
134
135dnl Checks for header files.
136AC_CHECK_HEADERS(pwd.h)
137
138dnl Checks for typedefs, structures, and compiler characteristics.
139AC_C_INLINE
140gl_AC_TYPE_UNSIGNED_LONG_LONG
141AC_TYPE_SIZE_T
142AC_CHECK_TYPES(ptrdiff_t)
143gt_TYPE_SSIZE_T
144AC_TYPE_PID_T
145gl_GLIBC21
146if test $GLIBC21 = yes; then
147  AC_CHECK_MEMBERS([struct __locale_struct.__names], , , [#include <xlocale.h>])
148fi
149
150dnl Checks for library functions.
151AC_CHECK_FUNCS([select])
152AC_FUNC_VFORK
153gt_SIGINFO
154gt_SETLOCALE
155gt_LIBGREP
156AC_C_BIGENDIAN([endianness=1], [endianness=0],
157  [echo "AC-C-BIGENDIAN fails to work on your system." | sed -e 's,-,_,g' 1>&2
158   echo "Please report this as a bug to bug-autoconf@gnu.org" 1>&2
159   exit 1])
160AC_DEFINE_UNQUOTED([ENDIANNESS], [$endianness],
161  [Define according to the byte order of the target machine: 1 for big endian, 0 for little endian.])
162
163gt_PREREQ_HOSTNAME
164
165dnl Compilation on mingw and Cygwin needs special Makefile rules, because
166dnl 1. when we install a shared library, we must arrange to export
167dnl    auxiliary pointer variables for every exported variable,
168dnl 2. when we install a shared library and a static library simultaneously,
169dnl    the include file specifies __declspec(dllimport) and therefore we
170dnl    must arrange to define the auxiliary pointer variables for the
171dnl    exported variables _also_ in the static library.
172if test "$enable_shared" = yes; then
173  case "$host_os" in
174    mingw* | cygwin*) is_woe32dll=yes ;;
175    *) is_woe32dll=no ;;
176  esac
177else
178  is_woe32dll=no
179fi
180AM_CONDITIONAL([WOE32DLL], [test $is_woe32dll = yes])
181if test $is_woe32dll = yes; then
182  AC_DEFINE([WOE32DLL], 1,
183    [Define when --enable-shared is used on mingw or Cygwin.])
184fi
185
186dnl Put some default definitions into config.h.
187AH_TOP([
188/* Default value for alignment of strings in .mo file.  */
189#define DEFAULT_OUTPUT_ALIGNMENT 1
190])
191AH_BOTTOM([
192/* Indicator for intl/ that it is compiled for testing purposes only.  */
193#define USE_IN_GETTEXT_TESTS
194
195/* A file name cannot consist of any character possible.  INVALID_PATH_CHAR
196   contains the characters not allowed.  */
197#if defined _MSC_VER || defined __MINGW32__
198/* Woe32.  This string is valid for Windows NT/2000.  On Windows 95/98/ME some
199   few characters in the range 0x80..0xff are invalid as well, but this doesn't
200   matter much for our purposes.  */
201# define INVALID_PATH_CHAR "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\"*/:<>?\\|"
202#elif defined MSDOS
203/* Something like this for MSDOG.  */
204# define INVALID_PATH_CHAR "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 \177\\:."
205#else
206/* Unix.  */
207# define INVALID_PATH_CHAR "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 \177/"
208#endif
209
210/* This is the page width for the message_print function.  It should
211   not be set to more than 79 characters (Emacs users will appreciate
212   it).  It is used to wrap the msgid and msgstr strings, and also to
213   wrap the file position (#:) comments.  */
214#define PAGE_WIDTH 79
215
216/* On Windows, variables that may be in a DLL must be marked specially.  */
217#if ((defined _MSC_VER && defined _DLL) || defined WOE32DLL) && !defined IN_RELOCWRAPPER
218# define DLL_VARIABLE __declspec (dllimport)
219#else
220# define DLL_VARIABLE
221#endif
222
223/* Extra OS/2 (emx+gcc) defines.  */
224#ifdef __EMX__
225# include "intl/os2compat.h"
226#endif
227])
228
229dnl Check for the expat XML parser.
230dnl On operating systems where binary distribution vendors are likely to
231dnl ship both gettext and expat, we use dynamic loading to avoid a hard
232dnl dependency from gettext to expat.
233case "$host_os" in
234  linux*)
235    AC_DEFINE([DYNLOAD_LIBEXPAT], 1,
236      [Define to 1 if libexpat shall be dynamically loaded via dlopen().])
237    LIBEXPAT="-ldl"
238    LTLIBEXPAT="-ldl"
239    AC_SUBST(LIBEXPAT)
240    AC_SUBST(LTLIBEXPAT)
241    ;;
242  *)
243    AC_LIB_HAVE_LINKFLAGS([expat], [],
244      [#include <expat.h>], [XML_ExpatVersion();])
245    ;;
246esac
247
248dnl Check for nm output filter that yields the exported symbols.
249AC_DEFUN([gt_GLOBAL_SYMBOL_PIPE], [
250  AC_REQUIRE([AC_PROG_NM]) dnl provided by libtool.m4
251  AC_SUBST([NM])
252  AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE]) dnl provided by libtool.m4
253  GLOBAL_SYMBOL_PIPE=$lt_cv_sys_global_symbol_pipe
254  AC_SUBST([GLOBAL_SYMBOL_PIPE])
255  if test -n "$GLOBAL_SYMBOL_PIPE"; then
256    HAVE_GLOBAL_SYMBOL_PIPE=1
257  else
258    HAVE_GLOBAL_SYMBOL_PIPE=
259  fi
260  AC_SUBST([HAVE_GLOBAL_SYMBOL_PIPE])
261])
262gt_GLOBAL_SYMBOL_PIPE
263
264dnl Check for Emacs and where to install .elc files.
265AM_PATH_LISPDIR
266dnl Sometimes Emacs is badly installed. Allow the user to work around it.
267AC_ARG_WITH([emacs],
268  [  --without-emacs         do not use Emacs, don't install po-mode],
269  [gt_use_emacs=$withval],
270  [gt_use_emacs=yes])
271if test "$EMACS" != no; then
272  AC_MSG_CHECKING([whether Emacs support is requested])
273  AC_MSG_RESULT([$gt_use_emacs])
274  if test "$gt_use_emacs" = no; then
275    EMACS=no
276  fi
277fi
278
279aclocaldir='${datadir}/aclocal'
280AC_SUBST(aclocaldir)
281
282dnl Check for tools needed for formatting the documentation.
283ac_aux_dir_abs=`cd $ac_aux_dir && pwd`
284AC_PATH_PROG(DVIPS, dvips, $ac_aux_dir_abs/missing dvips)
285AC_PATH_PROG(TEXI2PDF, texi2pdf, $ac_aux_dir_abs/missing texi2pdf)
286AC_PATH_PROG(PERL, perl, $ac_aux_dir_abs/missing perl)
287
288dnl Check for tools needed for formatting man pages.
289CROSS_COMPILING=$cross_compiling
290AC_SUBST(CROSS_COMPILING)
291
292dnl Checks for optional programs for the tests/lang-* tests.
293gt_PROG_ANSI_CXX
294gt_LOCALE_FR
295gt_LOCALE_FR_UTF8
296
297dnl Check whether to execute tests that rely on libasprintf.
298dnl This test must be consistent with gettext-runtime/configure.ac.
299if test "${enable_libasprintf+set}" = set; then
300  if test "$enable_libasprintf" != no; then
301    TESTLIBASPRINTF=yes
302  else
303    TESTLIBASPRINTF=no
304  fi
305else
306  TESTLIBASPRINTF=yes
307fi
308if test "$CXX" = ":"; then
309  TESTLIBASPRINTF=no
310fi
311AC_SUBST(TESTLIBASPRINTF)
312
313dnl Generate the version information file in the intl/ directory.
314test -d intl || mkdir intl
315echo "GNU gettext library from gettext-$VERSION" > intl/VERSION
316cat > intl/ChangeLog.inst <<EOF
317$RELEASE_DATE  GNU  <bug-gnu-gettext@gnu.org>
318
319	* Version $VERSION released.
320
321EOF
322
323AC_CONFIG_SUBDIRS(examples)
324
325AC_CONFIG_FILES([Makefile])
326
327AC_CONFIG_FILES([doc/Makefile],
328                [FIX_MAKEFILE_COMPILE
329                 FIX_MAKEFILE_DISTRIB
330                 FIX_MAKEFILE_INFO])
331
332AC_CONFIG_FILES([intl/Makefile:../gettext-runtime/intl/Makefile.in], [
333  # Change srcdir variable so that it points to ../gettext-runtime/intl.
334  sed -e 's|^srcdir =.*$|srcdir = $(top_srcdir)/../gettext-runtime/intl|' \
335      -e 's|^VPATH =.*$||' \
336    < intl/Makefile > intl/Makefile.tmp
337  mv intl/Makefile.tmp intl/Makefile
338  ])
339
340AC_CONFIG_FILES([gnulib-lib/Makefile],
341                [FIX_MAKEFILE_COMPILE])
342
343AC_CONFIG_FILES([libgrep/Makefile],
344                [FIX_MAKEFILE_COMPILE])
345
346AC_CONFIG_FILES([libuniname/Makefile],
347                [FIX_MAKEFILE_COMPILE])
348
349AC_CONFIG_FILES([src/Makefile],
350                [FIX_MAKEFILE_COMPILE])
351AC_CONFIG_FILES([src/user-email:src/user-email.sh.in])
352
353AC_CONFIG_FILES([libgettextpo/Makefile],
354                [FIX_MAKEFILE_COMPILE])
355AC_CONFIG_FILES([libgettextpo/exported.sh])
356
357AC_CONFIG_FILES([po/Makefile.in])
358
359AC_CONFIG_FILES([projects/Makefile])
360
361AC_CONFIG_FILES([misc/Makefile])
362AC_CONFIG_FILES([misc/gettextize], [chmod a+x misc/gettextize])
363AC_CONFIG_FILES([misc/autopoint], [chmod a+x misc/autopoint])
364
365AC_CONFIG_FILES([man/Makefile],
366                [FIX_MAKEFILE_DISTRIB])
367AC_CONFIG_FILES([man/x-to-1])
368
369AC_CONFIG_FILES([m4/Makefile])
370
371AC_CONFIG_FILES([tests/Makefile],
372                [FIX_MAKEFILE_COMPILE])
373
374AC_OUTPUT
375