1 dnl Autoconf macro for an always external libltdl
2 dnl Copyright (C) 2009 Heikki Lindholm
4 dnl This file is free software; as a special exception the author gives
5 dnl unlimited permission to copy and/or distribute it, with or without
6 dnl modifications, as long as this notice is preserved.
8 dnl This file is distributed in the hope that it will be useful, but
9 dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10 dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 dnl [CHECK-SYMBOLS, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
15 AC_DEFUN([AM_PATH_LIBLTDL],
16 [ AC_ARG_WITH(libltdl-prefix,
17 AC_HELP_STRING([--with-libltdl-prefix=PFX],
18 [prefix where libltdl is installed (optional)]),
19 libltdl_prefix="$withval", libltdl_prefix="")
20 ltdl_save_CPPFLAGS="$CPPFLAGS"
21 ltdl_save_LDFLAGS="$LDFLAGS"
22 if test x$libltdl_prefix != x ; then
23 CPPFLAGS="-I$libltdl_prefix/include $CPPFLAGS"
24 LDFLAGS="-L$libltdl_prefix/lib -lltdl $LDFLAGS"
26 if test x"$LIBLTDL" = x ; then
29 CPPFLAGS="$LTDLINCL $CPPFLAGS"
30 LDFLAGS="$LIBLTDL $LDFLAGS"
33 symbols_to_check=ifelse([$1], ,"ltdl_dlopen","$1")
35 AC_CHECK_HEADER([ltdl.h],
37 for sym in $symbols_to_check
40 [AC_LINK_IFELSE(AC_LANG_CALL([], [$sym]),
52 if test x$libltdl_prefix != x ; then
53 LTDLINCL="-I$libltdl_prefix/include"
54 LIBLTDL="-L$libltdl_prefix/lib -lltdl"
56 if test x"$LIBLTDL" = x ; then
60 CPPFLAGS="$ltdl_save_CPPFLAGS"
61 LDFLAGS="$ltdl_save_LDFLAGS"
63 AC_MSG_CHECKING(for libltdl with symbols $symbols_to_check)
64 if test $ltdl_found = yes; then
66 ifelse([$2], , :, [$2])
71 ifelse([$3], , :, [$3])