Intial commit
[profile/ivi/w3m.git] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4-p6
2
3 dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 dnl w3m autoconf macros
14 #
15 # ----------------------------------------------------------------
16 # AC_W3M_VERSION
17 # ----------------------------------------------------------------
18 AC_DEFUN([AC_W3M_VERSION],
19 [AC_SUBST(CURRENT_VERSION)
20  cvsver=`$AWK '\$[1] ~ /Id:/ { print \$[3]}' $srcdir/ChangeLog`
21  sed -e 's/define CURRENT_VERSION "\(.*\)+cvs/define CURRENT_VERSION "\1+cvs-'$cvsver'/' $srcdir/version.c.in > version.c
22  CURRENT_VERSION=`sed -n 's/.*define CURRENT_VERSION *"w3m\/\(.*\)".*$/\1/p' version.c`])
23 #
24 # ----------------------------------------------------------------
25 # AC_W3M_COLOR
26 # ----------------------------------------------------------------
27 AC_DEFUN([AC_W3M_COLOR],
28 [AC_SUBST(USE_COLOR)
29 AC_MSG_CHECKING(if color escape sequence for kterm/pxvt is enabled)
30 AC_ARG_ENABLE(color,
31  [  --disable-color             disable color for vt100 terminal],,
32  [enable_color="yes"])
33 test x"$enable_color" = xyes && AC_DEFINE(USE_COLOR)
34 AC_MSG_RESULT($enable_color)])
35 #
36 # ----------------------------------------------------------------
37 # AC_W3M_ANSI_COLOR
38 # ----------------------------------------------------------------
39 AC_DEFUN([AC_W3M_ANSI_COLOR],
40 [AC_SUBST(USE_ANSI_COLOR)
41 AC_MSG_CHECKING(if ansi color escape sequence support is enabled)
42 AC_ARG_ENABLE(ansi_color,
43  [   --disable-ansi-color               disable ansi color escape sequence],,
44  [enable_ansi_color="$enable_color"])
45  test x"$enable_ansi_color" = xyes && AC_DEFINE(USE_ANSI_COLOR)
46  AC_MSG_RESULT($enable_ansi_color)])
47 #
48 # ----------------------------------------------------------------
49 # AC_W3M_BG_COLOR
50 # ----------------------------------------------------------------
51 AC_DEFUN([AC_W3M_BG_COLOR],
52 [AC_SUBST(USE_BG_COLOR)
53 AC_MSG_CHECKING(if background color support is enabled)
54 AC_ARG_ENABLE(bgcolor,
55  [   --disable-bgcolor          disable to set background color],,
56  [enable_bgcolor="$enable_color"])
57  test x"$enable_bgcolor" = xyes && AC_DEFINE(USE_BG_COLOR)
58 AC_MSG_RESULT($enable_bgcolor)])
59 #
60 # ----------------------------------------------------------------
61 # AC_W3M_MENU
62 # ----------------------------------------------------------------
63 AC_DEFUN([AC_W3M_MENU],
64 [AC_SUBST(USE_MENU)
65 AC_MSG_CHECKING(if popup menu is enabled)
66 AC_ARG_ENABLE(menu,
67  [  --disable-menu              disable popup menu],,
68  [enable_menu="yes"])
69  test x"$enable_menu" = xyes && AC_DEFINE(USE_MENU)
70  AC_MSG_RESULT($enable_menu)])
71 #
72 # ----------------------------------------------------------------
73 # AC_W3M_MOUSE
74 # ----------------------------------------------------------------
75 AC_DEFUN([AC_W3M_MOUSE],
76 [AC_SUBST(USE_MOUSE)
77 AC_MSG_CHECKING(if mouse operation enabled)
78 AC_ARG_ENABLE(mouse,
79  [  --disable-mouse             disable mouse operation],,
80  [enable_mouse="yes"])
81 test x"$enable_mouse" = xyes && AC_DEFINE(USE_MOUSE)
82 AC_MSG_RESULT($enable_mouse)])
83 #
84 # ----------------------------------------------------------------
85 # AC_W3M_COOKIE
86 # ----------------------------------------------------------------
87 AC_DEFUN([AC_W3M_COOKIE],
88 [AC_SUBST(USE_COOKIE)
89 AC_MSG_CHECKING(if cookie is enabled)
90 AC_ARG_ENABLE(cookie,
91  [  --disable-cookie            disable cookie],,
92  [enable_cookie="yes"])
93 test x"$enable_cookie" = xyes && AC_DEFINE(USE_COOKIE)
94 AC_MSG_RESULT($enable_cookie)])
95 #
96 # ----------------------------------------------------------------
97 # AC_W3M_DICT
98 # ----------------------------------------------------------------
99 AC_DEFUN([AC_W3M_DICT],
100 [AC_SUBST(USE_DICT)
101 AC_MSG_CHECKING(if dictionary lookup is enabled)
102 AC_ARG_ENABLE(dict,
103  [  --disable-dict              disable dictionary lookup (see README.dict)],,
104  [enable_dict="yes"])
105  test x"$enable_dict" = xyes && AC_DEFINE(USE_DICT)
106  AC_MSG_RESULT($enable_dict)])
107 #
108 # ----------------------------------------------------------------
109 # AC_W3M_HISTORY
110 # ----------------------------------------------------------------
111 AC_DEFUN([AC_W3M_HISTORY],
112 [AC_SUBST(USE_HISTORY)
113 AC_MSG_CHECKING(if URL history is enabled)
114 AC_ARG_ENABLE(history,
115  [  --disable-history           disable URL history],,
116  [enable_history="yes"])
117  test x"$enable_history" = xyes && AC_DEFINE(USE_HISTORY)
118  AC_MSG_RESULT($enable_history)])
119 #
120 # ----------------------------------------------------------------
121 # AC_W3M_NNTP
122 # ----------------------------------------------------------------
123 AC_DEFUN([AC_W3M_NNTP],
124 [AC_SUBST(USE_NNTP)
125  AC_MSG_CHECKING(if nntp is enabled)
126  AC_ARG_ENABLE(nntp,
127   [  --disable-nntp             disable NNTP],,
128   [enable_nntp="yes"])
129  test x"$enable_nntp" = xyes && AC_DEFINE(USE_NNTP)
130  AC_MSG_RESULT($enable_nntp)])
131
132 # ----------------------------------------------------------------
133 # AC_W3M_GOPHER
134 # ----------------------------------------------------------------
135 AC_DEFUN([AC_W3M_GOPHER],
136 [AC_SUBST(USE_GOPHER)
137  AC_MSG_CHECKING(if gopher is enabled)
138  AC_ARG_ENABLE(gopher,
139   [  --enable-gopher            enable GOPHER],,
140   [enable_gopher="no"])
141  test x"$enable_gopher" = xyes &&  AC_DEFINE(USE_GOPHER)
142  AC_MSG_RESULT($enable_gopher)])
143 #
144 # ----------------------------------------------------------------
145 # AC_W3M_M17N
146 # ----------------------------------------------------------------
147 # m17n enable?
148 AC_DEFUN([AC_W3M_M17N],
149 [AC_SUBST(USE_M17N)
150 AC_SUBST(USE_UNICODE)
151 AC_SUBST(WCTARGET)
152 AC_SUBST(WCCFLAGS)
153 AC_SUBST(DISPLAY_CHARSET)
154 AC_SUBST(SYSTEM_CHARSET)
155 AC_SUBST(DOCUMENT_CHARSET)
156 AC_SUBST(POSUBST)
157 AC_SUBST(POLANG)
158 WCTARGET=""; WCCFLAGS=""; wcinclude=""; wclib=""
159 AC_MSG_CHECKING(if m17n support is enabled)
160 AC_ARG_ENABLE(m17n,
161  [  --disable-m17n              do not use m17n],,
162  [enable_m17n="yes"])
163 AC_MSG_RESULT($enable_m17n)
164 if test x"$enable_m17n" = xno; then
165   w3m_lang="en"
166   WCTARGET=""
167   WCCFLAGS=""
168   wcinclude=""
169   wclib=""
170   display_charset='WC_CES_US_ASCII'
171   system_charset='WC_CES_US_ASCII'
172   document_charset='WC_CES_US_ASCII'
173 else
174  AC_DEFINE(USE_M17N)
175  WCTARGET="libwc/libwc.a"
176  WCCFLAGS='-I$(srcdir) -I$(srcdir)/..'
177  wcinclude='-I$(srcdir)/libwc'
178  wclib="-L./libwc -lwc"
179  AC_MSG_CHECKING(if unicode support is enabled)
180  AC_ARG_ENABLE(unicode,
181   [   --disable-unicode         do not use unicode],,
182   [enable_unicode="yes"])
183  AC_MSG_RESULT($enable_unicode)
184  if test x"$enable_m17n" = xyes; then
185   charset=US-ASCII
186  else
187   charset=$enable_m17n
188  fi
189  if test x"$enable_unicode" = xyes; then
190     WCCFLAGS="-DUSE_UNICODE $WCCFLAGS"
191     if test x"$charset" = xUS-ASCII; then
192      charset=UTF-8
193     fi
194     AC_DEFINE(USE_UNICODE)
195  fi
196  AC_MSG_CHECKING(if message l10n)
197  AC_ARG_ENABLE(messagel10n,
198    [   --enable-messagel10n=LL  message l10n instead of NLS],,
199    [enable_messagel10n="no"])
200  if test x$enable_messagel10n = xyes; then
201   enable_messagel10n="ja";
202  fi
203  AC_MSG_RESULT($enable_messagel10n)
204  if test x$enable_messagel10n = xno; then
205     :
206  else
207     POSUBST="\$(top_srcdir)/posubst"
208     POLANG="$enable_messagel10n"
209  fi
210  AC_MSG_CHECKING(if japanese support is enabled)
211  AC_ARG_ENABLE(japanese,
212    [   --enable-japanese=CODE   support Japanese CODE=(S|E|J|U)],,
213    [enable_japanese="no"])
214  AC_MSG_RESULT($enable_japanese)
215  if test x"$enable_japanese" = xno; then
216    w3m_lang="en"
217  else
218    w3m_lang="ja"
219    case "$enable_japanese" in
220    E*) charset=EUC-JP;;
221    S*) charset=Shift_JIS;;
222    J*) charset=ISO-2022-JP;;
223    U*) charset=UTF-8;;
224    esac 
225  fi
226  display_charset=$charset
227  AC_MSG_CHECKING(which charset is used for display)
228  AC_ARG_WITH(charset,
229   [  --with-charset=CHARSET],
230   [test x"with_charset" = xyes || display_charset="$with_charset"])
231  AC_MSG_RESULT($display_charset)
232  display_charset=`awk '$[1] == "'$display_charset'" {print $[2]}' $srcdir/charset-list`
233  case "$display_charset" in
234    WC_CES_ISO_2022_JP*)
235      system_charset=WC_CES_EUC_JP
236      document_charset=WC_CES_EUC_JP
237      ;;
238    WC_CES_SHIFT_JIS)
239      system_charset=$display_charset
240      # for auto-detect
241      document_charset=WC_CES_EUC_JP
242      ;;
243    WC_CES_ISO_2022_CN|WC_CES_HZ_GB_2312)
244      system_charset=WC_CES_EUC_CN
245      document_charset=WC_CES_EUC_CN
246      ;;
247    WC_CES_BIG5)
248      system_charset=$display_charset
249      # for auto-detect
250      document_charset=WC_CES_EUC_TW
251      ;;
252   WC_CES_ISO_2022_KR)
253      system_charset=WC_CES_EUC_KR
254      document_charset=WC_CES_EUC_KR
255      ;;
256   *)
257      system_charset=$display_charset
258      document_charset=$display_charset
259      ;;
260  esac
261 fi
262 W3M_LANGDEF=`echo $w3m_lang | tr 'a-z' 'A-Z'`
263 W3M_LANG=$W3M_LANGDEF
264 AC_DEFINE_UNQUOTED(W3M_LANG, $W3M_LANG)
265 AC_DEFINE_UNQUOTED(WCTARGET, "$WCTARGET")
266 AC_DEFINE_UNQUOTED(WCCFLAGS, "$WCCFLAGS")
267 CFLAGS="$CFLAGS $wcinclude"
268 W3M_LIBS="$W3M_LIBS $wclib"
269 AC_DEFINE_UNQUOTED(DISPLAY_CHARSET, $display_charset)
270 AC_DEFINE_UNQUOTED(SYSTEM_CHARSET, $system_charset)
271 AC_DEFINE_UNQUOTED(DOCUMENT_CHARSET, $document_charset)])
272 #
273 # ----------------------------------------------------------------
274 # AC_W3M_KEYMAP
275 # ----------------------------------------------------------------
276 AC_DEFUN([AC_W3M_KEYMAP],
277 [AC_SUBST(KEYMAP_FILE)
278  AC_MSG_CHECKING(default keymap)
279  AC_ARG_ENABLE(keymap,
280   [  --enable-keymap[=w3m|lynx] default keybind style(w3m or lynx)],,
281   [enable_keymap="w3m"])
282  AC_MSG_RESULT($enable_keymap)
283  case x"$enable_keymap" in
284  xw3m)
285   KEYMAP_FILE="keybind";;
286  xlynx)
287   KEYMAP_FILE="keybind_lynx";;
288  *)
289   AC_MSG_ERROR([keymap should be either w3m or lynx.]);;
290  esac
291  AC_SUBST(HELP_FILE)
292  HELP_FILE=w3mhelp-${enable_keymap}_$w3m_lang.html
293  AC_DEFINE_UNQUOTED(HELP_FILE, "$HELP_FILE")
294  AC_SUBST(KEYBIND)
295  AC_DEFINE_UNQUOTED(KEYBIND, $enable_keymap)])
296 #
297 # ----------------------------------------------------------------
298 # AC_W3M_MIGEMO
299 # ----------------------------------------------------------------
300 AC_DEFUN([AC_W3M_MIGEMO],
301 [AC_SUBST(USE_MIGEMO)
302  AC_SUBST(DEF_MIGEMO_COMMAND)
303  migemo_command="migemo -t egrep /usr/local/share/migemo/migemo-dict"
304  AC_MSG_CHECKING(if migemo is supported with)
305  AC_ARG_WITH(migemo,
306   [  --with-migemo=MIGEMO_COMMAND       migemo command],
307   [test x"$with_migemo" = xyes || migemo_command="$with_migemo"])
308  if test "${with_migemo+set}" = set -a "$with_migemo" != "no"; then
309    AC_DEFINE(USE_MIGEMO)
310  fi
311  AC_MSG_RESULT($migemo_command)
312  AC_DEFINE_UNQUOTED(DEF_MIGEMO_COMMAND, "$migemo_command")])
313 #
314 # ----------------------------------------------------------------
315 # AC_W3M_EDITOR
316 # ----------------------------------------------------------------
317 AC_DEFUN([AC_W3M_EDITOR],
318 [AC_SUBST(DEF_EDITOR)
319 w3m_editor="/usr/bin/vi"
320 AC_MSG_CHECKING(which editor is used by default)
321 AC_ARG_WITH(editor,
322  [  --with-editor=EDITOR                default editor (/usr/bin/vi)],
323  [w3m_editor="$with_editor"])
324 AC_MSG_RESULT($w3m_editor)
325 AC_DEFINE_UNQUOTED(DEF_EDITOR, "$w3m_editor")])
326 #
327 # ----------------------------------------------------------------
328 # AC_W3M_MAILER
329 # ----------------------------------------------------------------
330 AC_DEFUN([AC_W3M_MAILER],
331 [AC_SUBST(DEF_MAILER)
332 w3m_mailer="/usr/bin/mail"
333 AC_MSG_CHECKING(which mailer is used by default)
334 AC_ARG_WITH(mailer,
335  [  --with-mailer=MAILER                default mailer (/usr/bin/mail)],
336  [w3m_mailer="$with_mailer"])
337 AC_MSG_RESULT($w3m_mailer)
338 AC_DEFINE_UNQUOTED(DEF_MAILER, "$w3m_mailer")])
339 #
340 # ----------------------------------------------------------------
341 # AC_W3M_EXT_BROWSER
342 # ----------------------------------------------------------------
343 AC_DEFUN([AC_W3M_EXT_BROWSER],
344 [AC_SUBST(DEF_EXT_BROWSER)
345 w3m_browser="/usr/bin/mozilla"
346 AC_MSG_CHECKING(which external browser is used by default)
347 AC_ARG_WITH(browser,
348  [  --with-browser=BROWSER      default browser (/usr/bin/mozilla)],
349  [w3m_browser="$with_browser"])
350 AC_MSG_RESULT($w3m_browser)
351 AC_DEFINE_UNQUOTED(DEF_EXT_BROWSER, "$w3m_browser")])
352 #
353 # ----------------------------------------------------------------
354 # AC_W3M_HELP_CGI
355 # ----------------------------------------------------------------
356 AC_DEFUN([AC_W3M_HELP_CGI],
357 [AC_SUBST(USE_HELP_CGI)
358  AC_MSG_CHECKING(if help cgi is enabled)
359  AC_ARG_ENABLE(help_cgi,
360   [  --disable-help-cgi         disable help cgi],,
361   [enable_help_cgi="yes"])
362  test x"$enable_help_cgi" = xyes && AC_DEFINE(USE_HELP_CGI)
363  AC_MSG_RESULT($enable_help_cgi)])
364
365 # ----------------------------------------------------------------
366 # AC_W3M_EXTERNAL_URI_LOADER
367 # ----------------------------------------------------------------
368 AC_DEFUN([AC_W3M_EXTERNAL_URI_LOADER],
369 [AC_SUBST(USE_EXTERNAL_URI_LOADER)
370  AC_MSG_CHECKING(if external URI loader is enabled)
371  AC_ARG_ENABLE(external_uri_loader,
372  [  --disable-external-uri-loader       disable external URI loader],,
373  [enable_external_uri_loader="yes"])
374  test x"$enable_external_uri_loader" = xyes && AC_DEFINE(USE_EXTERNAL_URI_LOADER)
375  AC_MSG_RESULT($enable_external_uri_loader)])
376
377 # ----------------------------------------------------------------
378 # AC_W3M_W3MMAILER
379 # ----------------------------------------------------------------
380 AC_DEFUN([AC_W3M_W3MMAILER],
381 [AC_SUBST(USE_W3MMAILER)
382  AC_MSG_CHECKING(if w3mmail is used)
383  AC_ARG_ENABLE(w3mmailer,
384  [   --disable-w3mmailer                disable w3mmailer],,
385  [enable_w3mmailer="$enable_external_uri_loader"])
386  test x"$enable_external_uri_loader" = xno && enable_w3mmailer=no
387  test x"$enable_w3mmailer" = xyes && AC_DEFINE(USE_W3MMAILER)
388  AC_MSG_RESULT($enable_w3mmailer)])
389 #
390 # ----------------------------------------------------------------
391 # AC_W3M_EXTLIBS(libs)
392 # ----------------------------------------------------------------
393 AC_DEFUN([AC_W3M_EXTLIBS],
394 [lib=$1
395  AC_MSG_CHECKING(for -l$lib)
396  extlib="not found"
397  for dir in /lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib
398  do
399    if test -f $dir/lib$lib.a -o -f $dir/lib$lib.so ; then 
400     LIBS="$LIBS -l$lib"
401     extlib="found at $dir"
402     break
403    fi
404  done
405  AC_MSG_RESULT($extlib)])
406 #
407 # ----------------------------------------------------------------
408 # AC_W3M_TERMLIB
409 # ----------------------------------------------------------------
410 AC_DEFUN([AC_W3M_TERMLIB],
411 [AC_MSG_CHECKING(terminal library)
412 AC_ARG_WITH(termlib,
413  [  --with-termlib[=LIBS]               terminal library
414                                 LIBS is space separated list of:
415                                   terminfo mytinfo termcap ncurses curses],,
416  [with_termlib="yes"])
417  AC_MSG_RESULT($with_termlib)
418  test x"$with_termlib" = xyes && with_termlib="terminfo mytinfo termlib termcap ncurses curses"
419  for lib in $with_termlib; do
420    AC_CHECK_LIB($lib, tgetent, [W3M_LIBS="$W3M_LIBS -l$lib"; break])
421  done
422 ])
423 #
424 # ----------------------------------------------------------------
425 # AC_W3M_GC
426 # ----------------------------------------------------------------
427 AC_DEFUN([AC_W3M_GC],
428 [AC_MSG_CHECKING(GC library exists)
429 AC_SUBST(LIBGC)
430 AC_ARG_WITH(gc,
431  [  --with-gc[=PREFIX]          libgc PREFIX],
432  [test x"$with_gc" = xno && AC_MSG_ERROR([You can not build w3m without gc])],
433  [with_gc="yes"])
434  AC_MSG_RESULT($with_gc)
435  test x"$with_gc" = xyes && with_gc="/usr /usr/local ${HOME}"
436  unset ac_cv_header_gc_h
437  AC_CHECK_HEADER(gc.h)
438  if test x"$ac_cv_header_gc_h" = xno; then
439    AC_MSG_CHECKING(GC header location)
440    AC_MSG_RESULT($with_gc)
441    gcincludedir=no
442    for dir in $with_gc; do
443      for inc in include include/gc; do
444        cppflags="$CPPFLAGS"
445        CPPFLAGS="$CPPFLAGS -I$dir/$inc"
446        AC_MSG_CHECKING($dir/$inc)
447        unset ac_cv_header_gc_h
448        AC_CHECK_HEADER(gc.h, [gcincludedir="$dir/$inc"; CFLAGS="$CFLAGS -I$dir/$inc"; break])
449        CPPFLAGS="$cppflags"
450      done
451      if test x"$gcincludedir" != xno; then
452        break;
453      fi
454    done
455    if test x"$gcincludedir" = xno; then
456      AC_MSG_ERROR([gc.h not found])
457    fi
458  fi
459  unset ac_cv_lib_gc_GC_init
460  AC_CHECK_LIB(gc, GC_init, [LIBGC="-lgc"])
461  if test x"$ac_cv_lib_gc_GC_init" = xno; then
462     AC_MSG_CHECKING(GC library location)
463     AC_MSG_RESULT($with_gc)
464     gclibdir=no
465     for dir in $with_gc; do
466       ldflags="$LDFLAGS"
467       LDFLAGS="$LDFLAGS -L$dir/lib"
468       AC_MSG_CHECKING($dir)
469       unset ac_cv_lib_gc_GC_init
470       AC_CHECK_LIB(gc, GC_init, [gclibdir="$dir/lib"; LIBGC="-L$dir/lib -lgc"; break])
471       LDFLAGS="$ldflags"
472     done
473     if test x"$gclibdir" = xno; then
474       AC_MSG_ERROR([libgc not found])
475     fi
476  fi])
477 #
478 # ----------------------------------------------------------------
479 # AC_W3M_SSL_DIGEST_AUTH
480 # ----------------------------------------------------------------
481 AC_DEFUN([AC_W3M_SSL_DIGEST_AUTH],
482 [AC_SUBST(USE_SSL)
483 AC_SUBST(USE_SSL_VERIFY)
484 AC_MSG_CHECKING(if SSL is suported)
485 AC_ARG_WITH(ssl,
486  [  --with-ssl[=PREFIX]         support https protocol],,
487  [with_ssl="yes"])
488 AC_MSG_RESULT($with_ssl)
489 if test x"$with_ssl" != xno; then
490   PKG_CHECK_MODULES(SSL, openssl,,[
491     AC_MSG_CHECKING(for SSL library/header)
492     test x"$with_ssl" = xyes && with_ssl="/usr/openssl /usr/ssl /usr /usr/local/openssl /usr/local/ssl /usr/local"
493     AC_MSG_RESULT($with_ssl)
494     for dir in $with_ssl
495     do
496        if test -f "$dir/include/openssl/ssl.h"; then
497           SSL_CFLAGS="$SSL_CFLAGS -I$dir/include/openssl"
498           if test "$dir" != "/usr"; then
499              SSL_CFLAGS="$SSL_CFLAGS -I$dir/include"
500           fi
501        elif test "$dir" != "/usr" -a -f "$dir/include/ssl.h"; then
502           SSL_CFLAGS="$SSL_CFLAGS -I$dir/include"
503        fi
504        if test "$dir" != "/usr" -a -f "$dir/lib/libssl.a"; then
505           SSL_LIBS="$SSL_LIBS -L$dir/lib"
506        fi
507     done
508   ])
509   AC_CHECK_LIB(ssl, SSL_new,
510         [w3m_ssl="found"; CFLAGS="$CFLAGS $SSL_CFLAGS" W3M_LIBS="$W3M_LIBS $SSL_LIBS -lssl -lcrypto"],
511         [w3m_ssl="not found"],
512         [$SSL_LIBS -lcrypto])
513
514   if test x"$w3m_ssl" = xfound; then
515     AC_DEFINE(USE_SSL)
516     AC_MSG_CHECKING(if SSL certificate verify is enabled)
517     AC_ARG_ENABLE(sslverify,
518       [   --disable-sslverify           verify SSL certificate],,
519       [enable_sslverify="yes"])
520     test x"$enable_sslverify" = xyes && AC_DEFINE(USE_SSL_VERIFY)
521     AC_MSG_RESULT($enable_sslverify)
522   fi
523 fi
524 AC_SUBST(USE_DIGEST_AUTH)
525 AC_MSG_CHECKING(if digest auth is enabled)
526 AC_ARG_ENABLE(digest_auth,
527  [  --disable-digest-auth               disable digest auth],,
528  [enable_digest_auth="yes"])
529 if test x"$enable_digest_auth" = xyes -a x"$w3m_ssl" = xfound; then
530   AC_DEFINE(USE_DIGEST_AUTH)
531 else
532   enable_digest_auth="no"
533 fi
534 AC_MSG_RESULT($enable_digest_auth)
535 ])
536 #
537 # ----------------------------------------------------------------
538 # AC_W3M_ALARM
539 # ----------------------------------------------------------------
540 AC_DEFUN([AC_W3M_ALARM],
541 [AC_SUBST(USE_ALARM)
542  AC_MSG_CHECKING(if alarm is enabled)
543  AC_ARG_ENABLE(alarm,
544  [  --disable-alarm             disable alarm],,
545  [enable_alarm="yes"])
546  AC_MSG_RESULT($enable_alarm)
547  if test x"$enable_alarm" = xyes; then
548    AC_TRY_COMPILE(
549     [#include <unistd.h>
550 #include <signal.h>],
551     [int sa = SIGALRM;
552      void (*a) = alarm;],
553    [AC_DEFINE(USE_ALARM)])
554  fi])
555 #
556 # ----------------------------------------------------------------
557 # AC_W3M_CHECK_VER(name, version, major, minor, micro, 
558 #               action-if-ok, message-if-badver, action-if-nover)
559 # ----------------------------------------------------------------
560 AC_DEFUN([AC_W3M_CHECK_VER],
561 [version="$2"
562  if test x"$version" != x; then
563    AC_MSG_CHECKING($1 version)
564    AC_MSG_RESULT($version)
565    set -- `echo "$version" | sed 's/[[^0-9]]/ /g'`
566    if test "$[1]" -ne "$3" -o "$[2]" -lt "$4" || test "$[2]" -eq "$4" -a "$[3]" -lt "$5"; then
567      AC_MSG_WARN([$1 is too old. Install $1 (version >= $3.$4.$5)])
568      $7
569    else
570      $6
571    fi
572  else
573    AC_MSG_WARN([$1 is not installed.  Install $1 (version >= $3.$4.$5)])
574    $7
575  fi])
576 #
577 # ----------------------------------------------------------------
578 # AC_W3M_IMAGE
579 # ----------------------------------------------------------------
580 AC_DEFUN([AC_W3M_IMAGE],
581 [AC_SUBST(USE_IMAGE)
582  AC_SUBST(USE_W3MIMG_X11)
583  AC_SUBST(USE_W3MIMG_FB)
584  AC_SUBST(W3MIMGDISPLAY_SETUID)
585  AC_SUBST(INSTALL_W3MIMGDISPLAY)
586  INSTALL_W3MIMGDISPLAY='${INSTALL_PROGRAM}'
587  AC_DEFINE(INSTALL_W3MIMGDISPLAY, $INSTALL_W3MIMGDISPLAY)
588  AC_SUBST(USE_GDKPIXBUF)
589  AC_SUBST(USE_GTK2)
590  AC_SUBST(USE_IMLIB)
591  AC_SUBST(USE_IMLIB2)
592  AC_SUBST(IMGTARGETS)
593  AC_SUBST(IMGOBJS)
594  AC_SUBST(IMGX11CFLAGS)
595  AC_SUBST(IMGX11LDFLAGS)
596  AC_SUBST(IMGFBCFLAGS)
597  AC_SUBST(IMGFBLDFLAGS)
598  AC_MSG_CHECKING(if image is enabled)
599  AC_ARG_ENABLE(image,
600  [  --enable-image[=DEVS]               enable inline image handler for DEVS
601                                  DEVS may be comma separeted: x11,fb,fb+s
602                                  default: autodetected.
603                                  'no' means disable inline image],,
604  [enable_image="yes"])
605  AC_MSG_RESULT($enable_image)
606  if test x"$enable_image" != xno; then
607   IMGOBJS=w3mimg.o
608   if test x"$enable_image" = xyes; then
609     enable_image=x11
610     case "`uname -s`" in
611     Linux|linux|LINUX) 
612         if test -c /dev/fb0; then
613           enable_image=x11,fb
614         fi;;
615     esac
616   fi   
617   save_ifs="$IFS"; IFS=",";
618   for img in $enable_image; do
619     case $img in
620       x11) x11=yes;;
621       fb)  fb=yes;;
622       fb+s) fb=yes
623            AC_DEFINE(W3MIMGDISPLAY_SETUID)
624            INSTALL_W3MIMGDISPLAY='${INSTALL} -o root -m 4755 -s'
625            AC_DEFINE(INSTALL_W3MIMGDISPLAY, $INSTALL_W3MIMGDISPLAY);;
626     esac
627   done
628   IFS="$save_ifs"
629   enable_image=yes
630   AC_DEFINE(USE_IMAGE)
631   AC_MSG_CHECKING(image library)
632   AC_ARG_WITH(imagelib,
633    [  --with-imagelib=IMAGELIBS         image library
634                                  IMAGELIBS may be space separeted list of: 
635                                     gtk2 gdk-pixbuf imlib imlib2],,
636
637    [with_imagelib="yes"])
638   if test x"$with_imagelib" = xyes; then
639     with_imagelib="gtk2 gdk-pixbuf imlib imlib2"
640   fi
641   AC_MSG_RESULT($with_imagelib)
642   with_imlib=no
643   with_imlib2=no
644   with_gdkpixbuf=no
645   with_gtk2=no
646   for imagelib in $with_imagelib
647   do
648    case "$imagelib" in
649    imlib)
650      with_imlib="yes"
651      if test x"$IMLIB_CONFIG" = x; then
652        IMLIB_CONFIG=imlib-config
653      fi;;
654    imlib2)
655      with_imlib2="yes"
656      if test x"$IMLIB2_CONFIG" = x; then
657        IMLIB2_CONFIG=imlib2-config
658      fi;;
659    gdk-pixbuf)
660      with_gdkpixbuf="yes"
661      if test x"$GDKPIXBUF_CONFIG" = x; then
662        GDKPIXBUF_CONFIG=gdk-pixbuf-config
663      fi;;
664    gtk2)
665      with_gtk2="yes"
666      if test x"$PKG_CONFIG" = x; then
667        PKG_CONFIG=pkg-config
668      else
669        PKG_CONFIG=:
670      fi;;
671    esac
672   done
673   IMGTARGETS=""
674   if test x"$with_gtk2" = xyes; then
675    AC_W3M_CHECK_VER([GdkPixbuf],
676         [`$PKG_CONFIG --modversion gdk-pixbuf-2.0 2>/dev/null`],
677         2, 0, 0,
678         [have_gdkpixbuf="yes"; have_gtk2="yes"],
679         [have_gdkpixbuf="no"; have_gtk2="no"])
680   fi
681   if test x"$with_gdkpixbuf" = xyes; then
682    if test x"$have_gdkpixbuf" != xyes; then
683     AC_W3M_CHECK_VER([GdkPixbuf],
684         [`$GDKPIXBUF_CONFIG --version 2>/dev/null`],
685         0, 16, 0,
686         [have_gdkpixbuf="yes"],
687         [have_gdkpixbuf="no"])
688    fi
689   fi
690   if test x"$with_imlib" = xyes; then
691    AC_W3M_CHECK_VER([Imlib],
692         [`$IMLIB_CONFIG --version 2>/dev/null`],
693         1, 9, 8,
694         [have_imlib="yes"],
695         [have_imlib="no"])
696   fi
697   if test x"$with_imlib2" = xyes; then
698    AC_W3M_CHECK_VER([Imlib2],
699         [`$IMLIB2_CONFIG --version 2>/dev/null`],
700         1, 0, 5,
701         [have_imlib2="yes"],
702         [have_imlib2="no"])
703   fi
704   if test x"$x11" = xyes; then
705    if test x"$have_gtk2" = xyes; then
706      AC_DEFINE(USE_W3MIMG_X11)
707      IMGOBJS="$IMGOBJS x11/x11_w3mimg.o"
708      IMGTARGETS="x11"    
709      AC_DEFINE(USE_GDKPIXBUF)
710      AC_DEFINE(USE_GTK2)
711      IMGX11CFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`"
712      IMGX11LDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`"
713    elif test x"$have_gdkpixbuf" = xyes; then
714      AC_DEFINE(USE_W3MIMG_X11)
715      IMGOBJS="$IMGOBJS x11/x11_w3mimg.o"
716      IMGTARGETS="x11"    
717      AC_DEFINE(USE_GDKPIXBUF)
718      IMGX11CFLAGS="`${GDKPIXBUF_CONFIG} --cflags`"
719      IMGX11LDFLAGS="`${GDKPIXBUF_CONFIG} --libs` -lgdk_pixbuf_xlib"
720    elif test x"$have_imlib" = xyes; then
721      AC_DEFINE(USE_W3MIMG_X11)
722      IMGOBJS="$IMGOBJS x11/x11_w3mimg.o"
723      IMGTARGETS="x11"    
724      AC_DEFINE(USE_IMLIB)
725      IMGX11CFLAGS="`${IMLIB_CONFIG} --cflags`"
726      IMGX11LDFLAGS="`${IMLIB_CONFIG} --libs`"
727      IMGTARGETS="x11"    
728    elif test x"$have_imlib2" = xyes; then
729      AC_DEFINE(USE_W3MIMG_X11)
730      IMGOBJS="$IMGOBJS x11/x11_w3mimg.o"
731      IMGTARGETS="x11"    
732      AC_DEFINE(USE_IMLIB2)
733      IMGX11CFLAGS="`${IMLIB2_CONFIG} --cflags`"
734      IMGX11LDFLAGS="`${IMLIB2_CONFIG} --libs`"
735    else
736      AC_MSG_WARN([unable to build w3mimgdisplay with X11 support])
737    fi
738   fi
739   if test x"$fb" = xyes; then
740    if test x"$have_gtk2" = xyes; then
741      AC_DEFINE(USE_W3MIMG_FB)
742      IMGOBJS="$IMGOBJS fb/fb_w3mimg.o fb/fb.o fb/fb_img.o"
743      IMGTARGETS="${IMGTARGETS} fb"
744      AC_DEFINE(USE_GDKPIXBUF)
745      AC_DEFINE(USE_GTK2)
746      IMGFBCFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gtk+-2.0`"
747      IMGFBLDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0 gtk+-2.0`"
748    elif test x"$have_gdkpixbuf" = xyes; then
749      AC_DEFINE(USE_W3MIMG_FB)
750      IMGOBJS="$IMGOBJS fb/fb_w3mimg.o fb/fb.o fb/fb_img.o"
751      IMGTARGETS="${IMGTARGETS} fb"
752      AC_DEFINE(USE_GDKPIXBUF)
753      IMGFBCFLAGS="`${GDKPIXBUF_CONFIG} --cflags`"
754      IMGFBLDFLAGS="`${GDKPIXBUF_CONFIG} --libs`"
755    elif test x"$have_imlib2" = xyes; then
756      AC_DEFINE(USE_W3MIMG_FB)
757      IMGOBJS="$IMGOBJS fb/fb_w3mimg.o fb/fb.o fb/fb_img.o"
758      IMGTARGETS="${IMGTARGETS} fb"
759      AC_DEFINE(USE_IMLIB2)
760      IMGOBJS="$IMGOBJS fb/fb_w3mimg.o fb/fb.o fb/fb_img.o"
761      IMGFBCFLAGS="`${IMLIB2_CONFIG} --cflags`"
762      IMGFBLDFLAGS="`${IMLIB2_CONFIG} --libs`"
763    else
764      AC_MSG_WARN([unable to build w3mimgdisplay with FB support])
765    fi
766   fi
767   AC_DEFINE(IMGTARGETS, "$IMGTARGETS")
768   AC_DEFINE(IMGOBJS, "$IMGOBJS")
769   AC_DEFINE(IMGX11CFLAGS, "$IMGX11CFLAGS")
770   AC_DEFINE(IMGX11LDFLAGS, "$IMGX11LDFLAGS")
771   AC_DEFINE(IMGFBCFLAGS, "$IMGFBCFLAGS")
772   AC_DEFINE(IMGFBLDFLAGS, "$IMGLDFLAGS")
773  fi])
774 # ----------------------------------------------------------------
775 # AC_W3M_XFACE
776 # ----------------------------------------------------------------
777 AC_DEFUN([AC_W3M_XFACE],
778 [AC_SUBST(USE_XFACE)
779  AC_MSG_CHECKING(if xface is enabled)
780  AC_ARG_ENABLE(xface,
781   [   --disable-xface           disable xface support],,
782   [enable_xface="$enable_image"])
783  test x"$enable_xface" = xyes && AC_DEFINE(USE_XFACE)
784  AC_MSG_RESULT($enable_xface)
785  AC_CHECK_PROG(uncompface, uncompface, "yes", "no")
786  test "$uncompface" = "no" && AC_MSG_WARN([uncompface is not installed.])
787 ])
788 #
789 # ----------------------------------------------------------------
790 # AC_W3M_IPv6
791 # ----------------------------------------------------------------
792 AC_DEFUN([AC_W3M_IPv6],
793 [AC_MSG_CHECKING(if IPv6 support is enabled)
794 AC_ARG_ENABLE(ipv6,
795  [  --disable-ipv6              disable IPv6],,
796  [enable_ipv6="yes"])
797 AC_MSG_RESULT($enable_ipv6)
798
799 if test x"$enable_ipv6" = xyes; then
800  AC_MSG_CHECKING(if IPv6 API available)
801  AC_SUBST(INET6)
802  AC_CHECK_FUNC(getaddrinfo, 
803         [enable_ipv6="yes"],
804         [enable_ipv6="no"])
805  if test x"$enable_ipv6" = xno; then
806     AC_MSG_CHECKING(for libinet6)
807     for dir in /usr/local/v6/lib /usr/local/lib /usr/lib
808     do
809         if test -f $dir/libinet6.a; then
810           if test $dir != "/usr/lib"; then
811                 W3M_LIBS="$W3M_LIBS -L$dir"
812           fi
813           AC_CHECK_LIB(inet6, getaddrinfo,
814                 [enable_ipv6="yes"
815                  use_libinet6="found"; W3M_LIBS="$W3M_LIBS -linet6"; break],
816                 [use_libinet6="not found"])
817         fi
818     done
819     AC_MSG_RESULT($use_libinet6)
820  fi
821  if test x"$enable_ipv6" = xyes; then
822     AC_SUBST(HAVE_OLD_SS_FAMILY)
823     AC_MSG_CHECKING(if struct sockaddr_storage has an ss_family member)
824     AC_TRY_COMPILE([
825 #include <sys/types.h>
826 #include <sys/socket.h>
827       ], [
828         struct sockaddr_storage ss;
829         int i = ss.ss_family;
830       ],
831       [AC_MSG_RESULT(yes)],
832       [AC_TRY_COMPILE([
833 #include <sys/types.h>
834 #include <sys/socket.h>
835         ],
836         [
837         struct sockaddr_storage ss;
838         int i = ss.__ss_family;
839         ],
840         [AC_MSG_RESULT(no, but __ss_family exists)
841          AC_DEFINE(HAVE_OLD_SS_FAMILY)],
842         [AC_MSG_RESULT(no)
843          AC_MSG_WARN(IPv6 support is disabled)
844          enable_ipv6="no"])
845       ])
846  fi
847  if test x"$enable_ipv6" = xyes; then
848     AC_DEFINE(INET6)
849  fi
850 fi])
851 #
852 # ----------------------------------------------------------------
853 # AC_W3M_SYS_ERRLIST
854 # ----------------------------------------------------------------
855 AC_DEFUN([AC_W3M_SYS_ERRLIST],
856 [AC_SUBST(HAVE_SYS_ERRLIST)
857 AC_MSG_CHECKING(for sys_errlist)
858 AC_TRY_COMPILE(
859 changequote(<<,>>)dnl
860 <<extern char *sys_errlist[];>>,
861 <<printf(sys_errlist[0]);>>,
862 changequote([,])dnl
863 [have_sys_errlist="yes"; AC_DEFINE(HAVE_SYS_ERRLIST)],
864 [have_sys_errlist="no"])
865 AC_MSG_RESULT($have_sys_errlist)])
866 #
867 # ----------------------------------------------------------------
868 # AC_W3M_SIGSETJMP
869 # ----------------------------------------------------------------
870 AC_DEFUN([AC_W3M_SIGSETJMP],
871 [AC_SUBST(HAVE_SIGSETJMP)
872 AC_MSG_CHECKING(for sigsetjmp)
873 AC_TRY_COMPILE(
874 [#include <setjmp.h>],
875 [ jmp_buf env;
876    if (sigsetjmp(env, 1) != 0) { exit(0); } siglongjmp(env, 1);],
877 [have_sigsetjmp="yes"; AC_DEFINE(HAVE_SIGSETJMP)],
878 [have_sigsetjmp="no"])
879 AC_MSG_RESULT($have_sigsetjmp)])
880 #
881 # ----------------------------------------------------------------
882 # AC_W3M_SIGNAL_RETURN
883 # ----------------------------------------------------------------
884 AC_DEFUN([AC_W3M_SIGNAL],
885 [AC_TYPE_SIGNAL
886  AC_SUBST(RETSIGTYPE)
887  AC_SUBST(SIGNAL_RETURN)
888  if test x"$ac_cv_type_signal" = xvoid; then
889   AC_DEFINE(SIGNAL_RETURN,return)
890  else
891   AC_DEFINE(SIGNAL_RETURN,return 0)
892  fi])
893
894 # lib-prefix.m4 serial 3 (gettext-0.13)
895 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
896 dnl This file is free software, distributed under the terms of the GNU
897 dnl General Public License.  As a special exception to the GNU General
898 dnl Public License, this file may be distributed as part of a program
899 dnl that contains a configuration script generated by Autoconf, under
900 dnl the same distribution terms as the rest of that program.
901
902 dnl From Bruno Haible.
903
904 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
905 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
906 dnl require excessive bracketing.
907 ifdef([AC_HELP_STRING],
908 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
909 [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
910
911 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
912 dnl to access previously installed libraries. The basic assumption is that
913 dnl a user will want packages to use other packages he previously installed
914 dnl with the same --prefix option.
915 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
916 dnl libraries, but is otherwise very convenient.
917 AC_DEFUN([AC_LIB_PREFIX],
918 [
919   AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
920   AC_REQUIRE([AC_PROG_CC])
921   AC_REQUIRE([AC_CANONICAL_HOST])
922   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
923   dnl By default, look in $includedir and $libdir.
924   use_additional=yes
925   AC_LIB_WITH_FINAL_PREFIX([
926     eval additional_includedir=\"$includedir\"
927     eval additional_libdir=\"$libdir\"
928   ])
929   AC_LIB_ARG_WITH([lib-prefix],
930 [  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
931   --without-lib-prefix    don't search for libraries in includedir and libdir],
932 [
933     if test "X$withval" = "Xno"; then
934       use_additional=no
935     else
936       if test "X$withval" = "X"; then
937         AC_LIB_WITH_FINAL_PREFIX([
938           eval additional_includedir=\"$includedir\"
939           eval additional_libdir=\"$libdir\"
940         ])
941       else
942         additional_includedir="$withval/include"
943         additional_libdir="$withval/lib"
944       fi
945     fi
946 ])
947   if test $use_additional = yes; then
948     dnl Potentially add $additional_includedir to $CPPFLAGS.
949     dnl But don't add it
950     dnl   1. if it's the standard /usr/include,
951     dnl   2. if it's already present in $CPPFLAGS,
952     dnl   3. if it's /usr/local/include and we are using GCC on Linux,
953     dnl   4. if it doesn't exist as a directory.
954     if test "X$additional_includedir" != "X/usr/include"; then
955       haveit=
956       for x in $CPPFLAGS; do
957         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
958         if test "X$x" = "X-I$additional_includedir"; then
959           haveit=yes
960           break
961         fi
962       done
963       if test -z "$haveit"; then
964         if test "X$additional_includedir" = "X/usr/local/include"; then
965           if test -n "$GCC"; then
966             case $host_os in
967               linux*) haveit=yes;;
968             esac
969           fi
970         fi
971         if test -z "$haveit"; then
972           if test -d "$additional_includedir"; then
973             dnl Really add $additional_includedir to $CPPFLAGS.
974             CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
975           fi
976         fi
977       fi
978     fi
979     dnl Potentially add $additional_libdir to $LDFLAGS.
980     dnl But don't add it
981     dnl   1. if it's the standard /usr/lib,
982     dnl   2. if it's already present in $LDFLAGS,
983     dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
984     dnl   4. if it doesn't exist as a directory.
985     if test "X$additional_libdir" != "X/usr/lib"; then
986       haveit=
987       for x in $LDFLAGS; do
988         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
989         if test "X$x" = "X-L$additional_libdir"; then
990           haveit=yes
991           break
992         fi
993       done
994       if test -z "$haveit"; then
995         if test "X$additional_libdir" = "X/usr/local/lib"; then
996           if test -n "$GCC"; then
997             case $host_os in
998               linux*) haveit=yes;;
999             esac
1000           fi
1001         fi
1002         if test -z "$haveit"; then
1003           if test -d "$additional_libdir"; then
1004             dnl Really add $additional_libdir to $LDFLAGS.
1005             LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
1006           fi
1007         fi
1008       fi
1009     fi
1010   fi
1011 ])
1012
1013 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
1014 dnl acl_final_exec_prefix, containing the values to which $prefix and
1015 dnl $exec_prefix will expand at the end of the configure script.
1016 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
1017 [
1018   dnl Unfortunately, prefix and exec_prefix get only finally determined
1019   dnl at the end of configure.
1020   if test "X$prefix" = "XNONE"; then
1021     acl_final_prefix="$ac_default_prefix"
1022   else
1023     acl_final_prefix="$prefix"
1024   fi
1025   if test "X$exec_prefix" = "XNONE"; then
1026     acl_final_exec_prefix='${prefix}'
1027   else
1028     acl_final_exec_prefix="$exec_prefix"
1029   fi
1030   acl_save_prefix="$prefix"
1031   prefix="$acl_final_prefix"
1032   eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
1033   prefix="$acl_save_prefix"
1034 ])
1035
1036 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
1037 dnl variables prefix and exec_prefix bound to the values they will have
1038 dnl at the end of the configure script.
1039 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
1040 [
1041   acl_save_prefix="$prefix"
1042   prefix="$acl_final_prefix"
1043   acl_save_exec_prefix="$exec_prefix"
1044   exec_prefix="$acl_final_exec_prefix"
1045   $1
1046   exec_prefix="$acl_save_exec_prefix"
1047   prefix="$acl_save_prefix"
1048 ])
1049
1050 # lib-link.m4 serial 4 (gettext-0.12)
1051 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
1052 dnl This file is free software, distributed under the terms of the GNU
1053 dnl General Public License.  As a special exception to the GNU General
1054 dnl Public License, this file may be distributed as part of a program
1055 dnl that contains a configuration script generated by Autoconf, under
1056 dnl the same distribution terms as the rest of that program.
1057
1058 dnl From Bruno Haible.
1059
1060 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
1061 dnl the libraries corresponding to explicit and implicit dependencies.
1062 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
1063 dnl augments the CPPFLAGS variable.
1064 AC_DEFUN([AC_LIB_LINKFLAGS],
1065 [
1066   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1067   AC_REQUIRE([AC_LIB_RPATH])
1068   define([Name],[translit([$1],[./-], [___])])
1069   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1070                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1071   AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
1072     AC_LIB_LINKFLAGS_BODY([$1], [$2])
1073     ac_cv_lib[]Name[]_libs="$LIB[]NAME"
1074     ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
1075     ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
1076   ])
1077   LIB[]NAME="$ac_cv_lib[]Name[]_libs"
1078   LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
1079   INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
1080   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1081   AC_SUBST([LIB]NAME)
1082   AC_SUBST([LTLIB]NAME)
1083   dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
1084   dnl results of this search when this library appears as a dependency.
1085   HAVE_LIB[]NAME=yes
1086   undefine([Name])
1087   undefine([NAME])
1088 ])
1089
1090 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
1091 dnl searches for libname and the libraries corresponding to explicit and
1092 dnl implicit dependencies, together with the specified include files and
1093 dnl the ability to compile and link the specified testcode. If found, it
1094 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
1095 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
1096 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
1097 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
1098 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
1099 [
1100   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1101   AC_REQUIRE([AC_LIB_RPATH])
1102   define([Name],[translit([$1],[./-], [___])])
1103   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1104                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1105
1106   dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
1107   dnl accordingly.
1108   AC_LIB_LINKFLAGS_BODY([$1], [$2])
1109
1110   dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
1111   dnl because if the user has installed lib[]Name and not disabled its use
1112   dnl via --without-lib[]Name-prefix, he wants to use it.
1113   ac_save_CPPFLAGS="$CPPFLAGS"
1114   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1115
1116   AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
1117     ac_save_LIBS="$LIBS"
1118     LIBS="$LIBS $LIB[]NAME"
1119     AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
1120     LIBS="$ac_save_LIBS"
1121   ])
1122   if test "$ac_cv_lib[]Name" = yes; then
1123     HAVE_LIB[]NAME=yes
1124     AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
1125     AC_MSG_CHECKING([how to link with lib[]$1])
1126     AC_MSG_RESULT([$LIB[]NAME])
1127   else
1128     HAVE_LIB[]NAME=no
1129     dnl If $LIB[]NAME didn't lead to a usable library, we don't need
1130     dnl $INC[]NAME either.
1131     CPPFLAGS="$ac_save_CPPFLAGS"
1132     LIB[]NAME=
1133     LTLIB[]NAME=
1134   fi
1135   AC_SUBST([HAVE_LIB]NAME)
1136   AC_SUBST([LIB]NAME)
1137   AC_SUBST([LTLIB]NAME)
1138   undefine([Name])
1139   undefine([NAME])
1140 ])
1141
1142 dnl Determine the platform dependent parameters needed to use rpath:
1143 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
1144 dnl hardcode_direct, hardcode_minus_L.
1145 AC_DEFUN([AC_LIB_RPATH],
1146 [
1147   AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
1148   AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
1149   AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
1150   AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
1151   AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
1152     CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
1153     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
1154     . ./conftest.sh
1155     rm -f ./conftest.sh
1156     acl_cv_rpath=done
1157   ])
1158   wl="$acl_cv_wl"
1159   libext="$acl_cv_libext"
1160   shlibext="$acl_cv_shlibext"
1161   hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
1162   hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
1163   hardcode_direct="$acl_cv_hardcode_direct"
1164   hardcode_minus_L="$acl_cv_hardcode_minus_L"
1165   dnl Determine whether the user wants rpath handling at all.
1166   AC_ARG_ENABLE(rpath,
1167     [  --disable-rpath         do not hardcode runtime library paths],
1168     :, enable_rpath=yes)
1169 ])
1170
1171 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
1172 dnl the libraries corresponding to explicit and implicit dependencies.
1173 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
1174 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
1175 [
1176   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1177                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1178   dnl By default, look in $includedir and $libdir.
1179   use_additional=yes
1180   AC_LIB_WITH_FINAL_PREFIX([
1181     eval additional_includedir=\"$includedir\"
1182     eval additional_libdir=\"$libdir\"
1183   ])
1184   AC_LIB_ARG_WITH([lib$1-prefix],
1185 [  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
1186   --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
1187 [
1188     if test "X$withval" = "Xno"; then
1189       use_additional=no
1190     else
1191       if test "X$withval" = "X"; then
1192         AC_LIB_WITH_FINAL_PREFIX([
1193           eval additional_includedir=\"$includedir\"
1194           eval additional_libdir=\"$libdir\"
1195         ])
1196       else
1197         additional_includedir="$withval/include"
1198         additional_libdir="$withval/lib"
1199       fi
1200     fi
1201 ])
1202   dnl Search the library and its dependencies in $additional_libdir and
1203   dnl $LDFLAGS. Using breadth-first-seach.
1204   LIB[]NAME=
1205   LTLIB[]NAME=
1206   INC[]NAME=
1207   rpathdirs=
1208   ltrpathdirs=
1209   names_already_handled=
1210   names_next_round='$1 $2'
1211   while test -n "$names_next_round"; do
1212     names_this_round="$names_next_round"
1213     names_next_round=
1214     for name in $names_this_round; do
1215       already_handled=
1216       for n in $names_already_handled; do
1217         if test "$n" = "$name"; then
1218           already_handled=yes
1219           break
1220         fi
1221       done
1222       if test -z "$already_handled"; then
1223         names_already_handled="$names_already_handled $name"
1224         dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
1225         dnl or AC_LIB_HAVE_LINKFLAGS call.
1226         uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
1227         eval value=\"\$HAVE_LIB$uppername\"
1228         if test -n "$value"; then
1229           if test "$value" = yes; then
1230             eval value=\"\$LIB$uppername\"
1231             test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
1232             eval value=\"\$LTLIB$uppername\"
1233             test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
1234           else
1235             dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
1236             dnl that this library doesn't exist. So just drop it.
1237             :
1238           fi
1239         else
1240           dnl Search the library lib$name in $additional_libdir and $LDFLAGS
1241           dnl and the already constructed $LIBNAME/$LTLIBNAME.
1242           found_dir=
1243           found_la=
1244           found_so=
1245           found_a=
1246           if test $use_additional = yes; then
1247             if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
1248               found_dir="$additional_libdir"
1249               found_so="$additional_libdir/lib$name.$shlibext"
1250               if test -f "$additional_libdir/lib$name.la"; then
1251                 found_la="$additional_libdir/lib$name.la"
1252               fi
1253             else
1254               if test -f "$additional_libdir/lib$name.$libext"; then
1255                 found_dir="$additional_libdir"
1256                 found_a="$additional_libdir/lib$name.$libext"
1257                 if test -f "$additional_libdir/lib$name.la"; then
1258                   found_la="$additional_libdir/lib$name.la"
1259                 fi
1260               fi
1261             fi
1262           fi
1263           if test "X$found_dir" = "X"; then
1264             for x in $LDFLAGS $LTLIB[]NAME; do
1265               AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1266               case "$x" in
1267                 -L*)
1268                   dir=`echo "X$x" | sed -e 's/^X-L//'`
1269                   if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
1270                     found_dir="$dir"
1271                     found_so="$dir/lib$name.$shlibext"
1272                     if test -f "$dir/lib$name.la"; then
1273                       found_la="$dir/lib$name.la"
1274                     fi
1275                   else
1276                     if test -f "$dir/lib$name.$libext"; then
1277                       found_dir="$dir"
1278                       found_a="$dir/lib$name.$libext"
1279                       if test -f "$dir/lib$name.la"; then
1280                         found_la="$dir/lib$name.la"
1281                       fi
1282                     fi
1283                   fi
1284                   ;;
1285               esac
1286               if test "X$found_dir" != "X"; then
1287                 break
1288               fi
1289             done
1290           fi
1291           if test "X$found_dir" != "X"; then
1292             dnl Found the library.
1293             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
1294             if test "X$found_so" != "X"; then
1295               dnl Linking with a shared library. We attempt to hardcode its
1296               dnl directory into the executable's runpath, unless it's the
1297               dnl standard /usr/lib.
1298               if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
1299                 dnl No hardcoding is needed.
1300                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1301               else
1302                 dnl Use an explicit option to hardcode DIR into the resulting
1303                 dnl binary.
1304                 dnl Potentially add DIR to ltrpathdirs.
1305                 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1306                 haveit=
1307                 for x in $ltrpathdirs; do
1308                   if test "X$x" = "X$found_dir"; then
1309                     haveit=yes
1310                     break
1311                   fi
1312                 done
1313                 if test -z "$haveit"; then
1314                   ltrpathdirs="$ltrpathdirs $found_dir"
1315                 fi
1316                 dnl The hardcoding into $LIBNAME is system dependent.
1317                 if test "$hardcode_direct" = yes; then
1318                   dnl Using DIR/libNAME.so during linking hardcodes DIR into the
1319                   dnl resulting binary.
1320                   LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1321                 else
1322                   if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
1323                     dnl Use an explicit option to hardcode DIR into the resulting
1324                     dnl binary.
1325                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1326                     dnl Potentially add DIR to rpathdirs.
1327                     dnl The rpathdirs will be appended to $LIBNAME at the end.
1328                     haveit=
1329                     for x in $rpathdirs; do
1330                       if test "X$x" = "X$found_dir"; then
1331                         haveit=yes
1332                         break
1333                       fi
1334                     done
1335                     if test -z "$haveit"; then
1336                       rpathdirs="$rpathdirs $found_dir"
1337                     fi
1338                   else
1339                     dnl Rely on "-L$found_dir".
1340                     dnl But don't add it if it's already contained in the LDFLAGS
1341                     dnl or the already constructed $LIBNAME
1342                     haveit=
1343                     for x in $LDFLAGS $LIB[]NAME; do
1344                       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1345                       if test "X$x" = "X-L$found_dir"; then
1346                         haveit=yes
1347                         break
1348                       fi
1349                     done
1350                     if test -z "$haveit"; then
1351                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
1352                     fi
1353                     if test "$hardcode_minus_L" != no; then
1354                       dnl FIXME: Not sure whether we should use
1355                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1356                       dnl here.
1357                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1358                     else
1359                       dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
1360                       dnl here, because this doesn't fit in flags passed to the
1361                       dnl compiler. So give up. No hardcoding. This affects only
1362                       dnl very old systems.
1363                       dnl FIXME: Not sure whether we should use
1364                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1365                       dnl here.
1366                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1367                     fi
1368                   fi
1369                 fi
1370               fi
1371             else
1372               if test "X$found_a" != "X"; then
1373                 dnl Linking with a static library.
1374                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
1375               else
1376                 dnl We shouldn't come here, but anyway it's good to have a
1377                 dnl fallback.
1378                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
1379               fi
1380             fi
1381             dnl Assume the include files are nearby.
1382             additional_includedir=
1383             case "$found_dir" in
1384               */lib | */lib/)
1385                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
1386                 additional_includedir="$basedir/include"
1387                 ;;
1388             esac
1389             if test "X$additional_includedir" != "X"; then
1390               dnl Potentially add $additional_includedir to $INCNAME.
1391               dnl But don't add it
1392               dnl   1. if it's the standard /usr/include,
1393               dnl   2. if it's /usr/local/include and we are using GCC on Linux,
1394               dnl   3. if it's already present in $CPPFLAGS or the already
1395               dnl      constructed $INCNAME,
1396               dnl   4. if it doesn't exist as a directory.
1397               if test "X$additional_includedir" != "X/usr/include"; then
1398                 haveit=
1399                 if test "X$additional_includedir" = "X/usr/local/include"; then
1400                   if test -n "$GCC"; then
1401                     case $host_os in
1402                       linux*) haveit=yes;;
1403                     esac
1404                   fi
1405                 fi
1406                 if test -z "$haveit"; then
1407                   for x in $CPPFLAGS $INC[]NAME; do
1408                     AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1409                     if test "X$x" = "X-I$additional_includedir"; then
1410                       haveit=yes
1411                       break
1412                     fi
1413                   done
1414                   if test -z "$haveit"; then
1415                     if test -d "$additional_includedir"; then
1416                       dnl Really add $additional_includedir to $INCNAME.
1417                       INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
1418                     fi
1419                   fi
1420                 fi
1421               fi
1422             fi
1423             dnl Look for dependencies.
1424             if test -n "$found_la"; then
1425               dnl Read the .la file. It defines the variables
1426               dnl dlname, library_names, old_library, dependency_libs, current,
1427               dnl age, revision, installed, dlopen, dlpreopen, libdir.
1428               save_libdir="$libdir"
1429               case "$found_la" in
1430                 */* | *\\*) . "$found_la" ;;
1431                 *) . "./$found_la" ;;
1432               esac
1433               libdir="$save_libdir"
1434               dnl We use only dependency_libs.
1435               for dep in $dependency_libs; do
1436                 case "$dep" in
1437                   -L*)
1438                     additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
1439                     dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
1440                     dnl But don't add it
1441                     dnl   1. if it's the standard /usr/lib,
1442                     dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
1443                     dnl   3. if it's already present in $LDFLAGS or the already
1444                     dnl      constructed $LIBNAME,
1445                     dnl   4. if it doesn't exist as a directory.
1446                     if test "X$additional_libdir" != "X/usr/lib"; then
1447                       haveit=
1448                       if test "X$additional_libdir" = "X/usr/local/lib"; then
1449                         if test -n "$GCC"; then
1450                           case $host_os in
1451                             linux*) haveit=yes;;
1452                           esac
1453                         fi
1454                       fi
1455                       if test -z "$haveit"; then
1456                         haveit=
1457                         for x in $LDFLAGS $LIB[]NAME; do
1458                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1459                           if test "X$x" = "X-L$additional_libdir"; then
1460                             haveit=yes
1461                             break
1462                           fi
1463                         done
1464                         if test -z "$haveit"; then
1465                           if test -d "$additional_libdir"; then
1466                             dnl Really add $additional_libdir to $LIBNAME.
1467                             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
1468                           fi
1469                         fi
1470                         haveit=
1471                         for x in $LDFLAGS $LTLIB[]NAME; do
1472                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1473                           if test "X$x" = "X-L$additional_libdir"; then
1474                             haveit=yes
1475                             break
1476                           fi
1477                         done
1478                         if test -z "$haveit"; then
1479                           if test -d "$additional_libdir"; then
1480                             dnl Really add $additional_libdir to $LTLIBNAME.
1481                             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
1482                           fi
1483                         fi
1484                       fi
1485                     fi
1486                     ;;
1487                   -R*)
1488                     dir=`echo "X$dep" | sed -e 's/^X-R//'`
1489                     if test "$enable_rpath" != no; then
1490                       dnl Potentially add DIR to rpathdirs.
1491                       dnl The rpathdirs will be appended to $LIBNAME at the end.
1492                       haveit=
1493                       for x in $rpathdirs; do
1494                         if test "X$x" = "X$dir"; then
1495                           haveit=yes
1496                           break
1497                         fi
1498                       done
1499                       if test -z "$haveit"; then
1500                         rpathdirs="$rpathdirs $dir"
1501                       fi
1502                       dnl Potentially add DIR to ltrpathdirs.
1503                       dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1504                       haveit=
1505                       for x in $ltrpathdirs; do
1506                         if test "X$x" = "X$dir"; then
1507                           haveit=yes
1508                           break
1509                         fi
1510                       done
1511                       if test -z "$haveit"; then
1512                         ltrpathdirs="$ltrpathdirs $dir"
1513                       fi
1514                     fi
1515                     ;;
1516                   -l*)
1517                     dnl Handle this in the next round.
1518                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
1519                     ;;
1520                   *.la)
1521                     dnl Handle this in the next round. Throw away the .la's
1522                     dnl directory; it is already contained in a preceding -L
1523                     dnl option.
1524                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
1525                     ;;
1526                   *)
1527                     dnl Most likely an immediate library name.
1528                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
1529                     LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
1530                     ;;
1531                 esac
1532               done
1533             fi
1534           else
1535             dnl Didn't find the library; assume it is in the system directories
1536             dnl known to the linker and runtime loader. (All the system
1537             dnl directories known to the linker should also be known to the
1538             dnl runtime loader, otherwise the system is severely misconfigured.)
1539             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1540             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
1541           fi
1542         fi
1543       fi
1544     done
1545   done
1546   if test "X$rpathdirs" != "X"; then
1547     if test -n "$hardcode_libdir_separator"; then
1548       dnl Weird platform: only the last -rpath option counts, the user must
1549       dnl pass all path elements in one option. We can arrange that for a
1550       dnl single library, but not when more than one $LIBNAMEs are used.
1551       alldirs=
1552       for found_dir in $rpathdirs; do
1553         alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
1554       done
1555       dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
1556       acl_save_libdir="$libdir"
1557       libdir="$alldirs"
1558       eval flag=\"$hardcode_libdir_flag_spec\"
1559       libdir="$acl_save_libdir"
1560       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1561     else
1562       dnl The -rpath options are cumulative.
1563       for found_dir in $rpathdirs; do
1564         acl_save_libdir="$libdir"
1565         libdir="$found_dir"
1566         eval flag=\"$hardcode_libdir_flag_spec\"
1567         libdir="$acl_save_libdir"
1568         LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1569       done
1570     fi
1571   fi
1572   if test "X$ltrpathdirs" != "X"; then
1573     dnl When using libtool, the option that works for both libraries and
1574     dnl executables is -R. The -R options are cumulative.
1575     for found_dir in $ltrpathdirs; do
1576       LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
1577     done
1578   fi
1579 ])
1580
1581 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
1582 dnl unless already present in VAR.
1583 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
1584 dnl contains two or three consecutive elements that belong together.
1585 AC_DEFUN([AC_LIB_APPENDTOVAR],
1586 [
1587   for element in [$2]; do
1588     haveit=
1589     for x in $[$1]; do
1590       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1591       if test "X$x" = "X$element"; then
1592         haveit=yes
1593         break
1594       fi
1595     done
1596     if test -z "$haveit"; then
1597       [$1]="${[$1]}${[$1]:+ }$element"
1598     fi
1599   done
1600 ])
1601
1602 # lib-ld.m4 serial 3 (gettext-0.13)
1603 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
1604 dnl This file is free software, distributed under the terms of the GNU
1605 dnl General Public License.  As a special exception to the GNU General
1606 dnl Public License, this file may be distributed as part of a program
1607 dnl that contains a configuration script generated by Autoconf, under
1608 dnl the same distribution terms as the rest of that program.
1609
1610 dnl Subroutines of libtool.m4,
1611 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
1612 dnl with libtool.m4.
1613
1614 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
1615 AC_DEFUN([AC_LIB_PROG_LD_GNU],
1616 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
1617 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
1618 case `$LD -v 2>&1 </dev/null` in
1619 *GNU* | *'with BFD'*)
1620   acl_cv_prog_gnu_ld=yes ;;
1621 *)
1622   acl_cv_prog_gnu_ld=no ;;
1623 esac])
1624 with_gnu_ld=$acl_cv_prog_gnu_ld
1625 ])
1626
1627 dnl From libtool-1.4. Sets the variable LD.
1628 AC_DEFUN([AC_LIB_PROG_LD],
1629 [AC_ARG_WITH(gnu-ld,
1630 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
1631 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
1632 AC_REQUIRE([AC_PROG_CC])dnl
1633 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1634 # Prepare PATH_SEPARATOR.
1635 # The user is always right.
1636 if test "${PATH_SEPARATOR+set}" != set; then
1637   echo "#! /bin/sh" >conf$$.sh
1638   echo  "exit 0"   >>conf$$.sh
1639   chmod +x conf$$.sh
1640   if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
1641     PATH_SEPARATOR=';'
1642   else
1643     PATH_SEPARATOR=:
1644   fi
1645   rm -f conf$$.sh
1646 fi
1647 ac_prog=ld
1648 if test "$GCC" = yes; then
1649   # Check if gcc -print-prog-name=ld gives a path.
1650   AC_MSG_CHECKING([for ld used by GCC])
1651   case $host in
1652   *-*-mingw*)
1653     # gcc leaves a trailing carriage return which upsets mingw
1654     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
1655   *)
1656     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
1657   esac
1658   case $ac_prog in
1659     # Accept absolute paths.
1660     [[\\/]* | [A-Za-z]:[\\/]*)]
1661       [re_direlt='/[^/][^/]*/\.\./']
1662       # Canonicalize the path of ld
1663       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
1664       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1665         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1666       done
1667       test -z "$LD" && LD="$ac_prog"
1668       ;;
1669   "")
1670     # If it fails, then pretend we aren't using GCC.
1671     ac_prog=ld
1672     ;;
1673   *)
1674     # If it is relative, then search for the first ld in PATH.
1675     with_gnu_ld=unknown
1676     ;;
1677   esac
1678 elif test "$with_gnu_ld" = yes; then
1679   AC_MSG_CHECKING([for GNU ld])
1680 else
1681   AC_MSG_CHECKING([for non-GNU ld])
1682 fi
1683 AC_CACHE_VAL(acl_cv_path_LD,
1684 [if test -z "$LD"; then
1685   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1686   for ac_dir in $PATH; do
1687     test -z "$ac_dir" && ac_dir=.
1688     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
1689       acl_cv_path_LD="$ac_dir/$ac_prog"
1690       # Check to see if the program is GNU ld.  I'd rather use --version,
1691       # but apparently some GNU ld's only accept -v.
1692       # Break only if it was the GNU/non-GNU ld that we prefer.
1693       case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
1694       *GNU* | *'with BFD'*)
1695         test "$with_gnu_ld" != no && break ;;
1696       *)
1697         test "$with_gnu_ld" != yes && break ;;
1698       esac
1699     fi
1700   done
1701   IFS="$ac_save_ifs"
1702 else
1703   acl_cv_path_LD="$LD" # Let the user override the test with a path.
1704 fi])
1705 LD="$acl_cv_path_LD"
1706 if test -n "$LD"; then
1707   AC_MSG_RESULT($LD)
1708 else
1709   AC_MSG_RESULT(no)
1710 fi
1711 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1712 AC_LIB_PROG_LD_GNU
1713 ])
1714
1715
1716 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1717 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1718 dnl also defines GSTUFF_PKG_ERRORS on error
1719 AC_DEFUN(PKG_CHECK_MODULES, [
1720   succeeded=no
1721
1722   if test -z "$PKG_CONFIG"; then
1723     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1724   fi
1725
1726   if test "$PKG_CONFIG" = "no" ; then
1727      echo "*** The pkg-config script could not be found. Make sure it is"
1728      echo "*** in your path, or set the PKG_CONFIG environment variable"
1729      echo "*** to the full path to pkg-config."
1730      echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1731   else
1732      PKG_CONFIG_MIN_VERSION=0.9.0
1733      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1734         AC_MSG_CHECKING(for $2)
1735
1736         if $PKG_CONFIG --exists "$2" ; then
1737             AC_MSG_RESULT(yes)
1738             succeeded=yes
1739
1740             AC_MSG_CHECKING($1_CFLAGS)
1741             $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1742             AC_MSG_RESULT($$1_CFLAGS)
1743
1744             AC_MSG_CHECKING($1_LIBS)
1745             $1_LIBS=`$PKG_CONFIG --libs "$2"`
1746             AC_MSG_RESULT($$1_LIBS)
1747         else
1748             $1_CFLAGS=""
1749             $1_LIBS=""
1750             ## If we have a custom action on failure, don't print errors, but 
1751             ## do set a variable so people can do so.
1752             $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1753             ifelse([$4], ,echo $$1_PKG_ERRORS,)
1754         fi
1755
1756         AC_SUBST($1_CFLAGS)
1757         AC_SUBST($1_LIBS)
1758      else
1759         echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1760         echo "*** See http://www.freedesktop.org/software/pkgconfig"
1761      fi
1762   fi
1763
1764   if test $succeeded = yes; then
1765      ifelse([$3], , :, [$3])
1766   else
1767      ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
1768   fi
1769 ])
1770
1771
1772
1773 # gettext.m4 serial 28 (gettext-0.13)
1774 dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
1775 dnl This file is free software, distributed under the terms of the GNU
1776 dnl General Public License.  As a special exception to the GNU General
1777 dnl Public License, this file may be distributed as part of a program
1778 dnl that contains a configuration script generated by Autoconf, under
1779 dnl the same distribution terms as the rest of that program.
1780 dnl
1781 dnl This file can can be used in projects which are not available under
1782 dnl the GNU General Public License or the GNU Library General Public
1783 dnl License but which still want to provide support for the GNU gettext
1784 dnl functionality.
1785 dnl Please note that the actual code of the GNU gettext library is covered
1786 dnl by the GNU Library General Public License, and the rest of the GNU
1787 dnl gettext package package is covered by the GNU General Public License.
1788 dnl They are *not* in the public domain.
1789
1790 dnl Authors:
1791 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
1792 dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
1793
1794 dnl Macro to add for using GNU gettext.
1795
1796 dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
1797 dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
1798 dnl    default (if it is not specified or empty) is 'no-libtool'.
1799 dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
1800 dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
1801 dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
1802 dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
1803 dnl    depending on --{enable,disable}-{shared,static} and on the presence of
1804 dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
1805 dnl    $(top_builddir)/intl/libintl.a will be created.
1806 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
1807 dnl    implementations (in libc or libintl) without the ngettext() function
1808 dnl    will be ignored.  If NEEDSYMBOL is specified and is
1809 dnl    'need-formatstring-macros', then GNU gettext implementations that don't
1810 dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
1811 dnl INTLDIR is used to find the intl libraries.  If empty,
1812 dnl    the value `$(top_builddir)/intl/' is used.
1813 dnl
1814 dnl The result of the configuration is one of three cases:
1815 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
1816 dnl    and used.
1817 dnl    Catalog format: GNU --> install in $(datadir)
1818 dnl    Catalog extension: .mo after installation, .gmo in source tree
1819 dnl 2) GNU gettext has been found in the system's C library.
1820 dnl    Catalog format: GNU --> install in $(datadir)
1821 dnl    Catalog extension: .mo after installation, .gmo in source tree
1822 dnl 3) No internationalization, always use English msgid.
1823 dnl    Catalog format: none
1824 dnl    Catalog extension: none
1825 dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
1826 dnl The use of .gmo is historical (it was needed to avoid overwriting the
1827 dnl GNU format catalogs when building on a platform with an X/Open gettext),
1828 dnl but we keep it in order not to force irrelevant filename changes on the
1829 dnl maintainers.
1830 dnl
1831 AC_DEFUN([AM_GNU_GETTEXT],
1832 [
1833   dnl Argument checking.
1834   ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
1835     [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
1836 ])])])])])
1837   ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
1838     [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
1839 ])])])])
1840   define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
1841   define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
1842
1843   AC_REQUIRE([AM_PO_SUBDIRS])dnl
1844   ifelse(gt_included_intl, yes, [
1845     AC_REQUIRE([AM_INTL_SUBDIR])dnl
1846   ])
1847
1848   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
1849   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1850   AC_REQUIRE([AC_LIB_RPATH])
1851
1852   dnl Sometimes libintl requires libiconv, so first search for libiconv.
1853   dnl Ideally we would do this search only after the
1854   dnl      if test "$USE_NLS" = "yes"; then
1855   dnl        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
1856   dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
1857   dnl the configure script would need to contain the same shell code
1858   dnl again, outside any 'if'. There are two solutions:
1859   dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
1860   dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
1861   dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
1862   dnl documented, we avoid it.
1863   ifelse(gt_included_intl, yes, , [
1864     AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
1865   ])
1866
1867   dnl Set USE_NLS.
1868   AM_NLS
1869
1870   ifelse(gt_included_intl, yes, [
1871     BUILD_INCLUDED_LIBINTL=no
1872     USE_INCLUDED_LIBINTL=no
1873   ])
1874   LIBINTL=
1875   LTLIBINTL=
1876   POSUB=
1877
1878   dnl If we use NLS figure out what method
1879   if test "$USE_NLS" = "yes"; then
1880     gt_use_preinstalled_gnugettext=no
1881     ifelse(gt_included_intl, yes, [
1882       AC_MSG_CHECKING([whether included gettext is requested])
1883       AC_ARG_WITH(included-gettext,
1884         [  --with-included-gettext use the GNU gettext library included here],
1885         nls_cv_force_use_gnu_gettext=$withval,
1886         nls_cv_force_use_gnu_gettext=no)
1887       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
1888
1889       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
1890       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
1891     ])
1892         dnl User does not insist on using GNU NLS library.  Figure out what
1893         dnl to use.  If GNU gettext is available we use this.  Else we have
1894         dnl to fall back to GNU NLS library.
1895
1896         dnl Add a version number to the cache macros.
1897         define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
1898         define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
1899         define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
1900
1901         AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
1902          [AC_TRY_LINK([#include <libintl.h>
1903 ]ifelse([$2], [need-formatstring-macros],
1904 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
1905 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
1906 #endif
1907 changequote(,)dnl
1908 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
1909 changequote([,])dnl
1910 ], [])[extern int _nl_msg_cat_cntr;
1911 extern int *_nl_domain_bindings;],
1912             [bindtextdomain ("", "");
1913 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
1914             gt_cv_func_gnugettext_libc=yes,
1915             gt_cv_func_gnugettext_libc=no)])
1916
1917         if test "$gt_cv_func_gnugettext_libc" != "yes"; then
1918           dnl Sometimes libintl requires libiconv, so first search for libiconv.
1919           ifelse(gt_included_intl, yes, , [
1920             AM_ICONV_LINK
1921           ])
1922           dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
1923           dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
1924           dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
1925           dnl even if libiconv doesn't exist.
1926           AC_LIB_LINKFLAGS_BODY([intl])
1927           AC_CACHE_CHECK([for GNU gettext in libintl],
1928             gt_cv_func_gnugettext_libintl,
1929            [gt_save_CPPFLAGS="$CPPFLAGS"
1930             CPPFLAGS="$CPPFLAGS $INCINTL"
1931             gt_save_LIBS="$LIBS"
1932             LIBS="$LIBS $LIBINTL"
1933             dnl Now see whether libintl exists and does not depend on libiconv.
1934             AC_TRY_LINK([#include <libintl.h>
1935 ]ifelse([$2], [need-formatstring-macros],
1936 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
1937 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
1938 #endif
1939 changequote(,)dnl
1940 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
1941 changequote([,])dnl
1942 ], [])[extern int _nl_msg_cat_cntr;
1943 extern
1944 #ifdef __cplusplus
1945 "C"
1946 #endif
1947 const char *_nl_expand_alias ();],
1948               [bindtextdomain ("", "");
1949 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
1950               gt_cv_func_gnugettext_libintl=yes,
1951               gt_cv_func_gnugettext_libintl=no)
1952             dnl Now see whether libintl exists and depends on libiconv.
1953             if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
1954               LIBS="$LIBS $LIBICONV"
1955               AC_TRY_LINK([#include <libintl.h>
1956 ]ifelse([$2], [need-formatstring-macros],
1957 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
1958 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
1959 #endif
1960 changequote(,)dnl
1961 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
1962 changequote([,])dnl
1963 ], [])[extern int _nl_msg_cat_cntr;
1964 extern
1965 #ifdef __cplusplus
1966 "C"
1967 #endif
1968 const char *_nl_expand_alias ();],
1969                 [bindtextdomain ("", "");
1970 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
1971                [LIBINTL="$LIBINTL $LIBICONV"
1972                 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
1973                 gt_cv_func_gnugettext_libintl=yes
1974                ])
1975             fi
1976             CPPFLAGS="$gt_save_CPPFLAGS"
1977             LIBS="$gt_save_LIBS"])
1978         fi
1979
1980         dnl If an already present or preinstalled GNU gettext() is found,
1981         dnl use it.  But if this macro is used in GNU gettext, and GNU
1982         dnl gettext is already preinstalled in libintl, we update this
1983         dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
1984         if test "$gt_cv_func_gnugettext_libc" = "yes" \
1985            || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
1986                 && test "$PACKAGE" != gettext-runtime \
1987                 && test "$PACKAGE" != gettext-tools; }; then
1988           gt_use_preinstalled_gnugettext=yes
1989         else
1990           dnl Reset the values set by searching for libintl.
1991           LIBINTL=
1992           LTLIBINTL=
1993           INCINTL=
1994         fi
1995
1996     ifelse(gt_included_intl, yes, [
1997         if test "$gt_use_preinstalled_gnugettext" != "yes"; then
1998           dnl GNU gettext is not found in the C library.
1999           dnl Fall back on included GNU gettext library.
2000           nls_cv_use_gnu_gettext=yes
2001         fi
2002       fi
2003
2004       if test "$nls_cv_use_gnu_gettext" = "yes"; then
2005         dnl Mark actions used to generate GNU NLS library.
2006         BUILD_INCLUDED_LIBINTL=yes
2007         USE_INCLUDED_LIBINTL=yes
2008         LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
2009         LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
2010         LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
2011       fi
2012
2013       if test "$gt_use_preinstalled_gnugettext" = "yes" \
2014          || test "$nls_cv_use_gnu_gettext" = "yes"; then
2015         dnl Mark actions to use GNU gettext tools.
2016         CATOBJEXT=.gmo
2017       fi
2018     ])
2019
2020     if test "$gt_use_preinstalled_gnugettext" = "yes" \
2021        || test "$nls_cv_use_gnu_gettext" = "yes"; then
2022       AC_DEFINE(ENABLE_NLS, 1,
2023         [Define to 1 if translation of program messages to the user's native language
2024    is requested.])
2025     else
2026       USE_NLS=no
2027     fi
2028   fi
2029
2030   AC_MSG_CHECKING([whether to use NLS])
2031   AC_MSG_RESULT([$USE_NLS])
2032   if test "$USE_NLS" = "yes"; then
2033     AC_MSG_CHECKING([where the gettext function comes from])
2034     if test "$gt_use_preinstalled_gnugettext" = "yes"; then
2035       if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
2036         gt_source="external libintl"
2037       else
2038         gt_source="libc"
2039       fi
2040     else
2041       gt_source="included intl directory"
2042     fi
2043     AC_MSG_RESULT([$gt_source])
2044   fi
2045
2046   if test "$USE_NLS" = "yes"; then
2047
2048     if test "$gt_use_preinstalled_gnugettext" = "yes"; then
2049       if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
2050         AC_MSG_CHECKING([how to link with libintl])
2051         AC_MSG_RESULT([$LIBINTL])
2052         AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
2053       fi
2054
2055       dnl For backward compatibility. Some packages may be using this.
2056       AC_DEFINE(HAVE_GETTEXT, 1,
2057        [Define if the GNU gettext() function is already present or preinstalled.])
2058       AC_DEFINE(HAVE_DCGETTEXT, 1,
2059        [Define if the GNU dcgettext() function is already present or preinstalled.])
2060     fi
2061
2062     dnl We need to process the po/ directory.
2063     POSUB=po
2064   fi
2065
2066   ifelse(gt_included_intl, yes, [
2067     dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
2068     dnl to 'yes' because some of the testsuite requires it.
2069     if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
2070       BUILD_INCLUDED_LIBINTL=yes
2071     fi
2072
2073     dnl Make all variables we use known to autoconf.
2074     AC_SUBST(BUILD_INCLUDED_LIBINTL)
2075     AC_SUBST(USE_INCLUDED_LIBINTL)
2076     AC_SUBST(CATOBJEXT)
2077
2078     dnl For backward compatibility. Some configure.ins may be using this.
2079     nls_cv_header_intl=
2080     nls_cv_header_libgt=
2081
2082     dnl For backward compatibility. Some Makefiles may be using this.
2083     DATADIRNAME=share
2084     AC_SUBST(DATADIRNAME)
2085
2086     dnl For backward compatibility. Some Makefiles may be using this.
2087     INSTOBJEXT=.mo
2088     AC_SUBST(INSTOBJEXT)
2089
2090     dnl For backward compatibility. Some Makefiles may be using this.
2091     GENCAT=gencat
2092     AC_SUBST(GENCAT)
2093
2094     dnl For backward compatibility. Some Makefiles may be using this.
2095     if test "$USE_INCLUDED_LIBINTL" = yes; then
2096       INTLOBJS="\$(GETTOBJS)"
2097     fi
2098     AC_SUBST(INTLOBJS)
2099
2100     dnl Enable libtool support if the surrounding package wishes it.
2101     INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
2102     AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
2103   ])
2104
2105   dnl For backward compatibility. Some Makefiles may be using this.
2106   INTLLIBS="$LIBINTL"
2107   AC_SUBST(INTLLIBS)
2108
2109   dnl Make all documented variables known to autoconf.
2110   AC_SUBST(LIBINTL)
2111   AC_SUBST(LTLIBINTL)
2112   AC_SUBST(POSUB)
2113 ])
2114
2115
2116 dnl Checks for all prerequisites of the intl subdirectory,
2117 dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
2118 dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
2119 AC_DEFUN([AM_INTL_SUBDIR],
2120 [
2121   AC_REQUIRE([AC_PROG_INSTALL])dnl
2122   AC_REQUIRE([AM_MKINSTALLDIRS])dnl
2123   AC_REQUIRE([AC_PROG_CC])dnl
2124   AC_REQUIRE([AC_CANONICAL_HOST])dnl
2125   AC_REQUIRE([AC_PROG_RANLIB])dnl
2126   AC_REQUIRE([AC_ISC_POSIX])dnl
2127   AC_REQUIRE([AC_HEADER_STDC])dnl
2128   AC_REQUIRE([AC_C_CONST])dnl
2129   AC_REQUIRE([bh_C_SIGNED])dnl
2130   AC_REQUIRE([AC_C_INLINE])dnl
2131   AC_REQUIRE([AC_TYPE_OFF_T])dnl
2132   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2133   AC_REQUIRE([jm_AC_TYPE_LONG_LONG])dnl
2134   AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
2135   AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
2136   AC_REQUIRE([gt_TYPE_WINT_T])dnl
2137   AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
2138   AC_REQUIRE([jm_AC_HEADER_STDINT_H])
2139   AC_REQUIRE([gt_TYPE_INTMAX_T])
2140   AC_REQUIRE([gt_PRINTF_POSIX])
2141   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2142   AC_REQUIRE([AC_FUNC_MMAP])dnl
2143   AC_REQUIRE([jm_GLIBC21])dnl
2144   AC_REQUIRE([gt_INTDIV0])dnl
2145   AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
2146   AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
2147   AC_REQUIRE([gt_INTTYPES_PRI])dnl
2148   AC_REQUIRE([gl_XSIZE])dnl
2149
2150   AC_CHECK_TYPE([ptrdiff_t], ,
2151     [AC_DEFINE([ptrdiff_t], [long],
2152        [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
2153     ])
2154   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
2155 stdlib.h string.h unistd.h sys/param.h])
2156   AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \
2157 mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \
2158 strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \
2159 __fsetlocking])
2160
2161   dnl Use the _snprintf function only if it is declared (because on NetBSD it
2162   dnl is defined as a weak alias of snprintf; we prefer to use the latter).
2163   gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
2164   gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
2165
2166   dnl Use the *_unlocked functions only if they are declared.
2167   dnl (because some of them were defined without being declared in Solaris
2168   dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
2169   dnl on Solaris 2.5.1 to run on Solaris 2.6).
2170   dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
2171   gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
2172   gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
2173   gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
2174
2175   case $gt_cv_func_printf_posix in
2176     *yes) HAVE_POSIX_PRINTF=1 ;;
2177     *) HAVE_POSIX_PRINTF=0 ;;
2178   esac
2179   AC_SUBST([HAVE_POSIX_PRINTF])
2180   if test "$ac_cv_func_asprintf" = yes; then
2181     HAVE_ASPRINTF=1
2182   else
2183     HAVE_ASPRINTF=0
2184   fi
2185   AC_SUBST([HAVE_ASPRINTF])
2186   if test "$ac_cv_func_snprintf" = yes; then
2187     HAVE_SNPRINTF=1
2188   else
2189     HAVE_SNPRINTF=0
2190   fi
2191   AC_SUBST([HAVE_SNPRINTF])
2192   if test "$ac_cv_func_wprintf" = yes; then
2193     HAVE_WPRINTF=1
2194   else
2195     HAVE_WPRINTF=0
2196   fi
2197   AC_SUBST([HAVE_WPRINTF])
2198
2199   AM_ICONV
2200   AM_LANGINFO_CODESET
2201   if test $ac_cv_header_locale_h = yes; then
2202     AM_LC_MESSAGES
2203   fi
2204
2205   dnl intl/plural.c is generated from intl/plural.y. It requires bison,
2206   dnl because plural.y uses bison specific features. It requires at least
2207   dnl bison-1.26 because earlier versions generate a plural.c that doesn't
2208   dnl compile.
2209   dnl bison is only needed for the maintainer (who touches plural.y). But in
2210   dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
2211   dnl the rule in general Makefile. Now, some people carelessly touch the
2212   dnl files or have a broken "make" program, hence the plural.c rule will
2213   dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
2214   dnl present or too old.
2215   AC_CHECK_PROGS([INTLBISON], [bison])
2216   if test -z "$INTLBISON"; then
2217     ac_verc_fail=yes
2218   else
2219     dnl Found it, now check the version.
2220     AC_MSG_CHECKING([version of bison])
2221 changequote(<<,>>)dnl
2222     ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
2223     case $ac_prog_version in
2224       '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
2225       1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
2226 changequote([,])dnl
2227          ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
2228       *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
2229     esac
2230     AC_MSG_RESULT([$ac_prog_version])
2231   fi
2232   if test $ac_verc_fail = yes; then
2233     INTLBISON=:
2234   fi
2235 ])
2236
2237
2238 dnl gt_CHECK_DECL(FUNC, INCLUDES)
2239 dnl Check whether a function is declared.
2240 AC_DEFUN([gt_CHECK_DECL],
2241 [
2242   AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
2243     [AC_TRY_COMPILE([$2], [
2244 #ifndef $1
2245   char *p = (char *) $1;
2246 #endif
2247 ], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
2248   if test $ac_cv_have_decl_$1 = yes; then
2249     gt_value=1
2250   else
2251     gt_value=0
2252   fi
2253   AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
2254     [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
2255 ])
2256
2257
2258 dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
2259 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
2260
2261 # po.m4 serial 3 (gettext-0.14)
2262 dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
2263 dnl This file is free software, distributed under the terms of the GNU
2264 dnl General Public License.  As a special exception to the GNU General
2265 dnl Public License, this file may be distributed as part of a program
2266 dnl that contains a configuration script generated by Autoconf, under
2267 dnl the same distribution terms as the rest of that program.
2268 dnl
2269 dnl This file can can be used in projects which are not available under
2270 dnl the GNU General Public License or the GNU Library General Public
2271 dnl License but which still want to provide support for the GNU gettext
2272 dnl functionality.
2273 dnl Please note that the actual code of the GNU gettext library is covered
2274 dnl by the GNU Library General Public License, and the rest of the GNU
2275 dnl gettext package package is covered by the GNU General Public License.
2276 dnl They are *not* in the public domain.
2277
2278 dnl Authors:
2279 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
2280 dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
2281
2282 dnl Checks for all prerequisites of the po subdirectory.
2283 AC_DEFUN([AM_PO_SUBDIRS],
2284 [
2285   AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2286   AC_REQUIRE([AC_PROG_INSTALL])dnl
2287   AC_REQUIRE([AM_MKINSTALLDIRS])dnl
2288   AC_REQUIRE([AM_NLS])dnl
2289
2290   dnl Perform the following tests also if --disable-nls has been given,
2291   dnl because they are needed for "make dist" to work.
2292
2293   dnl Search for GNU msgfmt in the PATH.
2294   dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
2295   dnl The second test excludes FreeBSD msgfmt.
2296   AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2297     [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
2298      (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
2299     :)
2300   AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2301
2302   dnl Search for GNU xgettext 0.12 or newer in the PATH.
2303   dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
2304   dnl The second test excludes FreeBSD xgettext.
2305   AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2306     [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
2307      (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)],
2308     :)
2309   dnl Remove leftover from FreeBSD xgettext call.
2310   rm -f messages.po
2311
2312   dnl Search for GNU msgmerge 0.11 or newer in the PATH.
2313   AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
2314     [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
2315
2316   dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
2317   dnl Test whether we really found GNU msgfmt.
2318   if test "$GMSGFMT" != ":"; then
2319     dnl If it is no GNU msgfmt we define it as : so that the
2320     dnl Makefiles still can work.
2321     if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
2322        (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
2323       : ;
2324     else
2325       GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
2326       AC_MSG_RESULT(
2327         [found $GMSGFMT program is not GNU msgfmt; ignore it])
2328       GMSGFMT=":"
2329     fi
2330   fi
2331
2332   dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
2333   dnl Test whether we really found GNU xgettext.
2334   if test "$XGETTEXT" != ":"; then
2335     dnl If it is no GNU xgettext we define it as : so that the
2336     dnl Makefiles still can work.
2337     if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
2338        (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
2339       : ;
2340     else
2341       AC_MSG_RESULT(
2342         [found xgettext program is not GNU xgettext; ignore it])
2343       XGETTEXT=":"
2344     fi
2345     dnl Remove leftover from FreeBSD xgettext call.
2346     rm -f messages.po
2347   fi
2348
2349   AC_OUTPUT_COMMANDS([
2350     for ac_file in $CONFIG_FILES; do
2351       # Support "outfile[:infile[:infile...]]"
2352       case "$ac_file" in
2353         *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
2354       esac
2355       # PO directories have a Makefile.in generated from Makefile.in.in.
2356       case "$ac_file" in */Makefile.in)
2357         # Adjust a relative srcdir.
2358         ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
2359         ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
2360         ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
2361         # In autoconf-2.13 it is called $ac_given_srcdir.
2362         # In autoconf-2.50 it is called $srcdir.
2363         test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
2364         case "$ac_given_srcdir" in
2365           .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
2366           /*) top_srcdir="$ac_given_srcdir" ;;
2367           *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
2368         esac
2369         if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
2370           rm -f "$ac_dir/POTFILES"
2371           test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
2372           cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[   ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
2373           POMAKEFILEDEPS="POTFILES.in"
2374           # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
2375           # on $ac_dir but don't depend on user-specified configuration
2376           # parameters.
2377           if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
2378             # The LINGUAS file contains the set of available languages.
2379             if test -n "$OBSOLETE_ALL_LINGUAS"; then
2380               test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
2381             fi
2382             ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
2383             # Hide the ALL_LINGUAS assigment from automake.
2384             eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
2385             POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
2386           else
2387             # The set of available languages was given in configure.in.
2388             eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
2389           fi
2390           # Compute POFILES
2391           # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
2392           # Compute UPDATEPOFILES
2393           # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
2394           # Compute DUMMYPOFILES
2395           # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
2396           # Compute GMOFILES
2397           # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
2398           case "$ac_given_srcdir" in
2399             .) srcdirpre= ;;
2400             *) srcdirpre='$(srcdir)/' ;;
2401           esac
2402           POFILES=
2403           UPDATEPOFILES=
2404           DUMMYPOFILES=
2405           GMOFILES=
2406           for lang in $ALL_LINGUAS; do
2407             POFILES="$POFILES $srcdirpre$lang.po"
2408             UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
2409             DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
2410             GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
2411           done
2412           # CATALOGS depends on both $ac_dir and the user's LINGUAS
2413           # environment variable.
2414           INST_LINGUAS=
2415           if test -n "$ALL_LINGUAS"; then
2416             for presentlang in $ALL_LINGUAS; do
2417               useit=no
2418               if test "%UNSET%" != "$LINGUAS"; then
2419                 desiredlanguages="$LINGUAS"
2420               else
2421                 desiredlanguages="$ALL_LINGUAS"
2422               fi
2423               for desiredlang in $desiredlanguages; do
2424                 # Use the presentlang catalog if desiredlang is
2425                 #   a. equal to presentlang, or
2426                 #   b. a variant of presentlang (because in this case,
2427                 #      presentlang can be used as a fallback for messages
2428                 #      which are not translated in the desiredlang catalog).
2429                 case "$desiredlang" in
2430                   "$presentlang"*) useit=yes;;
2431                 esac
2432               done
2433               if test $useit = yes; then
2434                 INST_LINGUAS="$INST_LINGUAS $presentlang"
2435               fi
2436             done
2437           fi
2438           CATALOGS=
2439           if test -n "$INST_LINGUAS"; then
2440             for lang in $INST_LINGUAS; do
2441               CATALOGS="$CATALOGS $lang.gmo"
2442             done
2443           fi
2444           test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
2445           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"
2446           for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
2447             if test -f "$f"; then
2448               case "$f" in
2449                 *.orig | *.bak | *~) ;;
2450                 *) cat "$f" >> "$ac_dir/Makefile" ;;
2451               esac
2452             fi
2453           done
2454         fi
2455         ;;
2456       esac
2457     done],
2458    [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
2459     # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
2460     # from automake.
2461     eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
2462     # Capture the value of LINGUAS because we need it to compute CATALOGS.
2463     LINGUAS="${LINGUAS-%UNSET%}"
2464    ])
2465 ])
2466
2467 dnl Postprocesses a Makefile in a directory containing PO files.
2468 AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
2469 [
2470   # When this code is run, in config.status, two variables have already been
2471   # set:
2472   # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
2473   # - LINGUAS is the value of the environment variable LINGUAS at configure
2474   #   time.
2475
2476 changequote(,)dnl
2477   # Adjust a relative srcdir.
2478   ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
2479   ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
2480   ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
2481   # In autoconf-2.13 it is called $ac_given_srcdir.
2482   # In autoconf-2.50 it is called $srcdir.
2483   test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
2484   case "$ac_given_srcdir" in
2485     .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
2486     /*) top_srcdir="$ac_given_srcdir" ;;
2487     *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
2488   esac
2489
2490   # Find a way to echo strings without interpreting backslash.
2491   if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
2492     gt_echo='echo'
2493   else
2494     if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
2495       gt_echo='printf %s\n'
2496     else
2497       echo_func () {
2498         cat <<EOT
2499 $*
2500 EOT
2501       }
2502       gt_echo='echo_func'
2503     fi
2504   fi
2505
2506   # A sed script that extracts the value of VARIABLE from a Makefile.
2507   sed_x_variable='
2508 # Test if the hold space is empty.
2509 x
2510 s/P/P/
2511 x
2512 ta
2513 # Yes it was empty. Look if we have the expected variable definition.
2514 /^[      ]*VARIABLE[     ]*=/{
2515   # Seen the first line of the variable definition.
2516   s/^[   ]*VARIABLE[     ]*=//
2517   ba
2518 }
2519 bd
2520 :a
2521 # Here we are processing a line from the variable definition.
2522 # Remove comment, more precisely replace it with a space.
2523 s/#.*$/ /
2524 # See if the line ends in a backslash.
2525 tb
2526 :b
2527 s/\\$//
2528 # Print the line, without the trailing backslash.
2529 p
2530 tc
2531 # There was no trailing backslash. The end of the variable definition is
2532 # reached. Clear the hold space.
2533 s/^.*$//
2534 x
2535 bd
2536 :c
2537 # A trailing backslash means that the variable definition continues in the
2538 # next line. Put a nonempty string into the hold space to indicate this.
2539 s/^.*$/P/
2540 x
2541 :d
2542 '
2543 changequote([,])dnl
2544
2545   # Set POTFILES to the value of the Makefile variable POTFILES.
2546   sed_x_POTFILES="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`"
2547   POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
2548   # Compute POTFILES_DEPS as
2549   #   $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
2550   POTFILES_DEPS=
2551   for file in $POTFILES; do
2552     POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
2553   done
2554   POMAKEFILEDEPS=""
2555
2556   if test -n "$OBSOLETE_ALL_LINGUAS"; then
2557     test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
2558   fi
2559   if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
2560     # The LINGUAS file contains the set of available languages.
2561     ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
2562     POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
2563   else
2564     # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
2565     sed_x_LINGUAS="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`"
2566     ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
2567   fi
2568   # Hide the ALL_LINGUAS assigment from automake.
2569   eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
2570   # Compute POFILES
2571   # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
2572   # Compute UPDATEPOFILES
2573   # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
2574   # Compute DUMMYPOFILES
2575   # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
2576   # Compute GMOFILES
2577   # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
2578   # Compute PROPERTIESFILES
2579   # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
2580   # Compute CLASSFILES
2581   # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
2582   # Compute QMFILES
2583   # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
2584   # Compute MSGFILES
2585   # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
2586   # Compute RESOURCESDLLFILES
2587   # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
2588   case "$ac_given_srcdir" in
2589     .) srcdirpre= ;;
2590     *) srcdirpre='$(srcdir)/' ;;
2591   esac
2592   POFILES=
2593   UPDATEPOFILES=
2594   DUMMYPOFILES=
2595   GMOFILES=
2596   PROPERTIESFILES=
2597   CLASSFILES=
2598   QMFILES=
2599   MSGFILES=
2600   RESOURCESDLLFILES=
2601   for lang in $ALL_LINGUAS; do
2602     POFILES="$POFILES $srcdirpre$lang.po"
2603     UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
2604     DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
2605     GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
2606     PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
2607     CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
2608     QMFILES="$QMFILES $srcdirpre$lang.qm"
2609     frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2610     MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
2611     frobbedlang=`echo $lang | sed -e 's/_/-/g'`
2612     RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
2613   done
2614   # CATALOGS depends on both $ac_dir and the user's LINGUAS
2615   # environment variable.
2616   INST_LINGUAS=
2617   if test -n "$ALL_LINGUAS"; then
2618     for presentlang in $ALL_LINGUAS; do
2619       useit=no
2620       if test "%UNSET%" != "$LINGUAS"; then
2621         desiredlanguages="$LINGUAS"
2622       else
2623         desiredlanguages="$ALL_LINGUAS"
2624       fi
2625       for desiredlang in $desiredlanguages; do
2626         # Use the presentlang catalog if desiredlang is
2627         #   a. equal to presentlang, or
2628         #   b. a variant of presentlang (because in this case,
2629         #      presentlang can be used as a fallback for messages
2630         #      which are not translated in the desiredlang catalog).
2631         case "$desiredlang" in
2632           "$presentlang"*) useit=yes;;
2633         esac
2634       done
2635       if test $useit = yes; then
2636         INST_LINGUAS="$INST_LINGUAS $presentlang"
2637       fi
2638     done
2639   fi
2640   CATALOGS=
2641   JAVACATALOGS=
2642   QTCATALOGS=
2643   TCLCATALOGS=
2644   CSHARPCATALOGS=
2645   if test -n "$INST_LINGUAS"; then
2646     for lang in $INST_LINGUAS; do
2647       CATALOGS="$CATALOGS $lang.gmo"
2648       JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
2649       QTCATALOGS="$QTCATALOGS $lang.qm"
2650       frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2651       TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
2652       frobbedlang=`echo $lang | sed -e 's/_/-/g'`
2653       CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
2654     done
2655   fi
2656
2657   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"
2658   if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
2659     # Add dependencies that cannot be formulated as a simple suffix rule.
2660     for lang in $ALL_LINGUAS; do
2661       frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2662       cat >> "$ac_file.tmp" <<EOF
2663 $frobbedlang.msg: $lang.po
2664         @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
2665         \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
2666 EOF
2667     done
2668   fi
2669   if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
2670     # Add dependencies that cannot be formulated as a simple suffix rule.
2671     for lang in $ALL_LINGUAS; do
2672       frobbedlang=`echo $lang | sed -e 's/_/-/g'`
2673       cat >> "$ac_file.tmp" <<EOF
2674 $frobbedlang/\$(DOMAIN).resources.dll: $lang.po
2675         @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
2676         \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
2677 EOF
2678     done
2679   fi
2680   if test -n "$POMAKEFILEDEPS"; then
2681     cat >> "$ac_file.tmp" <<EOF
2682 Makefile: $POMAKEFILEDEPS
2683 EOF
2684   fi
2685   mv "$ac_file.tmp" "$ac_file"
2686 ])
2687
2688 # nls.m4 serial 1 (gettext-0.12)
2689 dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
2690 dnl This file is free software, distributed under the terms of the GNU
2691 dnl General Public License.  As a special exception to the GNU General
2692 dnl Public License, this file may be distributed as part of a program
2693 dnl that contains a configuration script generated by Autoconf, under
2694 dnl the same distribution terms as the rest of that program.
2695 dnl
2696 dnl This file can can be used in projects which are not available under
2697 dnl the GNU General Public License or the GNU Library General Public
2698 dnl License but which still want to provide support for the GNU gettext
2699 dnl functionality.
2700 dnl Please note that the actual code of the GNU gettext library is covered
2701 dnl by the GNU Library General Public License, and the rest of the GNU
2702 dnl gettext package package is covered by the GNU General Public License.
2703 dnl They are *not* in the public domain.
2704
2705 dnl Authors:
2706 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
2707 dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
2708
2709 AC_DEFUN([AM_NLS],
2710 [
2711   AC_MSG_CHECKING([whether NLS is requested])
2712   dnl Default is enabled NLS
2713   AC_ARG_ENABLE(nls,
2714     [  --disable-nls           do not use Native Language Support],
2715     USE_NLS=$enableval, USE_NLS=yes)
2716   AC_MSG_RESULT($USE_NLS)
2717   AC_SUBST(USE_NLS)
2718 ])
2719
2720 AC_DEFUN([AM_MKINSTALLDIRS],
2721 [
2722   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
2723   dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
2724   dnl Try to locate it.
2725   MKINSTALLDIRS=
2726   if test -n "$ac_aux_dir"; then
2727     case "$ac_aux_dir" in
2728       /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
2729       *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
2730     esac
2731   fi
2732   if test -z "$MKINSTALLDIRS"; then
2733     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
2734   fi
2735   AC_SUBST(MKINSTALLDIRS)
2736 ])
2737
2738 # progtest.m4 serial 3 (gettext-0.12)
2739 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
2740 dnl This file is free software, distributed under the terms of the GNU
2741 dnl General Public License.  As a special exception to the GNU General
2742 dnl Public License, this file may be distributed as part of a program
2743 dnl that contains a configuration script generated by Autoconf, under
2744 dnl the same distribution terms as the rest of that program.
2745 dnl
2746 dnl This file can can be used in projects which are not available under
2747 dnl the GNU General Public License or the GNU Library General Public
2748 dnl License but which still want to provide support for the GNU gettext
2749 dnl functionality.
2750 dnl Please note that the actual code of the GNU gettext library is covered
2751 dnl by the GNU Library General Public License, and the rest of the GNU
2752 dnl gettext package package is covered by the GNU General Public License.
2753 dnl They are *not* in the public domain.
2754
2755 dnl Authors:
2756 dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
2757
2758 # Search path for a program which passes the given test.
2759
2760 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2761 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2762 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
2763 [
2764 # Prepare PATH_SEPARATOR.
2765 # The user is always right.
2766 if test "${PATH_SEPARATOR+set}" != set; then
2767   echo "#! /bin/sh" >conf$$.sh
2768   echo  "exit 0"   >>conf$$.sh
2769   chmod +x conf$$.sh
2770   if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
2771     PATH_SEPARATOR=';'
2772   else
2773     PATH_SEPARATOR=:
2774   fi
2775   rm -f conf$$.sh
2776 fi
2777
2778 # Find out how to test for executable files. Don't use a zero-byte file,
2779 # as systems may use methods other than mode bits to determine executability.
2780 cat >conf$$.file <<_ASEOF
2781 #! /bin/sh
2782 exit 0
2783 _ASEOF
2784 chmod +x conf$$.file
2785 if test -x conf$$.file >/dev/null 2>&1; then
2786   ac_executable_p="test -x"
2787 else
2788   ac_executable_p="test -f"
2789 fi
2790 rm -f conf$$.file
2791
2792 # Extract the first word of "$2", so it can be a program name with args.
2793 set dummy $2; ac_word=[$]2
2794 AC_MSG_CHECKING([for $ac_word])
2795 AC_CACHE_VAL(ac_cv_path_$1,
2796 [case "[$]$1" in
2797   [[\\/]]* | ?:[[\\/]]*)
2798     ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2799     ;;
2800   *)
2801     ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
2802     for ac_dir in ifelse([$5], , $PATH, [$5]); do
2803       IFS="$ac_save_IFS"
2804       test -z "$ac_dir" && ac_dir=.
2805       for ac_exec_ext in '' $ac_executable_extensions; do
2806         if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
2807           if [$3]; then
2808             ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
2809             break 2
2810           fi
2811         fi
2812       done
2813     done
2814     IFS="$ac_save_IFS"
2815 dnl If no 4th arg is given, leave the cache variable unset,
2816 dnl so AC_PATH_PROGS will keep looking.
2817 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2818 ])dnl
2819     ;;
2820 esac])dnl
2821 $1="$ac_cv_path_$1"
2822 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
2823   AC_MSG_RESULT([$]$1)
2824 else
2825   AC_MSG_RESULT(no)
2826 fi
2827 AC_SUBST($1)dnl
2828 ])
2829
2830 # iconv.m4 serial AM4 (gettext-0.11.3)
2831 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2832 dnl This file is free software, distributed under the terms of the GNU
2833 dnl General Public License.  As a special exception to the GNU General
2834 dnl Public License, this file may be distributed as part of a program
2835 dnl that contains a configuration script generated by Autoconf, under
2836 dnl the same distribution terms as the rest of that program.
2837
2838 dnl From Bruno Haible.
2839
2840 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
2841 [
2842   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
2843   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2844   AC_REQUIRE([AC_LIB_RPATH])
2845
2846   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
2847   dnl accordingly.
2848   AC_LIB_LINKFLAGS_BODY([iconv])
2849 ])
2850
2851 AC_DEFUN([AM_ICONV_LINK],
2852 [
2853   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
2854   dnl those with the standalone portable GNU libiconv installed).
2855
2856   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
2857   dnl accordingly.
2858   AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
2859
2860   dnl Add $INCICONV to CPPFLAGS before performing the following checks,
2861   dnl because if the user has installed libiconv and not disabled its use
2862   dnl via --without-libiconv-prefix, he wants to use it. The first
2863   dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
2864   am_save_CPPFLAGS="$CPPFLAGS"
2865   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
2866
2867   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
2868     am_cv_func_iconv="no, consider installing GNU libiconv"
2869     am_cv_lib_iconv=no
2870     AC_TRY_LINK([#include <stdlib.h>
2871 #include <iconv.h>],
2872       [iconv_t cd = iconv_open("","");
2873        iconv(cd,NULL,NULL,NULL,NULL);
2874        iconv_close(cd);],
2875       am_cv_func_iconv=yes)
2876     if test "$am_cv_func_iconv" != yes; then
2877       am_save_LIBS="$LIBS"
2878       LIBS="$LIBS $LIBICONV"
2879       AC_TRY_LINK([#include <stdlib.h>
2880 #include <iconv.h>],
2881         [iconv_t cd = iconv_open("","");
2882          iconv(cd,NULL,NULL,NULL,NULL);
2883          iconv_close(cd);],
2884         am_cv_lib_iconv=yes
2885         am_cv_func_iconv=yes)
2886       LIBS="$am_save_LIBS"
2887     fi
2888   ])
2889   if test "$am_cv_func_iconv" = yes; then
2890     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
2891   fi
2892   if test "$am_cv_lib_iconv" = yes; then
2893     AC_MSG_CHECKING([how to link with libiconv])
2894     AC_MSG_RESULT([$LIBICONV])
2895   else
2896     dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
2897     dnl either.
2898     CPPFLAGS="$am_save_CPPFLAGS"
2899     LIBICONV=
2900     LTLIBICONV=
2901   fi
2902   AC_SUBST(LIBICONV)
2903   AC_SUBST(LTLIBICONV)
2904 ])
2905
2906 AC_DEFUN([AM_ICONV],
2907 [
2908   AM_ICONV_LINK
2909   if test "$am_cv_func_iconv" = yes; then
2910     AC_MSG_CHECKING([for iconv declaration])
2911     AC_CACHE_VAL(am_cv_proto_iconv, [
2912       AC_TRY_COMPILE([
2913 #include <stdlib.h>
2914 #include <iconv.h>
2915 extern
2916 #ifdef __cplusplus
2917 "C"
2918 #endif
2919 #if defined(__STDC__) || defined(__cplusplus)
2920 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
2921 #else
2922 size_t iconv();
2923 #endif
2924 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
2925       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);"])
2926     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
2927     AC_MSG_RESULT([$]{ac_t:-
2928          }[$]am_cv_proto_iconv)
2929     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
2930       [Define as const if the declaration of iconv() needs const.])
2931   fi
2932 ])
2933
2934 # isc-posix.m4 serial 2 (gettext-0.11.2)
2935 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
2936 dnl This file is free software, distributed under the terms of the GNU
2937 dnl General Public License.  As a special exception to the GNU General
2938 dnl Public License, this file may be distributed as part of a program
2939 dnl that contains a configuration script generated by Autoconf, under
2940 dnl the same distribution terms as the rest of that program.
2941
2942 # This file is not needed with autoconf-2.53 and newer.  Remove it in 2005.
2943
2944 # This test replaces the one in autoconf.
2945 # Currently this macro should have the same name as the autoconf macro
2946 # because gettext's gettext.m4 (distributed in the automake package)
2947 # still uses it.  Otherwise, the use in gettext.m4 makes autoheader
2948 # give these diagnostics:
2949 #   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
2950 #   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
2951
2952 undefine([AC_ISC_POSIX])
2953
2954 AC_DEFUN([AC_ISC_POSIX],
2955   [
2956     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
2957     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
2958   ]
2959 )
2960
2961 # signed.m4 serial 1 (gettext-0.10.40)
2962 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
2963 dnl This file is free software, distributed under the terms of the GNU
2964 dnl General Public License.  As a special exception to the GNU General
2965 dnl Public License, this file may be distributed as part of a program
2966 dnl that contains a configuration script generated by Autoconf, under
2967 dnl the same distribution terms as the rest of that program.
2968
2969 dnl From Bruno Haible.
2970
2971 AC_DEFUN([bh_C_SIGNED],
2972 [
2973   AC_CACHE_CHECK([for signed], bh_cv_c_signed,
2974    [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)])
2975   if test $bh_cv_c_signed = no; then
2976     AC_DEFINE(signed, ,
2977               [Define to empty if the C compiler doesn't support this keyword.])
2978   fi
2979 ])
2980
2981 # longlong.m4 serial 4
2982 dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
2983 dnl This file is free software, distributed under the terms of the GNU
2984 dnl General Public License.  As a special exception to the GNU General
2985 dnl Public License, this file may be distributed as part of a program
2986 dnl that contains a configuration script generated by Autoconf, under
2987 dnl the same distribution terms as the rest of that program.
2988
2989 dnl From Paul Eggert.
2990
2991 # Define HAVE_LONG_LONG if 'long long' works.
2992
2993 AC_DEFUN([jm_AC_TYPE_LONG_LONG],
2994 [
2995   AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
2996   [AC_TRY_LINK([long long ll = 1LL; int i = 63;],
2997     [long long llmax = (long long) -1;
2998      return ll << i | ll >> i | llmax / ll | llmax % ll;],
2999     ac_cv_type_long_long=yes,
3000     ac_cv_type_long_long=no)])
3001   if test $ac_cv_type_long_long = yes; then
3002     AC_DEFINE(HAVE_LONG_LONG, 1,
3003       [Define if you have the 'long long' type.])
3004   fi
3005 ])
3006
3007 # longdouble.m4 serial 1 (gettext-0.12)
3008 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
3009 dnl This file is free software, distributed under the terms of the GNU
3010 dnl General Public License.  As a special exception to the GNU General
3011 dnl Public License, this file may be distributed as part of a program
3012 dnl that contains a configuration script generated by Autoconf, under
3013 dnl the same distribution terms as the rest of that program.
3014
3015 dnl From Bruno Haible.
3016 dnl Test whether the compiler supports the 'long double' type.
3017 dnl Prerequisite: AC_PROG_CC
3018
3019 AC_DEFUN([gt_TYPE_LONGDOUBLE],
3020 [
3021   AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
3022     [if test "$GCC" = yes; then
3023        gt_cv_c_long_double=yes
3024      else
3025        AC_TRY_COMPILE([
3026          /* The Stardent Vistra knows sizeof(long double), but does not support it.  */
3027          long double foo = 0.0;
3028          /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
3029          int array [2*(sizeof(long double) >= sizeof(double)) - 1];
3030          ], ,
3031          gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
3032      fi])
3033   if test $gt_cv_c_long_double = yes; then
3034     AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
3035   fi
3036 ])
3037
3038 # wchar_t.m4 serial 1 (gettext-0.12)
3039 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
3040 dnl This file is free software, distributed under the terms of the GNU
3041 dnl General Public License.  As a special exception to the GNU General
3042 dnl Public License, this file may be distributed as part of a program
3043 dnl that contains a configuration script generated by Autoconf, under
3044 dnl the same distribution terms as the rest of that program.
3045
3046 dnl From Bruno Haible.
3047 dnl Test whether <stddef.h> has the 'wchar_t' type.
3048 dnl Prerequisite: AC_PROG_CC
3049
3050 AC_DEFUN([gt_TYPE_WCHAR_T],
3051 [
3052   AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
3053     [AC_TRY_COMPILE([#include <stddef.h>
3054        wchar_t foo = (wchar_t)'\0';], ,
3055        gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
3056   if test $gt_cv_c_wchar_t = yes; then
3057     AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
3058   fi
3059 ])
3060
3061 # wint_t.m4 serial 1 (gettext-0.12)
3062 dnl Copyright (C) 2003 Free Software Foundation, Inc.
3063 dnl This file is free software, distributed under the terms of the GNU
3064 dnl General Public License.  As a special exception to the GNU General
3065 dnl Public License, this file may be distributed as part of a program
3066 dnl that contains a configuration script generated by Autoconf, under
3067 dnl the same distribution terms as the rest of that program.
3068
3069 dnl From Bruno Haible.
3070 dnl Test whether <wchar.h> has the 'wint_t' type.
3071 dnl Prerequisite: AC_PROG_CC
3072
3073 AC_DEFUN([gt_TYPE_WINT_T],
3074 [
3075   AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
3076     [AC_TRY_COMPILE([#include <wchar.h>
3077        wint_t foo = (wchar_t)'\0';], ,
3078        gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
3079   if test $gt_cv_c_wint_t = yes; then
3080     AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
3081   fi
3082 ])
3083
3084 # inttypes_h.m4 serial 5 (gettext-0.12)
3085 dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3086 dnl This file is free software, distributed under the terms of the GNU
3087 dnl General Public License.  As a special exception to the GNU General
3088 dnl Public License, this file may be distributed as part of a program
3089 dnl that contains a configuration script generated by Autoconf, under
3090 dnl the same distribution terms as the rest of that program.
3091
3092 dnl From Paul Eggert.
3093
3094 # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
3095 # doesn't clash with <sys/types.h>, and declares uintmax_t.
3096
3097 AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
3098 [
3099   AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
3100   [AC_TRY_COMPILE(
3101     [#include <sys/types.h>
3102 #include <inttypes.h>],
3103     [uintmax_t i = (uintmax_t) -1;],
3104     jm_ac_cv_header_inttypes_h=yes,
3105     jm_ac_cv_header_inttypes_h=no)])
3106   if test $jm_ac_cv_header_inttypes_h = yes; then
3107     AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
3108       [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
3109        and declares uintmax_t. ])
3110   fi
3111 ])
3112
3113 # stdint_h.m4 serial 3 (gettext-0.12)
3114 dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3115 dnl This file is free software, distributed under the terms of the GNU
3116 dnl General Public License.  As a special exception to the GNU General
3117 dnl Public License, this file may be distributed as part of a program
3118 dnl that contains a configuration script generated by Autoconf, under
3119 dnl the same distribution terms as the rest of that program.
3120
3121 dnl From Paul Eggert.
3122
3123 # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
3124 # doesn't clash with <sys/types.h>, and declares uintmax_t.
3125
3126 AC_DEFUN([jm_AC_HEADER_STDINT_H],
3127 [
3128   AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
3129   [AC_TRY_COMPILE(
3130     [#include <sys/types.h>
3131 #include <stdint.h>],
3132     [uintmax_t i = (uintmax_t) -1;],
3133     jm_ac_cv_header_stdint_h=yes,
3134     jm_ac_cv_header_stdint_h=no)])
3135   if test $jm_ac_cv_header_stdint_h = yes; then
3136     AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
3137       [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
3138        and declares uintmax_t. ])
3139   fi
3140 ])
3141
3142 # intmax.m4 serial 1 (gettext-0.12)
3143 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
3144 dnl This file is free software, distributed under the terms of the GNU
3145 dnl General Public License.  As a special exception to the GNU General
3146 dnl Public License, this file may be distributed as part of a program
3147 dnl that contains a configuration script generated by Autoconf, under
3148 dnl the same distribution terms as the rest of that program.
3149
3150 dnl From Bruno Haible.
3151 dnl Test whether the system has the 'intmax_t' type, but don't attempt to
3152 dnl find a replacement if it is lacking.
3153
3154 AC_DEFUN([gt_TYPE_INTMAX_T],
3155 [
3156   AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
3157   AC_REQUIRE([jm_AC_HEADER_STDINT_H])
3158   AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
3159     [AC_TRY_COMPILE([
3160 #include <stddef.h> 
3161 #include <stdlib.h>
3162 #if HAVE_STDINT_H_WITH_UINTMAX
3163 #include <stdint.h>
3164 #endif
3165 #if HAVE_INTTYPES_H_WITH_UINTMAX
3166 #include <inttypes.h>
3167 #endif
3168 ], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
3169   if test $gt_cv_c_intmax_t = yes; then
3170     AC_DEFINE(HAVE_INTMAX_T, 1,
3171       [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
3172   fi
3173 ])
3174
3175 # printf-posix.m4 serial 2 (gettext-0.13.1)
3176 dnl Copyright (C) 2003 Free Software Foundation, Inc.
3177 dnl This file is free software, distributed under the terms of the GNU
3178 dnl General Public License.  As a special exception to the GNU General
3179 dnl Public License, this file may be distributed as part of a program
3180 dnl that contains a configuration script generated by Autoconf, under
3181 dnl the same distribution terms as the rest of that program.
3182
3183 dnl From Bruno Haible.
3184 dnl Test whether the printf() function supports POSIX/XSI format strings with
3185 dnl positions.
3186
3187 AC_DEFUN([gt_PRINTF_POSIX],
3188 [
3189   AC_REQUIRE([AC_PROG_CC])
3190   AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
3191     gt_cv_func_printf_posix,
3192     [
3193       AC_TRY_RUN([
3194 #include <stdio.h>
3195 #include <string.h>
3196 /* The string "%2$d %1$d", with dollar characters protected from the shell's
3197    dollar expansion (possibly an autoconf bug).  */
3198 static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
3199 static char buf[100];
3200 int main ()
3201 {
3202   sprintf (buf, format, 33, 55);
3203   return (strcmp (buf, "55 33") != 0);
3204 }], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no,
3205       [
3206         AC_EGREP_CPP(notposix, [
3207 #if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
3208   notposix
3209 #endif
3210         ], gt_cv_func_printf_posix="guessing no",
3211            gt_cv_func_printf_posix="guessing yes")
3212       ])
3213     ])
3214   case $gt_cv_func_printf_posix in
3215     *yes)
3216       AC_DEFINE(HAVE_POSIX_PRINTF, 1,
3217         [Define if your printf() function supports format strings with positions.])
3218       ;;
3219   esac
3220 ])
3221
3222 # glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
3223 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
3224 dnl This file is free software, distributed under the terms of the GNU
3225 dnl General Public License.  As a special exception to the GNU General
3226 dnl Public License, this file may be distributed as part of a program
3227 dnl that contains a configuration script generated by Autoconf, under
3228 dnl the same distribution terms as the rest of that program.
3229
3230 # Test for the GNU C Library, version 2.1 or newer.
3231 # From Bruno Haible.
3232
3233 AC_DEFUN([jm_GLIBC21],
3234   [
3235     AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
3236       ac_cv_gnu_library_2_1,
3237       [AC_EGREP_CPP([Lucky GNU user],
3238         [
3239 #include <features.h>
3240 #ifdef __GNU_LIBRARY__
3241  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
3242   Lucky GNU user
3243  #endif
3244 #endif
3245         ],
3246         ac_cv_gnu_library_2_1=yes,
3247         ac_cv_gnu_library_2_1=no)
3248       ]
3249     )
3250     AC_SUBST(GLIBC21)
3251     GLIBC21="$ac_cv_gnu_library_2_1"
3252   ]
3253 )
3254
3255 # intdiv0.m4 serial 1 (gettext-0.11.3)
3256 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3257 dnl This file is free software, distributed under the terms of the GNU
3258 dnl General Public License.  As a special exception to the GNU General
3259 dnl Public License, this file may be distributed as part of a program
3260 dnl that contains a configuration script generated by Autoconf, under
3261 dnl the same distribution terms as the rest of that program.
3262
3263 dnl From Bruno Haible.
3264
3265 AC_DEFUN([gt_INTDIV0],
3266 [
3267   AC_REQUIRE([AC_PROG_CC])dnl
3268   AC_REQUIRE([AC_CANONICAL_HOST])dnl
3269
3270   AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
3271     gt_cv_int_divbyzero_sigfpe,
3272     [
3273       AC_TRY_RUN([
3274 #include <stdlib.h>
3275 #include <signal.h>
3276
3277 static void
3278 #ifdef __cplusplus
3279 sigfpe_handler (int sig)
3280 #else
3281 sigfpe_handler (sig) int sig;
3282 #endif
3283 {
3284   /* Exit with code 0 if SIGFPE, with code 1 if any other signal.  */
3285   exit (sig != SIGFPE);
3286 }
3287
3288 int x = 1;
3289 int y = 0;
3290 int z;
3291 int nan;
3292
3293 int main ()
3294 {
3295   signal (SIGFPE, sigfpe_handler);
3296 /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP.  */
3297 #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
3298   signal (SIGTRAP, sigfpe_handler);
3299 #endif
3300 /* Linux/SPARC yields signal SIGILL.  */
3301 #if defined (__sparc__) && defined (__linux__)
3302   signal (SIGILL, sigfpe_handler);
3303 #endif
3304
3305   z = x / y;
3306   nan = y / y;
3307   exit (1);
3308 }
3309 ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
3310         [
3311           # Guess based on the CPU.
3312           case "$host_cpu" in
3313             alpha* | i[34567]86 | m68k | s390*)
3314               gt_cv_int_divbyzero_sigfpe="guessing yes";;
3315             *)
3316               gt_cv_int_divbyzero_sigfpe="guessing no";;
3317           esac
3318         ])
3319     ])
3320   case "$gt_cv_int_divbyzero_sigfpe" in
3321     *yes) value=1;;
3322     *) value=0;;
3323   esac
3324   AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
3325     [Define if integer division by zero raises signal SIGFPE.])
3326 ])
3327
3328 # uintmax_t.m4 serial 7 (gettext-0.12)
3329 dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3330 dnl This file is free software, distributed under the terms of the GNU
3331 dnl General Public License.  As a special exception to the GNU General
3332 dnl Public License, this file may be distributed as part of a program
3333 dnl that contains a configuration script generated by Autoconf, under
3334 dnl the same distribution terms as the rest of that program.
3335
3336 dnl From Paul Eggert.
3337
3338 AC_PREREQ(2.13)
3339
3340 # Define uintmax_t to 'unsigned long' or 'unsigned long long'
3341 # if it is not already defined in <stdint.h> or <inttypes.h>.
3342
3343 AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
3344 [
3345   AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
3346   AC_REQUIRE([jm_AC_HEADER_STDINT_H])
3347   if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
3348     AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
3349     test $ac_cv_type_unsigned_long_long = yes \
3350       && ac_type='unsigned long long' \
3351       || ac_type='unsigned long'
3352     AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
3353       [Define to unsigned long or unsigned long long
3354        if <stdint.h> and <inttypes.h> don't define.])
3355   else
3356     AC_DEFINE(HAVE_UINTMAX_T, 1,
3357       [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
3358   fi
3359 ])
3360
3361 # ulonglong.m4 serial 3
3362 dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
3363 dnl This file is free software, distributed under the terms of the GNU
3364 dnl General Public License.  As a special exception to the GNU General
3365 dnl Public License, this file may be distributed as part of a program
3366 dnl that contains a configuration script generated by Autoconf, under
3367 dnl the same distribution terms as the rest of that program.
3368
3369 dnl From Paul Eggert.
3370
3371 # Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
3372
3373 AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
3374 [
3375   AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
3376   [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;],
3377     [unsigned long long ullmax = (unsigned long long) -1;
3378      return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
3379     ac_cv_type_unsigned_long_long=yes,
3380     ac_cv_type_unsigned_long_long=no)])
3381   if test $ac_cv_type_unsigned_long_long = yes; then
3382     AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
3383       [Define if you have the 'unsigned long long' type.])
3384   fi
3385 ])
3386
3387 # inttypes.m4 serial 1 (gettext-0.11.4)
3388 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
3389 dnl This file is free software, distributed under the terms of the GNU
3390 dnl General Public License.  As a special exception to the GNU General
3391 dnl Public License, this file may be distributed as part of a program
3392 dnl that contains a configuration script generated by Autoconf, under
3393 dnl the same distribution terms as the rest of that program.
3394
3395 dnl From Paul Eggert.
3396
3397 # Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
3398 # <sys/types.h>.
3399
3400 AC_DEFUN([gt_HEADER_INTTYPES_H],
3401 [
3402   AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
3403   [
3404     AC_TRY_COMPILE(
3405       [#include <sys/types.h>
3406 #include <inttypes.h>],
3407       [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
3408   ])
3409   if test $gt_cv_header_inttypes_h = yes; then
3410     AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
3411       [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
3412   fi
3413 ])
3414
3415 # inttypes-pri.m4 serial 1 (gettext-0.11.4)
3416 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
3417 dnl This file is free software, distributed under the terms of the GNU
3418 dnl General Public License.  As a special exception to the GNU General
3419 dnl Public License, this file may be distributed as part of a program
3420 dnl that contains a configuration script generated by Autoconf, under
3421 dnl the same distribution terms as the rest of that program.
3422
3423 dnl From Bruno Haible.
3424
3425 # Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
3426 # macros to non-string values.  This is the case on AIX 4.3.3.
3427
3428 AC_DEFUN([gt_INTTYPES_PRI],
3429 [
3430   AC_REQUIRE([gt_HEADER_INTTYPES_H])
3431   if test $gt_cv_header_inttypes_h = yes; then
3432     AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
3433       gt_cv_inttypes_pri_broken,
3434       [
3435         AC_TRY_COMPILE([#include <inttypes.h>
3436 #ifdef PRId32
3437 char *p = PRId32;
3438 #endif
3439 ], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
3440       ])
3441   fi
3442   if test "$gt_cv_inttypes_pri_broken" = yes; then
3443     AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
3444       [Define if <inttypes.h> exists and defines unusable PRI* macros.])
3445   fi
3446 ])
3447
3448 # xsize.m4 serial 2
3449 dnl Copyright (C) 2003 Free Software Foundation, Inc.
3450 dnl This file is free software, distributed under the terms of the GNU
3451 dnl General Public License.  As a special exception to the GNU General
3452 dnl Public License, this file may be distributed as part of a program
3453 dnl that contains a configuration script generated by Autoconf, under
3454 dnl the same distribution terms as the rest of that program.
3455
3456 AC_DEFUN([gl_XSIZE],
3457 [
3458   dnl Prerequisites of lib/xsize.h.
3459   AC_REQUIRE([gl_SIZE_MAX])
3460   AC_CHECK_HEADERS(stdint.h)
3461 ])
3462
3463 # size_max.m4 serial 2
3464 dnl Copyright (C) 2003 Free Software Foundation, Inc.
3465 dnl This file is free software, distributed under the terms of the GNU
3466 dnl General Public License.  As a special exception to the GNU General
3467 dnl Public License, this file may be distributed as part of a program
3468 dnl that contains a configuration script generated by Autoconf, under
3469 dnl the same distribution terms as the rest of that program.
3470
3471 dnl From Bruno Haible.
3472
3473 AC_DEFUN([gl_SIZE_MAX],
3474 [
3475   AC_CHECK_HEADERS(stdint.h)
3476   dnl First test whether the system already has SIZE_MAX.
3477   AC_MSG_CHECKING([for SIZE_MAX])
3478   result=
3479   AC_EGREP_CPP([Found it], [
3480 #include <limits.h>
3481 #if HAVE_STDINT_H
3482 #include <stdint.h>
3483 #endif
3484 #ifdef SIZE_MAX
3485 Found it
3486 #endif
3487 ], result=yes)
3488   if test -z "$result"; then
3489     dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
3490     dnl than the type 'unsigned long'.
3491     dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
3492     dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
3493     _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi,
3494       [#include <stddef.h>], result=?)
3495     _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo,
3496       [#include <stddef.h>], result=?)
3497     _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
3498       [#include <stddef.h>], result=?)
3499     if test "$fits_in_uint" = 1; then
3500       dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
3501       dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
3502       AC_TRY_COMPILE([#include <stddef.h>
3503         extern size_t foo;
3504         extern unsigned long foo;
3505         ], [], fits_in_uint=0)
3506     fi
3507     if test -z "$result"; then
3508       if test "$fits_in_uint" = 1; then
3509         result="$res_hi$res_lo"U
3510       else
3511         result="$res_hi$res_lo"UL
3512       fi
3513     else
3514       dnl Shouldn't happen, but who knows...
3515       result='~(size_t)0'
3516     fi
3517   fi
3518   AC_MSG_RESULT([$result])
3519   if test "$result" != yes; then
3520     AC_DEFINE_UNQUOTED([SIZE_MAX], [$result],
3521       [Define as the maximum value of type 'size_t', if the system doesn't define it.])
3522   fi
3523 ])
3524
3525 # codeset.m4 serial AM1 (gettext-0.10.40)
3526 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
3527 dnl This file is free software, distributed under the terms of the GNU
3528 dnl General Public License.  As a special exception to the GNU General
3529 dnl Public License, this file may be distributed as part of a program
3530 dnl that contains a configuration script generated by Autoconf, under
3531 dnl the same distribution terms as the rest of that program.
3532
3533 dnl From Bruno Haible.
3534
3535 AC_DEFUN([AM_LANGINFO_CODESET],
3536 [
3537   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
3538     [AC_TRY_LINK([#include <langinfo.h>],
3539       [char* cs = nl_langinfo(CODESET);],
3540       am_cv_langinfo_codeset=yes,
3541       am_cv_langinfo_codeset=no)
3542     ])
3543   if test $am_cv_langinfo_codeset = yes; then
3544     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
3545       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
3546   fi
3547 ])
3548
3549 # lcmessage.m4 serial 3 (gettext-0.11.3)
3550 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
3551 dnl This file is free software, distributed under the terms of the GNU
3552 dnl General Public License.  As a special exception to the GNU General
3553 dnl Public License, this file may be distributed as part of a program
3554 dnl that contains a configuration script generated by Autoconf, under
3555 dnl the same distribution terms as the rest of that program.
3556 dnl
3557 dnl This file can can be used in projects which are not available under
3558 dnl the GNU General Public License or the GNU Library General Public
3559 dnl License but which still want to provide support for the GNU gettext
3560 dnl functionality.
3561 dnl Please note that the actual code of the GNU gettext library is covered
3562 dnl by the GNU Library General Public License, and the rest of the GNU
3563 dnl gettext package package is covered by the GNU General Public License.
3564 dnl They are *not* in the public domain.
3565
3566 dnl Authors:
3567 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995.
3568
3569 # Check whether LC_MESSAGES is available in <locale.h>.
3570
3571 AC_DEFUN([AM_LC_MESSAGES],
3572 [
3573   AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
3574     [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
3575        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
3576   if test $am_cv_val_LC_MESSAGES = yes; then
3577     AC_DEFINE(HAVE_LC_MESSAGES, 1,
3578       [Define if your <locale.h> file defines LC_MESSAGES.])
3579   fi
3580 ])
3581