Upgrade to 0.18.3.2
[platform/upstream/gettext.git] / gettext-tools / configure.ac
1 dnl Configuration for the gettext-tools directory of GNU gettext
2 dnl Copyright (C) 1995-1999, 2000-2011 Free Software Foundation, Inc.
3 dnl
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation; either version 3 of the License, or
7 dnl (at your option) any later version.
8 dnl
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 dnl Process this file with autoconf to produce a configure script.
18
19 AC_PREREQ([2.62])
20 AC_INIT
21 AC_CONFIG_SRCDIR([src/msgfmt.c])
22 AC_CONFIG_AUX_DIR([../build-aux])
23 . $srcdir/../version.sh
24 gl_INIT_PACKAGE([gettext-tools], [$VERSION_NUMBER])
25 AM_INIT_AUTOMAKE([1.11.1 silent-rules parallel-tests])
26 AC_CONFIG_HEADERS([config.h])
27
28 dnl Installation directories.
29 test "$docdir" != '${datarootdir}/doc/${PACKAGE}' || docdir='${datarootdir}/doc/gettext'
30
31 dnl Checks for programs.
32 AC_PROG_CC
33 AC_PROG_INSTALL
34 AC_PROG_YACC
35
36 gt_JAVA_CHOICE
37
38 gt_GCJ
39 if test -n "$HAVE_GCJ" && test "$JAVA_CHOICE" = yes; then
40   BUILDJAVAEXE=yes
41 else
42   BUILDJAVAEXE=no
43 fi
44 AC_SUBST([BUILDJAVAEXE])
45
46 gt_JAVAEXEC
47 gt_JAVACOMP([1.3])
48 AC_CHECK_PROG([JAR], [jar], [jar])
49 if test -n "$HAVE_JAVACOMP" && test -n "$JAR" && test "$JAVA_CHOICE" != no; then
50   BUILDJAVA=yes
51 else
52   BUILDJAVA=no
53 fi
54 AC_SUBST([BUILDJAVA])
55 if test -n "$HAVE_JAVAEXEC" && test $BUILDJAVA = yes; then
56   TESTJAVA=yes
57 else
58   TESTJAVA=no
59 fi
60 AC_SUBST([TESTJAVA])
61
62 gt_CSHARPCOMP
63 if test -n "$HAVE_CSHARPCOMP" && test "$CSHARP_CHOICE" != no; then
64   BUILDCSHARP=yes
65 else
66   BUILDCSHARP=no
67 fi
68 AC_SUBST([BUILDCSHARP])
69
70 gt_CSHARPEXEC([csharpexec-test.exe], [$srcdir/m4])
71 if test -n "$HAVE_CSHARPEXEC" && test $BUILDCSHARP = yes; then
72   TESTCSHARP=yes
73 else
74   TESTCSHARP=no
75 fi
76 AC_SUBST([TESTCSHARP])
77
78 dnl Check for host type.
79 AC_CANONICAL_HOST
80
81 dnl Checks for compiler output filename suffixes.
82 AC_OBJEXT
83 AC_EXEEXT
84
85 dnl Make sure we see all GNU and Solaris extensions.
86 gl_EARLY
87 grgl_EARLY
88 gtpo_EARLY
89
90 dnl Check for build configuration.
91
92 gl_WOE32_DLL
93
94 LT_INIT([win32-dll])
95
96 dnl Prepares the libtool configuration for handling of Windows resources, and
97 dnl sets the RC variable to a program that compiles Windows resource files.
98 LT_LANG([Windows Resource])
99
100 dnl On mingw and Cygwin, we can activate special Makefile rules which add
101 dnl version information to the shared libraries and executables.
102 case "$host_os" in
103   mingw* | cygwin*) is_woe32=yes ;;
104   *) is_woe32=no ;;
105 esac
106 AM_CONDITIONAL([WOE32], [test $is_woe32 = yes])
107
108 dnl On Cygwin 1.7.10-1 or later, error_* variables are defined in the
109 dnl Cygwin DLL.  To avoid any conflict with gettext DLLs, always link
110 dnl to gnulib's error.c.  See GETTEXTLIB_EXPORTS_FLAGS setting below.
111 case "$host_os" in
112   cygwin*) ac_cv_lib_error_at_line=no ;;
113 esac
114
115 dnl Checks for libraries.
116
117 dnl These are the only lines required to internationalize the package.
118 dnl (OK, not quite, the AC_CONFIG_FILES has also some parts.)
119 AM_GNU_GETTEXT([use-libtool], [need-ngettext])
120
121 dnl This line internationalizes the bison generated parsers.
122 BISON_I18N
123
124 dnl Test whether msgmerge must be linked against libm. This is the case on
125 dnl most systems; but BeOS has all <math.h> functions in libc and doesn't have
126 dnl a libm.
127 MSGMERGE_LIBM=?
128 AC_TRY_LINK([
129    #ifndef __NO_MATH_INLINES
130    # define __NO_MATH_INLINES 1 /* for glibc */
131    #endif
132    #include <math.h>
133    double x;],
134   [x = ceil(x); x = sqrt(x);],
135   [MSGMERGE_LIBM=])
136 if test "$MSGMERGE_LIBM" = "?"; then
137   save_LIBS="$LIBS" 
138   LIBS="$LIBS -lm"
139   AC_TRY_LINK([
140      #ifndef __NO_MATH_INLINES
141      # define __NO_MATH_INLINES 1 /* for glibc */
142      #endif
143      #include <math.h>
144      double x;],
145     [x = ceil(x); x = sqrt(x);],
146     [MSGMERGE_LIBM="-lm"])
147   LIBS="$save_LIBS"
148 fi
149 if test "$MSGMERGE_LIBM" = "?"; then
150   MSGMERGE_LIBM=
151 fi
152 AC_SUBST([MSGMERGE_LIBM])
153
154 dnl Checks for header files, functions and declarations.
155 gl_INIT
156 grgl_INIT
157 gtpo_INIT
158
159 dnl Checks for header files.
160 AC_CHECK_HEADERS([pwd.h])
161
162 dnl Checks for typedefs, structures, and compiler characteristics.
163 AC_C_INLINE
164 AC_TYPE_UNSIGNED_LONG_LONG_INT
165 AC_TYPE_SIZE_T
166 AC_CHECK_TYPES([ptrdiff_t])
167 gt_TYPE_SSIZE_T
168 AC_TYPE_PID_T
169 gl_GLIBC21
170 if test $GLIBC21 = yes; then
171   AC_CHECK_MEMBERS([struct __locale_struct.__names], , , [#include <xlocale.h>])
172 fi
173
174 dnl Checks for library functions.
175 AC_CHECK_FUNCS([select])
176 AC_FUNC_VFORK
177 gt_SIGINFO
178 gt_SETLOCALE
179
180 AC_C_BIGENDIAN([endianness=1], [endianness=0],
181   [echo "AC-C-BIGENDIAN fails to work on your system." | sed -e 's,-,_,g' 1>&2
182    echo "Please report this as a bug to bug-autoconf@gnu.org" 1>&2
183    exit 1],
184   [endianness=universal])
185 if test $endianness != universal; then
186   AC_DEFINE_UNQUOTED([ENDIANNESS], [$endianness],
187     [Define according to the byte order of the target machine: 1 for big endian, 0 for little endian.])
188 fi
189 dnl For possibly universal binaries, it's not possible to determine the
190 dnl endianness at configure time. So determine it at compile time.
191 AH_BOTTOM([
192 #ifndef ENDIANNESS
193 # if defined __BIG_ENDIAN__
194 #  define ENDIANNESS 1
195 # endif
196 # if defined __LITTLE_ENDIAN__
197 #  define ENDIANNESS 0
198 # endif
199 #endif
200 ])
201
202 gt_PREREQ_HOSTNAME
203
204 dnl Compilation on mingw and Cygwin needs special Makefile rules, because
205 dnl 1. when we install a shared library, we must arrange to export
206 dnl    auxiliary pointer variables for every exported variable,
207 dnl 2. when we install a shared library and a static library simultaneously,
208 dnl    the include file specifies __declspec(dllimport) and therefore we
209 dnl    must arrange to define the auxiliary pointer variables for the
210 dnl    exported variables _also_ in the static library.
211 if test "$enable_shared" = yes; then
212   case "$host_os" in
213     mingw* | cygwin*) is_woe32dll=yes ;;
214     *) is_woe32dll=no ;;
215   esac
216 else
217   is_woe32dll=no
218 fi
219 AM_CONDITIONAL([WOE32DLL], [test $is_woe32dll = yes])
220 if test $is_woe32dll = yes; then
221   AC_DEFINE([WOE32DLL], [1],
222     [Define when --enable-shared is used on mingw or Cygwin.])
223 fi
224
225 GETTEXTLIB_EXPORTS_FLAGS=
226 dnl woe32dll/gettextlib-exports.c needs to know whether the getopt facility
227 dnl is replaced by gnulib. GETOPT_H is set by gl_FUNC_GETOPT_POSIX, inside
228 dnl gl_INIT.
229 if test -n "$GETOPT_H"; then
230   GETTEXTLIB_EXPORTS_FLAGS="-DGNULIB_DEFINED_GETOPT $GETTEXTLIB_EXPORTS_FLAGS"
231 fi
232 dnl woe32dll/gettextlib-exports.c needs to know whether the error
233 dnl facility is replaced by gnulib. ac_cv_lib_error_at_line is set by
234 dnl gl_ERROR, inside gl_INIT.
235 if test "$ac_cv_lib_error_at_line" = no; then
236   GETTEXTLIB_EXPORTS_FLAGS="-DGNULIB_DEFINED_ERROR $GETTEXTLIB_EXPORTS_FLAGS"
237 fi
238
239 dnl 64-bit mingw does not prepend an underscore to C symbols.
240 dnl USER_LABEL_PREFIX is set by gl_ASM_SYMBOL_PREFIX, inside gl_INIT.
241 if test "$USER_LABEL_PREFIX" = _; then
242   GETTEXTLIB_EXPORTS_FLAGS="-DUSER_LABEL_PREFIX_UNDERSCORE $GETTEXTLIB_EXPORTS_FLAGS"
243 fi
244 AC_SUBST([GETTEXTLIB_EXPORTS_FLAGS])
245
246 dnl Tell the source files that the error facility is replaced by
247 dnl gnulib, to make sure to prepend "rpl_" prefix to the error_*
248 dnl symbols.
249 if test "$ac_cv_lib_error_at_line" = no; then
250   AC_DEFINE([GNULIB_REPLACE_ERROR], [1],
251     [Define when the error facility is replaced by gnulib.])
252 fi
253
254 dnl Put some default definitions into config.h.
255 AH_TOP([
256 /* Default value for alignment of strings in .mo file.  */
257 #define DEFAULT_OUTPUT_ALIGNMENT 1
258 ])
259 AH_BOTTOM([
260 /* A file name cannot consist of any character possible.  INVALID_PATH_CHAR
261    contains the characters not allowed.  */
262 #if defined _MSC_VER || defined __MINGW32__
263 /* Woe32.  This string is valid for Windows NT/2000.  On Windows 95/98/ME some
264    few characters in the range 0x80..0xff are invalid as well, but this doesn't
265    matter much for our purposes.  */
266 # 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\"*/:<>?\\|"
267 #elif defined MSDOS
268 /* Something like this for MSDOG.  */
269 # 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\\:."
270 #else
271 /* Unix.  */
272 # 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/"
273 #endif
274
275 /* This is the page width for the message_print function.  It should
276    not be set to more than 79 characters (Emacs users will appreciate
277    it).  It is used to wrap the msgid and msgstr strings, and also to
278    wrap the file position (#:) comments.  */
279 #define PAGE_WIDTH 79
280
281 /* On Windows, variables that may be in a DLL must be marked specially.  */
282 #if ((defined _MSC_VER && defined _DLL) || defined WOE32DLL) && !defined IN_RELOCWRAPPER
283 # define DLL_VARIABLE __declspec (dllimport)
284 #else
285 # define DLL_VARIABLE
286 #endif
287
288 /* Extra OS/2 (emx+gcc) defines.  */
289 #ifdef __EMX__
290 # include "intl/os2compat.h"
291 #endif
292 ])
293
294 dnl Check for the expat XML parser.
295 dnl On operating systems where binary distribution vendors are likely to
296 dnl ship both gettext and expat, we use dynamic loading to avoid a hard
297 dnl dependency from gettext to expat.
298 case "$host_os" in
299   linux*)
300     AC_DEFINE([DYNLOAD_LIBEXPAT], [1],
301       [Define to 1 if libexpat shall be dynamically loaded via dlopen().])
302     LIBEXPAT="-ldl"
303     LTLIBEXPAT="-ldl"
304     AC_SUBST([LIBEXPAT])
305     AC_SUBST([LTLIBEXPAT])
306     ;;
307   *)
308     AC_LIB_HAVE_LINKFLAGS([expat], [],
309       [#include <expat.h>], [XML_ExpatVersion();])
310     ;;
311 esac
312
313 dnl Check for nm output filter that yields the exported symbols.
314 gt_GLOBAL_SYMBOL_PIPE
315
316 dnl Check for Emacs and where to install .elc files.
317 dnl Sometimes Emacs is badly installed. Allow the user to work around it.
318 AC_ARG_WITH([emacs],
319   [  --without-emacs         do not use Emacs, don't install po-mode],
320   [gt_use_emacs=$withval],
321   [gt_use_emacs=yes])
322 if test "$EMACS" != no; then
323   AC_MSG_CHECKING([whether Emacs support is requested])
324   AC_MSG_RESULT([$gt_use_emacs])
325   if test "$gt_use_emacs" = no; then
326     EMACS=no
327   fi
328 fi
329 dnl If $EMACS = no, we won't install any Emacs Lisp (*.el) files,
330 dnl therefore it's useless to determine $(lispdir).
331 if test "$EMACS" != no; then
332   AM_PATH_LISPDIR
333 fi
334
335 aclocaldir='${datadir}/aclocal'
336 AC_SUBST([aclocaldir])
337
338 dnl Check how to install the set of previous versions, for autopoint.
339 AC_ARG_WITH([git],
340   [  --without-git           don't use git to compress the infrastructure archive],
341   [gt_use_git=$withval],
342   [gt_use_git=maybe])
343 AC_ARG_WITH([cvs],
344   [  --with-cvs              use cvs to compress the infrastructure archive
345                           (deprecated)],
346   [gt_use_cvs=$withval],
347   [gt_use_cvs=no])
348 AC_ARG_WITH([bzip2],
349   [  --without-bzip2         don't use bzip2 to compress the infrastructure archive],
350   [gt_use_bzip2=$withval],
351   [gt_use_bzip2=maybe])
352 AC_ARG_WITH([xz],
353   [  --without-xz            don't use xz to compress the infrastructure archive],
354   [gt_use_xz=$withval],
355   [gt_use_xz=maybe])
356 # The CVS format is deprecated, because "cvs init" does not work in all
357 # circumstances
358 # (see <http://lists.gnu.org/archive/html/bug-cvs/2010-05/msg00003.html>)
359 # and we are not allowed to distribute the cvs infrastructure files ourselves
360 # (see <http://lists.gnu.org/archive/html/bug-cvs/2010-06/msg00011.html>).
361 #
362 # With the archive from version 0.18.1, we can observe the following
363 # compression rates:
364 #    Size           File
365 #  16916480   archive.dir.tar
366 #   3528757   archive.dir.tar.gz
367 #   2621440   archive.cvs.tar
368 #   2082492   archive.dir.tar.bz2
369 #    696320   archive.git.tar
370 #    599046   archive.git.tar.bz2
371 #    592989   archive.git.tar.gz
372 #    588124   archive.git.tar.xz
373 #    457190   archive.cvs.tar.gz
374 #    335808   archive.cvs.tar.bz2
375 #    308880   archive.dir.tar.xz
376 #    299124   archive.cvs.tar.xz
377 # Among these:
378 #   - We don't offer the uncompressed ones, because at least gzip can be
379 #     assumed to be present everywhere.
380 #   - Among archive.git.tar.*, all have approximately the same size, because
381 #     git already compresses most of its repository data. Offer only .gz here.
382 #   - Among archive.cvs.tar.*, offer only .gz, for simplicity, since --with-cvs
383 #     is deprecated.
384 # The remaining ones are:
385 #    Size           File            ARCHIVE_FORMAT
386 #   3528757   archive.dir.tar.gz      dirgz
387 #   2082492   archive.dir.tar.bz2     dirbz2
388 #    592989   archive.git.tar.gz      git
389 #    457190   archive.cvs.tar.gz      cvs
390 #    308880   archive.dir.tar.xz      dirxz
391 if test "$gt_use_xz" != no && test "$gt_use_xz" != maybe; then
392   # --with-xz is specified. Even if --with-git or --with-cvs or --with-bzip2 is
393   # also specified, we use the dirxz format.
394   ARCHIVE_FORMAT=dirxz
395 else
396   if test "$gt_use_git" != no && test "$gt_use_git" != maybe; then
397     # --with-git is specified. Even if --with-cvs or --with-bzip2 is also
398     # specified, we use the git format.
399     ARCHIVE_FORMAT=git
400   else
401     if test "$gt_use_cvs" != no; then
402       # --with-cvs is specified. Even if --with-bzip2 is also specified, we use
403       # the cvs format.
404       ARCHIVE_FORMAT=cvs
405     else
406       if test "$gt_use_bzip2" != no && test "$gt_use_bzip2" != maybe; then
407         # --with-bzip2 is specified. We use the dirbz2 format.
408         ARCHIVE_FORMAT=dirbz2
409       else
410         # Neither --with-git nor --with-cvs nor --with-bzip2 nor --with-xz is
411         # specified. Determine which programs are present.
412         if test "$gt_use_xz" != no \
413            && (xz --version) >/dev/null 2>&1 \
414            && xz --version | grep lzma >/dev/null; then
415           # --without-xz is not specified, and the xz program exists.
416           ARCHIVE_FORMAT=dirxz
417         else
418           # --without-xz is specified, or the xz program is missing.
419 changequote(,)dnl
420           if test "$gt_use_git" != no \
421              && (git --version) >/dev/null 2>&1 \
422              && { case `git --version | sed -e 's/^[^0-9]*//'` in
423                     0.* | 1.[0-5].*) false ;;
424                     *) true ;;
425                   esac
426                 }; then
427 changequote([,])dnl
428             # --without-git is not specified, and the git program exists
429             # in version 1.6 or newer. Use git format.
430             ARCHIVE_FORMAT=git
431           else
432             # --without-git is specified, or the git program is missing.
433 changequote(,)dnl
434             if test "$gt_use_bzip2" != no \
435                && (: | bzip2 --version) >/dev/null 2>&1 \
436                && { sed_bzip2_version1='s/ \([0-9][0-9.]*\).*/ \1/'
437                     sed_bzip2_version2='s/^.* //'
438                     case `(: | bzip2 --version) 2>&1 \
439                           | sed -e 1q \
440                           | sed -e "$sed_bzip2_version1" -e "$sed_bzip2_version2"` in
441                       0.*) false ;;
442                       *) true ;;
443                     esac
444                   }; then
445 changequote([,])dnl
446               # --without-bzip2 is not specified, and the bzip2 program exists
447               # in version 1.0 or newer. Use dirbz2 format.
448               ARCHIVE_FORMAT=dirbz2
449             else
450               # --without-bzip2 is specified, or the bzip2 program is missing.
451               ARCHIVE_FORMAT=dirgz
452             fi
453           fi
454         fi
455       fi
456     fi
457   fi
458 fi
459 AC_SUBST([ARCHIVE_FORMAT])
460
461 dnl Check for tools needed for formatting the documentation.
462 ac_aux_dir_abs=`cd $ac_aux_dir && pwd`
463 AC_PATH_PROG([DVIPS], [dvips], [$ac_aux_dir_abs/missing dvips])
464 AC_PATH_PROG([TEXI2PDF], [texi2pdf], [$ac_aux_dir_abs/missing texi2pdf])
465 AC_PATH_PROG([PERL], [perl], [$ac_aux_dir_abs/missing perl])
466
467 dnl Check for tools needed for formatting man pages.
468 CROSS_COMPILING=$cross_compiling
469 AC_SUBST([CROSS_COMPILING])
470
471 dnl Checks for optional programs for the tests/lang-*, tests/recode-* tests.
472 gl_PROG_ANSI_CXX([CXX], [ANSICXX])
473 gt_LOCALE_FR
474 gt_LOCALE_FR_UTF8
475 gt_LOCALE_JA
476
477 dnl Checks for functions for the tests/*.c tests.
478 AC_CHECK_FUNCS_ONCE([getrlimit setrlimit uselocale])
479
480 dnl Prepares the libtool configuration for languages used by the tests.
481 LT_LANG([C++])
482
483 dnl Check whether to execute tests that rely on libasprintf.
484 dnl This test must be consistent with gettext-runtime/configure.ac.
485 if test "${enable_libasprintf+set}" = set; then
486   if test "$enable_libasprintf" != no; then
487     TESTLIBASPRINTF=yes
488   else
489     TESTLIBASPRINTF=no
490   fi
491 else
492   TESTLIBASPRINTF=yes
493 fi
494 if test "$CXX" = no; then
495   TESTLIBASPRINTF=no
496 fi
497 AC_SUBST([TESTLIBASPRINTF])
498
499 dnl Generate the version information file in the intl/ directory.
500 test -d intl || mkdir intl
501 echo "GNU gettext library from gettext-$VERSION" > intl/VERSION
502 cat > intl/ChangeLog.inst <<EOF
503 $RELEASE_DATE  GNU  <bug-gnu-gettext@gnu.org>
504
505         * Version $VERSION released.
506
507 EOF
508
509 AC_CONFIG_SUBDIRS([examples])
510
511 AC_CONFIG_FILES([Makefile])
512
513 AC_CONFIG_FILES([doc/Makefile])
514
515 AC_CONFIG_FILES([intl/Makefile:../gettext-runtime/intl/Makefile.in], [
516   # Change srcdir variable so that it points to ../gettext-runtime/intl.
517   sed -e 's|^srcdir =.*$|srcdir = $(top_srcdir)/../gettext-runtime/intl|' \
518       -e 's|^VPATH =.*$||' \
519     < intl/Makefile > intl/Makefile.tmp
520   mv intl/Makefile.tmp intl/Makefile
521   ])
522
523 AC_CONFIG_FILES([gnulib-lib/Makefile])
524
525 AC_CONFIG_FILES([libgrep/Makefile])
526
527 AC_CONFIG_FILES([src/Makefile])
528 AC_CONFIG_FILES([src/user-email:src/user-email.sh.in])
529
530 AC_CONFIG_FILES([libgettextpo/Makefile])
531 AC_CONFIG_FILES([libgettextpo/exported.sh])
532
533 AC_CONFIG_FILES([po/Makefile.in])
534
535 AC_CONFIG_FILES([projects/Makefile])
536
537 AC_CONFIG_FILES([styles/Makefile])
538
539 AC_CONFIG_FILES([misc/Makefile])
540 AC_CONFIG_FILES([misc/gettextize], [chmod a+x misc/gettextize])
541 AC_CONFIG_FILES([misc/autopoint], [chmod a+x misc/autopoint])
542 AC_CONFIG_FILES([misc/convert-archive], [chmod a+x misc/convert-archive])
543
544 AC_CONFIG_FILES([man/Makefile],
545                 [FIX_MAKEFILE_DISTRIB])
546 AC_CONFIG_FILES([man/x-to-1])
547
548 AC_CONFIG_FILES([m4/Makefile])
549
550 AC_CONFIG_FILES([tests/Makefile])
551
552 AC_CONFIG_FILES([gnulib-tests/Makefile])
553
554 AC_OUTPUT