Update to GNU Libtool 20030216 (from Cygwin) to get dynamic linking working

under Cygwin.

svn path=/trunk/yasm/; revision=860
This commit is contained in:
Peter Johnson 2003-03-15 23:19:33 +00:00
parent 9653cd6bcb
commit ad6ab091e8
6 changed files with 5262 additions and 2965 deletions

View file

@ -61,11 +61,13 @@ AC_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_LN_S
AM_PROG_LEX
# Libtool
AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
AC_LIBLTDL_CONVENIENCE
#AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
AC_SUBST([LIBTOOL_DEPS])
# REQUIRE a standard (ANSI/ISO) C compiler
if test "$ac_cv_prog_cc_stdc" = no; then

View file

@ -27,9 +27,9 @@ libltdlc_la_LIBADD = $(LIBADD_DL)
## Because we do not have automatic dependency tracking:
ltdl.lo: ltdl.h ../libyasm/config.h
$(OBJECTS): libtool
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck
$(libltdl_la_OBJECTS) $(libltdlc_la_OBJECTS): $(top_builddir)/libtool
#libtool: $(LIBTOOL_DEPS)
# $(SHELL) $(top_builddir)/config.status --recheck
## This allows us to install libltdl without using ln and without creating
## a world writeable directory.

View file

@ -1,84 +0,0 @@
## Process this file with autoconf to create configure. -*- autoconf -*-
# Copyright 2001 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA
## FIXME: Is this really new enough? ##
AC_PREREQ(2.50)
## ------------------------ ##
## Autoconf initialisation. ##
## ------------------------ ##
AC_INIT([libltdl], [1.2], [bug-libtool@gnu.org])
AC_CONFIG_SRCDIR([ltdl.c])
## ------------------------------- ##
## Libltdl specific configuration. ##
## ------------------------------- ##
# We shouldn't be using these internal macros of autoconf,
# but CONFIG_AUX_DIR($with_auxdir) breaks automake.
AC_ARG_WITH([auxdir],
[AC_HELP_STRING([--with-auxdir=DIR], [path to autoconf auxiliary files])],
[AC_CONFIG_AUX_DIRS($with_auxdir)],
[AC_CONFIG_AUX_DIR_DEFAULT])
if test -z "$enable_ltdl_install$enable_ltdl_convenience"; then
if test -f ${srcdir}/ltmain.sh; then
# if libltdl is libtoolized, it is assumed to be stand-alone and
# installed unless the command line overrides it (tested above)
enable_ltdl_install=yes
else
AC_MSG_WARN([*** The top-level configure must select either])
AC_MSG_WARN([*** [A""C_LIBLTDL_INSTALLABLE] or [A""C_LIBLTDL_CONVENIENCE].])
AC_MSG_ERROR([*** Maybe you want to --enable-ltdl-install?])
fi
fi
## ------------------------ ##
## Automake Initialisation. ##
## ------------------------ ##
AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION, -)
AM_CONFIG_HEADER([config.h:config-h.in])
## ------------------ ##
## C compiler checks. ##
## ------------------ ##
AC_PROG_CC
AC_C_CONST
AC_C_INLINE
## ----------------------- ##
## Libtool initialisation. ##
## ----------------------- ##
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_SUBST([LIBTOOL_DEPS])
AC_LIB_LTDL
## -------- ##
## Outputs. ##
## -------- ##
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View file

@ -65,20 +65,52 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# include <errno.h>
#endif
#if HAVE_DIRENT_H
#ifndef __WINDOWS__
# ifdef __WIN32__
# define __WINDOWS__
# endif
#endif
#undef LT_USE_POSIX_DIRENT
#ifdef HAVE_CLOSEDIR
# ifdef HAVE_OPENDIR
# ifdef HAVE_READDIR
# ifdef HAVE_DIRENT_H
# define LT_USE_POSIX_DIRENT
# endif /* HAVE_DIRENT_H */
# endif /* HAVE_READDIR */
# endif /* HAVE_OPENDIR */
#endif /* HAVE_CLOSEDIR */
#undef LT_USE_WINDOWS_DIRENT_EMULATION
#ifndef LT_USE_POSIX_DIRENT
# ifdef __WINDOWS__
# define LT_USE_WINDOWS_DIRENT_EMULATION
# endif /* __WINDOWS__ */
#endif /* LT_USE_POSIX_DIRENT */
#ifdef LT_USE_POSIX_DIRENT
# include <dirent.h>
# define LT_D_NAMLEN(dirent) (strlen((dirent)->d_name))
#else
# define dirent direct
# define LT_D_NAMLEN(dirent) ((dirent)->d_namlen)
# if HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
# if HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
# if HAVE_NDIR_H
# include <ndir.h>
# ifdef LT_USE_WINDOWS_DIRENT_EMULATION
# define LT_D_NAMLEN(dirent) (strlen((dirent)->d_name))
# else
# define dirent direct
# define LT_D_NAMLEN(dirent) ((dirent)->d_namlen)
# if HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
# if HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
# if HAVE_NDIR_H
# include <ndir.h>
# endif
# endif
#endif
@ -94,7 +126,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
#include "ltdl.h"
#if WITH_DMALLOC
# include <dmalloc.h>
#endif
/* --- WINDOWS SUPPORT --- */
@ -114,7 +148,28 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# define LT_READTEXT_MODE "r"
#endif
#ifdef LT_USE_WINDOWS_DIRENT_EMULATION
#include <windows.h>
#define dirent lt_dirent
#define DIR lt_DIR
struct dirent
{
char d_name[2048];
int d_namlen;
};
typedef struct _DIR
{
HANDLE hSearch;
WIN32_FIND_DATA Win32FindData;
BOOL firsttime;
struct dirent file_info;
} DIR;
#endif /* LT_USE_WINDOWS_DIRENT_EMULATION */
/* --- MANIFEST CONSTANTS --- */
@ -154,7 +209,8 @@ static char *lt_estrdup LT_PARAMS((const char *str));
static lt_ptr lt_emalloc LT_PARAMS((size_t size));
static lt_ptr lt_erealloc LT_PARAMS((lt_ptr addr, size_t size));
static lt_ptr rpl_realloc LT_PARAMS((lt_ptr ptr, size_t size));
/* static lt_ptr rpl_realloc LT_PARAMS((lt_ptr ptr, size_t size)); */
#define rpl_realloc realloc
/* These are the pointers that can be changed by the caller: */
LT_GLOBAL_DATA lt_ptr (*lt_dlmalloc) LT_PARAMS((size_t size))
@ -166,6 +222,18 @@ LT_GLOBAL_DATA void (*lt_dlfree) LT_PARAMS((lt_ptr ptr))
/* The following macros reduce the amount of typing needed to cast
assigned memory. */
#if WITH_DMALLOC
#define LT_DLMALLOC(tp, n) ((tp *) xmalloc ((n) * sizeof(tp)))
#define LT_DLREALLOC(tp, p, n) ((tp *) xrealloc ((p), (n) * sizeof(tp)))
#define LT_DLFREE(p) \
LT_STMT_START { if (p) (p) = (xfree (p), (lt_ptr) 0); } LT_STMT_END
#define LT_EMALLOC(tp, n) ((tp *) xmalloc ((n) * sizeof(tp)))
#define LT_EREALLOC(tp, p, n) ((tp *) xrealloc ((p), (n) * sizeof(tp)))
#else
#define LT_DLMALLOC(tp, n) ((tp *) lt_dlmalloc ((n) * sizeof(tp)))
#define LT_DLREALLOC(tp, p, n) ((tp *) rpl_realloc ((p), (n) * sizeof(tp)))
#define LT_DLFREE(p) \
@ -174,6 +242,8 @@ LT_GLOBAL_DATA void (*lt_dlfree) LT_PARAMS((lt_ptr ptr))
#define LT_EMALLOC(tp, n) ((tp *) lt_emalloc ((n) * sizeof(tp)))
#define LT_EREALLOC(tp, p, n) ((tp *) lt_erealloc ((p), (n) * sizeof(tp)))
#endif
#define LT_DLMEM_REASSIGN(p, q) LT_STMT_START { \
if ((p) != (q)) { if (p) lt_dlfree (p); (p) = (q); (q) = 0; } \
} LT_STMT_END
@ -187,7 +257,7 @@ LT_GLOBAL_DATA void (*lt_dlfree) LT_PARAMS((lt_ptr ptr))
static char *strdup LT_PARAMS((const char *str));
char *
static char *
strdup(str)
const char *str;
{
@ -213,7 +283,7 @@ strdup(str)
static int strcmp LT_PARAMS((const char *str1, const char *str2));
int
static int
strcmp (str1, str2)
const char *str1;
const char *str2;
@ -245,7 +315,7 @@ strcmp (str1, str2)
static const char *strchr LT_PARAMS((const char *str, int ch));
const char*
static const char*
strchr(str, ch)
const char *str;
int ch;
@ -271,7 +341,7 @@ strchr(str, ch)
static const char *strrchr LT_PARAMS((const char *str, int ch));
const char*
static const char*
strrchr(str, ch)
const char *str;
int ch;
@ -305,7 +375,7 @@ strrchr(str, ch)
static lt_ptr memcpy LT_PARAMS((lt_ptr dest, const lt_ptr src, size_t size));
lt_ptr
static lt_ptr
memcpy (dest, src, size)
lt_ptr dest;
const lt_ptr src;
@ -329,7 +399,7 @@ memcpy (dest, src, size)
static lt_ptr memmove LT_PARAMS((lt_ptr dest, const lt_ptr src, size_t size));
lt_ptr
static lt_ptr
memmove (dest, src, size)
lt_ptr dest;
const lt_ptr src;
@ -353,6 +423,76 @@ memmove (dest, src, size)
#endif /* !HAVE_MEMMOVE */
#ifdef LT_USE_WINDOWS_DIRENT_EMULATION
static void closedir LT_PARAMS((DIR *entry));
static void
closedir(entry)
DIR *entry;
{
assert(entry != (DIR *) NULL);
FindClose(entry->hSearch);
lt_dlfree((lt_ptr)entry);
}
static DIR * opendir LT_PARAMS((const char *path));
static DIR*
opendir (path)
const char *path;
{
char file_specification[LT_FILENAME_MAX];
DIR *entry;
assert(path != (char *) NULL);
(void) strncpy(file_specification,path,LT_FILENAME_MAX-1);
(void) strcat(file_specification,"\\");
entry = LT_DLMALLOC (DIR,sizeof(DIR));
if (entry != (DIR *) 0)
{
entry->firsttime = TRUE;
entry->hSearch = FindFirstFile(file_specification,&entry->Win32FindData);
}
if (entry->hSearch == INVALID_HANDLE_VALUE)
{
(void) strcat(file_specification,"\\*.*");
entry->hSearch = FindFirstFile(file_specification,&entry->Win32FindData);
if (entry->hSearch == INVALID_HANDLE_VALUE)
{
LT_DLFREE (entry);
return (DIR *) 0;
}
}
return(entry);
}
static struct dirent *readdir LT_PARAMS((DIR *entry));
static struct dirent *readdir(entry)
DIR *entry;
{
int
status;
if (entry == (DIR *) 0)
return((struct dirent *) 0);
if (!entry->firsttime)
{
status = FindNextFile(entry->hSearch,&entry->Win32FindData);
if (status == 0)
return((struct dirent *) 0);
}
entry->firsttime = FALSE;
(void) strncpy(entry->file_info.d_name,entry->Win32FindData.cFileName,
LT_FILENAME_MAX-1);
entry->file_info.d_namlen = strlen(entry->file_info.d_name);
return(&entry->file_info);
}
#endif /* LT_USE_WINDOWS_DIRENT_EMULATION */
/* According to Alexandre Oliva <oliva@lsd.ic.unicamp.br>,
``realloc is not entirely portable''
@ -361,15 +501,22 @@ memmove (dest, src, size)
Instead implement our own version (with known boundary conditions)
using lt_dlmalloc and lt_dlfree. */
#undef realloc
#define realloc rpl_realloc
/* #undef realloc
#define realloc rpl_realloc
*/
#if 0
/* You can't (re)define realloc unless you also (re)define malloc.
Right now, this code uses the size of the *destination* to decide
how much to copy. That's not right, but you can't know the size
of the source unless you know enough about, or wrote malloc. So
this code is disabled... */
lt_ptr
static lt_ptr
realloc (ptr, size)
lt_ptr ptr;
size_t size;
{
if (size <= 0)
if (size == 0)
{
/* For zero or less bytes, free the original memory */
if (ptr != 0)
@ -400,6 +547,7 @@ realloc (ptr, size)
return mem;
}
}
#endif
#if ! HAVE_ARGZ_APPEND
@ -408,7 +556,7 @@ realloc (ptr, size)
static error_t argz_append LT_PARAMS((char **pargz, size_t *pargz_len,
const char *buf, size_t buf_len));
error_t
static error_t
argz_append (pargz, pargz_len, buf, buf_len)
char **pargz;
size_t *pargz_len;
@ -450,7 +598,7 @@ argz_append (pargz, pargz_len, buf, buf_len)
static error_t argz_create_sep LT_PARAMS((const char *str, int delim,
char **pargz, size_t *pargz_len));
error_t
static error_t
argz_create_sep (str, delim, pargz, pargz_len)
const char *str;
int delim;
@ -513,7 +661,7 @@ argz_create_sep (str, delim, pargz, pargz_len)
static error_t argz_insert LT_PARAMS((char **pargz, size_t *pargz_len,
char *before, const char *entry));
error_t
static error_t
argz_insert (pargz, pargz_len, before, entry)
char **pargz;
size_t *pargz_len;
@ -524,11 +672,6 @@ argz_insert (pargz, pargz_len, before, entry)
assert (pargz_len);
assert (entry && *entry);
/* Either PARGZ/PARGZ_LEN is empty and BEFORE is NULL,
or BEFORE points into an address within the ARGZ vector. */
assert ((!*pargz && !*pargz_len && !before)
|| ((*pargz <= before) && (before < (*pargz + *pargz_len))));
/* No BEFORE address indicates ENTRY should be inserted after the
current last element. */
if (!before)
@ -575,7 +718,7 @@ argz_insert (pargz, pargz_len, before, entry)
static char *argz_next LT_PARAMS((char *argz, size_t argz_len,
char *entry));
char *
static char *
argz_next (argz, argz_len, entry)
char *argz;
size_t argz_len;
@ -620,7 +763,7 @@ argz_next (argz, argz_len, entry)
static void argz_stringify LT_PARAMS((char *argz, size_t argz_len,
int sep));
void
static void
argz_stringify (argz, argz_len, sep)
char *argz;
size_t argz_len;
@ -856,7 +999,7 @@ lt_dlseterror (errindex)
return errors;
}
lt_ptr
static lt_ptr
lt_emalloc (size)
size_t size;
{
@ -866,7 +1009,7 @@ lt_emalloc (size)
return mem;
}
lt_ptr
static lt_ptr
lt_erealloc (addr, size)
lt_ptr addr;
size_t size;
@ -877,14 +1020,14 @@ lt_erealloc (addr, size)
return mem;
}
char *
static char *
lt_estrdup (str)
const char *str;
{
char *dupl = strdup (str);
if (LT_STRLEN (str) && !dupl)
char *copy = strdup (str);
if (LT_STRLEN (str) && !copy)
LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));
return dupl;
return copy;
}
@ -893,11 +1036,7 @@ lt_estrdup (str)
/* --- DLOPEN() INTERFACE LOADER --- */
/* The Cygwin dlopen implementation prints a spurious error message to
stderr if its call to LoadLibrary() fails for any reason. We can
mitigate this by not using the Cygwin implementation, and falling
back to our own LoadLibrary() wrapper. */
#if HAVE_LIBDL && !defined(__CYGWIN__)
#if HAVE_LIBDL
/* dynamic linking with dlopen/dlsym */
@ -1709,9 +1848,17 @@ static int lt_argz_insert LT_PARAMS((char **pargz,
static int lt_argz_insertinorder LT_PARAMS((char **pargz,
size_t *pargz_len,
const char *entry));
static int lt_argz_insertdir LT_PARAMS((char **pargz,
size_t *pargz_len,
const char *dirnam,
struct dirent *dp));
static int lt_dlpath_insertdir LT_PARAMS((char **ppath,
char *before,
const char *dir));
static int list_files_by_dir LT_PARAMS((const char *dirnam,
char **pargz,
size_t *pargz_len));
static int file_not_found LT_PARAMS((void));
static char *user_search_path= 0;
static lt_dlloader *loaders = 0;
@ -1732,7 +1879,7 @@ lt_dlinit ()
handles = 0;
user_search_path = 0; /* empty search path */
#if HAVE_LIBDL && !defined(__CYGWIN__)
#if HAVE_LIBDL
errors += lt_dlloader_add (lt_dlloader_next (0), &sys_dl, "dlopen");
#endif
#if HAVE_SHL_LOAD
@ -1917,6 +2064,18 @@ tryall_dlopen (handle, filename)
cur = *handle;
if (filename)
{
/* Comment out the check of file permissions using access.
This call seems to always return -1 with error EACCES.
*/
/* We need to catch missing file errors early so that
file_not_found() can detect what happened.
if (access (filename, R_OK) != 0)
{
LT_DLMUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND));
++errors;
goto done;
} */
cur->info.filename = lt_estrdup (filename);
if (!cur->info.filename)
{
@ -1984,8 +2143,9 @@ tryall_dlopen_module (handle, prefix, dirname, dlname)
assert (strchr (dirname, LT_DIRSEP_CHAR) == 0);
#endif
if (dirname[dirname_len -1] == '/')
--dirname_len;
if (dirname_len > 0)
if (dirname[dirname_len -1] == '/')
--dirname_len;
filename_len = dirname_len + 1 + LT_STRLEN (dlname);
/* Allocate memory, and combine DIRNAME and MODULENAME into it.
@ -2167,11 +2327,11 @@ foreach_dirinpath (search_path, base_name, func, data1, data2)
{
int result = 0;
int filenamesize = 0;
int lenbase = LT_STRLEN (base_name);
size_t lenbase = LT_STRLEN (base_name);
size_t argz_len = 0;
char * argz = 0;
char * filename = 0;
char * canonical = 0;
char *argz = 0;
char *filename = 0;
char *canonical = 0;
LT_DLMUTEX_LOCK ();
@ -2191,7 +2351,7 @@ foreach_dirinpath (search_path, base_name, func, data1, data2)
char *dir_name = 0;
while ((dir_name = argz_next (argz, argz_len, dir_name)))
{
int lendir = LT_STRLEN (dir_name);
size_t lendir = LT_STRLEN (dir_name);
if (lendir +1 +lenbase >= filenamesize)
{
@ -2202,7 +2362,9 @@ foreach_dirinpath (search_path, base_name, func, data1, data2)
goto cleanup;
}
strncpy (filename, dir_name, lendir);
assert (filenamesize > lendir);
strcpy (filename, dir_name);
if (base_name && *base_name)
{
if (filename[lendir -1] != '/')
@ -2278,11 +2440,11 @@ find_handle_callback (filename, data, ignored)
lt_ptr data;
lt_ptr ignored;
{
lt_dlhandle *handle = (lt_dlhandle *) data;
int found = access (filename, R_OK);
lt_dlhandle *handle = (lt_dlhandle *) data;
int notfound = access (filename, R_OK);
/* Bail out if file cannot be read... */
if (!found)
if (notfound)
return 0;
/* Try to dlopen the file, but do not continue searching in any
@ -2502,7 +2664,7 @@ trim (dest, str)
/* remove the leading and trailing "'" from str
and store the result in dest */
const char *end = strrchr (str, '\'');
int len = LT_STRLEN (str);
size_t len = LT_STRLEN (str);
char *tmp;
LT_DLFREE (*dest);
@ -2540,7 +2702,7 @@ free_vars (dlname, oldname, libdir, deplibs)
return 0;
}
int
static int
try_dlopen (phandle, filename)
lt_dlhandle *phandle;
const char *filename;
@ -2627,7 +2789,6 @@ try_dlopen (phandle, filename)
char * deplibs = 0;
char * line = 0;
size_t line_len;
int i;
/* if we can't find the installed flag, it is probably an
installed libtool archive, produced with an old version
@ -2643,23 +2804,26 @@ try_dlopen (phandle, filename)
}
/* canonicalize the module name */
for (i = 0; i < ext - base_name; ++i)
{
if (isalnum ((int)(base_name[i])))
{
name[i] = base_name[i];
}
else
{
name[i] = '_';
}
}
name[ext - base_name] = LT_EOS_CHAR;
{
size_t i;
for (i = 0; i < ext - base_name; ++i)
{
if (isalnum ((int)(base_name[i])))
{
name[i] = base_name[i];
}
else
{
name[i] = '_';
}
}
name[ext - base_name] = LT_EOS_CHAR;
}
/* Now try to open the .la file. If there is no directory name
component, try to find it first in user_search_path and then other
prescribed paths. Otherwise (or in any case if the module was not
yet found) try opening just the module name as passed. */
/* Now try to open the .la file. If there is no directory name
component, try to find it first in user_search_path and then other
prescribed paths. Otherwise (or in any case if the module was not
yet found) try opening just the module name as passed. */
if (!dir)
{
const char *search_path;
@ -2718,17 +2882,17 @@ try_dlopen (phandle, filename)
/* read the .la file */
while (!feof (file))
{
if (!fgets (line, line_len, file))
if (!fgets (line, (int) line_len, file))
{
break;
}
/* Handle the case where we occasionally need to read a line
that is longer than the initial buffer size. */
while (line[LT_STRLEN(line) -1] != '\n')
while ((line[LT_STRLEN(line) -1] != '\n') && (!feof (file)))
{
line = LT_DLREALLOC (char, line, line_len *2);
if (!fgets (&line[line_len -1], line_len +1, file))
if (!fgets (&line[line_len -1], (int) line_len +1, file))
{
break;
}
@ -2876,7 +3040,10 @@ try_dlopen (phandle, filename)
#endif
)))
{
tryall_dlopen (&newhandle, filename);
if (tryall_dlopen (&newhandle, filename) != 0)
{
newhandle = NULL;
}
}
if (!newhandle)
@ -2929,7 +3096,7 @@ lt_dlopen (filename)
non-zero. */
static int file_not_found LT_PARAMS((void));
int
static int
file_not_found ()
{
const char *error = 0;
@ -2952,7 +3119,7 @@ lt_dlopenext (filename)
lt_dlhandle handle = 0;
char * tmp = 0;
char * ext = 0;
int len;
size_t len;
int errors = 0;
if (!filename)
@ -2990,7 +3157,7 @@ lt_dlopenext (filename)
failed, it is better to return an error message here than to
report FILE_NOT_FOUND when the alternatives (foo.so etc) are not
in the module search path. */
if (handle || ((errors > 0) && file_not_found ()))
if (handle || ((errors > 0) && !file_not_found ()))
{
LT_DLFREE (tmp);
return handle;
@ -3017,7 +3184,7 @@ lt_dlopenext (filename)
/* As before, if the file was found but loading failed, return now
with the current error message. */
if (handle || ((errors > 0) && file_not_found ()))
if (handle || ((errors > 0) && !file_not_found ()))
{
LT_DLFREE (tmp);
return handle;
@ -3032,7 +3199,7 @@ lt_dlopenext (filename)
}
int
static int
lt_argz_insert (pargz, pargz_len, before, entry)
char **pargz;
size_t *pargz_len;
@ -3058,7 +3225,7 @@ lt_argz_insert (pargz, pargz_len, before, entry)
return 0;
}
int
static int
lt_argz_insertinorder (pargz, pargz_len, entry)
char **pargz;
size_t *pargz_len;
@ -3082,10 +3249,10 @@ lt_argz_insertinorder (pargz, pargz_len, entry)
return lt_argz_insert (pargz, pargz_len, before, entry);
}
int lt_argz_insertdir LT_PARAMS((char **pargz, size_t *pargz_len,
static int lt_argz_insertdir LT_PARAMS((char **pargz, size_t *pargz_len,
const char *dirnam, struct dirent *dp));
int
static int
lt_argz_insertdir (pargz, pargz_len, dirnam, dp)
char **pargz;
size_t *pargz_len;
@ -3154,7 +3321,7 @@ lt_argz_insertdir (pargz, pargz_len, dirnam, dp)
static int list_files_by_dir LT_PARAMS((const char *dirnam, char **pargz,
size_t *pargz_len));
int
static int
list_files_by_dir (dirnam, pargz, pargz_len)
const char *dirnam;
char **pargz;
@ -3321,6 +3488,9 @@ lt_dlclose (handle)
errors += handle->loader->module_close (data, handle->module);
errors += unload_deplibs(handle);
/* It is up to the callers to free the data itself. */
LT_DLFREE (handle->caller_data);
LT_DLFREE (handle->info.filename);
LT_DLFREE (handle->info.name);
LT_DLFREE (handle);
@ -3345,7 +3515,7 @@ lt_dlsym (handle, symbol)
lt_dlhandle handle;
const char *symbol;
{
int lensym;
size_t lensym;
char lsym[LT_SYMBOL_LENGTH];
char *sym;
lt_ptr address;
@ -3445,7 +3615,7 @@ lt_dlerror ()
return error ? error : LT_DLSTRERROR (UNKNOWN);
}
int
static int
lt_dlpath_insertdir (ppath, before, dir)
char **ppath;
char *before;

7025
m4/libtool.m4 vendored

File diff suppressed because it is too large Load diff

View file

@ -1,328 +1,428 @@
## ltdl.m4 - Configure ltdl for the target system. -*-Shell-script-*-
## Copyright (C) 1999-2000 Free Software Foundation, Inc.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
## As a special exception to the GNU General Public License, if you
## distribute this file as part of a program that contains a
## configuration script generated by Autoconf, you may include it under
## the same distribution terms that you use for the rest of that program.
# serial 2 AC_LIB_LTDL
# AC_LIB_LTDL
# -----------
# Perform all the checks necessary for compilation of the ltdl objects
# -- including compiler checks and header checks.
AC_DEFUN(AC_LIB_LTDL,
[AC_PREREQ(2.13)
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_C_CONST])
AC_REQUIRE([AC_HEADER_STDC])
AC_REQUIRE([AC_HEADER_DIRENT])
AC_REQUIRE([AC_LIBTOOL_HEADER_ASSERT])
AC_REQUIRE([_LT_AC_CHECK_DLFCN])
AC_REQUIRE([AC_LTDL_ENABLE_INSTALL])
AC_REQUIRE([AC_LTDL_SHLIBEXT])
AC_REQUIRE([AC_LTDL_SHLIBPATH])
AC_REQUIRE([AC_LTDL_SYSSEARCHPATH])
AC_REQUIRE([AC_LTDL_OBJDIR])
AC_REQUIRE([AC_LTDL_DLPREOPEN])
AC_REQUIRE([AC_LTDL_DLLIB])
AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])
AC_REQUIRE([AC_LTDL_DLSYM_USCORE])
AC_REQUIRE([AC_LTDL_SYS_DLOPEN_DEPLIBS])
AC_REQUIRE([AC_LTDL_FUNC_ARGZ])
AC_CHECK_HEADERS([errno.h malloc.h memory.h stdlib.h stdio.h ctype.h unistd.h])
AC_CHECK_HEADERS([dl.h sys/dl.h dld.h])
AC_CHECK_HEADERS([string.h strings.h], break)
AC_CHECK_FUNCS([strchr index], break)
AC_CHECK_FUNCS([strrchr rindex], break)
AC_CHECK_FUNCS([memcpy bcopy], break)
AC_CHECK_FUNCS([memmove strcmp])
])# AC_LIB_LTDL
# AC_LTDL_ENABLE_INSTALL
# ----------------------
AC_DEFUN(AC_LTDL_ENABLE_INSTALL,
[AC_ARG_ENABLE(ltdl-install,
[ --enable-ltdl-install install libltdl])
AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno)
AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)
])])# AC_LTDL_ENABLE_INSTALL
# AC_LTDL_SYS_DLOPEN_DEPLIBS
# --------------------------
AC_DEFUN(AC_LTDL_SYS_DLOPEN_DEPLIBS,
[AC_REQUIRE([AC_CANONICAL_HOST])
AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
libltdl_cv_sys_dlopen_deplibs, [dnl
# PORTME does your system automatically load deplibs for dlopen()?
libltdl_cv_sys_dlopen_deplibs=unknown
case "$host_os" in
linux*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
netbsd*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
openbsd*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
solaris*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
esac
])
if test "$libltdl_cv_sys_dlopen_deplibs" != yes; then
AC_DEFINE(LTDL_DLOPEN_DEPLIBS, 1,
[Define if the OS needs help to load dependent libraries for dlopen(). ])
fi
])# AC_LTDL_SYS_DLOPEN_DEPLIBS
# AC_LTDL_SHLIBEXT
# ----------------
AC_DEFUN(AC_LTDL_SHLIBEXT,
[AC_REQUIRE([_LT_AC_LTCONFIG_HACK])
AC_CACHE_CHECK([which extension is used for shared libraries],
libltdl_cv_shlibext,
[ac_last=
for ac_spec in $library_names_spec; do
ac_last="$ac_spec"
done
echo "$ac_last" | [sed 's/\[.*\]//;s/^[^.]*//;s/\$.*$//;s/\.$//'] > conftest
libltdl_cv_shlibext=`cat conftest`
rm -f conftest
])
if test -n "$libltdl_cv_shlibext"; then
AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext",
[Define to the extension used for shared libraries, say, ".so". ])
fi
])# AC_LTDL_SHLIBEXT
# AC_LTDL_SHLIBPATH
# -----------------
AC_DEFUN(AC_LTDL_SHLIBPATH,
[AC_REQUIRE([_LT_AC_LTCONFIG_HACK])
AC_CACHE_CHECK([which variable specifies run-time library path],
libltdl_cv_shlibpath_var, [libltdl_cv_shlibpath_var="$shlibpath_var"])
if test -n "$libltdl_cv_shlibpath_var"; then
AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var",
[Define to the name of the environment variable that determines the dynamic library search path. ])
fi
])# AC_LTDL_SHLIBPATH
# AC_LTDL_SYSSEARCHPATH
# ---------------------
AC_DEFUN(AC_LTDL_SYSSEARCHPATH,
[AC_REQUIRE([_LT_AC_LTCONFIG_HACK])
AC_CACHE_CHECK([for the default library search path],
libltdl_cv_sys_search_path, [libltdl_cv_sys_search_path="$sys_lib_dlsearch_path_spec"])
if test -n "$libltdl_cv_sys_search_path"; then
case "$host" in
*-*-mingw*) pathsep=";" ;;
*) pathsep=":" ;;
esac
sys_search_path=
for dir in $libltdl_cv_sys_search_path; do
if test -z "$sys_search_path"; then
sys_search_path="$dir"
else
sys_search_path="$sys_search_path$pathsep$dir"
fi
done
AC_DEFINE_UNQUOTED(LTDL_SYSSEARCHPATH, "$sys_search_path",
[Define to the system default library search path. ])
fi
])# AC_LTDL_SYSSEARCHPATH
# AC_LTDL_OBJDIR
# --------------
AC_DEFUN(AC_LTDL_OBJDIR,
[AC_CACHE_CHECK([for objdir],
libltdl_cv_objdir, [libltdl_cv_objdir="$objdir"
if test -n "$objdir"; then
:
else
rm -f .libs 2>/dev/null
mkdir .libs 2>/dev/null
if test -d .libs; then
libltdl_cv_objdir=.libs
else
# MS-DOS does not allow filenames that begin with a dot.
libltdl_cv_objdir=_libs
fi
rmdir .libs 2>/dev/null
fi])
AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir/",
[Define to the sub-directory in which libtool stores uninstalled libraries. ])
])# AC_LTDL_OBJDIR
# AC_LTDL_DLPREOPEN
# -----------------
AC_DEFUN(AC_LTDL_DLPREOPEN,
[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl
AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
libltdl_cv_preloaded_symbols, [dnl
if test -n "$global_symbol_pipe"; then
libltdl_cv_preloaded_symbols=yes
else
libltdl_cv_preloaded_symbols=no
fi
])
if test x"$libltdl_cv_preloaded_symbols" = x"yes"; then
AC_DEFINE(HAVE_PRELOADED_SYMBOLS, 1,
[Define if libtool can extract symbol lists from object files. ])
fi
])# AC_LTDL_DLPREOPEN
# AC_LTDL_DLLIB
# -------------
AC_DEFUN(AC_LTDL_DLLIB,
[LIBADD_DL=
AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
[Define if you have the libdl library or equivalent. ]) LIBADD_DL="-ldl"],
[AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
[Define if you have the libdl library or equivalent.])],
[AC_CHECK_LIB(svld, dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
[Define if you have the libdl library or equivalent.]) LIBADD_DL="-lsvld"]
)])])
AC_CHECK_FUNC(shl_load, [AC_DEFINE(HAVE_SHL_LOAD, 1,
[Define if you have the shl_load function.])],
[AC_CHECK_LIB(dld, shl_load,
[AC_DEFINE(HAVE_SHL_LOAD, 1,
[Define if you have the shl_load function.])
LIBADD_DL="$LIBADD_DL -ldld"])
])
AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD, 1,
[Define if you have the GNU dld library.])dnl
test "x$ac_cv_lib_dld_shl_load" = yes || LIBADD_DL="$LIBADD_DL -ldld"])
AC_SUBST(LIBADD_DL)
if test "x$ac_cv_func_dlopen" = xyes || test "x$ac_cv_lib_dl_dlopen" = xyes; then
LIBS_SAVE="$LIBS"
LIBS="$LIBS $LIBADD_DL"
AC_CHECK_FUNCS(dlerror)
LIBS="$LIBS_SAVE"
fi
])# AC_LTDL_DLLIB
# AC_LTDL_SYMBOL_USCORE
# ---------------------
AC_DEFUN(AC_LTDL_SYMBOL_USCORE,
[dnl does the compiler prefix global symbols with an underscore?
AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl
AC_MSG_CHECKING([for _ prefix in compiled symbols])
AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
[ac_cv_sys_symbol_underscore=no
cat > conftest.$ac_ext <<EOF
void nm_test_func(){}
int main(){nm_test_func;return 0;}
EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
ac_nlist=conftest.nm
if AC_TRY_EVAL(NM conftest.$ac_objext \| $global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
# See whether the symbols have a leading underscore.
if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
ac_cv_sys_symbol_underscore=yes
else
if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
:
else
echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
fi
fi
else
echo "configure: cannot run $global_symbol_pipe" >&AC_FD_CC
fi
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.c >&AC_FD_CC
fi
rm -rf conftest*
])
AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
])# AC_LTDL_SYMBOL_USCORE
# AC_LTDL_DLSYM_USCORE
# --------------------
AC_DEFUN(AC_LTDL_DLSYM_USCORE,
[AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])dnl
if test x"$ac_cv_sys_symbol_underscore" = xyes; then
if test x"$ac_cv_func_dlopen" = xyes ||
test x"$ac_cv_lib_dl_dlopen" = xyes ; then
AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
libltdl_cv_need_uscore, [dnl
libltdl_cv_need_uscore=unknown
save_LIBS="$LIBS"
LIBS="$LIBS $LIBADD_DL"
_LT_AC_TRY_DLOPEN_SELF(
libltdl_cv_need_uscore=no, libltdl_cv_need_uscore=yes,
[], libltdl_cv_need_uscore=cross)
LIBS="$save_LIBS"
])
fi
fi
if test x"$libltdl_cv_need_uscore" = xyes; then
AC_DEFINE(NEED_USCORE, 1,
[Define if dlsym() requires a leading underscode in symbol names. ])
fi
])# AC_LTDL_DLSYM_USCORE
# AC_CHECK_TYPES(TYPES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
# [INCLUDES])
# ---------------------------------------------------------------
# This macro did not exist in Autoconf 2.13, which we do still support
ifdef([AC_CHECK_TYPES], [],
[define([AC_CHECK_TYPES],
[AC_CACHE_CHECK([for $1], ac_Type,
[AC_TRY_LINK([$4],
[if (($1 *) 0)
return 0;
if (sizeof ($1))
return 0;],
[ac_Type=yes],
[ac_Type=no])])
if test "x$ac_Type" = xyes; then
ifelse([$2], [], [:], [$2])
else
ifelse([$3], [], [:], [$3])
fi])
])# AC_CHECK_TYPES
# AC_LTDL_FUNC_ARGZ
# -----------------
AC_DEFUN([AC_LTDL_FUNC_ARGZ],
[AC_CHECK_HEADERS([argz.h])
AC_CHECK_TYPES([error_t],
[],
[AC_DEFINE([error_t], [int],
[Define to a type to use for \`error_t' if it is not otherwise available.])],
[#if HAVE_ARGZ_H
# include <argz.h>
#endif])
AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next argz_stringify])
])# AC_LTDL_FUNC_ARGZ
## ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*-
## Copyright (C) 1999-2000 Free Software Foundation, Inc.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
## As a special exception to the GNU General Public License, if you
## distribute this file as part of a program that contains a
## configuration script generated by Autoconf, you may include it under
## the same distribution terms that you use for the rest of that program.
# serial 6 AC_LIB_LTDL
# AC_WITH_LTDL
# ------------
# Clients of libltdl can use this macro to allow the installer to
# choose between a shipped copy of the ltdl sources or a preinstalled
# version of the library.
AC_DEFUN([AC_WITH_LTDL],
[AC_REQUIRE([AC_LIB_LTDL])
AC_SUBST([LIBLTDL])
AC_SUBST([INCLTDL])
# Unless the user asks us to check, assume no installed ltdl exists.
use_installed_libltdl=no
AC_ARG_WITH([included_ltdl],
[ --with-included-ltdl use the GNU ltdl sources included here])
if test "x$with_included_ltdl" != xyes; then
# We are not being forced to use the included libltdl sources, so
# decide whether there is a useful installed version we can use.
AC_CHECK_HEADER([ltdl.h],
[AC_CHECK_LIB([ltdl], [lt_dlcaller_register],
[with_included_ltdl=no],
[with_included_ltdl=yes])
])
fi
if test "x$enable_ltdl_install" != xyes; then
# If the user did not specify an installable libltdl, then default
# to a convenience lib.
AC_LIBLTDL_CONVENIENCE
fi
if test "x$with_included_ltdl" = xno; then
# If the included ltdl is not to be used. then Use the
# preinstalled libltdl we found.
AC_DEFINE([HAVE_LTDL], 1,
[Define this if a modern libltdl is already installed])
LIBLTDL=-lltdl
fi
# Report our decision...
AC_MSG_CHECKING([whether to use included libltdl])
AC_MSG_RESULT([$with_included_ltdl])
AC_CONFIG_SUBDIRS([libltdl])
])# AC_WITH_LTDL
# AC_LIB_LTDL
# -----------
# Perform all the checks necessary for compilation of the ltdl objects
# -- including compiler checks and header checks.
AC_DEFUN([AC_LIB_LTDL],
[AC_PREREQ(2.50)
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_C_CONST])
AC_REQUIRE([AC_HEADER_STDC])
AC_REQUIRE([AC_HEADER_DIRENT])
AC_REQUIRE([_LT_AC_CHECK_DLFCN])
AC_REQUIRE([AC_LTDL_ENABLE_INSTALL])
AC_REQUIRE([AC_LTDL_SHLIBEXT])
AC_REQUIRE([AC_LTDL_SHLIBPATH])
AC_REQUIRE([AC_LTDL_SYSSEARCHPATH])
AC_REQUIRE([AC_LTDL_OBJDIR])
AC_REQUIRE([AC_LTDL_DLPREOPEN])
AC_REQUIRE([AC_LTDL_DLLIB])
AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])
AC_REQUIRE([AC_LTDL_DLSYM_USCORE])
AC_REQUIRE([AC_LTDL_SYS_DLOPEN_DEPLIBS])
AC_REQUIRE([AC_LTDL_FUNC_ARGZ])
AC_CHECK_HEADERS([assert.h ctype.h errno.h malloc.h memory.h stdlib.h \
stdio.h unistd.h])
AC_CHECK_HEADERS([dl.h sys/dl.h dld.h])
AC_CHECK_HEADERS([string.h strings.h], [break])
AC_CHECK_FUNCS([strchr index], [break])
AC_CHECK_FUNCS([strrchr rindex], [break])
AC_CHECK_FUNCS([memcpy bcopy], [break])
AC_CHECK_FUNCS([memmove strcmp])
AC_CHECK_FUNCS([closedir opendir readdir])
])# AC_LIB_LTDL
# AC_LTDL_ENABLE_INSTALL
# ----------------------
AC_DEFUN([AC_LTDL_ENABLE_INSTALL],
[AC_ARG_ENABLE([ltdl-install],
[AC_HELP_STRING([--enable-ltdl-install], [install libltdl])])
AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno)
AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)
])])# AC_LTDL_ENABLE_INSTALL
# AC_LTDL_SYS_DLOPEN_DEPLIBS
# --------------------------
AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS],
[AC_REQUIRE([AC_CANONICAL_HOST])
AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
[libltdl_cv_sys_dlopen_deplibs],
[# PORTME does your system automatically load deplibs for dlopen?
# or its logical equivalent (e.g. shl_load for HP-UX < 11)
# For now, we just catch OSes we know something about -- in the
# future, we'll try test this programmatically.
libltdl_cv_sys_dlopen_deplibs=unknown
case "$host_os" in
aix3*|aix4.1.*|aix4.2.*)
# Unknown whether this is true for these versions of AIX, but
# we want this `case' here to explicitly catch those versions.
libltdl_cv_sys_dlopen_deplibs=unknown
;;
aix[[45]]*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
gnu*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
hpux10*|hpux11*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
irix[[12345]]*|irix6.[[01]]*)
# Catch all versions of IRIX before 6.2, and indicate that we don't
# know how it worked for any of those versions.
libltdl_cv_sys_dlopen_deplibs=unknown
;;
irix*)
# The case above catches anything before 6.2, and it's known that
# at 6.2 and later dlopen does load deplibs.
libltdl_cv_sys_dlopen_deplibs=yes
;;
linux*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
netbsd*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
openbsd*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
osf[[1234]]*)
# dlopen did load deplibs (at least at 4.x), but until the 5.x series,
# it did *not* use an RPATH in a shared library to find objects the
# library depends on, so we explictly say `no'.
libltdl_cv_sys_dlopen_deplibs=no
;;
osf5.0|osf5.0a|osf5.1)
# dlopen *does* load deplibs and with the right loader patch applied
# it even uses RPATH in a shared library to search for shared objects
# that the library depends on, but there's no easy way to know if that
# patch is installed. Since this is the case, all we can really
# say is unknown -- it depends on the patch being installed. If
# it is, this changes to `yes'. Without it, it would be `no'.
libltdl_cv_sys_dlopen_deplibs=unknown
;;
osf*)
# the two cases above should catch all versions of osf <= 5.1. Read
# the comments above for what we know about them.
# At > 5.1, deplibs are loaded *and* any RPATH in a shared library
# is used to find them so we can finally say `yes'.
libltdl_cv_sys_dlopen_deplibs=yes
;;
solaris*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
esac
])
if test "$libltdl_cv_sys_dlopen_deplibs" != yes; then
AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1],
[Define if the OS needs help to load dependent libraries for dlopen().])
fi
])# AC_LTDL_SYS_DLOPEN_DEPLIBS
# AC_LTDL_SHLIBEXT
# ----------------
AC_DEFUN([AC_LTDL_SHLIBEXT],
[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
AC_CACHE_CHECK([which extension is used for shared libraries],
[libltdl_cv_shlibext],
[ac_last=
for ac_spec in $library_names_spec; do
ac_last="$ac_spec"
done
echo "$ac_last" | [sed 's/\[.*\]//;s/^[^.]*//;s/\$.*$//;s/\.$//'] > conftest
libltdl_cv_shlibext=`cat conftest`
rm -f conftest
])
if test -n "$libltdl_cv_shlibext"; then
AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext",
[Define to the extension used for shared libraries, say, ".so".])
fi
])# AC_LTDL_SHLIBEXT
# AC_LTDL_SHLIBPATH
# -----------------
AC_DEFUN([AC_LTDL_SHLIBPATH],
[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
AC_CACHE_CHECK([which variable specifies run-time library path],
[libltdl_cv_shlibpath_var], [libltdl_cv_shlibpath_var="$shlibpath_var"])
if test -n "$libltdl_cv_shlibpath_var"; then
AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var",
[Define to the name of the environment variable that determines the dynamic library search path.])
fi
])# AC_LTDL_SHLIBPATH
# AC_LTDL_SYSSEARCHPATH
# ---------------------
AC_DEFUN([AC_LTDL_SYSSEARCHPATH],
[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
AC_CACHE_CHECK([for the default library search path],
[libltdl_cv_sys_search_path],
[libltdl_cv_sys_search_path="$sys_lib_dlsearch_path_spec"])
if test -n "$libltdl_cv_sys_search_path"; then
sys_search_path=
for dir in $libltdl_cv_sys_search_path; do
if test -z "$sys_search_path"; then
sys_search_path="$dir"
else
sys_search_path="$sys_search_path$PATH_SEPARATOR$dir"
fi
done
AC_DEFINE_UNQUOTED(LTDL_SYSSEARCHPATH, "$sys_search_path",
[Define to the system default library search path.])
fi
])# AC_LTDL_SYSSEARCHPATH
# AC_LTDL_OBJDIR
# --------------
AC_DEFUN([AC_LTDL_OBJDIR],
[AC_CACHE_CHECK([for objdir],
[libltdl_cv_objdir],
[libltdl_cv_objdir="$objdir"
if test -n "$objdir"; then
:
else
rm -f .libs 2>/dev/null
mkdir .libs 2>/dev/null
if test -d .libs; then
libltdl_cv_objdir=.libs
else
# MS-DOS does not allow filenames that begin with a dot.
libltdl_cv_objdir=_libs
fi
rmdir .libs 2>/dev/null
fi
])
AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir/",
[Define to the sub-directory in which libtool stores uninstalled libraries.])
])# AC_LTDL_OBJDIR
# AC_LTDL_DLPREOPEN
# -----------------
AC_DEFUN([AC_LTDL_DLPREOPEN],
[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])
AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
[libltdl_cv_preloaded_symbols],
[if test -n "$lt_cv_sys_global_symbol_pipe"; then
libltdl_cv_preloaded_symbols=yes
else
libltdl_cv_preloaded_symbols=no
fi
])
if test x"$libltdl_cv_preloaded_symbols" = xyes; then
AC_DEFINE(HAVE_PRELOADED_SYMBOLS, 1,
[Define if libtool can extract symbol lists from object files.])
fi
])# AC_LTDL_DLPREOPEN
# AC_LTDL_DLLIB
# -------------
AC_DEFUN([AC_LTDL_DLLIB],
[LIBADD_DL=
AC_SUBST(LIBADD_DL)
AC_LANG_PUSH([C])
AC_CHECK_FUNC([shl_load],
[AC_DEFINE([HAVE_SHL_LOAD], [1],
[Define if you have the shl_load function.])],
[AC_CHECK_LIB([dld], [shl_load],
[AC_DEFINE([HAVE_SHL_LOAD], [1],
[Define if you have the shl_load function.])
LIBADD_DL="$LIBADD_DL -ldld"],
[AC_CHECK_LIB([dl], [dlopen],
[AC_DEFINE([HAVE_LIBDL], [1],
[Define if you have the libdl library or equivalent.])
LIBADD_DL="-ldl" libltdl_cv_lib_dl_dlopen="yes"],
[AC_TRY_LINK([#if HAVE_DLFCN_H
# include <dlfcn.h>
#endif
],
[dlopen(0, 0);],
[AC_DEFINE([HAVE_LIBDL], [1],
[Define if you have the libdl library or equivalent.]) libltdl_cv_func_dlopen="yes"],
[AC_CHECK_LIB([svld], [dlopen],
[AC_DEFINE([HAVE_LIBDL], [1],
[Define if you have the libdl library or equivalent.])
LIBADD_DL="-lsvld" libltdl_cv_func_dlopen="yes"],
[AC_CHECK_LIB([dld], [dld_link],
[AC_DEFINE([HAVE_DLD], [1],
[Define if you have the GNU dld library.])
LIBADD_DL="$LIBADD_DL -ldld"
])
])
])
])
])
])
if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes
then
lt_save_LIBS="$LIBS"
LIBS="$LIBS $LIBADD_DL"
AC_CHECK_FUNCS([dlerror])
LIBS="$lt_save_LIBS"
fi
AC_LANG_POP
])# AC_LTDL_DLLIB
# AC_LTDL_SYMBOL_USCORE
# ---------------------
# does the compiler prefix global symbols with an underscore?
AC_DEFUN([AC_LTDL_SYMBOL_USCORE],
[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])
AC_CACHE_CHECK([for _ prefix in compiled symbols],
[ac_cv_sys_symbol_underscore],
[ac_cv_sys_symbol_underscore=no
cat > conftest.$ac_ext <<EOF
void nm_test_func(){}
int main(){nm_test_func;return 0;}
EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
ac_nlist=conftest.nm
if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
# See whether the symbols have a leading underscore.
if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
ac_cv_sys_symbol_underscore=yes
else
if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
:
else
echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
fi
fi
else
echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC
fi
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.c >&AC_FD_CC
fi
rm -rf conftest*
])
])# AC_LTDL_SYMBOL_USCORE
# AC_LTDL_DLSYM_USCORE
# --------------------
AC_DEFUN([AC_LTDL_DLSYM_USCORE],
[AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])
if test x"$ac_cv_sys_symbol_underscore" = xyes; then
if test x"$libltdl_cv_func_dlopen" = xyes ||
test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then
AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
[libltdl_cv_need_uscore],
[libltdl_cv_need_uscore=unknown
save_LIBS="$LIBS"
LIBS="$LIBS $LIBADD_DL"
_LT_AC_TRY_DLOPEN_SELF(
[libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes],
[], [libltdl_cv_need_uscore=cross])
LIBS="$save_LIBS"
])
fi
fi
if test x"$libltdl_cv_need_uscore" = xyes; then
AC_DEFINE(NEED_USCORE, 1,
[Define if dlsym() requires a leading underscore in symbol names.])
fi
])# AC_LTDL_DLSYM_USCORE
# AC_LTDL_FUNC_ARGZ
# -----------------
AC_DEFUN([AC_LTDL_FUNC_ARGZ],
[AC_CHECK_HEADERS([argz.h])
AC_CHECK_TYPES([error_t],
[],
[AC_DEFINE([error_t], [int],
[Define to a type to use for `error_t' if it is not otherwise available.])],
[#if HAVE_ARGZ_H
# include <argz.h>
#endif])
AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next argz_stringify])
])# AC_LTDL_FUNC_ARGZ