1998-12-21 21:04:14 +08:00
|
|
|
dnl Process this file with autoconf to create configure.
|
1998-12-25 18:39:59 +08:00
|
|
|
dnl Initialize the libltdl package.
|
1998-11-18 15:29:36 +08:00
|
|
|
AC_INIT(ltdl.c)
|
1999-01-17 19:19:40 +08:00
|
|
|
AM_INIT_AUTOMAKE(libltdl,1.0,-)
|
|
|
|
|
|
|
|
AM_MAINTAINER_MODE
|
1998-11-18 15:29:36 +08:00
|
|
|
|
* ltmain.in (libobjs_save, oldobjs): when building an
old-fashioned archive, use a copy of libobjs saved before
convenience libraries are appended
* libltdl/ltdl.h (_LTDLL_EXPORT, _LTDLL_IMPORT): use cygwin or
unix library import/export primitives; this may be convenient for
people willing to create DLLs
(_LTDLL_EXTERN): select _LTDLL_EXPORT or _LTDLL_IMPORT depending
on _LTDL_COMPILE_
* libltdl/ltdl.h, libltdl/ltdl.c (lt_dlpreopen): new function,
that replaces the current preloaded_symbols list with its
argument, and returns the old value, initially NULL
(dldpre_init): don't refer to dld_preloaded_symbols any more
(dldpre_open, dldpre_sym): search preloaded_symbols
(lt_dlpreopen_default): call lt_dlpreopen with
dld_preloaded_symbols, that is declared as extern; it should be
called from the main program or from some static library without
-no-undefined
(lt_dlerror): new function, that returns the error message for the
last error occurred; the error message is kept in the static
variable last_error
* libltdl/configure.in (enable-ltdl-install): moved back from
enable-install; other packages might use enable-install already,
better have fine grained control over this.
* libltdl/Makefile.am (libltdls.la): discarded
1999-01-06 07:13:44 +08:00
|
|
|
AC_ARG_ENABLE(ltdl-install,
|
* configure.in (AC_CONFIG_SUBDIRS): add libltdl, demo, mdemo and
depdemo commented out, so that `dist' works before `check'
(BUILD_LTDL): will contain libltdl if --enable-ltdl-install
* Makefile.am (DIST_SUBDIRS): expand SUBDIRS and add depdemo,
commented out
(SUBDIRS): add $(BUILT_LTDL)
* libltdl/Makefile.am (EXTRA_LTLIBRARIES): add libtest.la, the
same as libltdl but always a convenience library. Not built by
default. Both libraries now depend on the libtool script, that
depends on ../libtool and is rebuilt when needed
* mdemo/Makefile.am (mdemo, mdemo.debug): depend on and link with
../libltdl/libtest.la, that is rebuilt if needed
(mdemo_LDADD): removed $(LIBADD_M), to avoid silent failures
(foo1.la): renamed from libfoo1.la; test removing the lib prefix
* mdemo/foo1.c: renamed libfoo1_LTX symbols to foo1_LTX
* mdemo/main.c: don't include string.h nor math.h, nor refer to
sin nor cos
* tests/mdemo-exec.test: renamed libfoo1.la to foo1.la
* tests/mdemo-inst.test: ditto
1999-01-11 03:16:30 +08:00
|
|
|
[--enable-ltdl-install install libltdl])
|
* ltmain.in (libobjs_save, oldobjs): when building an
old-fashioned archive, use a copy of libobjs saved before
convenience libraries are appended
* libltdl/ltdl.h (_LTDLL_EXPORT, _LTDLL_IMPORT): use cygwin or
unix library import/export primitives; this may be convenient for
people willing to create DLLs
(_LTDLL_EXTERN): select _LTDLL_EXPORT or _LTDLL_IMPORT depending
on _LTDL_COMPILE_
* libltdl/ltdl.h, libltdl/ltdl.c (lt_dlpreopen): new function,
that replaces the current preloaded_symbols list with its
argument, and returns the old value, initially NULL
(dldpre_init): don't refer to dld_preloaded_symbols any more
(dldpre_open, dldpre_sym): search preloaded_symbols
(lt_dlpreopen_default): call lt_dlpreopen with
dld_preloaded_symbols, that is declared as extern; it should be
called from the main program or from some static library without
-no-undefined
(lt_dlerror): new function, that returns the error message for the
last error occurred; the error message is kept in the static
variable last_error
* libltdl/configure.in (enable-ltdl-install): moved back from
enable-install; other packages might use enable-install already,
better have fine grained control over this.
* libltdl/Makefile.am (libltdls.la): discarded
1999-01-06 07:13:44 +08:00
|
|
|
AM_CONDITIONAL(INSTALL_LTDL, test x$enable_ltdl_install = xyes)
|
|
|
|
if test x$enable_ltdl_install = xyes; then
|
1998-12-24 03:33:09 +08:00
|
|
|
LIBLIBS=libltdl.la
|
|
|
|
NOINSTLIBS=
|
|
|
|
else
|
|
|
|
LIBLIBS=
|
|
|
|
NOINSTLIBS=libltdl.la
|
|
|
|
fi
|
|
|
|
AC_SUBST(LIBLIBS)
|
|
|
|
AC_SUBST(NOINSTLIBS)
|
|
|
|
|
1998-11-18 15:29:36 +08:00
|
|
|
AC_PROG_CC
|
|
|
|
AM_PROG_LIBTOOL
|
|
|
|
|
1999-01-17 19:19:40 +08:00
|
|
|
AC_CACHE_CHECK([which variable specifies run-time library path],
|
|
|
|
libltdl_cv_shlibpath_var, [dnl
|
1999-01-14 02:37:25 +08:00
|
|
|
(
|
|
|
|
rm -f conftest
|
|
|
|
./libtool --config > conftest
|
|
|
|
. ./conftest
|
|
|
|
rm -f conftest
|
1999-01-17 19:19:40 +08:00
|
|
|
echo "$shlibpath_var" > conftest
|
1999-01-14 02:37:25 +08:00
|
|
|
)
|
1999-01-17 19:19:40 +08:00
|
|
|
libltdl_cv_shlibpath_var=`cat conftest`
|
1999-01-14 02:37:25 +08:00
|
|
|
rm -f conftest
|
|
|
|
])
|
1999-01-17 19:19:40 +08:00
|
|
|
if test -n "$libltdl_cv_shlibpath_var"; then
|
|
|
|
AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var")
|
1999-01-14 02:37:25 +08:00
|
|
|
fi
|
|
|
|
|
1999-01-17 19:19:40 +08:00
|
|
|
AC_CACHE_CHECK([for objdir],
|
|
|
|
libltdl_cv_objdir, [dnl
|
1999-01-14 02:37:25 +08:00
|
|
|
(
|
|
|
|
rm -f conftest
|
|
|
|
./libtool --config > conftest
|
|
|
|
. ./conftest
|
|
|
|
rm -f conftest
|
1999-01-17 19:19:40 +08:00
|
|
|
echo "$objdir" > conftest
|
1999-01-14 02:37:25 +08:00
|
|
|
)
|
1999-01-17 19:19:40 +08:00
|
|
|
libltdl_cv_objdir=`cat conftest`
|
1999-01-14 02:37:25 +08:00
|
|
|
rm -f conftest
|
|
|
|
])
|
1999-01-17 19:19:40 +08:00
|
|
|
test -z "$libltdl_cv_objdir" && libltdl_cv_objdir=".libs"
|
|
|
|
AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir")
|
1999-01-14 02:37:25 +08:00
|
|
|
|
1998-11-24 05:26:38 +08:00
|
|
|
AC_HEADER_STDC
|
1999-01-17 19:19:40 +08:00
|
|
|
AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dlfcn.h dl.h)
|
1998-12-02 21:05:23 +08:00
|
|
|
AC_CHECK_HEADERS(string.h strings.h, break)
|
1998-12-25 18:39:59 +08:00
|
|
|
AC_CHECK_FUNCS(strdup strchr strrchr index rindex)
|
* ltmain.in (-force-static, force_static): removed
* libltdl/Makefile.am (CFLAGS): ditto
* libltdl/configure.in: check for memory.h, rindex() and
dlpreopening. Fixed NEED_USCORE caching policy.
* libltdl/ltdl.h (lt_dlsym): make the name argument const
* libltdl/ltdl.c (types): new variable: head of list of available
dlopening mechanisms
(lt_dltype_t): interface of a dlopening mechanism, with pointers
to functions for init, exit, open, close and sym
(lt_dlhandle_t): added pointer to interface type
(strdup): don't name it strdup; it can be troublesome
(strrchr): ditto; use rindex if available
(LIBTOOL_STATIC): check HAVE_DLPREOPEN instead, and move to the
end of the file, so that it becomes the header of the list
(all): renamed all interface-implementation functions, to avoid
name clashes, and created lt_dltype_t nodes for all of them
(lt_dlinit): initialize all available interfaces; remove those
that fail from the list. Return failure only if no interfaces
could be initialized.
(lt_dlexit): return number of failures
(tryall_dlopen): try to open the library with all available
interfaces
(lt_dlopen): use tryall_dlopen; increased size of fixed buffers.
We should probably make these bound-checked or dynamically
allocated for the final release! Fix bug when filename did not
contain slashes; should we check for `\\' too? Try old_library if
everything else fails.
(lt_dlclose): use the interface type for closing
(lt_dlsym): make `symbol' const, use interface type for looking up
* mdemo/Makefile.am: moved mdemo/modules/* back into mdemo
(SUBDIRS): removed
(libfoo2_la_LDFLAGS): added -static; nice test. However, since it
causes -lm to linked into hell*, it causes tests that should fail
to pass
(noinst_HEADERS): no need to install foo.h
* mdemo/configure.in: remove modules/Makefile
tests/mdemo-exec.test: updated accordingly
1998-12-16 13:42:23 +08:00
|
|
|
|
1999-01-10 04:05:55 +08:00
|
|
|
test_dlerror=no
|
1998-11-18 15:29:36 +08:00
|
|
|
LIBADD_DL=
|
1999-01-10 04:05:55 +08:00
|
|
|
AC_CHECK_FUNCS(dlopen, [AC_DEFINE(HAVE_LIBDL) test_dlerror=yes],
|
|
|
|
[AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL) LIBADD_DL="-ldl" test_dlerror=yes],
|
|
|
|
[AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD) LIBADD_DL="-ldld"],
|
|
|
|
[AC_CHECK_FUNCS(shl_load, AC_DEFINE(HAVE_SHL_LOAD))]
|
|
|
|
)]
|
1998-11-18 15:29:36 +08:00
|
|
|
)]
|
|
|
|
)
|
|
|
|
AC_SUBST(LIBADD_DL)
|
|
|
|
|
1999-01-10 04:05:55 +08:00
|
|
|
if test "$test_dlerror" = yes; then
|
|
|
|
LIBS_SAVE="$LIBS"
|
|
|
|
LIBS="$LIBS $LIBADD_DL"
|
|
|
|
AC_CHECK_FUNCS(dlerror)
|
|
|
|
LIBS="$LIBS_SAVE"
|
|
|
|
fi
|
|
|
|
|
1998-12-21 21:04:14 +08:00
|
|
|
AM_SYS_SYMBOL_UNDERSCORE
|
|
|
|
if test x"$USE_SYMBOL_UNDERSCORE" = xyes; then
|
* ltmain.in (-force-static, force_static): removed
* libltdl/Makefile.am (CFLAGS): ditto
* libltdl/configure.in: check for memory.h, rindex() and
dlpreopening. Fixed NEED_USCORE caching policy.
* libltdl/ltdl.h (lt_dlsym): make the name argument const
* libltdl/ltdl.c (types): new variable: head of list of available
dlopening mechanisms
(lt_dltype_t): interface of a dlopening mechanism, with pointers
to functions for init, exit, open, close and sym
(lt_dlhandle_t): added pointer to interface type
(strdup): don't name it strdup; it can be troublesome
(strrchr): ditto; use rindex if available
(LIBTOOL_STATIC): check HAVE_DLPREOPEN instead, and move to the
end of the file, so that it becomes the header of the list
(all): renamed all interface-implementation functions, to avoid
name clashes, and created lt_dltype_t nodes for all of them
(lt_dlinit): initialize all available interfaces; remove those
that fail from the list. Return failure only if no interfaces
could be initialized.
(lt_dlexit): return number of failures
(tryall_dlopen): try to open the library with all available
interfaces
(lt_dlopen): use tryall_dlopen; increased size of fixed buffers.
We should probably make these bound-checked or dynamically
allocated for the final release! Fix bug when filename did not
contain slashes; should we check for `\\' too? Try old_library if
everything else fails.
(lt_dlclose): use the interface type for closing
(lt_dlsym): make `symbol' const, use interface type for looking up
* mdemo/Makefile.am: moved mdemo/modules/* back into mdemo
(SUBDIRS): removed
(libfoo2_la_LDFLAGS): added -static; nice test. However, since it
causes -lm to linked into hell*, it causes tests that should fail
to pass
(noinst_HEADERS): no need to install foo.h
* mdemo/configure.in: remove modules/Makefile
tests/mdemo-exec.test: updated accordingly
1998-12-16 13:42:23 +08:00
|
|
|
if test x"$ac_cv_func_dlopen" = xyes ||
|
|
|
|
test x"$ac_cv_lib_dl_dlopen" = xyes ; then
|
1998-12-16 10:39:15 +08:00
|
|
|
AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
|
* ltmain.in (-force-static, force_static): removed
* libltdl/Makefile.am (CFLAGS): ditto
* libltdl/configure.in: check for memory.h, rindex() and
dlpreopening. Fixed NEED_USCORE caching policy.
* libltdl/ltdl.h (lt_dlsym): make the name argument const
* libltdl/ltdl.c (types): new variable: head of list of available
dlopening mechanisms
(lt_dltype_t): interface of a dlopening mechanism, with pointers
to functions for init, exit, open, close and sym
(lt_dlhandle_t): added pointer to interface type
(strdup): don't name it strdup; it can be troublesome
(strrchr): ditto; use rindex if available
(LIBTOOL_STATIC): check HAVE_DLPREOPEN instead, and move to the
end of the file, so that it becomes the header of the list
(all): renamed all interface-implementation functions, to avoid
name clashes, and created lt_dltype_t nodes for all of them
(lt_dlinit): initialize all available interfaces; remove those
that fail from the list. Return failure only if no interfaces
could be initialized.
(lt_dlexit): return number of failures
(tryall_dlopen): try to open the library with all available
interfaces
(lt_dlopen): use tryall_dlopen; increased size of fixed buffers.
We should probably make these bound-checked or dynamically
allocated for the final release! Fix bug when filename did not
contain slashes; should we check for `\\' too? Try old_library if
everything else fails.
(lt_dlclose): use the interface type for closing
(lt_dlsym): make `symbol' const, use interface type for looking up
* mdemo/Makefile.am: moved mdemo/modules/* back into mdemo
(SUBDIRS): removed
(libfoo2_la_LDFLAGS): added -static; nice test. However, since it
causes -lm to linked into hell*, it causes tests that should fail
to pass
(noinst_HEADERS): no need to install foo.h
* mdemo/configure.in: remove modules/Makefile
tests/mdemo-exec.test: updated accordingly
1998-12-16 13:42:23 +08:00
|
|
|
libltdl_cv_need_uscore, [dnl
|
|
|
|
AC_TRY_RUN([
|
1998-11-24 05:26:38 +08:00
|
|
|
#include <dlfcn.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
fnord() { int i=42;}
|
1998-12-25 18:39:59 +08:00
|
|
|
main() { void *self, *ptr1, *ptr2; self=dlopen(0,RTLD_LAZY);
|
1998-11-24 05:26:38 +08:00
|
|
|
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
|
|
|
|
if(ptr1 && !ptr2) exit(0); } exit(1); }
|
* ltmain.in (-force-static, force_static): removed
* libltdl/Makefile.am (CFLAGS): ditto
* libltdl/configure.in: check for memory.h, rindex() and
dlpreopening. Fixed NEED_USCORE caching policy.
* libltdl/ltdl.h (lt_dlsym): make the name argument const
* libltdl/ltdl.c (types): new variable: head of list of available
dlopening mechanisms
(lt_dltype_t): interface of a dlopening mechanism, with pointers
to functions for init, exit, open, close and sym
(lt_dlhandle_t): added pointer to interface type
(strdup): don't name it strdup; it can be troublesome
(strrchr): ditto; use rindex if available
(LIBTOOL_STATIC): check HAVE_DLPREOPEN instead, and move to the
end of the file, so that it becomes the header of the list
(all): renamed all interface-implementation functions, to avoid
name clashes, and created lt_dltype_t nodes for all of them
(lt_dlinit): initialize all available interfaces; remove those
that fail from the list. Return failure only if no interfaces
could be initialized.
(lt_dlexit): return number of failures
(tryall_dlopen): try to open the library with all available
interfaces
(lt_dlopen): use tryall_dlopen; increased size of fixed buffers.
We should probably make these bound-checked or dynamically
allocated for the final release! Fix bug when filename did not
contain slashes; should we check for `\\' too? Try old_library if
everything else fails.
(lt_dlclose): use the interface type for closing
(lt_dlsym): make `symbol' const, use interface type for looking up
* mdemo/Makefile.am: moved mdemo/modules/* back into mdemo
(SUBDIRS): removed
(libfoo2_la_LDFLAGS): added -static; nice test. However, since it
causes -lm to linked into hell*, it causes tests that should fail
to pass
(noinst_HEADERS): no need to install foo.h
* mdemo/configure.in: remove modules/Makefile
tests/mdemo-exec.test: updated accordingly
1998-12-16 13:42:23 +08:00
|
|
|
], libltdl_cv_need_uscore=no, libltdl_cv_need_uscore=yes,
|
|
|
|
libltdl_cv_need_uscore=no
|
|
|
|
)])
|
1998-11-24 05:26:38 +08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
* ltmain.in (-force-static, force_static): removed
* libltdl/Makefile.am (CFLAGS): ditto
* libltdl/configure.in: check for memory.h, rindex() and
dlpreopening. Fixed NEED_USCORE caching policy.
* libltdl/ltdl.h (lt_dlsym): make the name argument const
* libltdl/ltdl.c (types): new variable: head of list of available
dlopening mechanisms
(lt_dltype_t): interface of a dlopening mechanism, with pointers
to functions for init, exit, open, close and sym
(lt_dlhandle_t): added pointer to interface type
(strdup): don't name it strdup; it can be troublesome
(strrchr): ditto; use rindex if available
(LIBTOOL_STATIC): check HAVE_DLPREOPEN instead, and move to the
end of the file, so that it becomes the header of the list
(all): renamed all interface-implementation functions, to avoid
name clashes, and created lt_dltype_t nodes for all of them
(lt_dlinit): initialize all available interfaces; remove those
that fail from the list. Return failure only if no interfaces
could be initialized.
(lt_dlexit): return number of failures
(tryall_dlopen): try to open the library with all available
interfaces
(lt_dlopen): use tryall_dlopen; increased size of fixed buffers.
We should probably make these bound-checked or dynamically
allocated for the final release! Fix bug when filename did not
contain slashes; should we check for `\\' too? Try old_library if
everything else fails.
(lt_dlclose): use the interface type for closing
(lt_dlsym): make `symbol' const, use interface type for looking up
* mdemo/Makefile.am: moved mdemo/modules/* back into mdemo
(SUBDIRS): removed
(libfoo2_la_LDFLAGS): added -static; nice test. However, since it
causes -lm to linked into hell*, it causes tests that should fail
to pass
(noinst_HEADERS): no need to install foo.h
* mdemo/configure.in: remove modules/Makefile
tests/mdemo-exec.test: updated accordingly
1998-12-16 13:42:23 +08:00
|
|
|
if test x"$libltdl_cv_need_uscore" = xyes; then
|
1998-12-23 18:27:14 +08:00
|
|
|
AC_DEFINE(NEED_USCORE)
|
* ltmain.in (-force-static, force_static): removed
* libltdl/Makefile.am (CFLAGS): ditto
* libltdl/configure.in: check for memory.h, rindex() and
dlpreopening. Fixed NEED_USCORE caching policy.
* libltdl/ltdl.h (lt_dlsym): make the name argument const
* libltdl/ltdl.c (types): new variable: head of list of available
dlopening mechanisms
(lt_dltype_t): interface of a dlopening mechanism, with pointers
to functions for init, exit, open, close and sym
(lt_dlhandle_t): added pointer to interface type
(strdup): don't name it strdup; it can be troublesome
(strrchr): ditto; use rindex if available
(LIBTOOL_STATIC): check HAVE_DLPREOPEN instead, and move to the
end of the file, so that it becomes the header of the list
(all): renamed all interface-implementation functions, to avoid
name clashes, and created lt_dltype_t nodes for all of them
(lt_dlinit): initialize all available interfaces; remove those
that fail from the list. Return failure only if no interfaces
could be initialized.
(lt_dlexit): return number of failures
(tryall_dlopen): try to open the library with all available
interfaces
(lt_dlopen): use tryall_dlopen; increased size of fixed buffers.
We should probably make these bound-checked or dynamically
allocated for the final release! Fix bug when filename did not
contain slashes; should we check for `\\' too? Try old_library if
everything else fails.
(lt_dlclose): use the interface type for closing
(lt_dlsym): make `symbol' const, use interface type for looking up
* mdemo/Makefile.am: moved mdemo/modules/* back into mdemo
(SUBDIRS): removed
(libfoo2_la_LDFLAGS): added -static; nice test. However, since it
causes -lm to linked into hell*, it causes tests that should fail
to pass
(noinst_HEADERS): no need to install foo.h
* mdemo/configure.in: remove modules/Makefile
tests/mdemo-exec.test: updated accordingly
1998-12-16 13:42:23 +08:00
|
|
|
fi
|
|
|
|
|
1998-11-18 15:29:36 +08:00
|
|
|
dnl Output the makefile
|
|
|
|
AC_OUTPUT(Makefile)
|
1998-12-21 21:04:14 +08:00
|
|
|
|
|
|
|
# Local Variables:
|
|
|
|
# mode:shell-script
|
|
|
|
# sh-indentation:2
|
|
|
|
# End:
|