Imported Upstream version 0.18.1.1
[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-2010 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.59])
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([silent-rules])
26 AM_CONFIG_HEADER([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 case "$host_os" in
101   # On Cygwin, without -no-undefined, a warning is emitted and only a static
102   # library is built.
103   beos* | mingw* | cygwin*) LTNOUNDEF='-no-undefined' ;;
104   *) LTNOUNDEF='' ;;
105 esac
106 AC_SUBST([LTNOUNDEF])
107
108 dnl On mingw and Cygwin, we can activate special Makefile rules which add
109 dnl version information to the shared libraries and executables.
110 case "$host_os" in
111   mingw* | cygwin*) is_woe32=yes ;;
112   *) is_woe32=no ;;
113 esac
114 AM_CONDITIONAL([WOE32], [test $is_woe32 = yes])
115
116 dnl Checks for libraries.
117
118 dnl These are the only lines required to internationalize the package.
119 dnl (OK, not quite, the AC_CONFIG_FILES has also some parts.)
120 AM_GNU_GETTEXT([use-libtool], [need-ngettext])
121
122 dnl This line internationalizes the bison generated parsers.
123 BISON_I18N
124
125 dnl Test whether msgmerge must be linked against libm. This is the case on
126 dnl most systems; but BeOS has all <math.h> functions in libc and doesn't have
127 dnl a libm.
128 MSGMERGE_LIBM=?
129 AC_TRY_LINK([
130    #ifndef __NO_MATH_INLINES
131    # define __NO_MATH_INLINES 1 /* for glibc */
132    #endif
133    #include <math.h>
134    double x;],
135   [x = ceil(x); x = sqrt(x);],
136   [MSGMERGE_LIBM=])
137 if test "$MSGMERGE_LIBM" = "?"; then
138   save_LIBS="$LIBS" 
139   LIBS="$LIBS -lm"
140   AC_TRY_LINK([
141      #ifndef __NO_MATH_INLINES
142      # define __NO_MATH_INLINES 1 /* for glibc */
143      #endif
144      #include <math.h>
145      double x;],
146     [x = ceil(x); x = sqrt(x);],
147     [MSGMERGE_LIBM="-lm"])
148   LIBS="$save_LIBS"
149 fi
150 if test "$MSGMERGE_LIBM" = "?"; then
151   MSGMERGE_LIBM=
152 fi
153 AC_SUBST([MSGMERGE_LIBM])
154
155 dnl Checks for header files, functions and declarations.
156 gl_INIT
157 grgl_INIT
158 gtpo_INIT
159
160 dnl Checks for header files.
161 AC_CHECK_HEADERS([pwd.h])
162
163 dnl Checks for typedefs, structures, and compiler characteristics.
164 AC_C_INLINE
165 AC_TYPE_UNSIGNED_LONG_LONG_INT
166 AC_TYPE_SIZE_T
167 AC_CHECK_TYPES([ptrdiff_t])
168 gt_TYPE_SSIZE_T
169 AC_TYPE_PID_T
170 gl_GLIBC21
171 if test $GLIBC21 = yes; then
172   AC_CHECK_MEMBERS([struct __locale_struct.__names], , , [#include <xlocale.h>])
173 fi
174
175 dnl Checks for library functions.
176 AC_CHECK_FUNCS([select])
177 AC_FUNC_VFORK
178 gt_SIGINFO
179 gt_SETLOCALE
180
181 AC_C_BIGENDIAN([endianness=1], [endianness=0],
182   [echo "AC-C-BIGENDIAN fails to work on your system." | sed -e 's,-,_,g' 1>&2
183    echo "Please report this as a bug to bug-autoconf@gnu.org" 1>&2
184    exit 1],
185   [endianness=universal])
186 if test $endianness != universal; then
187   AC_DEFINE_UNQUOTED([ENDIANNESS], [$endianness],
188     [Define according to the byte order of the target machine: 1 for big endian, 0 for little endian.])
189 fi
190 dnl For possibly universal binaries, it's not possible to determine the
191 dnl endianness at configure time. So determine it at compile time.
192 AH_BOTTOM([
193 #ifndef ENDIANNESS
194 # if defined __BIG_ENDIAN__
195 #  define ENDIANNESS 1
196 # endif
197 # if defined __LITTLE_ENDIAN__
198 #  define ENDIANNESS 0
199 # endif
200 #endif
201 ])
202
203 gt_PREREQ_HOSTNAME
204
205 dnl Compilation on mingw and Cygwin needs special Makefile rules, because
206 dnl 1. when we install a shared library, we must arrange to export
207 dnl    auxiliary pointer variables for every exported variable,
208 dnl 2. when we install a shared library and a static library simultaneously,
209 dnl    the include file specifies __declspec(dllimport) and therefore we
210 dnl    must arrange to define the auxiliary pointer variables for the
211 dnl    exported variables _also_ in the static library.
212 if test "$enable_shared" = yes; then
213   case "$host_os" in
214     mingw* | cygwin*) is_woe32dll=yes ;;
215     *) is_woe32dll=no ;;
216   esac
217 else
218   is_woe32dll=no
219 fi
220 AM_CONDITIONAL([WOE32DLL], [test $is_woe32dll = yes])
221 if test $is_woe32dll = yes; then
222   AC_DEFINE([WOE32DLL], [1],
223     [Define when --enable-shared is used on mingw or Cygwin.])
224 fi
225
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"
231 else
232   GETTEXTLIB_EXPORTS_FLAGS=
233 fi
234 AC_SUBST([GETTEXTLIB_EXPORTS_FLAGS])
235
236 dnl Put some default definitions into config.h.
237 AH_TOP([
238 /* Default value for alignment of strings in .mo file.  */
239 #define DEFAULT_OUTPUT_ALIGNMENT 1
240 ])
241 AH_BOTTOM([
242 /* A file name cannot consist of any character possible.  INVALID_PATH_CHAR
243    contains the characters not allowed.  */
244 #if defined _MSC_VER || defined __MINGW32__
245 /* Woe32.  This string is valid for Windows NT/2000.  On Windows 95/98/ME some
246    few characters in the range 0x80..0xff are invalid as well, but this doesn't
247    matter much for our purposes.  */
248 # 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\"*/:<>?\\|"
249 #elif defined MSDOS
250 /* Something like this for MSDOG.  */
251 # 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\\:."
252 #else
253 /* Unix.  */
254 # 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/"
255 #endif
256
257 /* This is the page width for the message_print function.  It should
258    not be set to more than 79 characters (Emacs users will appreciate
259    it).  It is used to wrap the msgid and msgstr strings, and also to
260    wrap the file position (#:) comments.  */
261 #define PAGE_WIDTH 79
262
263 /* On Windows, variables that may be in a DLL must be marked specially.  */
264 #if ((defined _MSC_VER && defined _DLL) || defined WOE32DLL) && !defined IN_RELOCWRAPPER
265 # define DLL_VARIABLE __declspec (dllimport)
266 #else
267 # define DLL_VARIABLE
268 #endif
269
270 /* Extra OS/2 (emx+gcc) defines.  */
271 #ifdef __EMX__
272 # include "intl/os2compat.h"
273 #endif
274 ])
275
276 dnl Check for the expat XML parser.
277 dnl On operating systems where binary distribution vendors are likely to
278 dnl ship both gettext and expat, we use dynamic loading to avoid a hard
279 dnl dependency from gettext to expat.
280 case "$host_os" in
281   linux*)
282     AC_DEFINE([DYNLOAD_LIBEXPAT], [1],
283       [Define to 1 if libexpat shall be dynamically loaded via dlopen().])
284     LIBEXPAT="-ldl"
285     LTLIBEXPAT="-ldl"
286     AC_SUBST([LIBEXPAT])
287     AC_SUBST([LTLIBEXPAT])
288     ;;
289   *)
290     AC_LIB_HAVE_LINKFLAGS([expat], [],
291       [#include <expat.h>], [XML_ExpatVersion();])
292     ;;
293 esac
294
295 dnl Check for nm output filter that yields the exported symbols.
296 gt_GLOBAL_SYMBOL_PIPE
297
298 dnl Check for Emacs and where to install .elc files.
299 AM_PATH_LISPDIR
300 dnl Sometimes Emacs is badly installed. Allow the user to work around it.
301 AC_ARG_WITH([emacs],
302   [  --without-emacs         do not use Emacs, don't install po-mode],
303   [gt_use_emacs=$withval],
304   [gt_use_emacs=yes])
305 if test "$EMACS" != no; then
306   AC_MSG_CHECKING([whether Emacs support is requested])
307   AC_MSG_RESULT([$gt_use_emacs])
308   if test "$gt_use_emacs" = no; then
309     EMACS=no
310   fi
311 fi
312
313 aclocaldir='${datadir}/aclocal'
314 AC_SUBST([aclocaldir])
315
316 dnl Check how to install the set of previous versions, for autopoint.
317 AC_ARG_WITH([git],
318   [  --without-git           don't use git to compress the infrastructure archive],
319   [gt_use_git=$withval],
320   [gt_use_git=maybe])
321 AC_ARG_WITH([cvs],
322   [  --with-cvs              use cvs to compress the infrastructure archive
323                           (deprecated)],
324   [gt_use_cvs=$withval],
325   [gt_use_cvs=no])
326 # The CVS format is deprecated, because "cvs init" does not work in all
327 # circumstances
328 # (see <http://lists.gnu.org/archive/html/bug-cvs/2010-05/msg00003.html>)
329 # and we are not allowed to distribute the cvs infrastructure files ourselves
330 # (see <http://lists.gnu.org/archive/html/bug-cvs/2010-06/msg00011.html>).
331 if test "$gt_use_git" != no && test "$gt_use_git" != maybe; then
332   # --with-git is specified. Even if --with-cvs is also specified, we use the
333   # git format.
334   ARCHIVE_FORMAT=git
335 else
336   if test "$gt_use_cvs" != no; then
337     # --with-cvs is specified.
338     ARCHIVE_FORMAT=cvs
339   else
340     # Neither --with-git nor --with-cvs is specified.
341 changequote(,)dnl
342     if test "$gt_use_git" != no \
343        && (git --version) >/dev/null 2>&1 \
344        && { case `git --version | sed -e 's/^[^0-9]*//'` in
345               0.* | 1.[0-5].*) false ;;
346               *) true ;;
347             esac
348           }; then
349 changequote([,])dnl
350       # --without-git is not specified, and the git program exists
351       # in version 1.6 or newer. Use git format.
352       ARCHIVE_FORMAT=git
353     else
354       # --without-git is specified, or the git program is missing.
355       ARCHIVE_FORMAT=dir
356     fi
357   fi
358 fi
359 AC_SUBST([ARCHIVE_FORMAT])
360
361 dnl Check for tools needed for formatting the documentation.
362 ac_aux_dir_abs=`cd $ac_aux_dir && pwd`
363 AC_PATH_PROG([DVIPS], [dvips], [$ac_aux_dir_abs/missing dvips])
364 AC_PATH_PROG([TEXI2PDF], [texi2pdf], [$ac_aux_dir_abs/missing texi2pdf])
365 AC_PATH_PROG([PERL], [perl], [$ac_aux_dir_abs/missing perl])
366
367 dnl Check for tools needed for formatting man pages.
368 CROSS_COMPILING=$cross_compiling
369 AC_SUBST([CROSS_COMPILING])
370
371 dnl Checks for optional programs for the tests/lang-*, tests/recode-* tests.
372 gt_PROG_ANSI_CXX
373 gt_LOCALE_FR
374 gt_LOCALE_FR_UTF8
375 gt_LOCALE_JA
376
377 dnl Checks for functions for the tests/*.c tests.
378 AC_CHECK_FUNCS_ONCE([getrlimit setrlimit uselocale])
379
380 dnl Prepares the libtool configuration for languages used by the tests.
381 LT_LANG([C++])
382
383 dnl Check whether to execute tests that rely on libasprintf.
384 dnl This test must be consistent with gettext-runtime/configure.ac.
385 if test "${enable_libasprintf+set}" = set; then
386   if test "$enable_libasprintf" != no; then
387     TESTLIBASPRINTF=yes
388   else
389     TESTLIBASPRINTF=no
390   fi
391 else
392   TESTLIBASPRINTF=yes
393 fi
394 if test "$CXX" = ":"; then
395   TESTLIBASPRINTF=no
396 fi
397 AC_SUBST([TESTLIBASPRINTF])
398
399 dnl Generate the version information file in the intl/ directory.
400 test -d intl || mkdir intl
401 echo "GNU gettext library from gettext-$VERSION" > intl/VERSION
402 cat > intl/ChangeLog.inst <<EOF
403 $RELEASE_DATE  GNU  <bug-gnu-gettext@gnu.org>
404
405         * Version $VERSION released.
406
407 EOF
408
409 AC_CONFIG_SUBDIRS([examples])
410
411 AC_CONFIG_FILES([Makefile])
412
413 AC_CONFIG_FILES([doc/Makefile])
414
415 AC_CONFIG_FILES([intl/Makefile:../gettext-runtime/intl/Makefile.in], [
416   # Change srcdir variable so that it points to ../gettext-runtime/intl.
417   sed -e 's|^srcdir =.*$|srcdir = $(top_srcdir)/../gettext-runtime/intl|' \
418       -e 's|^VPATH =.*$||' \
419     < intl/Makefile > intl/Makefile.tmp
420   mv intl/Makefile.tmp intl/Makefile
421   ])
422
423 AC_CONFIG_FILES([gnulib-lib/Makefile])
424
425 AC_CONFIG_FILES([libgrep/Makefile])
426
427 AC_CONFIG_FILES([src/Makefile])
428 AC_CONFIG_FILES([src/user-email:src/user-email.sh.in])
429
430 AC_CONFIG_FILES([libgettextpo/Makefile])
431 AC_CONFIG_FILES([libgettextpo/exported.sh])
432
433 AC_CONFIG_FILES([po/Makefile.in])
434
435 AC_CONFIG_FILES([projects/Makefile])
436
437 AC_CONFIG_FILES([styles/Makefile])
438
439 AC_CONFIG_FILES([misc/Makefile])
440 AC_CONFIG_FILES([misc/gettextize], [chmod a+x misc/gettextize])
441 AC_CONFIG_FILES([misc/autopoint], [chmod a+x misc/autopoint])
442 AC_CONFIG_FILES([misc/convert-archive], [chmod a+x misc/convert-archive])
443
444 AC_CONFIG_FILES([man/Makefile],
445                 [FIX_MAKEFILE_DISTRIB])
446 AC_CONFIG_FILES([man/x-to-1])
447
448 AC_CONFIG_FILES([m4/Makefile])
449
450 AC_CONFIG_FILES([tests/Makefile])
451
452 AC_CONFIG_FILES([gnulib-tests/Makefile])
453
454 AC_OUTPUT