diff options
author | Nils Durner <durner@gnunet.org> | 2009-05-29 19:20:23 +0000 |
---|---|---|
committer | Nils Durner <durner@gnunet.org> | 2009-05-29 19:20:23 +0000 |
commit | 179946965cc0f171e4af1bd053b42ec36314c86e (patch) | |
tree | df49518ea91d8a644ecbd0e6a48c26c1e7fe93b3 /m4/libltdl-external.m4 | |
parent | c137702c332798fb68622739f61ae06bbf6286df (diff) | |
download | gnunet-179946965cc0f171e4af1bd053b42ec36314c86e.tar.gz gnunet-179946965cc0f171e4af1bd053b42ec36314c86e.zip |
cp
Diffstat (limited to 'm4/libltdl-external.m4')
-rw-r--r-- | m4/libltdl-external.m4 | 75 |
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 @@ | |||
1 | dnl Autoconf macro for an always external libltdl | ||
2 | dnl Copyright (C) 2009 Heikki Lindholm | ||
3 | dnl | ||
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. | ||
7 | dnl | ||
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. | ||
11 | |||
12 | dnl AM_PATH_LIBLTDL( | ||
13 | dnl [CHECK-SYMBOLS, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) | ||
14 | dnl | ||
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" | ||
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 | ]) | ||