~ubuntu-branches/ubuntu/natty/curl/natty

« back to all changes in this revision

Viewing changes to acinclude.m4

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-12-04 01:09:30 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20071204010930-he4zlo7f3qdaz3qz
Tags: 7.17.1-1ubuntu1
* Merge with Debian; remaining changes:
  - Drop the stunnel build dependency.
* Drop the build-dependency on libdb4.5-dev, add build-dependency on
  openssh-server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
# KIND, either express or implied.
20
20
#
21
 
# $Id: acinclude.m4,v 1.123 2007-04-10 18:53:21 yangtse Exp $
 
21
# $Id: acinclude.m4,v 1.136 2007-10-24 16:40:59 yangtse Exp $
22
22
###########################################################################
23
23
 
24
24
 
171
171
])
172
172
 
173
173
 
 
174
dnl CURL_CHECK_HEADER_WINLDAP
 
175
dnl -------------------------------------------------
 
176
dnl Check for compilable and valid winldap.h header
 
177
 
 
178
AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [
 
179
  AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
 
180
  AC_CACHE_CHECK([for winldap.h], [ac_cv_header_winldap_h], [
 
181
    AC_COMPILE_IFELSE([
 
182
      AC_LANG_PROGRAM([
 
183
#undef inline
 
184
#ifdef HAVE_WINDOWS_H
 
185
#ifndef WIN32_LEAN_AND_MEAN
 
186
#define WIN32_LEAN_AND_MEAN
 
187
#endif
 
188
#include <windows.h>
 
189
#endif
 
190
#include <winldap.h>
 
191
      ],[
 
192
#ifdef __CYGWIN__
 
193
        HAVE_WINLDAP_H shall not be defined.
 
194
#else
 
195
        LDAP *ldp = ldap_init("dummy", LDAP_PORT);
 
196
        ULONG res = ldap_unbind(ldp);
 
197
#endif
 
198
      ])
 
199
    ],[
 
200
      ac_cv_header_winldap_h="yes"
 
201
    ],[
 
202
      ac_cv_header_winldap_h="no"
 
203
    ])
 
204
  ])
 
205
  case "$ac_cv_header_winldap_h" in
 
206
    yes)
 
207
      AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1,
 
208
        [Define to 1 if you have the winldap.h header file.])
 
209
      ;;
 
210
  esac
 
211
])
 
212
 
 
213
 
 
214
dnl CURL_CHECK_HEADER_WINBER
 
215
dnl -------------------------------------------------
 
216
dnl Check for compilable and valid winber.h header
 
217
 
 
218
AC_DEFUN([CURL_CHECK_HEADER_WINBER], [
 
219
  AC_REQUIRE([CURL_CHECK_HEADER_WINLDAP])dnl
 
220
  AC_CACHE_CHECK([for winber.h], [ac_cv_header_winber_h], [
 
221
    AC_COMPILE_IFELSE([
 
222
      AC_LANG_PROGRAM([
 
223
#undef inline
 
224
#ifdef HAVE_WINDOWS_H
 
225
#ifndef WIN32_LEAN_AND_MEAN
 
226
#define WIN32_LEAN_AND_MEAN
 
227
#endif
 
228
#include <windows.h>
 
229
#endif
 
230
#include <winldap.h>
 
231
#include <winber.h>
 
232
      ],[
 
233
#ifdef __CYGWIN__
 
234
        HAVE_WINBER_H shall not be defined.
 
235
#else
 
236
        BERVAL *bvp = NULL;
 
237
        BerElement *bep = ber_init(bvp);
 
238
        ber_free(bep, 1);
 
239
#endif
 
240
      ])
 
241
    ],[
 
242
      ac_cv_header_winber_h="yes"
 
243
    ],[
 
244
      ac_cv_header_winber_h="no"
 
245
    ])
 
246
  ])
 
247
  case "$ac_cv_header_winber_h" in
 
248
    yes)
 
249
      AC_DEFINE_UNQUOTED(HAVE_WINBER_H, 1,
 
250
        [Define to 1 if you have the winber.h header file.])
 
251
      ;;
 
252
  esac
 
253
])
 
254
 
 
255
 
 
256
dnl CURL_CHECK_HEADER_LBER
 
257
dnl -------------------------------------------------
 
258
dnl Check for compilable and valid lber.h header,
 
259
dnl and check if it is needed even with ldap.h
 
260
 
 
261
AC_DEFUN([CURL_CHECK_HEADER_LBER], [
 
262
  AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
 
263
  AC_CACHE_CHECK([for lber.h], [ac_cv_header_lber_h], [
 
264
    AC_COMPILE_IFELSE([
 
265
      AC_LANG_PROGRAM([
 
266
#undef inline
 
267
#ifdef HAVE_WINDOWS_H
 
268
#ifndef WIN32_LEAN_AND_MEAN
 
269
#define WIN32_LEAN_AND_MEAN
 
270
#endif
 
271
#include <windows.h>
 
272
#else
 
273
#ifdef HAVE_SYS_TYPES_H
 
274
#include <sys/types.h>
 
275
#endif
 
276
#endif
 
277
#ifndef NULL
 
278
#define NULL (void *)0
 
279
#endif
 
280
#include <lber.h>
 
281
      ],[
 
282
        BerValue *bvp = NULL;
 
283
        BerElement *bep = ber_init(bvp);
 
284
        ber_free(bep, 1);
 
285
      ])
 
286
    ],[
 
287
      ac_cv_header_lber_h="yes"
 
288
    ],[
 
289
      ac_cv_header_lber_h="no"
 
290
    ])
 
291
  ])
 
292
  if test "$ac_cv_header_lber_h" = "yes"; then
 
293
    AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
 
294
      [Define to 1 if you have the lber.h header file.])
 
295
    #
 
296
    AC_COMPILE_IFELSE([
 
297
      AC_LANG_PROGRAM([
 
298
#undef inline
 
299
#ifdef HAVE_WINDOWS_H
 
300
#ifndef WIN32_LEAN_AND_MEAN
 
301
#define WIN32_LEAN_AND_MEAN
 
302
#endif
 
303
#include <windows.h>
 
304
#else
 
305
#ifdef HAVE_SYS_TYPES_H
 
306
#include <sys/types.h>
 
307
#endif
 
308
#endif
 
309
#ifndef NULL
 
310
#define NULL (void *)0
 
311
#endif
 
312
#ifndef LDAP_DEPRECATED
 
313
#define LDAP_DEPRECATED 1
 
314
#endif
 
315
#include <ldap.h>
 
316
      ],[
 
317
        BerValue *bvp = NULL;
 
318
        BerElement *bep = ber_init(bvp);
 
319
        ber_free(bep, 1);
 
320
      ])
 
321
    ],[
 
322
      curl_cv_need_header_lber_h="no"
 
323
    ],[
 
324
      curl_cv_need_header_lber_h="yes"
 
325
    ])
 
326
    #
 
327
    case "$curl_cv_need_header_lber_h" in
 
328
      yes)
 
329
        AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
 
330
          [Define to 1 if you need the lber.h header file even with ldap.h])
 
331
        ;;
 
332
    esac
 
333
  fi
 
334
])
 
335
 
 
336
 
 
337
dnl CURL_CHECK_HEADER_LDAP
 
338
dnl -------------------------------------------------
 
339
dnl Check for compilable and valid ldap.h header
 
340
 
 
341
AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
 
342
  AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
 
343
  AC_CACHE_CHECK([for ldap.h], [ac_cv_header_ldap_h], [
 
344
    AC_COMPILE_IFELSE([
 
345
      AC_LANG_PROGRAM([
 
346
#undef inline
 
347
#ifdef HAVE_WINDOWS_H
 
348
#ifndef WIN32_LEAN_AND_MEAN
 
349
#define WIN32_LEAN_AND_MEAN
 
350
#endif
 
351
#include <windows.h>
 
352
#else
 
353
#ifdef HAVE_SYS_TYPES_H
 
354
#include <sys/types.h>
 
355
#endif
 
356
#endif
 
357
#ifndef LDAP_DEPRECATED
 
358
#define LDAP_DEPRECATED 1
 
359
#endif
 
360
#ifdef NEED_LBER_H
 
361
#include <lber.h>
 
362
#endif
 
363
#include <ldap.h>
 
364
      ],[
 
365
        LDAP *ldp = ldap_init("dummy", LDAP_PORT);
 
366
        int res = ldap_unbind(ldp);
 
367
      ])
 
368
    ],[
 
369
      ac_cv_header_ldap_h="yes"
 
370
    ],[
 
371
      ac_cv_header_ldap_h="no"
 
372
    ])
 
373
  ])
 
374
  case "$ac_cv_header_ldap_h" in
 
375
    yes)
 
376
      AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
 
377
        [Define to 1 if you have the ldap.h header file.])
 
378
      ;;
 
379
  esac
 
380
])
 
381
 
 
382
 
 
383
dnl CURL_CHECK_HEADER_LDAP_SSL
 
384
dnl -------------------------------------------------
 
385
dnl Check for compilable and valid ldap_ssl.h header
 
386
 
 
387
AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
 
388
  AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
 
389
  AC_CACHE_CHECK([for ldap_ssl.h], [ac_cv_header_ldap_ssl_h], [
 
390
    AC_COMPILE_IFELSE([
 
391
      AC_LANG_PROGRAM([
 
392
#undef inline
 
393
#ifdef HAVE_WINDOWS_H
 
394
#ifndef WIN32_LEAN_AND_MEAN
 
395
#define WIN32_LEAN_AND_MEAN
 
396
#endif
 
397
#include <windows.h>
 
398
#else
 
399
#ifdef HAVE_SYS_TYPES_H
 
400
#include <sys/types.h>
 
401
#endif
 
402
#endif
 
403
#ifndef LDAP_DEPRECATED
 
404
#define LDAP_DEPRECATED 1
 
405
#endif
 
406
#ifdef NEED_LBER_H
 
407
#include <lber.h>
 
408
#endif
 
409
#ifdef HAVE_LDAP_H
 
410
#include <ldap.h>
 
411
#endif
 
412
#include <ldap_ssl.h>
 
413
      ],[
 
414
        LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1);
 
415
      ])
 
416
    ],[
 
417
      ac_cv_header_ldap_ssl_h="yes"
 
418
    ],[
 
419
      ac_cv_header_ldap_ssl_h="no"
 
420
    ])
 
421
  ])
 
422
  case "$ac_cv_header_ldap_ssl_h" in
 
423
    yes)
 
424
      AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
 
425
        [Define to 1 if you have the ldap_ssl.h header file.])
 
426
      ;;
 
427
  esac
 
428
])
 
429
 
 
430
 
 
431
dnl CURL_CHECK_HEADER_LDAPSSL
 
432
dnl -------------------------------------------------
 
433
dnl Check for compilable and valid ldapssl.h header
 
434
 
 
435
AC_DEFUN([CURL_CHECK_HEADER_LDAPSSL], [
 
436
  AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
 
437
  AC_CACHE_CHECK([for ldapssl.h], [ac_cv_header_ldapssl_h], [
 
438
    AC_COMPILE_IFELSE([
 
439
      AC_LANG_PROGRAM([
 
440
#undef inline
 
441
#ifdef HAVE_WINDOWS_H
 
442
#ifndef WIN32_LEAN_AND_MEAN
 
443
#define WIN32_LEAN_AND_MEAN
 
444
#endif
 
445
#include <windows.h>
 
446
#else
 
447
#ifdef HAVE_SYS_TYPES_H
 
448
#include <sys/types.h>
 
449
#endif
 
450
#endif
 
451
#ifndef NULL
 
452
#define NULL (void *)0
 
453
#endif
 
454
#ifndef LDAP_DEPRECATED
 
455
#define LDAP_DEPRECATED 1
 
456
#endif
 
457
#ifdef NEED_LBER_H
 
458
#include <lber.h>
 
459
#endif
 
460
#ifdef HAVE_LDAP_H
 
461
#include <ldap.h>
 
462
#endif
 
463
#include <ldapssl.h>
 
464
      ],[
 
465
        char *cert_label = NULL;
 
466
        LDAP *ldp = ldap_ssl_init("dummy", LDAPS_PORT, cert_label);
 
467
      ])
 
468
    ],[
 
469
      ac_cv_header_ldapssl_h="yes"
 
470
    ],[
 
471
      ac_cv_header_ldapssl_h="no"
 
472
    ])
 
473
  ])
 
474
  case "$ac_cv_header_ldapssl_h" in
 
475
    yes)
 
476
      AC_DEFINE_UNQUOTED(HAVE_LDAPSSL_H, 1,
 
477
        [Define to 1 if you have the ldapssl.h header file.])
 
478
      ;;
 
479
  esac
 
480
])
 
481
 
 
482
 
 
483
dnl CURL_CHECK_LIBS_WINLDAP
 
484
dnl -------------------------------------------------
 
485
dnl Check for libraries needed for WINLDAP support,
 
486
dnl and prepended to LIBS any needed libraries.
 
487
dnl This macro can take an optional parameter with a
 
488
dnl white space separated list of libraries to check
 
489
dnl before the WINLDAP default ones.
 
490
 
 
491
AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
 
492
  AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
 
493
  #
 
494
  AC_MSG_CHECKING([for WINLDAP libraries])
 
495
  #
 
496
  u_libs=""
 
497
  #
 
498
  ifelse($1,,,[
 
499
    for x_lib in $1; do
 
500
      case "$x_lib" in
 
501
        -l*)
 
502
          l_lib="$x_lib"
 
503
          ;;
 
504
        *)
 
505
          l_lib="-l$x_lib"
 
506
          ;;
 
507
      esac
 
508
      if test -z "$u_libs"; then
 
509
        u_libs="$l_lib"
 
510
      else
 
511
        u_libs="$u_libs $l_lib"
 
512
      fi
 
513
    done
 
514
  ])
 
515
  #
 
516
  curl_cv_save_LIBS="$LIBS"
 
517
  curl_cv_ldap_LIBS="unknown"
 
518
  #
 
519
  for x_nlibs in '' "$u_libs" \
 
520
    '-lwldap32' ; do
 
521
    if test -z "$x_nlibs"; then
 
522
      LIBS="$curl_cv_save_LIBS"
 
523
    else
 
524
      LIBS="$x_nlibs $curl_cv_save_LIBS"
 
525
    fi
 
526
    AC_LINK_IFELSE([
 
527
      AC_LANG_PROGRAM([
 
528
#undef inline
 
529
#ifdef HAVE_WINDOWS_H
 
530
#ifndef WIN32_LEAN_AND_MEAN
 
531
#define WIN32_LEAN_AND_MEAN
 
532
#endif
 
533
#include <windows.h>
 
534
#ifdef HAVE_WINLDAP_H
 
535
#include <winldap.h>
 
536
#endif
 
537
#ifdef HAVE_WINBER_H
 
538
#include <winber.h>
 
539
#endif
 
540
#endif
 
541
      ],[
 
542
        BERVAL *bvp = NULL;
 
543
        BerElement *bep = ber_init(bvp);
 
544
        LDAP *ldp = ldap_init("dummy", LDAP_PORT);
 
545
        ULONG res = ldap_unbind(ldp);
 
546
        ber_free(bep, 1);
 
547
      ])
 
548
    ],[
 
549
       curl_cv_ldap_LIBS="$x_nlibs"
 
550
       break
 
551
    ])
 
552
  done
 
553
  #
 
554
  LIBS="$curl_cv_save_LIBS"
 
555
  #
 
556
  case X-"$curl_cv_ldap_LIBS" in
 
557
    X-unknown)
 
558
      AC_MSG_RESULT([cannot find WINLDAP libraries])
 
559
      ;;
 
560
    X-)
 
561
      AC_MSG_RESULT([no additional lib required])
 
562
      ;;
 
563
    *)
 
564
      if test -z "$curl_cv_save_LIBS"; then
 
565
        LIBS="$curl_cv_ldap_LIBS"
 
566
      else
 
567
        LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
 
568
      fi
 
569
      AC_MSG_RESULT([$curl_cv_ldap_LIBS])
 
570
      ;;
 
571
  esac
 
572
  #
 
573
])
 
574
 
 
575
 
 
576
dnl CURL_CHECK_LIBS_LDAP
 
577
dnl -------------------------------------------------
 
578
dnl Check for libraries needed for LDAP support,
 
579
dnl and prepended to LIBS any needed libraries.
 
580
dnl This macro can take an optional parameter with a
 
581
dnl white space separated list of libraries to check
 
582
dnl before the default ones.
 
583
 
 
584
AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
 
585
  AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
 
586
  #
 
587
  AC_MSG_CHECKING([for LDAP libraries])
 
588
  #
 
589
  u_libs=""
 
590
  #
 
591
  ifelse($1,,,[
 
592
    for x_lib in $1; do
 
593
      case "$x_lib" in
 
594
        -l*)
 
595
          l_lib="$x_lib"
 
596
          ;;
 
597
        *)
 
598
          l_lib="-l$x_lib"
 
599
          ;;
 
600
      esac
 
601
      if test -z "$u_libs"; then
 
602
        u_libs="$l_lib"
 
603
      else
 
604
        u_libs="$u_libs $l_lib"
 
605
      fi
 
606
    done
 
607
  ])
 
608
  #
 
609
  curl_cv_save_LIBS="$LIBS"
 
610
  curl_cv_ldap_LIBS="unknown"
 
611
  #
 
612
  for x_nlibs in '' "$u_libs" \
 
613
    '-lldap' \
 
614
    '-llber -lldap' \
 
615
    '-lldap -llber' \
 
616
    '-lldapssl -lldapx -lldapsdk' \
 
617
    '-lldapsdk -lldapx -lldapssl' ; do
 
618
    if test -z "$x_nlibs"; then
 
619
      LIBS="$curl_cv_save_LIBS"
 
620
    else
 
621
      LIBS="$x_nlibs $curl_cv_save_LIBS"
 
622
    fi
 
623
    AC_LINK_IFELSE([
 
624
      AC_LANG_PROGRAM([
 
625
#undef inline
 
626
#ifdef HAVE_WINDOWS_H
 
627
#ifndef WIN32_LEAN_AND_MEAN
 
628
#define WIN32_LEAN_AND_MEAN
 
629
#endif
 
630
#include <windows.h>
 
631
#else
 
632
#ifdef HAVE_SYS_TYPES_H
 
633
#include <sys/types.h>
 
634
#endif
 
635
#endif
 
636
#ifndef NULL
 
637
#define NULL (void *)0
 
638
#endif
 
639
#ifndef LDAP_DEPRECATED
 
640
#define LDAP_DEPRECATED 1
 
641
#endif
 
642
#ifdef NEED_LBER_H
 
643
#include <lber.h>
 
644
#endif
 
645
#ifdef HAVE_LDAP_H
 
646
#include <ldap.h>
 
647
#endif
 
648
      ],[
 
649
        BerValue *bvp = NULL;
 
650
        BerElement *bep = ber_init(bvp);
 
651
        LDAP *ldp = ldap_init("dummy", LDAP_PORT);
 
652
        int res = ldap_unbind(ldp);
 
653
        ber_free(bep, 1);
 
654
      ])
 
655
    ],[
 
656
       curl_cv_ldap_LIBS="$x_nlibs"
 
657
       break
 
658
    ])
 
659
  done
 
660
  #
 
661
  LIBS="$curl_cv_save_LIBS"
 
662
  #
 
663
  case X-"$curl_cv_ldap_LIBS" in
 
664
    X-unknown)
 
665
      AC_MSG_RESULT([cannot find LDAP libraries])
 
666
      ;;
 
667
    X-)
 
668
      AC_MSG_RESULT([no additional lib required])
 
669
      ;;
 
670
    *)
 
671
      if test -z "$curl_cv_save_LIBS"; then
 
672
        LIBS="$curl_cv_ldap_LIBS"
 
673
      else
 
674
        LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
 
675
      fi
 
676
      AC_MSG_RESULT([$curl_cv_ldap_LIBS])
 
677
      ;;
 
678
  esac
 
679
  #
 
680
])
 
681
 
 
682
 
174
683
dnl CURL_CHECK_HEADER_MALLOC
175
684
dnl -------------------------------------------------
176
685
dnl Check for compilable and valid malloc.h header,
1107
1616
#  define PLATFORM_SUNOS4
1108
1617
# endif
1109
1618
#endif
1110
 
#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX4)
 
1619
#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
1111
1620
# define PLATFORM_AIX_V3
1112
1621
#endif
1113
1622
 
1316
1825
#include <string.h>
1317
1826
#include <sys/types.h>
1318
1827
#include <netdb.h>
 
1828
#ifndef NULL
 
1829
#define NULL (void *)0
 
1830
#endif
1319
1831
 
1320
1832
int
1321
1833
main () {
1762
2274
           dnl only if the compiler is newer than 2.95 since we got lots of
1763
2275
           dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
1764
2276
           dnl gcc 2.95.4 on FreeBSD 4.9!
1765
 
           WARN="$WARN -Wundef -Wno-long-long -Wsign-compare"
 
2277
           WARN="$WARN -Wundef -Wno-long-long -Wsign-compare -Wshadow -Wno-multichar"
1766
2278
         fi
1767
2279
 
1768
2280
         if test "$gccnum" -ge "296"; then
1830
2342
 
1831
2343
]) dnl end of AC_DEFUN()
1832
2344
 
1833
 
 
1834
 
dnl Determine the name of the library to pass to dlopen() based on the name
1835
 
dnl that would normally be given to AC_CHECK_LIB.  The preprocessor symbol
1836
 
dnl given is set to the quoted library file name. 
1837
 
dnl The standard dynamic library file name is first generated, based on the
1838
 
dnl current system type, then a search is performed for that file on the
1839
 
dnl standard dynamic library path.  If it is a symbolic link, the destination
1840
 
dnl of the link is used as the file name, after stripping off any minor
1841
 
dnl version numbers. If a library file can't be found, a guess is made.
1842
 
dnl This macro assumes AC_PROG_LIBTOOL has been called and requires perl
1843
 
dnl to be available in the PATH, or $PERL to be set to its location.
1844
 
dnl
1845
 
dnl CURL_DLLIB_NAME(VARIABLE, library_name)
1846
 
dnl e.g. CURL_DLLIB_NAME(LDAP_NAME, ldap) on a Linux system might result
1847
 
dnl in LDAP_NAME holding the string "libldap.so.2".
1848
 
 
1849
 
AC_DEFUN([CURL_DLLIB_NAME],
1850
 
[
1851
 
AC_MSG_CHECKING([name of dynamic library $2])
1852
 
dnl The shared library extension variable name changes from version to
1853
 
dnl version of libtool.  Try a few names then just set one statically.
1854
 
test -z "$shared_ext" && eval shared_ext=\"$shrext_cmds\"
1855
 
test -z "$shared_ext" && shared_ext="$std_shrext"
1856
 
test -z "$shared_ext" && shared_ext="$shrext"
1857
 
test -z "$shared_ext" && shared_ext=".so"
1858
 
 
1859
 
dnl Create the library link name of the correct form for this platform
1860
 
LIBNAME_LINK_SPEC=`echo "$library_names_spec" | $SED 's/^.* //'`
1861
 
DLGUESSLIB=`name=$2 eval echo "$libname_spec"`
1862
 
DLGUESSFILE=`libname="$DLGUESSLIB" release="" major="" versuffix="" eval echo "$LIBNAME_LINK_SPEC"`
1863
 
dnl Last resort in case libtool knows nothing about shared libs on this platform
1864
 
test -z "$DLGUESSFILE" && DLGUESSFILE="$DLGUESSLIB$shared_ext"
1865
 
 
1866
 
dnl Synthesize a likely dynamic library name in case we can't find an actual one
1867
 
SO_NAME_SPEC="$soname_spec"
1868
 
dnl soname_spec undefined when identical to the 1st entry in library_names_spec
1869
 
test -z "$SO_NAME_SPEC" && SO_NAME_SPEC=`echo "$library_names_spec" | $SED 's/ .*$//'`
1870
 
DLGUESSSOFILE=`libname="$DLGUESSLIB" release="" major="" versuffix="" eval echo "$SO_NAME_SPEC"`
1871
 
dnl Last resort in case libtool knows nothing about shared libs on this platform
1872
 
test -z "$DLGUESSSOFILE" && DLGUESSSOFILE="$DLGUESSFILE"
1873
 
 
1874
 
if test "$cross_compiling" = yes; then
1875
 
  dnl Can't look at filesystem when cross-compiling
1876
 
  AC_DEFINE_UNQUOTED($1, "$DLGUESSSOFILE", [$2 dynamic library file])
1877
 
  AC_MSG_RESULT([$DLGUESSSOFILE (guess while cross-compiling)])
1878
 
else
1879
 
 
1880
 
  DLFOUNDFILE=""
1881
 
  if test "$sys_lib_dlsearch_path_spec" ; then
1882
 
    dnl Search for the link library name and see what it points to.
1883
 
    for direc in $sys_lib_dlsearch_path_spec ; do
1884
 
      DLTRYFILE="$direc/$DLGUESSFILE"
1885
 
      dnl Find where the symbolic link for this name points
1886
 
      changequote(<<, >>)dnl
1887
 
      <<
1888
 
      DLFOUNDFILE=`${PERL:-perl} -e 'use File::Basename; (basename(readlink($ARGV[0])) =~ /^(.*[^\d]\.\d+)[\d\.]*$/ && print ${1}) || exit 1;' "$DLTRYFILE" 2>&5`
1889
 
      >>
1890
 
      changequote([, ])dnl
1891
 
      if test "$?" -eq "0"; then
1892
 
        dnl Found the file link
1893
 
        break
1894
 
      fi
1895
 
    done
1896
 
  fi
1897
 
 
1898
 
  if test -z "$DLFOUNDFILE" ; then
1899
 
    dnl Couldn't find a link library, so guess at a name.
1900
 
    DLFOUNDFILE="$DLGUESSSOFILE"
1901
 
  fi
1902
 
 
1903
 
  AC_DEFINE_UNQUOTED($1, "$DLFOUNDFILE", [$2 dynamic library file])
1904
 
  AC_MSG_RESULT($DLFOUNDFILE)
1905
 
fi
1906
 
])
1907
 
 
1908
2345
# This is only a temporary fix. This macro is here to replace the broken one
1909
2346
# delivered by the automake project (including the 1.9.6 release). As soon as
1910
2347
# they ship a working version we SHOULD remove this work-around.