aboutsummaryrefslogtreecommitdiff
path: root/m4/libltdl-external.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/libltdl-external.m4')
-rw-r--r--m4/libltdl-external.m475
1 files changed, 75 insertions, 0 deletions
diff --git a/m4/libltdl-external.m4 b/m4/libltdl-external.m4
new file mode 100644
index 000000000..1c4ce09b2
--- /dev/null
+++ b/m4/libltdl-external.m4
@@ -0,0 +1,75 @@
1dnl Autoconf macro for an always external libltdl
2dnl Copyright (C) 2009 Heikki Lindholm
3dnl
4dnl This file is free software; as a special exception the author gives
5dnl unlimited permission to copy and/or distribute it, with or without
6dnl modifications, as long as this notice is preserved.
7dnl
8dnl This file is distributed in the hope that it will be useful, but
9dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
12dnl AM_PATH_LIBLTDL(
13dnl [CHECK-SYMBOLS, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
14dnl
15AC_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"
25 else
26 if test x"$LIBLTDL" = x ; then
27 LIBLTDL="-lltdl"
28 fi
29 CPPFLAGS="$LTDLINCL $CPPFLAGS"
30 LDFLAGS="$LIBLTDL $LDFLAGS"
31 fi
32
33 symbols_to_check=ifelse([$1], ,"ltdl_dlopen","$1")
34 ltdl_found=yes
35 AC_CHECK_HEADER([ltdl.h],
36 [
37 for sym in $symbols_to_check
38 do
39 AC_CHECK_DECL([$sym],
40 [AC_LINK_IFELSE(AC_LANG_CALL([], [$sym]),
41 [ltdl_found=yes],
42 [ltdl_found=no])],
43 [ltdl_found=no],
44 [AC_INCLUDES_DEFAULT
45 #include <ltdl.h>])
46 done
47 ],
48 [ltdl_found=no],
49 [AC_INCLUDES_DEFAULT]
50 )
51
52 if test x$libltdl_prefix != x ; then
53 LTDLINCL="-I$libltdl_prefix/include"
54 LIBLTDL="-L$libltdl_prefix/lib -lltdl"
55 else
56 if test x"$LIBLTDL" = x ; then
57 LIBLTDL="-lltdl"
58 fi
59 fi
60 CPPFLAGS="$ltdl_save_CPPFLAGS"
61 LDFLAGS="$ltdl_save_LDFLAGS"
62
63 AC_MSG_CHECKING(for libltdl with symbols $symbols_to_check)
64 if test $ltdl_found = yes; then
65 AC_MSG_RESULT(yes)
66 ifelse([$2], , :, [$2])
67 else
68 LTDLINCL=""
69 LIBLTDL=""
70 AC_MSG_RESULT(no)
71 ifelse([$3], , :, [$3])
72 fi
73 AC_SUBST(LTDLINCL)
74 AC_SUBST(LIBLTDL)
75])