~netrek-developers/netrek-client-cow/trunk

« back to all changes in this revision

Viewing changes to aclocal.m4

  • Committer: Collin Pruitt
  • Date: 2009-05-12 04:30:09 UTC
  • Revision ID: collinp111@gmail.com-20090512043009-3jsjojoyrk16oass
Initial upload - updated from http://james.tooraweenah.com/darcs/netrek-client-cow/ using darcs (hince the existnace of _darcs), fully patched.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
 
2
 
 
3
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 
4
# 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 
5
# This file is free software; the Free Software Foundation
 
6
# gives unlimited permission to copy and/or distribute it,
 
7
# with or without modifications, as long as this notice is preserved.
 
8
 
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
 
11
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 
12
# PARTICULAR PURPOSE.
 
13
 
 
14
# gettext.m4 serial 60 (gettext-0.17)
 
15
dnl Copyright (C) 1995-2007 Free Software Foundation, Inc.
 
16
dnl This file is free software; the Free Software Foundation
 
17
dnl gives unlimited permission to copy and/or distribute it,
 
18
dnl with or without modifications, as long as this notice is preserved.
 
19
dnl
 
20
dnl This file can can be used in projects which are not available under
 
21
dnl the GNU General Public License or the GNU Library General Public
 
22
dnl License but which still want to provide support for the GNU gettext
 
23
dnl functionality.
 
24
dnl Please note that the actual code of the GNU gettext library is covered
 
25
dnl by the GNU Library General Public License, and the rest of the GNU
 
26
dnl gettext package package is covered by the GNU General Public License.
 
27
dnl They are *not* in the public domain.
 
28
 
 
29
dnl Authors:
 
30
dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
 
31
dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2006.
 
32
 
 
33
dnl Macro to add for using GNU gettext.
 
34
 
 
35
dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
 
36
dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
 
37
dnl    default (if it is not specified or empty) is 'no-libtool'.
 
38
dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
 
39
dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
 
40
dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
 
41
dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
 
42
dnl    depending on --{enable,disable}-{shared,static} and on the presence of
 
43
dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
 
44
dnl    $(top_builddir)/intl/libintl.a will be created.
 
45
dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
 
46
dnl    implementations (in libc or libintl) without the ngettext() function
 
47
dnl    will be ignored.  If NEEDSYMBOL is specified and is
 
48
dnl    'need-formatstring-macros', then GNU gettext implementations that don't
 
49
dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
 
50
dnl INTLDIR is used to find the intl libraries.  If empty,
 
51
dnl    the value `$(top_builddir)/intl/' is used.
 
52
dnl
 
53
dnl The result of the configuration is one of three cases:
 
54
dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
 
55
dnl    and used.
 
56
dnl    Catalog format: GNU --> install in $(datadir)
 
57
dnl    Catalog extension: .mo after installation, .gmo in source tree
 
58
dnl 2) GNU gettext has been found in the system's C library.
 
59
dnl    Catalog format: GNU --> install in $(datadir)
 
60
dnl    Catalog extension: .mo after installation, .gmo in source tree
 
61
dnl 3) No internationalization, always use English msgid.
 
62
dnl    Catalog format: none
 
63
dnl    Catalog extension: none
 
64
dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
 
65
dnl The use of .gmo is historical (it was needed to avoid overwriting the
 
66
dnl GNU format catalogs when building on a platform with an X/Open gettext),
 
67
dnl but we keep it in order not to force irrelevant filename changes on the
 
68
dnl maintainers.
 
69
dnl
 
70
AC_DEFUN([AM_GNU_GETTEXT],
 
71
[
 
72
  dnl Argument checking.
 
73
  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
 
74
    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
 
75
])])])])])
 
76
  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
 
77
    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
 
78
])])])])
 
79
  define([gt_included_intl],
 
80
    ifelse([$1], [external],
 
81
      ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]),
 
82
      [yes]))
 
83
  define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
 
84
  gt_NEEDS_INIT
 
85
  AM_GNU_GETTEXT_NEED([$2])
 
86
 
 
87
  AC_REQUIRE([AM_PO_SUBDIRS])dnl
 
88
  ifelse(gt_included_intl, yes, [
 
89
    AC_REQUIRE([AM_INTL_SUBDIR])dnl
 
90
  ])
 
91
 
 
92
  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
 
93
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
 
94
  AC_REQUIRE([AC_LIB_RPATH])
 
95
 
 
96
  dnl Sometimes libintl requires libiconv, so first search for libiconv.
 
97
  dnl Ideally we would do this search only after the
 
98
  dnl      if test "$USE_NLS" = "yes"; then
 
99
  dnl        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
 
100
  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
 
101
  dnl the configure script would need to contain the same shell code
 
102
  dnl again, outside any 'if'. There are two solutions:
 
103
  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
 
104
  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
 
105
  dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
 
106
  dnl documented, we avoid it.
 
107
  ifelse(gt_included_intl, yes, , [
 
108
    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
 
109
  ])
 
110
 
 
111
  dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
 
112
  gt_INTL_MACOSX
 
113
 
 
114
  dnl Set USE_NLS.
 
115
  AC_REQUIRE([AM_NLS])
 
116
 
 
117
  ifelse(gt_included_intl, yes, [
 
118
    BUILD_INCLUDED_LIBINTL=no
 
119
    USE_INCLUDED_LIBINTL=no
 
120
  ])
 
121
  LIBINTL=
 
122
  LTLIBINTL=
 
123
  POSUB=
 
124
 
 
125
  dnl Add a version number to the cache macros.
 
126
  case " $gt_needs " in
 
127
    *" need-formatstring-macros "*) gt_api_version=3 ;;
 
128
    *" need-ngettext "*) gt_api_version=2 ;;
 
129
    *) gt_api_version=1 ;;
 
130
  esac
 
131
  gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
 
132
  gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
 
133
 
 
134
  dnl If we use NLS figure out what method
 
135
  if test "$USE_NLS" = "yes"; then
 
136
    gt_use_preinstalled_gnugettext=no
 
137
    ifelse(gt_included_intl, yes, [
 
138
      AC_MSG_CHECKING([whether included gettext is requested])
 
139
      AC_ARG_WITH(included-gettext,
 
140
        [  --with-included-gettext use the GNU gettext library included here],
 
141
        nls_cv_force_use_gnu_gettext=$withval,
 
142
        nls_cv_force_use_gnu_gettext=no)
 
143
      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
 
144
 
 
145
      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
 
146
      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
 
147
    ])
 
148
        dnl User does not insist on using GNU NLS library.  Figure out what
 
149
        dnl to use.  If GNU gettext is available we use this.  Else we have
 
150
        dnl to fall back to GNU NLS library.
 
151
 
 
152
        if test $gt_api_version -ge 3; then
 
153
          gt_revision_test_code='
 
154
#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
 
155
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
 
156
#endif
 
157
changequote(,)dnl
 
158
typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
 
159
changequote([,])dnl
 
160
'
 
161
        else
 
162
          gt_revision_test_code=
 
163
        fi
 
164
        if test $gt_api_version -ge 2; then
 
165
          gt_expression_test_code=' + * ngettext ("", "", 0)'
 
166
        else
 
167
          gt_expression_test_code=
 
168
        fi
 
169
 
 
170
        AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
 
171
         [AC_TRY_LINK([#include <libintl.h>
 
172
$gt_revision_test_code
 
173
extern int _nl_msg_cat_cntr;
 
174
extern int *_nl_domain_bindings;],
 
175
            [bindtextdomain ("", "");
 
176
return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings],
 
177
            [eval "$gt_func_gnugettext_libc=yes"],
 
178
            [eval "$gt_func_gnugettext_libc=no"])])
 
179
 
 
180
        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
 
181
          dnl Sometimes libintl requires libiconv, so first search for libiconv.
 
182
          ifelse(gt_included_intl, yes, , [
 
183
            AM_ICONV_LINK
 
184
          ])
 
185
          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
 
186
          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
 
187
          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
 
188
          dnl even if libiconv doesn't exist.
 
189
          AC_LIB_LINKFLAGS_BODY([intl])
 
190
          AC_CACHE_CHECK([for GNU gettext in libintl],
 
191
            [$gt_func_gnugettext_libintl],
 
192
           [gt_save_CPPFLAGS="$CPPFLAGS"
 
193
            CPPFLAGS="$CPPFLAGS $INCINTL"
 
194
            gt_save_LIBS="$LIBS"
 
195
            LIBS="$LIBS $LIBINTL"
 
196
            dnl Now see whether libintl exists and does not depend on libiconv.
 
197
            AC_TRY_LINK([#include <libintl.h>
 
198
$gt_revision_test_code
 
199
extern int _nl_msg_cat_cntr;
 
200
extern
 
201
#ifdef __cplusplus
 
202
"C"
 
203
#endif
 
204
const char *_nl_expand_alias (const char *);],
 
205
              [bindtextdomain ("", "");
 
206
return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
 
207
              [eval "$gt_func_gnugettext_libintl=yes"],
 
208
              [eval "$gt_func_gnugettext_libintl=no"])
 
209
            dnl Now see whether libintl exists and depends on libiconv.
 
210
            if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
 
211
              LIBS="$LIBS $LIBICONV"
 
212
              AC_TRY_LINK([#include <libintl.h>
 
213
$gt_revision_test_code
 
214
extern int _nl_msg_cat_cntr;
 
215
extern
 
216
#ifdef __cplusplus
 
217
"C"
 
218
#endif
 
219
const char *_nl_expand_alias (const char *);],
 
220
                [bindtextdomain ("", "");
 
221
return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
 
222
               [LIBINTL="$LIBINTL $LIBICONV"
 
223
                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
 
224
                eval "$gt_func_gnugettext_libintl=yes"
 
225
               ])
 
226
            fi
 
227
            CPPFLAGS="$gt_save_CPPFLAGS"
 
228
            LIBS="$gt_save_LIBS"])
 
229
        fi
 
230
 
 
231
        dnl If an already present or preinstalled GNU gettext() is found,
 
232
        dnl use it.  But if this macro is used in GNU gettext, and GNU
 
233
        dnl gettext is already preinstalled in libintl, we update this
 
234
        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
 
235
        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
 
236
           || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
 
237
                && test "$PACKAGE" != gettext-runtime \
 
238
                && test "$PACKAGE" != gettext-tools; }; then
 
239
          gt_use_preinstalled_gnugettext=yes
 
240
        else
 
241
          dnl Reset the values set by searching for libintl.
 
242
          LIBINTL=
 
243
          LTLIBINTL=
 
244
          INCINTL=
 
245
        fi
 
246
 
 
247
    ifelse(gt_included_intl, yes, [
 
248
        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
 
249
          dnl GNU gettext is not found in the C library.
 
250
          dnl Fall back on included GNU gettext library.
 
251
          nls_cv_use_gnu_gettext=yes
 
252
        fi
 
253
      fi
 
254
 
 
255
      if test "$nls_cv_use_gnu_gettext" = "yes"; then
 
256
        dnl Mark actions used to generate GNU NLS library.
 
257
        BUILD_INCLUDED_LIBINTL=yes
 
258
        USE_INCLUDED_LIBINTL=yes
 
259
        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD"
 
260
        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD"
 
261
        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
 
262
      fi
 
263
 
 
264
      CATOBJEXT=
 
265
      if test "$gt_use_preinstalled_gnugettext" = "yes" \
 
266
         || test "$nls_cv_use_gnu_gettext" = "yes"; then
 
267
        dnl Mark actions to use GNU gettext tools.
 
268
        CATOBJEXT=.gmo
 
269
      fi
 
270
    ])
 
271
 
 
272
    if test -n "$INTL_MACOSX_LIBS"; then
 
273
      if test "$gt_use_preinstalled_gnugettext" = "yes" \
 
274
         || test "$nls_cv_use_gnu_gettext" = "yes"; then
 
275
        dnl Some extra flags are needed during linking.
 
276
        LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
 
277
        LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
 
278
      fi
 
279
    fi
 
280
 
 
281
    if test "$gt_use_preinstalled_gnugettext" = "yes" \
 
282
       || test "$nls_cv_use_gnu_gettext" = "yes"; then
 
283
      AC_DEFINE(ENABLE_NLS, 1,
 
284
        [Define to 1 if translation of program messages to the user's native language
 
285
   is requested.])
 
286
    else
 
287
      USE_NLS=no
 
288
    fi
 
289
  fi
 
290
 
 
291
  AC_MSG_CHECKING([whether to use NLS])
 
292
  AC_MSG_RESULT([$USE_NLS])
 
293
  if test "$USE_NLS" = "yes"; then
 
294
    AC_MSG_CHECKING([where the gettext function comes from])
 
295
    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
 
296
      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
 
297
        gt_source="external libintl"
 
298
      else
 
299
        gt_source="libc"
 
300
      fi
 
301
    else
 
302
      gt_source="included intl directory"
 
303
    fi
 
304
    AC_MSG_RESULT([$gt_source])
 
305
  fi
 
306
 
 
307
  if test "$USE_NLS" = "yes"; then
 
308
 
 
309
    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
 
310
      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
 
311
        AC_MSG_CHECKING([how to link with libintl])
 
312
        AC_MSG_RESULT([$LIBINTL])
 
313
        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
 
314
      fi
 
315
 
 
316
      dnl For backward compatibility. Some packages may be using this.
 
317
      AC_DEFINE(HAVE_GETTEXT, 1,
 
318
       [Define if the GNU gettext() function is already present or preinstalled.])
 
319
      AC_DEFINE(HAVE_DCGETTEXT, 1,
 
320
       [Define if the GNU dcgettext() function is already present or preinstalled.])
 
321
    fi
 
322
 
 
323
    dnl We need to process the po/ directory.
 
324
    POSUB=po
 
325
  fi
 
326
 
 
327
  ifelse(gt_included_intl, yes, [
 
328
    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
 
329
    dnl to 'yes' because some of the testsuite requires it.
 
330
    if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
 
331
      BUILD_INCLUDED_LIBINTL=yes
 
332
    fi
 
333
 
 
334
    dnl Make all variables we use known to autoconf.
 
335
    AC_SUBST(BUILD_INCLUDED_LIBINTL)
 
336
    AC_SUBST(USE_INCLUDED_LIBINTL)
 
337
    AC_SUBST(CATOBJEXT)
 
338
 
 
339
    dnl For backward compatibility. Some configure.ins may be using this.
 
340
    nls_cv_header_intl=
 
341
    nls_cv_header_libgt=
 
342
 
 
343
    dnl For backward compatibility. Some Makefiles may be using this.
 
344
    DATADIRNAME=share
 
345
    AC_SUBST(DATADIRNAME)
 
346
 
 
347
    dnl For backward compatibility. Some Makefiles may be using this.
 
348
    INSTOBJEXT=.mo
 
349
    AC_SUBST(INSTOBJEXT)
 
350
 
 
351
    dnl For backward compatibility. Some Makefiles may be using this.
 
352
    GENCAT=gencat
 
353
    AC_SUBST(GENCAT)
 
354
 
 
355
    dnl For backward compatibility. Some Makefiles may be using this.
 
356
    INTLOBJS=
 
357
    if test "$USE_INCLUDED_LIBINTL" = yes; then
 
358
      INTLOBJS="\$(GETTOBJS)"
 
359
    fi
 
360
    AC_SUBST(INTLOBJS)
 
361
 
 
362
    dnl Enable libtool support if the surrounding package wishes it.
 
363
    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
 
364
    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
 
365
  ])
 
366
 
 
367
  dnl For backward compatibility. Some Makefiles may be using this.
 
368
  INTLLIBS="$LIBINTL"
 
369
  AC_SUBST(INTLLIBS)
 
370
 
 
371
  dnl Make all documented variables known to autoconf.
 
372
  AC_SUBST(LIBINTL)
 
373
  AC_SUBST(LTLIBINTL)
 
374
  AC_SUBST(POSUB)
 
375
])
 
376
 
 
377
 
 
378
dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
 
379
m4_define([gt_NEEDS_INIT],
 
380
[
 
381
  m4_divert_text([DEFAULTS], [gt_needs=])
 
382
  m4_define([gt_NEEDS_INIT], [])
 
383
])
 
384
 
 
385
 
 
386
dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
 
387
AC_DEFUN([AM_GNU_GETTEXT_NEED],
 
388
[
 
389
  m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
 
390
])
 
391
 
 
392
 
 
393
dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
 
394
AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
 
395
 
 
396
# iconv.m4 serial AM6 (gettext-0.17)
 
397
dnl Copyright (C) 2000-2002, 2007 Free Software Foundation, Inc.
 
398
dnl This file is free software; the Free Software Foundation
 
399
dnl gives unlimited permission to copy and/or distribute it,
 
400
dnl with or without modifications, as long as this notice is preserved.
 
401
 
 
402
dnl From Bruno Haible.
 
403
 
 
404
AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
 
405
[
 
406
  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
 
407
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
 
408
  AC_REQUIRE([AC_LIB_RPATH])
 
409
 
 
410
  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
 
411
  dnl accordingly.
 
412
  AC_LIB_LINKFLAGS_BODY([iconv])
 
413
])
 
414
 
 
415
AC_DEFUN([AM_ICONV_LINK],
 
416
[
 
417
  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
 
418
  dnl those with the standalone portable GNU libiconv installed).
 
419
  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
 
420
 
 
421
  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
 
422
  dnl accordingly.
 
423
  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
 
424
 
 
425
  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
 
426
  dnl because if the user has installed libiconv and not disabled its use
 
427
  dnl via --without-libiconv-prefix, he wants to use it. The first
 
428
  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
 
429
  am_save_CPPFLAGS="$CPPFLAGS"
 
430
  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
 
431
 
 
432
  AC_CACHE_CHECK([for iconv], am_cv_func_iconv, [
 
433
    am_cv_func_iconv="no, consider installing GNU libiconv"
 
434
    am_cv_lib_iconv=no
 
435
    AC_TRY_LINK([#include <stdlib.h>
 
436
#include <iconv.h>],
 
437
      [iconv_t cd = iconv_open("","");
 
438
       iconv(cd,NULL,NULL,NULL,NULL);
 
439
       iconv_close(cd);],
 
440
      am_cv_func_iconv=yes)
 
441
    if test "$am_cv_func_iconv" != yes; then
 
442
      am_save_LIBS="$LIBS"
 
443
      LIBS="$LIBS $LIBICONV"
 
444
      AC_TRY_LINK([#include <stdlib.h>
 
445
#include <iconv.h>],
 
446
        [iconv_t cd = iconv_open("","");
 
447
         iconv(cd,NULL,NULL,NULL,NULL);
 
448
         iconv_close(cd);],
 
449
        am_cv_lib_iconv=yes
 
450
        am_cv_func_iconv=yes)
 
451
      LIBS="$am_save_LIBS"
 
452
    fi
 
453
  ])
 
454
  if test "$am_cv_func_iconv" = yes; then
 
455
    AC_CACHE_CHECK([for working iconv], am_cv_func_iconv_works, [
 
456
      dnl This tests against bugs in AIX 5.1 and HP-UX 11.11.
 
457
      am_save_LIBS="$LIBS"
 
458
      if test $am_cv_lib_iconv = yes; then
 
459
        LIBS="$LIBS $LIBICONV"
 
460
      fi
 
461
      AC_TRY_RUN([
 
462
#include <iconv.h>
 
463
#include <string.h>
 
464
int main ()
 
465
{
 
466
  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
 
467
     returns.  */
 
468
  {
 
469
    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
 
470
    if (cd_utf8_to_88591 != (iconv_t)(-1))
 
471
      {
 
472
        static const char input[] = "\342\202\254"; /* EURO SIGN */
 
473
        char buf[10];
 
474
        const char *inptr = input;
 
475
        size_t inbytesleft = strlen (input);
 
476
        char *outptr = buf;
 
477
        size_t outbytesleft = sizeof (buf);
 
478
        size_t res = iconv (cd_utf8_to_88591,
 
479
                            (char **) &inptr, &inbytesleft,
 
480
                            &outptr, &outbytesleft);
 
481
        if (res == 0)
 
482
          return 1;
 
483
      }
 
484
  }
 
485
#if 0 /* This bug could be worked around by the caller.  */
 
486
  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
 
487
  {
 
488
    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
 
489
    if (cd_88591_to_utf8 != (iconv_t)(-1))
 
490
      {
 
491
        static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
 
492
        char buf[50];
 
493
        const char *inptr = input;
 
494
        size_t inbytesleft = strlen (input);
 
495
        char *outptr = buf;
 
496
        size_t outbytesleft = sizeof (buf);
 
497
        size_t res = iconv (cd_88591_to_utf8,
 
498
                            (char **) &inptr, &inbytesleft,
 
499
                            &outptr, &outbytesleft);
 
500
        if ((int)res > 0)
 
501
          return 1;
 
502
      }
 
503
  }
 
504
#endif
 
505
  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
 
506
     provided.  */
 
507
  if (/* Try standardized names.  */
 
508
      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
 
509
      /* Try IRIX, OSF/1 names.  */
 
510
      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
 
511
      /* Try AIX names.  */
 
512
      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
 
513
      /* Try HP-UX names.  */
 
514
      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
 
515
    return 1;
 
516
  return 0;
 
517
}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
 
518
        [case "$host_os" in
 
519
           aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
 
520
           *)            am_cv_func_iconv_works="guessing yes" ;;
 
521
         esac])
 
522
      LIBS="$am_save_LIBS"
 
523
    ])
 
524
    case "$am_cv_func_iconv_works" in
 
525
      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
 
526
      *)   am_func_iconv=yes ;;
 
527
    esac
 
528
  else
 
529
    am_func_iconv=no am_cv_lib_iconv=no
 
530
  fi
 
531
  if test "$am_func_iconv" = yes; then
 
532
    AC_DEFINE(HAVE_ICONV, 1,
 
533
      [Define if you have the iconv() function and it works.])
 
534
  fi
 
535
  if test "$am_cv_lib_iconv" = yes; then
 
536
    AC_MSG_CHECKING([how to link with libiconv])
 
537
    AC_MSG_RESULT([$LIBICONV])
 
538
  else
 
539
    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
 
540
    dnl either.
 
541
    CPPFLAGS="$am_save_CPPFLAGS"
 
542
    LIBICONV=
 
543
    LTLIBICONV=
 
544
  fi
 
545
  AC_SUBST(LIBICONV)
 
546
  AC_SUBST(LTLIBICONV)
 
547
])
 
548
 
 
549
AC_DEFUN([AM_ICONV],
 
550
[
 
551
  AM_ICONV_LINK
 
552
  if test "$am_cv_func_iconv" = yes; then
 
553
    AC_MSG_CHECKING([for iconv declaration])
 
554
    AC_CACHE_VAL(am_cv_proto_iconv, [
 
555
      AC_TRY_COMPILE([
 
556
#include <stdlib.h>
 
557
#include <iconv.h>
 
558
extern
 
559
#ifdef __cplusplus
 
560
"C"
 
561
#endif
 
562
#if defined(__STDC__) || defined(__cplusplus)
 
563
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
 
564
#else
 
565
size_t iconv();
 
566
#endif
 
567
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
 
568
      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
 
569
    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
 
570
    AC_MSG_RESULT([$]{ac_t:-
 
571
         }[$]am_cv_proto_iconv)
 
572
    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
 
573
      [Define as const if the declaration of iconv() needs const.])
 
574
  fi
 
575
])
 
576
 
 
577
# intlmacosx.m4 serial 1 (gettext-0.17)
 
578
dnl Copyright (C) 2004-2007 Free Software Foundation, Inc.
 
579
dnl This file is free software; the Free Software Foundation
 
580
dnl gives unlimited permission to copy and/or distribute it,
 
581
dnl with or without modifications, as long as this notice is preserved.
 
582
dnl
 
583
dnl This file can can be used in projects which are not available under
 
584
dnl the GNU General Public License or the GNU Library General Public
 
585
dnl License but which still want to provide support for the GNU gettext
 
586
dnl functionality.
 
587
dnl Please note that the actual code of the GNU gettext library is covered
 
588
dnl by the GNU Library General Public License, and the rest of the GNU
 
589
dnl gettext package package is covered by the GNU General Public License.
 
590
dnl They are *not* in the public domain.
 
591
 
 
592
dnl Checks for special options needed on MacOS X.
 
593
dnl Defines INTL_MACOSX_LIBS.
 
594
AC_DEFUN([gt_INTL_MACOSX],
 
595
[
 
596
  dnl Check for API introduced in MacOS X 10.2.
 
597
  AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
 
598
    gt_cv_func_CFPreferencesCopyAppValue,
 
599
    [gt_save_LIBS="$LIBS"
 
600
     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
 
601
     AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>],
 
602
       [CFPreferencesCopyAppValue(NULL, NULL)],
 
603
       [gt_cv_func_CFPreferencesCopyAppValue=yes],
 
604
       [gt_cv_func_CFPreferencesCopyAppValue=no])
 
605
     LIBS="$gt_save_LIBS"])
 
606
  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
 
607
    AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1,
 
608
      [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
 
609
  fi
 
610
  dnl Check for API introduced in MacOS X 10.3.
 
611
  AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent,
 
612
    [gt_save_LIBS="$LIBS"
 
613
     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
 
614
     AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();],
 
615
       [gt_cv_func_CFLocaleCopyCurrent=yes],
 
616
       [gt_cv_func_CFLocaleCopyCurrent=no])
 
617
     LIBS="$gt_save_LIBS"])
 
618
  if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
 
619
    AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1,
 
620
      [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
 
621
  fi
 
622
  INTL_MACOSX_LIBS=
 
623
  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
 
624
    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
 
625
  fi
 
626
  AC_SUBST([INTL_MACOSX_LIBS])
 
627
])
 
628
 
 
629
# lib-ld.m4 serial 3 (gettext-0.13)
 
630
dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
 
631
dnl This file is free software; the Free Software Foundation
 
632
dnl gives unlimited permission to copy and/or distribute it,
 
633
dnl with or without modifications, as long as this notice is preserved.
 
634
 
 
635
dnl Subroutines of libtool.m4,
 
636
dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
 
637
dnl with libtool.m4.
 
638
 
 
639
dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
 
640
AC_DEFUN([AC_LIB_PROG_LD_GNU],
 
641
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
 
642
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
 
643
case `$LD -v 2>&1 </dev/null` in
 
644
*GNU* | *'with BFD'*)
 
645
  acl_cv_prog_gnu_ld=yes ;;
 
646
*)
 
647
  acl_cv_prog_gnu_ld=no ;;
 
648
esac])
 
649
with_gnu_ld=$acl_cv_prog_gnu_ld
 
650
])
 
651
 
 
652
dnl From libtool-1.4. Sets the variable LD.
 
653
AC_DEFUN([AC_LIB_PROG_LD],
 
654
[AC_ARG_WITH(gnu-ld,
 
655
[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
 
656
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
 
657
AC_REQUIRE([AC_PROG_CC])dnl
 
658
AC_REQUIRE([AC_CANONICAL_HOST])dnl
 
659
# Prepare PATH_SEPARATOR.
 
660
# The user is always right.
 
661
if test "${PATH_SEPARATOR+set}" != set; then
 
662
  echo "#! /bin/sh" >conf$$.sh
 
663
  echo  "exit 0"   >>conf$$.sh
 
664
  chmod +x conf$$.sh
 
665
  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
 
666
    PATH_SEPARATOR=';'
 
667
  else
 
668
    PATH_SEPARATOR=:
 
669
  fi
 
670
  rm -f conf$$.sh
 
671
fi
 
672
ac_prog=ld
 
673
if test "$GCC" = yes; then
 
674
  # Check if gcc -print-prog-name=ld gives a path.
 
675
  AC_MSG_CHECKING([for ld used by GCC])
 
676
  case $host in
 
677
  *-*-mingw*)
 
678
    # gcc leaves a trailing carriage return which upsets mingw
 
679
    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
 
680
  *)
 
681
    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
 
682
  esac
 
683
  case $ac_prog in
 
684
    # Accept absolute paths.
 
685
    [[\\/]* | [A-Za-z]:[\\/]*)]
 
686
      [re_direlt='/[^/][^/]*/\.\./']
 
687
      # Canonicalize the path of ld
 
688
      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
 
689
      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
 
690
        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
 
691
      done
 
692
      test -z "$LD" && LD="$ac_prog"
 
693
      ;;
 
694
  "")
 
695
    # If it fails, then pretend we aren't using GCC.
 
696
    ac_prog=ld
 
697
    ;;
 
698
  *)
 
699
    # If it is relative, then search for the first ld in PATH.
 
700
    with_gnu_ld=unknown
 
701
    ;;
 
702
  esac
 
703
elif test "$with_gnu_ld" = yes; then
 
704
  AC_MSG_CHECKING([for GNU ld])
 
705
else
 
706
  AC_MSG_CHECKING([for non-GNU ld])
 
707
fi
 
708
AC_CACHE_VAL(acl_cv_path_LD,
 
709
[if test -z "$LD"; then
 
710
  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
 
711
  for ac_dir in $PATH; do
 
712
    test -z "$ac_dir" && ac_dir=.
 
713
    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
 
714
      acl_cv_path_LD="$ac_dir/$ac_prog"
 
715
      # Check to see if the program is GNU ld.  I'd rather use --version,
 
716
      # but apparently some GNU ld's only accept -v.
 
717
      # Break only if it was the GNU/non-GNU ld that we prefer.
 
718
      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
 
719
      *GNU* | *'with BFD'*)
 
720
        test "$with_gnu_ld" != no && break ;;
 
721
      *)
 
722
        test "$with_gnu_ld" != yes && break ;;
 
723
      esac
 
724
    fi
 
725
  done
 
726
  IFS="$ac_save_ifs"
 
727
else
 
728
  acl_cv_path_LD="$LD" # Let the user override the test with a path.
 
729
fi])
 
730
LD="$acl_cv_path_LD"
 
731
if test -n "$LD"; then
 
732
  AC_MSG_RESULT($LD)
 
733
else
 
734
  AC_MSG_RESULT(no)
 
735
fi
 
736
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
 
737
AC_LIB_PROG_LD_GNU
 
738
])
 
739
 
 
740
# lib-link.m4 serial 13 (gettext-0.17)
 
741
dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
 
742
dnl This file is free software; the Free Software Foundation
 
743
dnl gives unlimited permission to copy and/or distribute it,
 
744
dnl with or without modifications, as long as this notice is preserved.
 
745
 
 
746
dnl From Bruno Haible.
 
747
 
 
748
AC_PREREQ(2.54)
 
749
 
 
750
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
 
751
dnl the libraries corresponding to explicit and implicit dependencies.
 
752
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
 
753
dnl augments the CPPFLAGS variable.
 
754
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
 
755
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
 
756
AC_DEFUN([AC_LIB_LINKFLAGS],
 
757
[
 
758
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
 
759
  AC_REQUIRE([AC_LIB_RPATH])
 
760
  define([Name],[translit([$1],[./-], [___])])
 
761
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
 
762
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
 
763
  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
 
764
    AC_LIB_LINKFLAGS_BODY([$1], [$2])
 
765
    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
 
766
    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
 
767
    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
 
768
    ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
 
769
  ])
 
770
  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
 
771
  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
 
772
  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
 
773
  LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
 
774
  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
 
775
  AC_SUBST([LIB]NAME)
 
776
  AC_SUBST([LTLIB]NAME)
 
777
  AC_SUBST([LIB]NAME[_PREFIX])
 
778
  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
 
779
  dnl results of this search when this library appears as a dependency.
 
780
  HAVE_LIB[]NAME=yes
 
781
  undefine([Name])
 
782
  undefine([NAME])
 
783
])
 
784
 
 
785
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
 
786
dnl searches for libname and the libraries corresponding to explicit and
 
787
dnl implicit dependencies, together with the specified include files and
 
788
dnl the ability to compile and link the specified testcode. If found, it
 
789
dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
 
790
dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
 
791
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
 
792
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
 
793
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
 
794
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
 
795
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
 
796
[
 
797
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
 
798
  AC_REQUIRE([AC_LIB_RPATH])
 
799
  define([Name],[translit([$1],[./-], [___])])
 
800
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
 
801
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
 
802
 
 
803
  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
 
804
  dnl accordingly.
 
805
  AC_LIB_LINKFLAGS_BODY([$1], [$2])
 
806
 
 
807
  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
 
808
  dnl because if the user has installed lib[]Name and not disabled its use
 
809
  dnl via --without-lib[]Name-prefix, he wants to use it.
 
810
  ac_save_CPPFLAGS="$CPPFLAGS"
 
811
  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
 
812
 
 
813
  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
 
814
    ac_save_LIBS="$LIBS"
 
815
    LIBS="$LIBS $LIB[]NAME"
 
816
    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
 
817
    LIBS="$ac_save_LIBS"
 
818
  ])
 
819
  if test "$ac_cv_lib[]Name" = yes; then
 
820
    HAVE_LIB[]NAME=yes
 
821
    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
 
822
    AC_MSG_CHECKING([how to link with lib[]$1])
 
823
    AC_MSG_RESULT([$LIB[]NAME])
 
824
  else
 
825
    HAVE_LIB[]NAME=no
 
826
    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
 
827
    dnl $INC[]NAME either.
 
828
    CPPFLAGS="$ac_save_CPPFLAGS"
 
829
    LIB[]NAME=
 
830
    LTLIB[]NAME=
 
831
    LIB[]NAME[]_PREFIX=
 
832
  fi
 
833
  AC_SUBST([HAVE_LIB]NAME)
 
834
  AC_SUBST([LIB]NAME)
 
835
  AC_SUBST([LTLIB]NAME)
 
836
  AC_SUBST([LIB]NAME[_PREFIX])
 
837
  undefine([Name])
 
838
  undefine([NAME])
 
839
])
 
840
 
 
841
dnl Determine the platform dependent parameters needed to use rpath:
 
842
dnl   acl_libext,
 
843
dnl   acl_shlibext,
 
844
dnl   acl_hardcode_libdir_flag_spec,
 
845
dnl   acl_hardcode_libdir_separator,
 
846
dnl   acl_hardcode_direct,
 
847
dnl   acl_hardcode_minus_L.
 
848
AC_DEFUN([AC_LIB_RPATH],
 
849
[
 
850
  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
 
851
  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
 
852
  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
 
853
  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
 
854
  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
 
855
  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
 
856
  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
 
857
    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
 
858
    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
 
859
    . ./conftest.sh
 
860
    rm -f ./conftest.sh
 
861
    acl_cv_rpath=done
 
862
  ])
 
863
  wl="$acl_cv_wl"
 
864
  acl_libext="$acl_cv_libext"
 
865
  acl_shlibext="$acl_cv_shlibext"
 
866
  acl_libname_spec="$acl_cv_libname_spec"
 
867
  acl_library_names_spec="$acl_cv_library_names_spec"
 
868
  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
 
869
  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
 
870
  acl_hardcode_direct="$acl_cv_hardcode_direct"
 
871
  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
 
872
  dnl Determine whether the user wants rpath handling at all.
 
873
  AC_ARG_ENABLE(rpath,
 
874
    [  --disable-rpath         do not hardcode runtime library paths],
 
875
    :, enable_rpath=yes)
 
876
])
 
877
 
 
878
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
 
879
dnl the libraries corresponding to explicit and implicit dependencies.
 
880
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
 
881
dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
 
882
dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
 
883
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
 
884
[
 
885
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
 
886
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
 
887
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
 
888
  dnl Autoconf >= 2.61 supports dots in --with options.
 
889
  define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
 
890
  dnl By default, look in $includedir and $libdir.
 
891
  use_additional=yes
 
892
  AC_LIB_WITH_FINAL_PREFIX([
 
893
    eval additional_includedir=\"$includedir\"
 
894
    eval additional_libdir=\"$libdir\"
 
895
  ])
 
896
  AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix],
 
897
[  --with-lib]N_A_M_E[-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
 
898
  --without-lib]N_A_M_E[-prefix     don't search for lib$1 in includedir and libdir],
 
899
[
 
900
    if test "X$withval" = "Xno"; then
 
901
      use_additional=no
 
902
    else
 
903
      if test "X$withval" = "X"; then
 
904
        AC_LIB_WITH_FINAL_PREFIX([
 
905
          eval additional_includedir=\"$includedir\"
 
906
          eval additional_libdir=\"$libdir\"
 
907
        ])
 
908
      else
 
909
        additional_includedir="$withval/include"
 
910
        additional_libdir="$withval/$acl_libdirstem"
 
911
      fi
 
912
    fi
 
913
])
 
914
  dnl Search the library and its dependencies in $additional_libdir and
 
915
  dnl $LDFLAGS. Using breadth-first-seach.
 
916
  LIB[]NAME=
 
917
  LTLIB[]NAME=
 
918
  INC[]NAME=
 
919
  LIB[]NAME[]_PREFIX=
 
920
  rpathdirs=
 
921
  ltrpathdirs=
 
922
  names_already_handled=
 
923
  names_next_round='$1 $2'
 
924
  while test -n "$names_next_round"; do
 
925
    names_this_round="$names_next_round"
 
926
    names_next_round=
 
927
    for name in $names_this_round; do
 
928
      already_handled=
 
929
      for n in $names_already_handled; do
 
930
        if test "$n" = "$name"; then
 
931
          already_handled=yes
 
932
          break
 
933
        fi
 
934
      done
 
935
      if test -z "$already_handled"; then
 
936
        names_already_handled="$names_already_handled $name"
 
937
        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
 
938
        dnl or AC_LIB_HAVE_LINKFLAGS call.
 
939
        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
 
940
        eval value=\"\$HAVE_LIB$uppername\"
 
941
        if test -n "$value"; then
 
942
          if test "$value" = yes; then
 
943
            eval value=\"\$LIB$uppername\"
 
944
            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
 
945
            eval value=\"\$LTLIB$uppername\"
 
946
            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
 
947
          else
 
948
            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
 
949
            dnl that this library doesn't exist. So just drop it.
 
950
            :
 
951
          fi
 
952
        else
 
953
          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
 
954
          dnl and the already constructed $LIBNAME/$LTLIBNAME.
 
955
          found_dir=
 
956
          found_la=
 
957
          found_so=
 
958
          found_a=
 
959
          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
 
960
          if test -n "$acl_shlibext"; then
 
961
            shrext=".$acl_shlibext"             # typically: shrext=.so
 
962
          else
 
963
            shrext=
 
964
          fi
 
965
          if test $use_additional = yes; then
 
966
            dir="$additional_libdir"
 
967
            dnl The same code as in the loop below:
 
968
            dnl First look for a shared library.
 
969
            if test -n "$acl_shlibext"; then
 
970
              if test -f "$dir/$libname$shrext"; then
 
971
                found_dir="$dir"
 
972
                found_so="$dir/$libname$shrext"
 
973
              else
 
974
                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
 
975
                  ver=`(cd "$dir" && \
 
976
                        for f in "$libname$shrext".*; do echo "$f"; done \
 
977
                        | sed -e "s,^$libname$shrext\\\\.,," \
 
978
                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
 
979
                        | sed 1q ) 2>/dev/null`
 
980
                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
 
981
                    found_dir="$dir"
 
982
                    found_so="$dir/$libname$shrext.$ver"
 
983
                  fi
 
984
                else
 
985
                  eval library_names=\"$acl_library_names_spec\"
 
986
                  for f in $library_names; do
 
987
                    if test -f "$dir/$f"; then
 
988
                      found_dir="$dir"
 
989
                      found_so="$dir/$f"
 
990
                      break
 
991
                    fi
 
992
                  done
 
993
                fi
 
994
              fi
 
995
            fi
 
996
            dnl Then look for a static library.
 
997
            if test "X$found_dir" = "X"; then
 
998
              if test -f "$dir/$libname.$acl_libext"; then
 
999
                found_dir="$dir"
 
1000
                found_a="$dir/$libname.$acl_libext"
 
1001
              fi
 
1002
            fi
 
1003
            if test "X$found_dir" != "X"; then
 
1004
              if test -f "$dir/$libname.la"; then
 
1005
                found_la="$dir/$libname.la"
 
1006
              fi
 
1007
            fi
 
1008
          fi
 
1009
          if test "X$found_dir" = "X"; then
 
1010
            for x in $LDFLAGS $LTLIB[]NAME; do
 
1011
              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 
1012
              case "$x" in
 
1013
                -L*)
 
1014
                  dir=`echo "X$x" | sed -e 's/^X-L//'`
 
1015
                  dnl First look for a shared library.
 
1016
                  if test -n "$acl_shlibext"; then
 
1017
                    if test -f "$dir/$libname$shrext"; then
 
1018
                      found_dir="$dir"
 
1019
                      found_so="$dir/$libname$shrext"
 
1020
                    else
 
1021
                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
 
1022
                        ver=`(cd "$dir" && \
 
1023
                              for f in "$libname$shrext".*; do echo "$f"; done \
 
1024
                              | sed -e "s,^$libname$shrext\\\\.,," \
 
1025
                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
 
1026
                              | sed 1q ) 2>/dev/null`
 
1027
                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
 
1028
                          found_dir="$dir"
 
1029
                          found_so="$dir/$libname$shrext.$ver"
 
1030
                        fi
 
1031
                      else
 
1032
                        eval library_names=\"$acl_library_names_spec\"
 
1033
                        for f in $library_names; do
 
1034
                          if test -f "$dir/$f"; then
 
1035
                            found_dir="$dir"
 
1036
                            found_so="$dir/$f"
 
1037
                            break
 
1038
                          fi
 
1039
                        done
 
1040
                      fi
 
1041
                    fi
 
1042
                  fi
 
1043
                  dnl Then look for a static library.
 
1044
                  if test "X$found_dir" = "X"; then
 
1045
                    if test -f "$dir/$libname.$acl_libext"; then
 
1046
                      found_dir="$dir"
 
1047
                      found_a="$dir/$libname.$acl_libext"
 
1048
                    fi
 
1049
                  fi
 
1050
                  if test "X$found_dir" != "X"; then
 
1051
                    if test -f "$dir/$libname.la"; then
 
1052
                      found_la="$dir/$libname.la"
 
1053
                    fi
 
1054
                  fi
 
1055
                  ;;
 
1056
              esac
 
1057
              if test "X$found_dir" != "X"; then
 
1058
                break
 
1059
              fi
 
1060
            done
 
1061
          fi
 
1062
          if test "X$found_dir" != "X"; then
 
1063
            dnl Found the library.
 
1064
            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
 
1065
            if test "X$found_so" != "X"; then
 
1066
              dnl Linking with a shared library. We attempt to hardcode its
 
1067
              dnl directory into the executable's runpath, unless it's the
 
1068
              dnl standard /usr/lib.
 
1069
              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
 
1070
                dnl No hardcoding is needed.
 
1071
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
 
1072
              else
 
1073
                dnl Use an explicit option to hardcode DIR into the resulting
 
1074
                dnl binary.
 
1075
                dnl Potentially add DIR to ltrpathdirs.
 
1076
                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
 
1077
                haveit=
 
1078
                for x in $ltrpathdirs; do
 
1079
                  if test "X$x" = "X$found_dir"; then
 
1080
                    haveit=yes
 
1081
                    break
 
1082
                  fi
 
1083
                done
 
1084
                if test -z "$haveit"; then
 
1085
                  ltrpathdirs="$ltrpathdirs $found_dir"
 
1086
                fi
 
1087
                dnl The hardcoding into $LIBNAME is system dependent.
 
1088
                if test "$acl_hardcode_direct" = yes; then
 
1089
                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
 
1090
                  dnl resulting binary.
 
1091
                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
 
1092
                else
 
1093
                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
 
1094
                    dnl Use an explicit option to hardcode DIR into the resulting
 
1095
                    dnl binary.
 
1096
                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
 
1097
                    dnl Potentially add DIR to rpathdirs.
 
1098
                    dnl The rpathdirs will be appended to $LIBNAME at the end.
 
1099
                    haveit=
 
1100
                    for x in $rpathdirs; do
 
1101
                      if test "X$x" = "X$found_dir"; then
 
1102
                        haveit=yes
 
1103
                        break
 
1104
                      fi
 
1105
                    done
 
1106
                    if test -z "$haveit"; then
 
1107
                      rpathdirs="$rpathdirs $found_dir"
 
1108
                    fi
 
1109
                  else
 
1110
                    dnl Rely on "-L$found_dir".
 
1111
                    dnl But don't add it if it's already contained in the LDFLAGS
 
1112
                    dnl or the already constructed $LIBNAME
 
1113
                    haveit=
 
1114
                    for x in $LDFLAGS $LIB[]NAME; do
 
1115
                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 
1116
                      if test "X$x" = "X-L$found_dir"; then
 
1117
                        haveit=yes
 
1118
                        break
 
1119
                      fi
 
1120
                    done
 
1121
                    if test -z "$haveit"; then
 
1122
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
 
1123
                    fi
 
1124
                    if test "$acl_hardcode_minus_L" != no; then
 
1125
                      dnl FIXME: Not sure whether we should use
 
1126
                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
 
1127
                      dnl here.
 
1128
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
 
1129
                    else
 
1130
                      dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
 
1131
                      dnl here, because this doesn't fit in flags passed to the
 
1132
                      dnl compiler. So give up. No hardcoding. This affects only
 
1133
                      dnl very old systems.
 
1134
                      dnl FIXME: Not sure whether we should use
 
1135
                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
 
1136
                      dnl here.
 
1137
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
 
1138
                    fi
 
1139
                  fi
 
1140
                fi
 
1141
              fi
 
1142
            else
 
1143
              if test "X$found_a" != "X"; then
 
1144
                dnl Linking with a static library.
 
1145
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
 
1146
              else
 
1147
                dnl We shouldn't come here, but anyway it's good to have a
 
1148
                dnl fallback.
 
1149
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
 
1150
              fi
 
1151
            fi
 
1152
            dnl Assume the include files are nearby.
 
1153
            additional_includedir=
 
1154
            case "$found_dir" in
 
1155
              */$acl_libdirstem | */$acl_libdirstem/)
 
1156
                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
 
1157
                LIB[]NAME[]_PREFIX="$basedir"
 
1158
                additional_includedir="$basedir/include"
 
1159
                ;;
 
1160
            esac
 
1161
            if test "X$additional_includedir" != "X"; then
 
1162
              dnl Potentially add $additional_includedir to $INCNAME.
 
1163
              dnl But don't add it
 
1164
              dnl   1. if it's the standard /usr/include,
 
1165
              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
 
1166
              dnl   3. if it's already present in $CPPFLAGS or the already
 
1167
              dnl      constructed $INCNAME,
 
1168
              dnl   4. if it doesn't exist as a directory.
 
1169
              if test "X$additional_includedir" != "X/usr/include"; then
 
1170
                haveit=
 
1171
                if test "X$additional_includedir" = "X/usr/local/include"; then
 
1172
                  if test -n "$GCC"; then
 
1173
                    case $host_os in
 
1174
                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
 
1175
                    esac
 
1176
                  fi
 
1177
                fi
 
1178
                if test -z "$haveit"; then
 
1179
                  for x in $CPPFLAGS $INC[]NAME; do
 
1180
                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 
1181
                    if test "X$x" = "X-I$additional_includedir"; then
 
1182
                      haveit=yes
 
1183
                      break
 
1184
                    fi
 
1185
                  done
 
1186
                  if test -z "$haveit"; then
 
1187
                    if test -d "$additional_includedir"; then
 
1188
                      dnl Really add $additional_includedir to $INCNAME.
 
1189
                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
 
1190
                    fi
 
1191
                  fi
 
1192
                fi
 
1193
              fi
 
1194
            fi
 
1195
            dnl Look for dependencies.
 
1196
            if test -n "$found_la"; then
 
1197
              dnl Read the .la file. It defines the variables
 
1198
              dnl dlname, library_names, old_library, dependency_libs, current,
 
1199
              dnl age, revision, installed, dlopen, dlpreopen, libdir.
 
1200
              save_libdir="$libdir"
 
1201
              case "$found_la" in
 
1202
                */* | *\\*) . "$found_la" ;;
 
1203
                *) . "./$found_la" ;;
 
1204
              esac
 
1205
              libdir="$save_libdir"
 
1206
              dnl We use only dependency_libs.
 
1207
              for dep in $dependency_libs; do
 
1208
                case "$dep" in
 
1209
                  -L*)
 
1210
                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
 
1211
                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
 
1212
                    dnl But don't add it
 
1213
                    dnl   1. if it's the standard /usr/lib,
 
1214
                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
 
1215
                    dnl   3. if it's already present in $LDFLAGS or the already
 
1216
                    dnl      constructed $LIBNAME,
 
1217
                    dnl   4. if it doesn't exist as a directory.
 
1218
                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
 
1219
                      haveit=
 
1220
                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
 
1221
                        if test -n "$GCC"; then
 
1222
                          case $host_os in
 
1223
                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
 
1224
                          esac
 
1225
                        fi
 
1226
                      fi
 
1227
                      if test -z "$haveit"; then
 
1228
                        haveit=
 
1229
                        for x in $LDFLAGS $LIB[]NAME; do
 
1230
                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 
1231
                          if test "X$x" = "X-L$additional_libdir"; then
 
1232
                            haveit=yes
 
1233
                            break
 
1234
                          fi
 
1235
                        done
 
1236
                        if test -z "$haveit"; then
 
1237
                          if test -d "$additional_libdir"; then
 
1238
                            dnl Really add $additional_libdir to $LIBNAME.
 
1239
                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
 
1240
                          fi
 
1241
                        fi
 
1242
                        haveit=
 
1243
                        for x in $LDFLAGS $LTLIB[]NAME; do
 
1244
                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 
1245
                          if test "X$x" = "X-L$additional_libdir"; then
 
1246
                            haveit=yes
 
1247
                            break
 
1248
                          fi
 
1249
                        done
 
1250
                        if test -z "$haveit"; then
 
1251
                          if test -d "$additional_libdir"; then
 
1252
                            dnl Really add $additional_libdir to $LTLIBNAME.
 
1253
                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
 
1254
                          fi
 
1255
                        fi
 
1256
                      fi
 
1257
                    fi
 
1258
                    ;;
 
1259
                  -R*)
 
1260
                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
 
1261
                    if test "$enable_rpath" != no; then
 
1262
                      dnl Potentially add DIR to rpathdirs.
 
1263
                      dnl The rpathdirs will be appended to $LIBNAME at the end.
 
1264
                      haveit=
 
1265
                      for x in $rpathdirs; do
 
1266
                        if test "X$x" = "X$dir"; then
 
1267
                          haveit=yes
 
1268
                          break
 
1269
                        fi
 
1270
                      done
 
1271
                      if test -z "$haveit"; then
 
1272
                        rpathdirs="$rpathdirs $dir"
 
1273
                      fi
 
1274
                      dnl Potentially add DIR to ltrpathdirs.
 
1275
                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
 
1276
                      haveit=
 
1277
                      for x in $ltrpathdirs; do
 
1278
                        if test "X$x" = "X$dir"; then
 
1279
                          haveit=yes
 
1280
                          break
 
1281
                        fi
 
1282
                      done
 
1283
                      if test -z "$haveit"; then
 
1284
                        ltrpathdirs="$ltrpathdirs $dir"
 
1285
                      fi
 
1286
                    fi
 
1287
                    ;;
 
1288
                  -l*)
 
1289
                    dnl Handle this in the next round.
 
1290
                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
 
1291
                    ;;
 
1292
                  *.la)
 
1293
                    dnl Handle this in the next round. Throw away the .la's
 
1294
                    dnl directory; it is already contained in a preceding -L
 
1295
                    dnl option.
 
1296
                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
 
1297
                    ;;
 
1298
                  *)
 
1299
                    dnl Most likely an immediate library name.
 
1300
                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
 
1301
                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
 
1302
                    ;;
 
1303
                esac
 
1304
              done
 
1305
            fi
 
1306
          else
 
1307
            dnl Didn't find the library; assume it is in the system directories
 
1308
            dnl known to the linker and runtime loader. (All the system
 
1309
            dnl directories known to the linker should also be known to the
 
1310
            dnl runtime loader, otherwise the system is severely misconfigured.)
 
1311
            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
 
1312
            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
 
1313
          fi
 
1314
        fi
 
1315
      fi
 
1316
    done
 
1317
  done
 
1318
  if test "X$rpathdirs" != "X"; then
 
1319
    if test -n "$acl_hardcode_libdir_separator"; then
 
1320
      dnl Weird platform: only the last -rpath option counts, the user must
 
1321
      dnl pass all path elements in one option. We can arrange that for a
 
1322
      dnl single library, but not when more than one $LIBNAMEs are used.
 
1323
      alldirs=
 
1324
      for found_dir in $rpathdirs; do
 
1325
        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
 
1326
      done
 
1327
      dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
 
1328
      acl_save_libdir="$libdir"
 
1329
      libdir="$alldirs"
 
1330
      eval flag=\"$acl_hardcode_libdir_flag_spec\"
 
1331
      libdir="$acl_save_libdir"
 
1332
      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
 
1333
    else
 
1334
      dnl The -rpath options are cumulative.
 
1335
      for found_dir in $rpathdirs; do
 
1336
        acl_save_libdir="$libdir"
 
1337
        libdir="$found_dir"
 
1338
        eval flag=\"$acl_hardcode_libdir_flag_spec\"
 
1339
        libdir="$acl_save_libdir"
 
1340
        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
 
1341
      done
 
1342
    fi
 
1343
  fi
 
1344
  if test "X$ltrpathdirs" != "X"; then
 
1345
    dnl When using libtool, the option that works for both libraries and
 
1346
    dnl executables is -R. The -R options are cumulative.
 
1347
    for found_dir in $ltrpathdirs; do
 
1348
      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
 
1349
    done
 
1350
  fi
 
1351
])
 
1352
 
 
1353
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
 
1354
dnl unless already present in VAR.
 
1355
dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
 
1356
dnl contains two or three consecutive elements that belong together.
 
1357
AC_DEFUN([AC_LIB_APPENDTOVAR],
 
1358
[
 
1359
  for element in [$2]; do
 
1360
    haveit=
 
1361
    for x in $[$1]; do
 
1362
      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 
1363
      if test "X$x" = "X$element"; then
 
1364
        haveit=yes
 
1365
        break
 
1366
      fi
 
1367
    done
 
1368
    if test -z "$haveit"; then
 
1369
      [$1]="${[$1]}${[$1]:+ }$element"
 
1370
    fi
 
1371
  done
 
1372
])
 
1373
 
 
1374
dnl For those cases where a variable contains several -L and -l options
 
1375
dnl referring to unknown libraries and directories, this macro determines the
 
1376
dnl necessary additional linker options for the runtime path.
 
1377
dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
 
1378
dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
 
1379
dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
 
1380
dnl otherwise linking without libtool is assumed.
 
1381
AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
 
1382
[
 
1383
  AC_REQUIRE([AC_LIB_RPATH])
 
1384
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
 
1385
  $1=
 
1386
  if test "$enable_rpath" != no; then
 
1387
    if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
 
1388
      dnl Use an explicit option to hardcode directories into the resulting
 
1389
      dnl binary.
 
1390
      rpathdirs=
 
1391
      next=
 
1392
      for opt in $2; do
 
1393
        if test -n "$next"; then
 
1394
          dir="$next"
 
1395
          dnl No need to hardcode the standard /usr/lib.
 
1396
          if test "X$dir" != "X/usr/$acl_libdirstem"; then
 
1397
            rpathdirs="$rpathdirs $dir"
 
1398
          fi
 
1399
          next=
 
1400
        else
 
1401
          case $opt in
 
1402
            -L) next=yes ;;
 
1403
            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
 
1404
                 dnl No need to hardcode the standard /usr/lib.
 
1405
                 if test "X$dir" != "X/usr/$acl_libdirstem"; then
 
1406
                   rpathdirs="$rpathdirs $dir"
 
1407
                 fi
 
1408
                 next= ;;
 
1409
            *) next= ;;
 
1410
          esac
 
1411
        fi
 
1412
      done
 
1413
      if test "X$rpathdirs" != "X"; then
 
1414
        if test -n ""$3""; then
 
1415
          dnl libtool is used for linking. Use -R options.
 
1416
          for dir in $rpathdirs; do
 
1417
            $1="${$1}${$1:+ }-R$dir"
 
1418
          done
 
1419
        else
 
1420
          dnl The linker is used for linking directly.
 
1421
          if test -n "$acl_hardcode_libdir_separator"; then
 
1422
            dnl Weird platform: only the last -rpath option counts, the user
 
1423
            dnl must pass all path elements in one option.
 
1424
            alldirs=
 
1425
            for dir in $rpathdirs; do
 
1426
              alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
 
1427
            done
 
1428
            acl_save_libdir="$libdir"
 
1429
            libdir="$alldirs"
 
1430
            eval flag=\"$acl_hardcode_libdir_flag_spec\"
 
1431
            libdir="$acl_save_libdir"
 
1432
            $1="$flag"
 
1433
          else
 
1434
            dnl The -rpath options are cumulative.
 
1435
            for dir in $rpathdirs; do
 
1436
              acl_save_libdir="$libdir"
 
1437
              libdir="$dir"
 
1438
              eval flag=\"$acl_hardcode_libdir_flag_spec\"
 
1439
              libdir="$acl_save_libdir"
 
1440
              $1="${$1}${$1:+ }$flag"
 
1441
            done
 
1442
          fi
 
1443
        fi
 
1444
      fi
 
1445
    fi
 
1446
  fi
 
1447
  AC_SUBST([$1])
 
1448
])
 
1449
 
 
1450
# lib-prefix.m4 serial 5 (gettext-0.15)
 
1451
dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
 
1452
dnl This file is free software; the Free Software Foundation
 
1453
dnl gives unlimited permission to copy and/or distribute it,
 
1454
dnl with or without modifications, as long as this notice is preserved.
 
1455
 
 
1456
dnl From Bruno Haible.
 
1457
 
 
1458
dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
 
1459
dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
 
1460
dnl require excessive bracketing.
 
1461
ifdef([AC_HELP_STRING],
 
1462
[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
 
1463
[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
 
1464
 
 
1465
dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
 
1466
dnl to access previously installed libraries. The basic assumption is that
 
1467
dnl a user will want packages to use other packages he previously installed
 
1468
dnl with the same --prefix option.
 
1469
dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
 
1470
dnl libraries, but is otherwise very convenient.
 
1471
AC_DEFUN([AC_LIB_PREFIX],
 
1472
[
 
1473
  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
 
1474
  AC_REQUIRE([AC_PROG_CC])
 
1475
  AC_REQUIRE([AC_CANONICAL_HOST])
 
1476
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
 
1477
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
 
1478
  dnl By default, look in $includedir and $libdir.
 
1479
  use_additional=yes
 
1480
  AC_LIB_WITH_FINAL_PREFIX([
 
1481
    eval additional_includedir=\"$includedir\"
 
1482
    eval additional_libdir=\"$libdir\"
 
1483
  ])
 
1484
  AC_LIB_ARG_WITH([lib-prefix],
 
1485
[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
 
1486
  --without-lib-prefix    don't search for libraries in includedir and libdir],
 
1487
[
 
1488
    if test "X$withval" = "Xno"; then
 
1489
      use_additional=no
 
1490
    else
 
1491
      if test "X$withval" = "X"; then
 
1492
        AC_LIB_WITH_FINAL_PREFIX([
 
1493
          eval additional_includedir=\"$includedir\"
 
1494
          eval additional_libdir=\"$libdir\"
 
1495
        ])
 
1496
      else
 
1497
        additional_includedir="$withval/include"
 
1498
        additional_libdir="$withval/$acl_libdirstem"
 
1499
      fi
 
1500
    fi
 
1501
])
 
1502
  if test $use_additional = yes; then
 
1503
    dnl Potentially add $additional_includedir to $CPPFLAGS.
 
1504
    dnl But don't add it
 
1505
    dnl   1. if it's the standard /usr/include,
 
1506
    dnl   2. if it's already present in $CPPFLAGS,
 
1507
    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
 
1508
    dnl   4. if it doesn't exist as a directory.
 
1509
    if test "X$additional_includedir" != "X/usr/include"; then
 
1510
      haveit=
 
1511
      for x in $CPPFLAGS; do
 
1512
        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 
1513
        if test "X$x" = "X-I$additional_includedir"; then
 
1514
          haveit=yes
 
1515
          break
 
1516
        fi
 
1517
      done
 
1518
      if test -z "$haveit"; then
 
1519
        if test "X$additional_includedir" = "X/usr/local/include"; then
 
1520
          if test -n "$GCC"; then
 
1521
            case $host_os in
 
1522
              linux* | gnu* | k*bsd*-gnu) haveit=yes;;
 
1523
            esac
 
1524
          fi
 
1525
        fi
 
1526
        if test -z "$haveit"; then
 
1527
          if test -d "$additional_includedir"; then
 
1528
            dnl Really add $additional_includedir to $CPPFLAGS.
 
1529
            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
 
1530
          fi
 
1531
        fi
 
1532
      fi
 
1533
    fi
 
1534
    dnl Potentially add $additional_libdir to $LDFLAGS.
 
1535
    dnl But don't add it
 
1536
    dnl   1. if it's the standard /usr/lib,
 
1537
    dnl   2. if it's already present in $LDFLAGS,
 
1538
    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
 
1539
    dnl   4. if it doesn't exist as a directory.
 
1540
    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
 
1541
      haveit=
 
1542
      for x in $LDFLAGS; do
 
1543
        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 
1544
        if test "X$x" = "X-L$additional_libdir"; then
 
1545
          haveit=yes
 
1546
          break
 
1547
        fi
 
1548
      done
 
1549
      if test -z "$haveit"; then
 
1550
        if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
 
1551
          if test -n "$GCC"; then
 
1552
            case $host_os in
 
1553
              linux*) haveit=yes;;
 
1554
            esac
 
1555
          fi
 
1556
        fi
 
1557
        if test -z "$haveit"; then
 
1558
          if test -d "$additional_libdir"; then
 
1559
            dnl Really add $additional_libdir to $LDFLAGS.
 
1560
            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
 
1561
          fi
 
1562
        fi
 
1563
      fi
 
1564
    fi
 
1565
  fi
 
1566
])
 
1567
 
 
1568
dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
 
1569
dnl acl_final_exec_prefix, containing the values to which $prefix and
 
1570
dnl $exec_prefix will expand at the end of the configure script.
 
1571
AC_DEFUN([AC_LIB_PREPARE_PREFIX],
 
1572
[
 
1573
  dnl Unfortunately, prefix and exec_prefix get only finally determined
 
1574
  dnl at the end of configure.
 
1575
  if test "X$prefix" = "XNONE"; then
 
1576
    acl_final_prefix="$ac_default_prefix"
 
1577
  else
 
1578
    acl_final_prefix="$prefix"
 
1579
  fi
 
1580
  if test "X$exec_prefix" = "XNONE"; then
 
1581
    acl_final_exec_prefix='${prefix}'
 
1582
  else
 
1583
    acl_final_exec_prefix="$exec_prefix"
 
1584
  fi
 
1585
  acl_save_prefix="$prefix"
 
1586
  prefix="$acl_final_prefix"
 
1587
  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
 
1588
  prefix="$acl_save_prefix"
 
1589
])
 
1590
 
 
1591
dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
 
1592
dnl variables prefix and exec_prefix bound to the values they will have
 
1593
dnl at the end of the configure script.
 
1594
AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
 
1595
[
 
1596
  acl_save_prefix="$prefix"
 
1597
  prefix="$acl_final_prefix"
 
1598
  acl_save_exec_prefix="$exec_prefix"
 
1599
  exec_prefix="$acl_final_exec_prefix"
 
1600
  $1
 
1601
  exec_prefix="$acl_save_exec_prefix"
 
1602
  prefix="$acl_save_prefix"
 
1603
])
 
1604
 
 
1605
dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
 
1606
dnl the basename of the libdir, either "lib" or "lib64".
 
1607
AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
 
1608
[
 
1609
  dnl There is no formal standard regarding lib and lib64. The current
 
1610
  dnl practice is that on a system supporting 32-bit and 64-bit instruction
 
1611
  dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
 
1612
  dnl libraries go under $prefix/lib. We determine the compiler's default
 
1613
  dnl mode by looking at the compiler's library search path. If at least
 
1614
  dnl of its elements ends in /lib64 or points to a directory whose absolute
 
1615
  dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
 
1616
  dnl default, namely "lib".
 
1617
  acl_libdirstem=lib
 
1618
  searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
 
1619
  if test -n "$searchpath"; then
 
1620
    acl_save_IFS="${IFS=        }"; IFS=":"
 
1621
    for searchdir in $searchpath; do
 
1622
      if test -d "$searchdir"; then
 
1623
        case "$searchdir" in
 
1624
          */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
 
1625
          *) searchdir=`cd "$searchdir" && pwd`
 
1626
             case "$searchdir" in
 
1627
               */lib64 ) acl_libdirstem=lib64 ;;
 
1628
             esac ;;
 
1629
        esac
 
1630
      fi
 
1631
    done
 
1632
    IFS="$acl_save_IFS"
 
1633
  fi
 
1634
])
 
1635
 
 
1636
# nls.m4 serial 3 (gettext-0.15)
 
1637
dnl Copyright (C) 1995-2003, 2005-2006 Free Software Foundation, Inc.
 
1638
dnl This file is free software; the Free Software Foundation
 
1639
dnl gives unlimited permission to copy and/or distribute it,
 
1640
dnl with or without modifications, as long as this notice is preserved.
 
1641
dnl
 
1642
dnl This file can can be used in projects which are not available under
 
1643
dnl the GNU General Public License or the GNU Library General Public
 
1644
dnl License but which still want to provide support for the GNU gettext
 
1645
dnl functionality.
 
1646
dnl Please note that the actual code of the GNU gettext library is covered
 
1647
dnl by the GNU Library General Public License, and the rest of the GNU
 
1648
dnl gettext package package is covered by the GNU General Public License.
 
1649
dnl They are *not* in the public domain.
 
1650
 
 
1651
dnl Authors:
 
1652
dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
 
1653
dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
 
1654
 
 
1655
AC_PREREQ(2.50)
 
1656
 
 
1657
AC_DEFUN([AM_NLS],
 
1658
[
 
1659
  AC_MSG_CHECKING([whether NLS is requested])
 
1660
  dnl Default is enabled NLS
 
1661
  AC_ARG_ENABLE(nls,
 
1662
    [  --disable-nls           do not use Native Language Support],
 
1663
    USE_NLS=$enableval, USE_NLS=yes)
 
1664
  AC_MSG_RESULT($USE_NLS)
 
1665
  AC_SUBST(USE_NLS)
 
1666
])
 
1667
 
 
1668
# po.m4 serial 15 (gettext-0.17)
 
1669
dnl Copyright (C) 1995-2007 Free Software Foundation, Inc.
 
1670
dnl This file is free software; the Free Software Foundation
 
1671
dnl gives unlimited permission to copy and/or distribute it,
 
1672
dnl with or without modifications, as long as this notice is preserved.
 
1673
dnl
 
1674
dnl This file can can be used in projects which are not available under
 
1675
dnl the GNU General Public License or the GNU Library General Public
 
1676
dnl License but which still want to provide support for the GNU gettext
 
1677
dnl functionality.
 
1678
dnl Please note that the actual code of the GNU gettext library is covered
 
1679
dnl by the GNU Library General Public License, and the rest of the GNU
 
1680
dnl gettext package package is covered by the GNU General Public License.
 
1681
dnl They are *not* in the public domain.
 
1682
 
 
1683
dnl Authors:
 
1684
dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
 
1685
dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
 
1686
 
 
1687
AC_PREREQ(2.50)
 
1688
 
 
1689
dnl Checks for all prerequisites of the po subdirectory.
 
1690
AC_DEFUN([AM_PO_SUBDIRS],
 
1691
[
 
1692
  AC_REQUIRE([AC_PROG_MAKE_SET])dnl
 
1693
  AC_REQUIRE([AC_PROG_INSTALL])dnl
 
1694
  AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
 
1695
  AC_REQUIRE([AM_NLS])dnl
 
1696
 
 
1697
  dnl Release version of the gettext macros. This is used to ensure that
 
1698
  dnl the gettext macros and po/Makefile.in.in are in sync.
 
1699
  AC_SUBST([GETTEXT_MACRO_VERSION], [0.17])
 
1700
 
 
1701
  dnl Perform the following tests also if --disable-nls has been given,
 
1702
  dnl because they are needed for "make dist" to work.
 
1703
 
 
1704
  dnl Search for GNU msgfmt in the PATH.
 
1705
  dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
 
1706
  dnl The second test excludes FreeBSD msgfmt.
 
1707
  AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
 
1708
    [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
 
1709
     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
 
1710
    :)
 
1711
  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
 
1712
 
 
1713
  dnl Test whether it is GNU msgfmt >= 0.15.
 
1714
changequote(,)dnl
 
1715
  case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
 
1716
    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;;
 
1717
    *) MSGFMT_015=$MSGFMT ;;
 
1718
  esac
 
1719
changequote([,])dnl
 
1720
  AC_SUBST([MSGFMT_015])
 
1721
changequote(,)dnl
 
1722
  case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
 
1723
    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
 
1724
    *) GMSGFMT_015=$GMSGFMT ;;
 
1725
  esac
 
1726
changequote([,])dnl
 
1727
  AC_SUBST([GMSGFMT_015])
 
1728
 
 
1729
  dnl Search for GNU xgettext 0.12 or newer in the PATH.
 
1730
  dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
 
1731
  dnl The second test excludes FreeBSD xgettext.
 
1732
  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
 
1733
    [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
 
1734
     (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
 
1735
    :)
 
1736
  dnl Remove leftover from FreeBSD xgettext call.
 
1737
  rm -f messages.po
 
1738
 
 
1739
  dnl Test whether it is GNU xgettext >= 0.15.
 
1740
changequote(,)dnl
 
1741
  case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
 
1742
    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
 
1743
    *) XGETTEXT_015=$XGETTEXT ;;
 
1744
  esac
 
1745
changequote([,])dnl
 
1746
  AC_SUBST([XGETTEXT_015])
 
1747
 
 
1748
  dnl Search for GNU msgmerge 0.11 or newer in the PATH.
 
1749
  AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
 
1750
    [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
 
1751
 
 
1752
  dnl Installation directories.
 
1753
  dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we
 
1754
  dnl have to define it here, so that it can be used in po/Makefile.
 
1755
  test -n "$localedir" || localedir='${datadir}/locale'
 
1756
  AC_SUBST([localedir])
 
1757
 
 
1758
  dnl Support for AM_XGETTEXT_OPTION.
 
1759
  test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
 
1760
  AC_SUBST([XGETTEXT_EXTRA_OPTIONS])
 
1761
 
 
1762
  AC_CONFIG_COMMANDS([po-directories], [[
 
1763
    for ac_file in $CONFIG_FILES; do
 
1764
      # Support "outfile[:infile[:infile...]]"
 
1765
      case "$ac_file" in
 
1766
        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
 
1767
      esac
 
1768
      # PO directories have a Makefile.in generated from Makefile.in.in.
 
1769
      case "$ac_file" in */Makefile.in)
 
1770
        # Adjust a relative srcdir.
 
1771
        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
 
1772
        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
 
1773
        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
 
1774
        # In autoconf-2.13 it is called $ac_given_srcdir.
 
1775
        # In autoconf-2.50 it is called $srcdir.
 
1776
        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
 
1777
        case "$ac_given_srcdir" in
 
1778
          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
 
1779
          /*) top_srcdir="$ac_given_srcdir" ;;
 
1780
          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
 
1781
        esac
 
1782
        # Treat a directory as a PO directory if and only if it has a
 
1783
        # POTFILES.in file. This allows packages to have multiple PO
 
1784
        # directories under different names or in different locations.
 
1785
        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
 
1786
          rm -f "$ac_dir/POTFILES"
 
1787
          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
 
1788
          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[   ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
 
1789
          POMAKEFILEDEPS="POTFILES.in"
 
1790
          # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
 
1791
          # on $ac_dir but don't depend on user-specified configuration
 
1792
          # parameters.
 
1793
          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
 
1794
            # The LINGUAS file contains the set of available languages.
 
1795
            if test -n "$OBSOLETE_ALL_LINGUAS"; then
 
1796
              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
 
1797
            fi
 
1798
            ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
 
1799
            # Hide the ALL_LINGUAS assigment from automake < 1.5.
 
1800
            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
 
1801
            POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
 
1802
          else
 
1803
            # The set of available languages was given in configure.in.
 
1804
            # Hide the ALL_LINGUAS assigment from automake < 1.5.
 
1805
            eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
 
1806
          fi
 
1807
          # Compute POFILES
 
1808
          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
 
1809
          # Compute UPDATEPOFILES
 
1810
          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
 
1811
          # Compute DUMMYPOFILES
 
1812
          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
 
1813
          # Compute GMOFILES
 
1814
          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
 
1815
          case "$ac_given_srcdir" in
 
1816
            .) srcdirpre= ;;
 
1817
            *) srcdirpre='$(srcdir)/' ;;
 
1818
          esac
 
1819
          POFILES=
 
1820
          UPDATEPOFILES=
 
1821
          DUMMYPOFILES=
 
1822
          GMOFILES=
 
1823
          for lang in $ALL_LINGUAS; do
 
1824
            POFILES="$POFILES $srcdirpre$lang.po"
 
1825
            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
 
1826
            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
 
1827
            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
 
1828
          done
 
1829
          # CATALOGS depends on both $ac_dir and the user's LINGUAS
 
1830
          # environment variable.
 
1831
          INST_LINGUAS=
 
1832
          if test -n "$ALL_LINGUAS"; then
 
1833
            for presentlang in $ALL_LINGUAS; do
 
1834
              useit=no
 
1835
              if test "%UNSET%" != "$LINGUAS"; then
 
1836
                desiredlanguages="$LINGUAS"
 
1837
              else
 
1838
                desiredlanguages="$ALL_LINGUAS"
 
1839
              fi
 
1840
              for desiredlang in $desiredlanguages; do
 
1841
                # Use the presentlang catalog if desiredlang is
 
1842
                #   a. equal to presentlang, or
 
1843
                #   b. a variant of presentlang (because in this case,
 
1844
                #      presentlang can be used as a fallback for messages
 
1845
                #      which are not translated in the desiredlang catalog).
 
1846
                case "$desiredlang" in
 
1847
                  "$presentlang"*) useit=yes;;
 
1848
                esac
 
1849
              done
 
1850
              if test $useit = yes; then
 
1851
                INST_LINGUAS="$INST_LINGUAS $presentlang"
 
1852
              fi
 
1853
            done
 
1854
          fi
 
1855
          CATALOGS=
 
1856
          if test -n "$INST_LINGUAS"; then
 
1857
            for lang in $INST_LINGUAS; do
 
1858
              CATALOGS="$CATALOGS $lang.gmo"
 
1859
            done
 
1860
          fi
 
1861
          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
 
1862
          sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
 
1863
          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
 
1864
            if test -f "$f"; then
 
1865
              case "$f" in
 
1866
                *.orig | *.bak | *~) ;;
 
1867
                *) cat "$f" >> "$ac_dir/Makefile" ;;
 
1868
              esac
 
1869
            fi
 
1870
          done
 
1871
        fi
 
1872
        ;;
 
1873
      esac
 
1874
    done]],
 
1875
   [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
 
1876
    # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
 
1877
    # from automake < 1.5.
 
1878
    eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
 
1879
    # Capture the value of LINGUAS because we need it to compute CATALOGS.
 
1880
    LINGUAS="${LINGUAS-%UNSET%}"
 
1881
   ])
 
1882
])
 
1883
 
 
1884
dnl Postprocesses a Makefile in a directory containing PO files.
 
1885
AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
 
1886
[
 
1887
  # When this code is run, in config.status, two variables have already been
 
1888
  # set:
 
1889
  # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
 
1890
  # - LINGUAS is the value of the environment variable LINGUAS at configure
 
1891
  #   time.
 
1892
 
 
1893
changequote(,)dnl
 
1894
  # Adjust a relative srcdir.
 
1895
  ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
 
1896
  ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
 
1897
  ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
 
1898
  # In autoconf-2.13 it is called $ac_given_srcdir.
 
1899
  # In autoconf-2.50 it is called $srcdir.
 
1900
  test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
 
1901
  case "$ac_given_srcdir" in
 
1902
    .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
 
1903
    /*) top_srcdir="$ac_given_srcdir" ;;
 
1904
    *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
 
1905
  esac
 
1906
 
 
1907
  # Find a way to echo strings without interpreting backslash.
 
1908
  if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
 
1909
    gt_echo='echo'
 
1910
  else
 
1911
    if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
 
1912
      gt_echo='printf %s\n'
 
1913
    else
 
1914
      echo_func () {
 
1915
        cat <<EOT
 
1916
$*
 
1917
EOT
 
1918
      }
 
1919
      gt_echo='echo_func'
 
1920
    fi
 
1921
  fi
 
1922
 
 
1923
  # A sed script that extracts the value of VARIABLE from a Makefile.
 
1924
  sed_x_variable='
 
1925
# Test if the hold space is empty.
 
1926
x
 
1927
s/P/P/
 
1928
x
 
1929
ta
 
1930
# Yes it was empty. Look if we have the expected variable definition.
 
1931
/^[      ]*VARIABLE[     ]*=/{
 
1932
  # Seen the first line of the variable definition.
 
1933
  s/^[   ]*VARIABLE[     ]*=//
 
1934
  ba
 
1935
}
 
1936
bd
 
1937
:a
 
1938
# Here we are processing a line from the variable definition.
 
1939
# Remove comment, more precisely replace it with a space.
 
1940
s/#.*$/ /
 
1941
# See if the line ends in a backslash.
 
1942
tb
 
1943
:b
 
1944
s/\\$//
 
1945
# Print the line, without the trailing backslash.
 
1946
p
 
1947
tc
 
1948
# There was no trailing backslash. The end of the variable definition is
 
1949
# reached. Clear the hold space.
 
1950
s/^.*$//
 
1951
x
 
1952
bd
 
1953
:c
 
1954
# A trailing backslash means that the variable definition continues in the
 
1955
# next line. Put a nonempty string into the hold space to indicate this.
 
1956
s/^.*$/P/
 
1957
x
 
1958
:d
 
1959
'
 
1960
changequote([,])dnl
 
1961
 
 
1962
  # Set POTFILES to the value of the Makefile variable POTFILES.
 
1963
  sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`
 
1964
  POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
 
1965
  # Compute POTFILES_DEPS as
 
1966
  #   $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
 
1967
  POTFILES_DEPS=
 
1968
  for file in $POTFILES; do
 
1969
    POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
 
1970
  done
 
1971
  POMAKEFILEDEPS=""
 
1972
 
 
1973
  if test -n "$OBSOLETE_ALL_LINGUAS"; then
 
1974
    test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
 
1975
  fi
 
1976
  if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
 
1977
    # The LINGUAS file contains the set of available languages.
 
1978
    ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
 
1979
    POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
 
1980
  else
 
1981
    # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
 
1982
    sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
 
1983
    ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
 
1984
  fi
 
1985
  # Hide the ALL_LINGUAS assigment from automake < 1.5.
 
1986
  eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
 
1987
  # Compute POFILES
 
1988
  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
 
1989
  # Compute UPDATEPOFILES
 
1990
  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
 
1991
  # Compute DUMMYPOFILES
 
1992
  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
 
1993
  # Compute GMOFILES
 
1994
  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
 
1995
  # Compute PROPERTIESFILES
 
1996
  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
 
1997
  # Compute CLASSFILES
 
1998
  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
 
1999
  # Compute QMFILES
 
2000
  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
 
2001
  # Compute MSGFILES
 
2002
  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
 
2003
  # Compute RESOURCESDLLFILES
 
2004
  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
 
2005
  case "$ac_given_srcdir" in
 
2006
    .) srcdirpre= ;;
 
2007
    *) srcdirpre='$(srcdir)/' ;;
 
2008
  esac
 
2009
  POFILES=
 
2010
  UPDATEPOFILES=
 
2011
  DUMMYPOFILES=
 
2012
  GMOFILES=
 
2013
  PROPERTIESFILES=
 
2014
  CLASSFILES=
 
2015
  QMFILES=
 
2016
  MSGFILES=
 
2017
  RESOURCESDLLFILES=
 
2018
  for lang in $ALL_LINGUAS; do
 
2019
    POFILES="$POFILES $srcdirpre$lang.po"
 
2020
    UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
 
2021
    DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
 
2022
    GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
 
2023
    PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
 
2024
    CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
 
2025
    QMFILES="$QMFILES $srcdirpre$lang.qm"
 
2026
    frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
 
2027
    MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
 
2028
    frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
 
2029
    RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
 
2030
  done
 
2031
  # CATALOGS depends on both $ac_dir and the user's LINGUAS
 
2032
  # environment variable.
 
2033
  INST_LINGUAS=
 
2034
  if test -n "$ALL_LINGUAS"; then
 
2035
    for presentlang in $ALL_LINGUAS; do
 
2036
      useit=no
 
2037
      if test "%UNSET%" != "$LINGUAS"; then
 
2038
        desiredlanguages="$LINGUAS"
 
2039
      else
 
2040
        desiredlanguages="$ALL_LINGUAS"
 
2041
      fi
 
2042
      for desiredlang in $desiredlanguages; do
 
2043
        # Use the presentlang catalog if desiredlang is
 
2044
        #   a. equal to presentlang, or
 
2045
        #   b. a variant of presentlang (because in this case,
 
2046
        #      presentlang can be used as a fallback for messages
 
2047
        #      which are not translated in the desiredlang catalog).
 
2048
        case "$desiredlang" in
 
2049
          "$presentlang"*) useit=yes;;
 
2050
        esac
 
2051
      done
 
2052
      if test $useit = yes; then
 
2053
        INST_LINGUAS="$INST_LINGUAS $presentlang"
 
2054
      fi
 
2055
    done
 
2056
  fi
 
2057
  CATALOGS=
 
2058
  JAVACATALOGS=
 
2059
  QTCATALOGS=
 
2060
  TCLCATALOGS=
 
2061
  CSHARPCATALOGS=
 
2062
  if test -n "$INST_LINGUAS"; then
 
2063
    for lang in $INST_LINGUAS; do
 
2064
      CATALOGS="$CATALOGS $lang.gmo"
 
2065
      JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
 
2066
      QTCATALOGS="$QTCATALOGS $lang.qm"
 
2067
      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
 
2068
      TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
 
2069
      frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
 
2070
      CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
 
2071
    done
 
2072
  fi
 
2073
 
 
2074
  sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
 
2075
  if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
 
2076
    # Add dependencies that cannot be formulated as a simple suffix rule.
 
2077
    for lang in $ALL_LINGUAS; do
 
2078
      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
 
2079
      cat >> "$ac_file.tmp" <<EOF
 
2080
$frobbedlang.msg: $lang.po
 
2081
        @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
 
2082
        \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
 
2083
EOF
 
2084
    done
 
2085
  fi
 
2086
  if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
 
2087
    # Add dependencies that cannot be formulated as a simple suffix rule.
 
2088
    for lang in $ALL_LINGUAS; do
 
2089
      frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
 
2090
      cat >> "$ac_file.tmp" <<EOF
 
2091
$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
 
2092
        @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
 
2093
        \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
 
2094
EOF
 
2095
    done
 
2096
  fi
 
2097
  if test -n "$POMAKEFILEDEPS"; then
 
2098
    cat >> "$ac_file.tmp" <<EOF
 
2099
Makefile: $POMAKEFILEDEPS
 
2100
EOF
 
2101
  fi
 
2102
  mv "$ac_file.tmp" "$ac_file"
 
2103
])
 
2104
 
 
2105
dnl Initializes the accumulator used by AM_XGETTEXT_OPTION.
 
2106
AC_DEFUN([AM_XGETTEXT_OPTION_INIT],
 
2107
[
 
2108
  XGETTEXT_EXTRA_OPTIONS=
 
2109
])
 
2110
 
 
2111
dnl Registers an option to be passed to xgettext in the po subdirectory.
 
2112
AC_DEFUN([AM_XGETTEXT_OPTION],
 
2113
[
 
2114
  AC_REQUIRE([AM_XGETTEXT_OPTION_INIT])
 
2115
  XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"
 
2116
])
 
2117
 
 
2118
# progtest.m4 serial 4 (gettext-0.14.2)
 
2119
dnl Copyright (C) 1996-2003, 2005 Free Software Foundation, Inc.
 
2120
dnl This file is free software; the Free Software Foundation
 
2121
dnl gives unlimited permission to copy and/or distribute it,
 
2122
dnl with or without modifications, as long as this notice is preserved.
 
2123
dnl
 
2124
dnl This file can can be used in projects which are not available under
 
2125
dnl the GNU General Public License or the GNU Library General Public
 
2126
dnl License but which still want to provide support for the GNU gettext
 
2127
dnl functionality.
 
2128
dnl Please note that the actual code of the GNU gettext library is covered
 
2129
dnl by the GNU Library General Public License, and the rest of the GNU
 
2130
dnl gettext package package is covered by the GNU General Public License.
 
2131
dnl They are *not* in the public domain.
 
2132
 
 
2133
dnl Authors:
 
2134
dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
 
2135
 
 
2136
AC_PREREQ(2.50)
 
2137
 
 
2138
# Search path for a program which passes the given test.
 
2139
 
 
2140
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
 
2141
dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
 
2142
AC_DEFUN([AM_PATH_PROG_WITH_TEST],
 
2143
[
 
2144
# Prepare PATH_SEPARATOR.
 
2145
# The user is always right.
 
2146
if test "${PATH_SEPARATOR+set}" != set; then
 
2147
  echo "#! /bin/sh" >conf$$.sh
 
2148
  echo  "exit 0"   >>conf$$.sh
 
2149
  chmod +x conf$$.sh
 
2150
  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
 
2151
    PATH_SEPARATOR=';'
 
2152
  else
 
2153
    PATH_SEPARATOR=:
 
2154
  fi
 
2155
  rm -f conf$$.sh
 
2156
fi
 
2157
 
 
2158
# Find out how to test for executable files. Don't use a zero-byte file,
 
2159
# as systems may use methods other than mode bits to determine executability.
 
2160
cat >conf$$.file <<_ASEOF
 
2161
#! /bin/sh
 
2162
exit 0
 
2163
_ASEOF
 
2164
chmod +x conf$$.file
 
2165
if test -x conf$$.file >/dev/null 2>&1; then
 
2166
  ac_executable_p="test -x"
 
2167
else
 
2168
  ac_executable_p="test -f"
 
2169
fi
 
2170
rm -f conf$$.file
 
2171
 
 
2172
# Extract the first word of "$2", so it can be a program name with args.
 
2173
set dummy $2; ac_word=[$]2
 
2174
AC_MSG_CHECKING([for $ac_word])
 
2175
AC_CACHE_VAL(ac_cv_path_$1,
 
2176
[case "[$]$1" in
 
2177
  [[\\/]]* | ?:[[\\/]]*)
 
2178
    ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
 
2179
    ;;
 
2180
  *)
 
2181
    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
 
2182
    for ac_dir in ifelse([$5], , $PATH, [$5]); do
 
2183
      IFS="$ac_save_IFS"
 
2184
      test -z "$ac_dir" && ac_dir=.
 
2185
      for ac_exec_ext in '' $ac_executable_extensions; do
 
2186
        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
 
2187
          echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
 
2188
          if [$3]; then
 
2189
            ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
 
2190
            break 2
 
2191
          fi
 
2192
        fi
 
2193
      done
 
2194
    done
 
2195
    IFS="$ac_save_IFS"
 
2196
dnl If no 4th arg is given, leave the cache variable unset,
 
2197
dnl so AC_PATH_PROGS will keep looking.
 
2198
ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
 
2199
])dnl
 
2200
    ;;
 
2201
esac])dnl
 
2202
$1="$ac_cv_path_$1"
 
2203
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
 
2204
  AC_MSG_RESULT([$]$1)
 
2205
else
 
2206
  AC_MSG_RESULT(no)
 
2207
fi
 
2208
AC_SUBST($1)dnl
 
2209
])
 
2210
 
 
2211
# Configure paths for SDL
 
2212
# Sam Lantinga 9/21/99
 
2213
# stolen from Manish Singh
 
2214
# stolen back from Frank Belew
 
2215
# stolen from Manish Singh
 
2216
# Shamelessly stolen from Owen Taylor
 
2217
 
 
2218
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 
2219
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
 
2220
dnl
 
2221
AC_DEFUN([AM_PATH_SDL],
 
2222
[dnl 
 
2223
dnl Get the cflags and libraries from the sdl-config script
 
2224
dnl
 
2225
AC_ARG_WITH(sdl-prefix,[  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)],
 
2226
            sdl_prefix="$withval", sdl_prefix="")
 
2227
AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
 
2228
            sdl_exec_prefix="$withval", sdl_exec_prefix="")
 
2229
AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
 
2230
                    , enable_sdltest=yes)
 
2231
 
 
2232
  if test x$sdl_exec_prefix != x ; then
 
2233
    sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
 
2234
    if test x${SDL_CONFIG+set} != xset ; then
 
2235
      SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
 
2236
    fi
 
2237
  fi
 
2238
  if test x$sdl_prefix != x ; then
 
2239
    sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
 
2240
    if test x${SDL_CONFIG+set} != xset ; then
 
2241
      SDL_CONFIG=$sdl_prefix/bin/sdl-config
 
2242
    fi
 
2243
  fi
 
2244
 
 
2245
  if test "x$prefix" != xNONE; then
 
2246
    PATH="$prefix/bin:$prefix/usr/bin:$PATH"
 
2247
  fi
 
2248
  AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
 
2249
  min_sdl_version=ifelse([$1], ,0.11.0,$1)
 
2250
  AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
 
2251
  no_sdl=""
 
2252
  if test "$SDL_CONFIG" = "no" ; then
 
2253
    no_sdl=yes
 
2254
  else
 
2255
    SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
 
2256
    SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
 
2257
 
 
2258
    sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
 
2259
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
 
2260
    sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
 
2261
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
 
2262
    sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
 
2263
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
 
2264
    if test "x$enable_sdltest" = "xyes" ; then
 
2265
      ac_save_CFLAGS="$CFLAGS"
 
2266
      ac_save_CXXFLAGS="$CXXFLAGS"
 
2267
      ac_save_LIBS="$LIBS"
 
2268
      CFLAGS="$CFLAGS $SDL_CFLAGS"
 
2269
      CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
 
2270
      LIBS="$LIBS $SDL_LIBS"
 
2271
dnl
 
2272
dnl Now check if the installed SDL is sufficiently new. (Also sanity
 
2273
dnl checks the results of sdl-config to some extent
 
2274
dnl
 
2275
      rm -f conf.sdltest
 
2276
      AC_TRY_RUN([
 
2277
#include <stdio.h>
 
2278
#include <stdlib.h>
 
2279
#include <string.h>
 
2280
#include "SDL.h"
 
2281
 
 
2282
char*
 
2283
my_strdup (char *str)
 
2284
{
 
2285
  char *new_str;
 
2286
  
 
2287
  if (str)
 
2288
    {
 
2289
      new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
 
2290
      strcpy (new_str, str);
 
2291
    }
 
2292
  else
 
2293
    new_str = NULL;
 
2294
  
 
2295
  return new_str;
 
2296
}
 
2297
 
 
2298
int main (int argc, char *argv[])
 
2299
{
 
2300
  int major, minor, micro;
 
2301
  char *tmp_version;
 
2302
 
 
2303
  /* This hangs on some systems (?)
 
2304
  system ("touch conf.sdltest");
 
2305
  */
 
2306
  { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
 
2307
 
 
2308
  /* HP/UX 9 (%@#!) writes to sscanf strings */
 
2309
  tmp_version = my_strdup("$min_sdl_version");
 
2310
  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
 
2311
     printf("%s, bad version string\n", "$min_sdl_version");
 
2312
     exit(1);
 
2313
   }
 
2314
 
 
2315
   if (($sdl_major_version > major) ||
 
2316
      (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
 
2317
      (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
 
2318
    {
 
2319
      return 0;
 
2320
    }
 
2321
  else
 
2322
    {
 
2323
      printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
 
2324
      printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
 
2325
      printf("*** best to upgrade to the required version.\n");
 
2326
      printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
 
2327
      printf("*** to point to the correct copy of sdl-config, and remove the file\n");
 
2328
      printf("*** config.cache before re-running configure\n");
 
2329
      return 1;
 
2330
    }
 
2331
}
 
2332
 
 
2333
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
 
2334
       CFLAGS="$ac_save_CFLAGS"
 
2335
       CXXFLAGS="$ac_save_CXXFLAGS"
 
2336
       LIBS="$ac_save_LIBS"
 
2337
     fi
 
2338
  fi
 
2339
  if test "x$no_sdl" = x ; then
 
2340
     AC_MSG_RESULT(yes)
 
2341
     ifelse([$2], , :, [$2])     
 
2342
  else
 
2343
     AC_MSG_RESULT(no)
 
2344
     if test "$SDL_CONFIG" = "no" ; then
 
2345
       echo "*** The sdl-config script installed by SDL could not be found"
 
2346
       echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
 
2347
       echo "*** your path, or set the SDL_CONFIG environment variable to the"
 
2348
       echo "*** full path to sdl-config."
 
2349
     else
 
2350
       if test -f conf.sdltest ; then
 
2351
        :
 
2352
       else
 
2353
          echo "*** Could not run SDL test program, checking why..."
 
2354
          CFLAGS="$CFLAGS $SDL_CFLAGS"
 
2355
          CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
 
2356
          LIBS="$LIBS $SDL_LIBS"
 
2357
          AC_TRY_LINK([
 
2358
#include <stdio.h>
 
2359
#include "SDL.h"
 
2360
 
 
2361
int main(int argc, char *argv[])
 
2362
{ return 0; }
 
2363
#undef  main
 
2364
#define main K_and_R_C_main
 
2365
],      [ return 0; ],
 
2366
        [ echo "*** The test program compiled, but did not run. This usually means"
 
2367
          echo "*** that the run-time linker is not finding SDL or finding the wrong"
 
2368
          echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
 
2369
          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
 
2370
          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
 
2371
          echo "*** is required on your system"
 
2372
          echo "***"
 
2373
          echo "*** If you have an old version installed, it is best to remove it, although"
 
2374
          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
 
2375
        [ echo "*** The test program failed to compile or link. See the file config.log for the"
 
2376
          echo "*** exact error that occured. This usually means SDL was incorrectly installed"
 
2377
          echo "*** or that you have moved SDL since it was installed. In the latter case, you"
 
2378
          echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
 
2379
          CFLAGS="$ac_save_CFLAGS"
 
2380
          CXXFLAGS="$ac_save_CXXFLAGS"
 
2381
          LIBS="$ac_save_LIBS"
 
2382
       fi
 
2383
     fi
 
2384
     SDL_CFLAGS=""
 
2385
     SDL_LIBS=""
 
2386
     ifelse([$3], , :, [$3])
 
2387
  fi
 
2388
  AC_SUBST(SDL_CFLAGS)
 
2389
  AC_SUBST(SDL_LIBS)
 
2390
  rm -f conf.sdltest
 
2391
])
 
2392
 
 
2393
# AM_CONDITIONAL                                            -*- Autoconf -*-
 
2394
 
 
2395
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
 
2396
# Free Software Foundation, Inc.
 
2397
#
 
2398
# This file is free software; the Free Software Foundation
 
2399
# gives unlimited permission to copy and/or distribute it,
 
2400
# with or without modifications, as long as this notice is preserved.
 
2401
 
 
2402
# serial 8
 
2403
 
 
2404
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
 
2405
# -------------------------------------
 
2406
# Define a conditional.
 
2407
AC_DEFUN([AM_CONDITIONAL],
 
2408
[AC_PREREQ(2.52)dnl
 
2409
 ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
 
2410
        [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
 
2411
AC_SUBST([$1_TRUE])dnl
 
2412
AC_SUBST([$1_FALSE])dnl
 
2413
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
 
2414
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
 
2415
if $2; then
 
2416
  $1_TRUE=
 
2417
  $1_FALSE='#'
 
2418
else
 
2419
  $1_TRUE='#'
 
2420
  $1_FALSE=
 
2421
fi
 
2422
AC_CONFIG_COMMANDS_PRE(
 
2423
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
 
2424
  AC_MSG_ERROR([[conditional "$1" was never defined.
 
2425
Usually this means the macro was only invoked conditionally.]])
 
2426
fi])])
 
2427
 
 
2428
# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 
2429
#
 
2430
# This file is free software; the Free Software Foundation
 
2431
# gives unlimited permission to copy and/or distribute it,
 
2432
# with or without modifications, as long as this notice is preserved.
 
2433
 
 
2434
# AM_PROG_MKDIR_P
 
2435
# ---------------
 
2436
# Check for `mkdir -p'.
 
2437
AC_DEFUN([AM_PROG_MKDIR_P],
 
2438
[AC_PREREQ([2.60])dnl
 
2439
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
 
2440
dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
 
2441
dnl while keeping a definition of mkdir_p for backward compatibility.
 
2442
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
 
2443
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
 
2444
dnl Makefile.ins that do not define MKDIR_P, so we do our own
 
2445
dnl adjustment using top_builddir (which is defined more often than
 
2446
dnl MKDIR_P).
 
2447
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
 
2448
case $mkdir_p in
 
2449
  [[\\/$]]* | ?:[[\\/]]*) ;;
 
2450
  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
 
2451
esac
 
2452
])
 
2453
 
 
2454
# Copyright (C) 2006  Free Software Foundation, Inc.
 
2455
#
 
2456
# This file is free software; the Free Software Foundation
 
2457
# gives unlimited permission to copy and/or distribute it,
 
2458
# with or without modifications, as long as this notice is preserved.
 
2459
 
 
2460
# _AM_SUBST_NOTMAKE(VARIABLE)
 
2461
# ---------------------------
 
2462
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
 
2463
# This macro is traced by Automake.
 
2464
AC_DEFUN([_AM_SUBST_NOTMAKE])
 
2465