1From 5ba3d140842268cbbdd983266efecb1fba5bdd59 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Thu, 22 Aug 2019 10:45:46 +0800
4Subject: [PATCH] Fix libtool detection
5
6Use LT_INIT instead of the deprecated AC_PROG_LIBTOOL to detect libtool, so it
7can work with our libtoolize and libtool.
8
9Simplify the detection of ltdl. It will find the ltdl from the sysroot; the
10switch --with-system-libltdl is no longer needed. The code is copied from
11pulseaudio configure.ac, together with the comment paragraph.
12
13Upstream-Status: Inappropriate [embedded specific]
14
15Signed-off-by: Jesse Zhang <sen.zhang@windriver.com>
16Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
17Signed-off-by: Changqing Li <changqing.li@windriver.com>
18---
19 configure.ac | 36 ++++++++++++++++++++++++++++++++++++
20 1 file changed, 36 insertions(+)
21
22diff --git a/configure.ac b/configure.ac
23index ad8bc8cdda..ef8fced680 100644
24--- a/configure.ac
25+++ b/configure.ac
26@@ -321,6 +321,42 @@ dnl #  See if we have Git.
27 dnl #
28 AC_CHECK_PROG(GIT, git, yes, no)
29
30+#### libtool stuff ####
31+
32+dnl set this shit so it doesn't force CFLAGS...
33+LTCFLAGS=" "
34+
35+LT_PREREQ(2.2)
36+LT_INIT([dlopen disable-static])
37+
38+dnl Unfortunately, even up to libtool 2.2.6a there is no way to know
39+dnl exactly which version of libltdl is present in the system, so we
40+dnl just assume that it's a working version as long as we have the
41+dnl library and the header files.
42+dnl
43+dnl As an extra safety device, check for lt_dladvise_init() which is
44+dnl only implemented in libtool 2.x, and refine as we go if we have
45+dnl refined requirements.
46+dnl
47+dnl Check the header files first since the system may have a
48+dnl libltdl.so for runtime, but no headers, and we want to bail out as
49+dnl soon as possible.
50+dnl
51+dnl We don't need any special variable for this though, since the user
52+dnl can give the proper place to find libltdl through the standard
53+dnl variables like LDFLAGS and CPPFLAGS.
54+
55+AC_CHECK_HEADER([ltdl.h],
56+    [AC_CHECK_LIB([ltdl], [lt_dladvise_init], [LIBLTDL=-lltdl], [LIBLTDL=])],
57+    [LIBLTDL=])
58+
59+AS_IF([test "x$LIBLTDL" = "x"],
60+    [AC_MSG_ERROR([Unable to find libltdl version 2. Makes sure you have libtool 2.2 or later installed.])])
61+AC_SUBST([LIBLTDL])
62+LTDL_SUBDIRS=
63+INCLTDL=-DWITH_SYSTEM_LTDL
64+AC_SUBST(LTDL_SUBDIRS)
65+
66 dnl Put this in later, when all distributed modules use autoconf.
67 dnl AC_ARG_WITH(disablemodulefoo,
68 dnl [  --without-rlm_foo         Disables module compilation.  Module list:]
69--
702.25.1
71
72