11
11
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
12
# PARTICULAR PURPOSE.
14
# iconv.m4 serial AM4 (gettext-0.11.3)
15
dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
16
dnl This file is free software; the Free Software Foundation
17
dnl gives unlimited permission to copy and/or distribute it,
18
dnl with or without modifications, as long as this notice is preserved.
20
dnl From Bruno Haible.
22
AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
24
dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
25
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
26
AC_REQUIRE([AC_LIB_RPATH])
28
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
30
AC_LIB_LINKFLAGS_BODY([iconv])
33
AC_DEFUN([AM_ICONV_LINK],
35
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
36
dnl those with the standalone portable GNU libiconv installed).
38
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
40
AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
42
dnl Add $INCICONV to CPPFLAGS before performing the following checks,
43
dnl because if the user has installed libiconv and not disabled its use
44
dnl via --without-libiconv-prefix, he wants to use it. The first
45
dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
46
am_save_CPPFLAGS="$CPPFLAGS"
47
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
49
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
50
am_cv_func_iconv="no, consider installing GNU libiconv"
52
AC_TRY_LINK([#include <stdlib.h>
54
[iconv_t cd = iconv_open("","");
55
iconv(cd,NULL,NULL,NULL,NULL);
58
if test "$am_cv_func_iconv" != yes; then
60
LIBS="$LIBS $LIBICONV"
61
AC_TRY_LINK([#include <stdlib.h>
63
[iconv_t cd = iconv_open("","");
64
iconv(cd,NULL,NULL,NULL,NULL);
71
if test "$am_cv_func_iconv" = yes; then
72
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
74
if test "$am_cv_lib_iconv" = yes; then
75
AC_MSG_CHECKING([how to link with libiconv])
76
AC_MSG_RESULT([$LIBICONV])
78
dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
80
CPPFLAGS="$am_save_CPPFLAGS"
91
if test "$am_cv_func_iconv" = yes; then
92
AC_MSG_CHECKING([for iconv declaration])
93
AC_CACHE_VAL(am_cv_proto_iconv, [
101
#if defined(__STDC__) || defined(__cplusplus)
102
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
106
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
107
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);"])
108
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
109
AC_MSG_RESULT([$]{ac_t:-
110
}[$]am_cv_proto_iconv)
111
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
112
[Define as const if the declaration of iconv() needs const.])
116
# lib-ld.m4 serial 3 (gettext-0.13)
117
dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
118
dnl This file is free software; the Free Software Foundation
119
dnl gives unlimited permission to copy and/or distribute it,
120
dnl with or without modifications, as long as this notice is preserved.
122
dnl Subroutines of libtool.m4,
123
dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
126
dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
127
AC_DEFUN([AC_LIB_PROG_LD_GNU],
128
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
129
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
130
case `$LD -v 2>&1 </dev/null` in
131
*GNU* | *'with BFD'*)
132
acl_cv_prog_gnu_ld=yes ;;
134
acl_cv_prog_gnu_ld=no ;;
136
with_gnu_ld=$acl_cv_prog_gnu_ld
139
dnl From libtool-1.4. Sets the variable LD.
140
AC_DEFUN([AC_LIB_PROG_LD],
142
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
143
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
144
AC_REQUIRE([AC_PROG_CC])dnl
145
AC_REQUIRE([AC_CANONICAL_HOST])dnl
146
# Prepare PATH_SEPARATOR.
147
# The user is always right.
148
if test "${PATH_SEPARATOR+set}" != set; then
149
echo "#! /bin/sh" >conf$$.sh
150
echo "exit 0" >>conf$$.sh
152
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
160
if test "$GCC" = yes; then
161
# Check if gcc -print-prog-name=ld gives a path.
162
AC_MSG_CHECKING([for ld used by GCC])
165
# gcc leaves a trailing carriage return which upsets mingw
166
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
168
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
171
# Accept absolute paths.
172
[[\\/]* | [A-Za-z]:[\\/]*)]
173
[re_direlt='/[^/][^/]*/\.\./']
174
# Canonicalize the path of ld
175
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
176
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
177
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
179
test -z "$LD" && LD="$ac_prog"
182
# If it fails, then pretend we aren't using GCC.
186
# If it is relative, then search for the first ld in PATH.
190
elif test "$with_gnu_ld" = yes; then
191
AC_MSG_CHECKING([for GNU ld])
193
AC_MSG_CHECKING([for non-GNU ld])
195
AC_CACHE_VAL(acl_cv_path_LD,
196
[if test -z "$LD"; then
197
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
198
for ac_dir in $PATH; do
199
test -z "$ac_dir" && ac_dir=.
200
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
201
acl_cv_path_LD="$ac_dir/$ac_prog"
202
# Check to see if the program is GNU ld. I'd rather use --version,
203
# but apparently some GNU ld's only accept -v.
204
# Break only if it was the GNU/non-GNU ld that we prefer.
205
case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
206
*GNU* | *'with BFD'*)
207
test "$with_gnu_ld" != no && break ;;
209
test "$with_gnu_ld" != yes && break ;;
215
acl_cv_path_LD="$LD" # Let the user override the test with a path.
218
if test -n "$LD"; then
223
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
227
# lib-link.m4 serial 9 (gettext-0.16)
228
dnl Copyright (C) 2001-2006 Free Software Foundation, Inc.
229
dnl This file is free software; the Free Software Foundation
230
dnl gives unlimited permission to copy and/or distribute it,
231
dnl with or without modifications, as long as this notice is preserved.
233
dnl From Bruno Haible.
237
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
238
dnl the libraries corresponding to explicit and implicit dependencies.
239
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
240
dnl augments the CPPFLAGS variable.
241
AC_DEFUN([AC_LIB_LINKFLAGS],
243
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
244
AC_REQUIRE([AC_LIB_RPATH])
245
define([Name],[translit([$1],[./-], [___])])
246
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
247
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
248
AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
249
AC_LIB_LINKFLAGS_BODY([$1], [$2])
250
ac_cv_lib[]Name[]_libs="$LIB[]NAME"
251
ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
252
ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
254
LIB[]NAME="$ac_cv_lib[]Name[]_libs"
255
LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
256
INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
257
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
259
AC_SUBST([LTLIB]NAME)
260
dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
261
dnl results of this search when this library appears as a dependency.
267
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
268
dnl searches for libname and the libraries corresponding to explicit and
269
dnl implicit dependencies, together with the specified include files and
270
dnl the ability to compile and link the specified testcode. If found, it
271
dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
272
dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
273
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
274
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
275
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
277
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
278
AC_REQUIRE([AC_LIB_RPATH])
279
define([Name],[translit([$1],[./-], [___])])
280
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
281
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
283
dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
285
AC_LIB_LINKFLAGS_BODY([$1], [$2])
287
dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
288
dnl because if the user has installed lib[]Name and not disabled its use
289
dnl via --without-lib[]Name-prefix, he wants to use it.
290
ac_save_CPPFLAGS="$CPPFLAGS"
291
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
293
AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
295
LIBS="$LIBS $LIB[]NAME"
296
AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
299
if test "$ac_cv_lib[]Name" = yes; then
301
AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
302
AC_MSG_CHECKING([how to link with lib[]$1])
303
AC_MSG_RESULT([$LIB[]NAME])
306
dnl If $LIB[]NAME didn't lead to a usable library, we don't need
307
dnl $INC[]NAME either.
308
CPPFLAGS="$ac_save_CPPFLAGS"
312
AC_SUBST([HAVE_LIB]NAME)
314
AC_SUBST([LTLIB]NAME)
319
dnl Determine the platform dependent parameters needed to use rpath:
320
dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
321
dnl hardcode_direct, hardcode_minus_L.
322
AC_DEFUN([AC_LIB_RPATH],
324
dnl Tell automake >= 1.10 to complain if config.rpath is missing.
325
m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
326
AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
327
AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
328
AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
329
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
330
AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
331
CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
332
${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
338
libext="$acl_cv_libext"
339
shlibext="$acl_cv_shlibext"
340
hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
341
hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
342
hardcode_direct="$acl_cv_hardcode_direct"
343
hardcode_minus_L="$acl_cv_hardcode_minus_L"
344
dnl Determine whether the user wants rpath handling at all.
346
[ --disable-rpath do not hardcode runtime library paths],
350
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
351
dnl the libraries corresponding to explicit and implicit dependencies.
352
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
353
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
355
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
356
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
357
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
358
dnl By default, look in $includedir and $libdir.
360
AC_LIB_WITH_FINAL_PREFIX([
361
eval additional_includedir=\"$includedir\"
362
eval additional_libdir=\"$libdir\"
364
AC_LIB_ARG_WITH([lib$1-prefix],
365
[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
366
--without-lib$1-prefix don't search for lib$1 in includedir and libdir],
368
if test "X$withval" = "Xno"; then
371
if test "X$withval" = "X"; then
372
AC_LIB_WITH_FINAL_PREFIX([
373
eval additional_includedir=\"$includedir\"
374
eval additional_libdir=\"$libdir\"
377
additional_includedir="$withval/include"
378
additional_libdir="$withval/$acl_libdirstem"
382
dnl Search the library and its dependencies in $additional_libdir and
383
dnl $LDFLAGS. Using breadth-first-seach.
389
names_already_handled=
390
names_next_round='$1 $2'
391
while test -n "$names_next_round"; do
392
names_this_round="$names_next_round"
394
for name in $names_this_round; do
396
for n in $names_already_handled; do
397
if test "$n" = "$name"; then
402
if test -z "$already_handled"; then
403
names_already_handled="$names_already_handled $name"
404
dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
405
dnl or AC_LIB_HAVE_LINKFLAGS call.
406
uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
407
eval value=\"\$HAVE_LIB$uppername\"
408
if test -n "$value"; then
409
if test "$value" = yes; then
410
eval value=\"\$LIB$uppername\"
411
test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
412
eval value=\"\$LTLIB$uppername\"
413
test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
415
dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
416
dnl that this library doesn't exist. So just drop it.
420
dnl Search the library lib$name in $additional_libdir and $LDFLAGS
421
dnl and the already constructed $LIBNAME/$LTLIBNAME.
426
if test $use_additional = yes; then
427
if test -n "$shlibext" \
428
&& { test -f "$additional_libdir/lib$name.$shlibext" \
429
|| { test "$shlibext" = dll \
430
&& test -f "$additional_libdir/lib$name.dll.a"; }; }; then
431
found_dir="$additional_libdir"
432
if test -f "$additional_libdir/lib$name.$shlibext"; then
433
found_so="$additional_libdir/lib$name.$shlibext"
435
found_so="$additional_libdir/lib$name.dll.a"
437
if test -f "$additional_libdir/lib$name.la"; then
438
found_la="$additional_libdir/lib$name.la"
441
if test -f "$additional_libdir/lib$name.$libext"; then
442
found_dir="$additional_libdir"
443
found_a="$additional_libdir/lib$name.$libext"
444
if test -f "$additional_libdir/lib$name.la"; then
445
found_la="$additional_libdir/lib$name.la"
450
if test "X$found_dir" = "X"; then
451
for x in $LDFLAGS $LTLIB[]NAME; do
452
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
455
dir=`echo "X$x" | sed -e 's/^X-L//'`
456
if test -n "$shlibext" \
457
&& { test -f "$dir/lib$name.$shlibext" \
458
|| { test "$shlibext" = dll \
459
&& test -f "$dir/lib$name.dll.a"; }; }; then
461
if test -f "$dir/lib$name.$shlibext"; then
462
found_so="$dir/lib$name.$shlibext"
464
found_so="$dir/lib$name.dll.a"
466
if test -f "$dir/lib$name.la"; then
467
found_la="$dir/lib$name.la"
470
if test -f "$dir/lib$name.$libext"; then
472
found_a="$dir/lib$name.$libext"
473
if test -f "$dir/lib$name.la"; then
474
found_la="$dir/lib$name.la"
480
if test "X$found_dir" != "X"; then
485
if test "X$found_dir" != "X"; then
486
dnl Found the library.
487
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
488
if test "X$found_so" != "X"; then
489
dnl Linking with a shared library. We attempt to hardcode its
490
dnl directory into the executable's runpath, unless it's the
491
dnl standard /usr/lib.
492
if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
493
dnl No hardcoding is needed.
494
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
496
dnl Use an explicit option to hardcode DIR into the resulting
498
dnl Potentially add DIR to ltrpathdirs.
499
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
501
for x in $ltrpathdirs; do
502
if test "X$x" = "X$found_dir"; then
507
if test -z "$haveit"; then
508
ltrpathdirs="$ltrpathdirs $found_dir"
510
dnl The hardcoding into $LIBNAME is system dependent.
511
if test "$hardcode_direct" = yes; then
512
dnl Using DIR/libNAME.so during linking hardcodes DIR into the
513
dnl resulting binary.
514
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
516
if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
517
dnl Use an explicit option to hardcode DIR into the resulting
519
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
520
dnl Potentially add DIR to rpathdirs.
521
dnl The rpathdirs will be appended to $LIBNAME at the end.
523
for x in $rpathdirs; do
524
if test "X$x" = "X$found_dir"; then
529
if test -z "$haveit"; then
530
rpathdirs="$rpathdirs $found_dir"
533
dnl Rely on "-L$found_dir".
534
dnl But don't add it if it's already contained in the LDFLAGS
535
dnl or the already constructed $LIBNAME
537
for x in $LDFLAGS $LIB[]NAME; do
538
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
539
if test "X$x" = "X-L$found_dir"; then
544
if test -z "$haveit"; then
545
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
547
if test "$hardcode_minus_L" != no; then
548
dnl FIXME: Not sure whether we should use
549
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
551
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
553
dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
554
dnl here, because this doesn't fit in flags passed to the
555
dnl compiler. So give up. No hardcoding. This affects only
556
dnl very old systems.
557
dnl FIXME: Not sure whether we should use
558
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
560
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
566
if test "X$found_a" != "X"; then
567
dnl Linking with a static library.
568
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
570
dnl We shouldn't come here, but anyway it's good to have a
572
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
575
dnl Assume the include files are nearby.
576
additional_includedir=
578
*/$acl_libdirstem | */$acl_libdirstem/)
579
basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
580
additional_includedir="$basedir/include"
583
if test "X$additional_includedir" != "X"; then
584
dnl Potentially add $additional_includedir to $INCNAME.
586
dnl 1. if it's the standard /usr/include,
587
dnl 2. if it's /usr/local/include and we are using GCC on Linux,
588
dnl 3. if it's already present in $CPPFLAGS or the already
589
dnl constructed $INCNAME,
590
dnl 4. if it doesn't exist as a directory.
591
if test "X$additional_includedir" != "X/usr/include"; then
593
if test "X$additional_includedir" = "X/usr/local/include"; then
594
if test -n "$GCC"; then
596
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
600
if test -z "$haveit"; then
601
for x in $CPPFLAGS $INC[]NAME; do
602
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
603
if test "X$x" = "X-I$additional_includedir"; then
608
if test -z "$haveit"; then
609
if test -d "$additional_includedir"; then
610
dnl Really add $additional_includedir to $INCNAME.
611
INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
617
dnl Look for dependencies.
618
if test -n "$found_la"; then
619
dnl Read the .la file. It defines the variables
620
dnl dlname, library_names, old_library, dependency_libs, current,
621
dnl age, revision, installed, dlopen, dlpreopen, libdir.
622
save_libdir="$libdir"
624
*/* | *\\*) . "$found_la" ;;
625
*) . "./$found_la" ;;
627
libdir="$save_libdir"
628
dnl We use only dependency_libs.
629
for dep in $dependency_libs; do
632
additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
633
dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
635
dnl 1. if it's the standard /usr/lib,
636
dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
637
dnl 3. if it's already present in $LDFLAGS or the already
638
dnl constructed $LIBNAME,
639
dnl 4. if it doesn't exist as a directory.
640
if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
642
if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
643
if test -n "$GCC"; then
645
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
649
if test -z "$haveit"; then
651
for x in $LDFLAGS $LIB[]NAME; do
652
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
653
if test "X$x" = "X-L$additional_libdir"; then
658
if test -z "$haveit"; then
659
if test -d "$additional_libdir"; then
660
dnl Really add $additional_libdir to $LIBNAME.
661
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
665
for x in $LDFLAGS $LTLIB[]NAME; do
666
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
667
if test "X$x" = "X-L$additional_libdir"; then
672
if test -z "$haveit"; then
673
if test -d "$additional_libdir"; then
674
dnl Really add $additional_libdir to $LTLIBNAME.
675
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
682
dir=`echo "X$dep" | sed -e 's/^X-R//'`
683
if test "$enable_rpath" != no; then
684
dnl Potentially add DIR to rpathdirs.
685
dnl The rpathdirs will be appended to $LIBNAME at the end.
687
for x in $rpathdirs; do
688
if test "X$x" = "X$dir"; then
693
if test -z "$haveit"; then
694
rpathdirs="$rpathdirs $dir"
696
dnl Potentially add DIR to ltrpathdirs.
697
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
699
for x in $ltrpathdirs; do
700
if test "X$x" = "X$dir"; then
705
if test -z "$haveit"; then
706
ltrpathdirs="$ltrpathdirs $dir"
711
dnl Handle this in the next round.
712
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
715
dnl Handle this in the next round. Throw away the .la's
716
dnl directory; it is already contained in a preceding -L
718
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
721
dnl Most likely an immediate library name.
722
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
723
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
729
dnl Didn't find the library; assume it is in the system directories
730
dnl known to the linker and runtime loader. (All the system
731
dnl directories known to the linker should also be known to the
732
dnl runtime loader, otherwise the system is severely misconfigured.)
733
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
734
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
740
if test "X$rpathdirs" != "X"; then
741
if test -n "$hardcode_libdir_separator"; then
742
dnl Weird platform: only the last -rpath option counts, the user must
743
dnl pass all path elements in one option. We can arrange that for a
744
dnl single library, but not when more than one $LIBNAMEs are used.
746
for found_dir in $rpathdirs; do
747
alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
749
dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
750
acl_save_libdir="$libdir"
752
eval flag=\"$hardcode_libdir_flag_spec\"
753
libdir="$acl_save_libdir"
754
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
756
dnl The -rpath options are cumulative.
757
for found_dir in $rpathdirs; do
758
acl_save_libdir="$libdir"
760
eval flag=\"$hardcode_libdir_flag_spec\"
761
libdir="$acl_save_libdir"
762
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
766
if test "X$ltrpathdirs" != "X"; then
767
dnl When using libtool, the option that works for both libraries and
768
dnl executables is -R. The -R options are cumulative.
769
for found_dir in $ltrpathdirs; do
770
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
775
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
776
dnl unless already present in VAR.
777
dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
778
dnl contains two or three consecutive elements that belong together.
779
AC_DEFUN([AC_LIB_APPENDTOVAR],
781
for element in [$2]; do
784
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
785
if test "X$x" = "X$element"; then
790
if test -z "$haveit"; then
791
[$1]="${[$1]}${[$1]:+ }$element"
796
dnl For those cases where a variable contains several -L and -l options
797
dnl referring to unknown libraries and directories, this macro determines the
798
dnl necessary additional linker options for the runtime path.
799
dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
800
dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
801
dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
802
dnl otherwise linking without libtool is assumed.
803
AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
805
AC_REQUIRE([AC_LIB_RPATH])
806
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
808
if test "$enable_rpath" != no; then
809
if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
810
dnl Use an explicit option to hardcode directories into the resulting
815
if test -n "$next"; then
817
dnl No need to hardcode the standard /usr/lib.
818
if test "X$dir" != "X/usr/$acl_libdirstem"; then
819
rpathdirs="$rpathdirs $dir"
825
-L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
826
dnl No need to hardcode the standard /usr/lib.
827
if test "X$dir" != "X/usr/$acl_libdirstem"; then
828
rpathdirs="$rpathdirs $dir"
835
if test "X$rpathdirs" != "X"; then
836
if test -n ""$3""; then
837
dnl libtool is used for linking. Use -R options.
838
for dir in $rpathdirs; do
839
$1="${$1}${$1:+ }-R$dir"
842
dnl The linker is used for linking directly.
843
if test -n "$hardcode_libdir_separator"; then
844
dnl Weird platform: only the last -rpath option counts, the user
845
dnl must pass all path elements in one option.
847
for dir in $rpathdirs; do
848
alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir"
850
acl_save_libdir="$libdir"
852
eval flag=\"$hardcode_libdir_flag_spec\"
853
libdir="$acl_save_libdir"
856
dnl The -rpath options are cumulative.
857
for dir in $rpathdirs; do
858
acl_save_libdir="$libdir"
860
eval flag=\"$hardcode_libdir_flag_spec\"
861
libdir="$acl_save_libdir"
862
$1="${$1}${$1:+ }$flag"
872
# lib-prefix.m4 serial 5 (gettext-0.15)
873
dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
874
dnl This file is free software; the Free Software Foundation
875
dnl gives unlimited permission to copy and/or distribute it,
876
dnl with or without modifications, as long as this notice is preserved.
878
dnl From Bruno Haible.
880
dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
881
dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
882
dnl require excessive bracketing.
883
ifdef([AC_HELP_STRING],
884
[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
885
[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
887
dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
888
dnl to access previously installed libraries. The basic assumption is that
889
dnl a user will want packages to use other packages he previously installed
890
dnl with the same --prefix option.
891
dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
892
dnl libraries, but is otherwise very convenient.
893
AC_DEFUN([AC_LIB_PREFIX],
895
AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
896
AC_REQUIRE([AC_PROG_CC])
897
AC_REQUIRE([AC_CANONICAL_HOST])
898
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
899
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
900
dnl By default, look in $includedir and $libdir.
902
AC_LIB_WITH_FINAL_PREFIX([
903
eval additional_includedir=\"$includedir\"
904
eval additional_libdir=\"$libdir\"
906
AC_LIB_ARG_WITH([lib-prefix],
907
[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
908
--without-lib-prefix don't search for libraries in includedir and libdir],
910
if test "X$withval" = "Xno"; then
913
if test "X$withval" = "X"; then
914
AC_LIB_WITH_FINAL_PREFIX([
915
eval additional_includedir=\"$includedir\"
916
eval additional_libdir=\"$libdir\"
919
additional_includedir="$withval/include"
920
additional_libdir="$withval/$acl_libdirstem"
924
if test $use_additional = yes; then
925
dnl Potentially add $additional_includedir to $CPPFLAGS.
927
dnl 1. if it's the standard /usr/include,
928
dnl 2. if it's already present in $CPPFLAGS,
929
dnl 3. if it's /usr/local/include and we are using GCC on Linux,
930
dnl 4. if it doesn't exist as a directory.
931
if test "X$additional_includedir" != "X/usr/include"; then
933
for x in $CPPFLAGS; do
934
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
935
if test "X$x" = "X-I$additional_includedir"; then
940
if test -z "$haveit"; then
941
if test "X$additional_includedir" = "X/usr/local/include"; then
942
if test -n "$GCC"; then
944
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
948
if test -z "$haveit"; then
949
if test -d "$additional_includedir"; then
950
dnl Really add $additional_includedir to $CPPFLAGS.
951
CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
956
dnl Potentially add $additional_libdir to $LDFLAGS.
958
dnl 1. if it's the standard /usr/lib,
959
dnl 2. if it's already present in $LDFLAGS,
960
dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
961
dnl 4. if it doesn't exist as a directory.
962
if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
964
for x in $LDFLAGS; do
965
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
966
if test "X$x" = "X-L$additional_libdir"; then
971
if test -z "$haveit"; then
972
if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
973
if test -n "$GCC"; then
979
if test -z "$haveit"; then
980
if test -d "$additional_libdir"; then
981
dnl Really add $additional_libdir to $LDFLAGS.
982
LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
990
dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
991
dnl acl_final_exec_prefix, containing the values to which $prefix and
992
dnl $exec_prefix will expand at the end of the configure script.
993
AC_DEFUN([AC_LIB_PREPARE_PREFIX],
995
dnl Unfortunately, prefix and exec_prefix get only finally determined
996
dnl at the end of configure.
997
if test "X$prefix" = "XNONE"; then
998
acl_final_prefix="$ac_default_prefix"
1000
acl_final_prefix="$prefix"
1002
if test "X$exec_prefix" = "XNONE"; then
1003
acl_final_exec_prefix='${prefix}'
1005
acl_final_exec_prefix="$exec_prefix"
1007
acl_save_prefix="$prefix"
1008
prefix="$acl_final_prefix"
1009
eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
1010
prefix="$acl_save_prefix"
1013
dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
1014
dnl variables prefix and exec_prefix bound to the values they will have
1015
dnl at the end of the configure script.
1016
AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
1018
acl_save_prefix="$prefix"
1019
prefix="$acl_final_prefix"
1020
acl_save_exec_prefix="$exec_prefix"
1021
exec_prefix="$acl_final_exec_prefix"
1023
exec_prefix="$acl_save_exec_prefix"
1024
prefix="$acl_save_prefix"
1027
dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
1028
dnl the basename of the libdir, either "lib" or "lib64".
1029
AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
1031
dnl There is no formal standard regarding lib and lib64. The current
1032
dnl practice is that on a system supporting 32-bit and 64-bit instruction
1033
dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
1034
dnl libraries go under $prefix/lib. We determine the compiler's default
1035
dnl mode by looking at the compiler's library search path. If at least
1036
dnl of its elements ends in /lib64 or points to a directory whose absolute
1037
dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
1038
dnl default, namely "lib".
1040
searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
1041
if test -n "$searchpath"; then
1042
acl_save_IFS="${IFS= }"; IFS=":"
1043
for searchdir in $searchpath; do
1044
if test -d "$searchdir"; then
1045
case "$searchdir" in
1046
*/lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
1047
*) searchdir=`cd "$searchdir" && pwd`
1048
case "$searchdir" in
1049
*/lib64 ) acl_libdirstem=lib64 ;;
14
1058
# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
16
1060
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005