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