1 dnl sxe-libtool.m4 -- just a quick libtoolish macros
3 dnl Copyright (C) 2007, 2008 Sebastian Freundt.
5 dnl This file is part of SXEmacs
7 AC_DEFUN([SXE_CHECK_LIBTOOL], [dnl
8 AC_MSG_RESULT([starting libtool investigation...])
9 m4_ifdef([LT_INIT], [_SXE_CHECK_LT2], [_SXE_CHECK_LT1])
11 if test -n "$export_dynamic_flag_spec"; then
12 sxe_cv_export_dynamic=$(\
13 echo $(eval echo "$export_dynamic_flag_spec"))
14 SXE_APPEND_UNDUP([$sxe_cv_export_dynamic], [LDFLAGS])
17 Neither -export-dynamic nor equivalent flags are supported by your linker.
18 Emodules however will reference some symbols dynamically.
19 We assume that your linker will do what we need, but this assumption
20 might be wrong as well.
24 ## cope with libtool's convenience lib/bin concept
25 if test -n "$lt_cv_objdir"; then
26 ## this variable is a #define, too
27 LT_OBJDIR="$lt_cv_objdir"
29 ## hm, probably not the best idea but let's try
32 ## definitely subst that though
35 ## currently there's no official variable for that, but `lt-'
36 ## seems to be a consistent choice throughout all libtools
37 LT_CONVENIENCE_PREFIX="lt-"
38 AC_SUBST([LT_CONVENIENCE_PREFIX])
40 ## prefix all the stuff in XCCLDFLAGS with XCCFLAG
41 ## assume XCCFLAG = -XCClinker for now
43 XCCLDFLAGS=$(echo "${XCCLDFLAGS}" | \
44 sed -e 's/\B-/'${XCCFLAG}' -/g')
45 ])dnl SXE_CHECK_LIBTOOL
47 AC_DEFUN([_SXE_CHECK_LT2], [dnl
48 LT_CONFIG_LTDL_DIR([libltdl], [recursive])
50 AC_REQUIRE([_LT_SYS_DYNAMIC_LINKER])
65 dnl newer libtool2s will do this implicitly, we drop all support
66 dnl for the `old' libtool2 stuff as this is available through
67 dnl cvs only and we stick with the latest
68 dnl AC_CONFIG_SUBDIRS([libltdl])
69 AC_CONFIG_MACRO_DIR([libltdl/m4])
72 m4_ifdef([LT_CONFIG_LTDL_DIR], [], [dnl else
73 AC_DEFUN([LT_CONFIG_LTDL_DIR], [dnl
74 AS_MESSAGE([trying to fake an initialisation of a libltdl subproject])
75 ])dnl LT_CONFIG_LTDL_DIR
78 AC_DEFUN([_SXE_CHECK_LT1], [dnl
79 ## This overcomes a strange but existent scenario
80 ## (see ssh horstbox for one)
81 ## where autoconf is SO new that it can actually only work
82 ## with libtool2 but, sigh, of course, sigh, libtool-1.stone.age
84 LT_CONFIG_LTDL_DIR([libltdl], [recursive])
86 AC_LIBLTDL_INSTALLABLE
87 dnl AC_LTDL_ENABLE_INSTALL
88 dnl Check for dlopen support
90 AC_PROG_LIBTOOL([dlopen])
94 dnl Substitute LTDLINCL and LIBLTDL in the Makefiles
97 AC_SUBST([LIBTOOL_DEPS])
100 AC_CONFIG_SUBDIRS([libltdl])
103 AC_DEFUN([SXE_CHECK_LIBLTDL], [dnl
104 ## make sure the libtool stuff has been run before
105 AC_REQUIRE([SXE_CHECK_LIBTOOL])
107 AC_CACHE_CHECK([for dynamic loader provided by libltdl],
108 [sxe_cv_feat_libltdl], [_SXE_CHECK_LIBLTDL])
110 ## if the user wants to use the included libltdl, descend
111 if test -z "$with_included_ltdl" -a \
112 -d "${sxe_srcdir}/libltdl" -a \
113 "$with_module_support" != "no" -a \
114 "$sxe_cv_feat_libltdl" != "yes"; then
115 with_included_ltdl="yes"
116 ## assume we have a working ltdl lib afterwards
117 sxe_cv_feat_libltdl="yes"
118 ## also install that pig
119 enable_ltdl_install="yes"
120 ## add libltdl/ to the include path
121 CPPFLAGS="$CPPFLAGS ${LTDLINCL}"
122 ## and assume we've seen ltdl.h
123 AC_DEFINE([HAVE_LTDL_H], [1], [Whether ltdl.h is somewhere])
124 elif test -d "${sxe_srcdir}/libltdl" -a \
125 "$with_included_ltdl" = "yes"; then
126 ## the user WANTS to use the included ltdl
127 ## assume we have a working ltdl lib afterwards
128 sxe_cv_feat_libltdl="yes"
129 ## also install that pig
130 enable_ltdl_install="yes"
131 ## add libltdl/ to the include path
132 CPPFLAGS="$CPPFLAGS -I${top_srcdir}/libltdl"
133 ## and assume we've seen ltdl.h
134 AC_DEFINE([HAVE_LTDL_H], [1], [Whether ltdl.h is somewhere])
136 with_included_ltdl="no"
138 AM_CONDITIONAL([DESCEND_LIBLTDL], [test "$with_included_ltdl" = "yes"])
139 ])dnl SXE_CHECK_LIBLTDL
141 AC_DEFUN([_SXE_CHECK_LIBLTDL], [dnl
143 SXE_CHECK_LTDL_HEADERS
146 if test "$ac_cv_header_ltdl_h" = "yes" -a \
147 "$ac_cv_func_lt_dlopen" = "yes" -a \
148 "$ac_cv_func_lt_dlclose" = "yes" -a \
149 "$ac_cv_type_lt_dlhandle" = "yes" -a \
150 "$ac_cv_type_lt_dlinfo" = "yes"; then
151 sxe_cv_feat_libltdl="yes"
153 sxe_cv_feat_libltdl="no"
155 ])dnl _SXE_CHECK_LIBLTDL
157 AC_DEFUN([SXE_CHECK_LTDL_HEADERS], [dnl
158 AC_CHECK_HEADERS([ltdl.h])
159 ])dnl SXE_CHECK_LTDL_HEADERS
161 AC_DEFUN([SXE_CHECK_LTDL_FUNCS], [dnl
162 AC_REQUIRE([SXE_CHECK_LIBTOOL])
165 LIBS="$LIBS $LIBLTDL"
166 _SXE_CHECK_LTDL_FUNCS
169 _SXE_CHECK_LTDL_TYPES
170 ])dnl _SXE_CHECK_LTDL_FUNCS
172 AC_DEFUN([_SXE_CHECK_LTDL_FUNCS], [dnl
174 lt_dlopen lt_dlopenext dnl
175 lt_dlclose lt_dlexit dnl
176 lt_dlsym lt_dlgetinfo dnl
177 lt_dlfree lt_dlforeach lt_dlhandle_next dnl
178 lt_dlinterface_register lt_dlcaller_register lt_dlhandle_fetch dnl
179 lt_dladdsearchdir dnl
180 lt_dlcaller_set_data lt_dlcaller_get_data dnl
184 AC_CHECK_DECLS([lt_dlopen, lt_dlopenext, lt_dlclose, lt_dlexit],
190 ])dnl _SXE_CHECK_LTDL_FUNCS
192 AC_DEFUN([_SXE_CHECK_LTDL_TYPES], [dnl
193 AC_CHECK_TYPES([lt_dlinfo, lt_dlhandle], [], [], [
198 ])dnl _SXE_CHECK_LTDL_TYPES
200 dnl sxe-libtool.m4 ends here