* libltdl/configure.in (stdlib.h, unistd.h, stdio.h): check

* libltdl/ltdl.c: include them
This commit is contained in:
Alexandre Oliva 1998-12-16 02:39:15 +00:00 committed by Alexandre Oliva
parent 508ebd073c
commit e392b24787
3 changed files with 29 additions and 15 deletions

View File

@ -1,5 +1,8 @@
1998-12-16 Alexandre Oliva <oliva@dcc.unicamp.br>
* libltdl/configure.in (stdlib.h, unistd.h, stdio.h): check
* libltdl/ltdl.c: include them
* demo/configure.in (BINARY_HELLDL): test whether dlopen is
supported at configure time
* demo/Makefile.am (helldl): use automake conditionals to build

View File

@ -6,7 +6,7 @@ AC_PROG_CC
AM_PROG_LIBTOOL
AC_HEADER_STDC
AC_CHECK_HEADERS(malloc.h dlfcn.h dl.h)
AC_CHECK_HEADERS(malloc.h stdlib.h unistd.h stdio.h dlfcn.h dl.h)
AC_CHECK_HEADERS(string.h strings.h, break)
AC_CHECK_FUNCS(strdup strrchr)
@ -20,22 +20,21 @@ AC_CHECK_FUNCS(dlopen, AC_DEFINE(HAVE_LIBDL),
)
AC_SUBST(LIBADD_DL)
AC_MSG_CHECKING(for underscore before symbols)
AC_CACHE_VAL(libltdl_cv_uscore,[
AC_CACHE_CHECK([for underscore before symbols], libltdl_cv_uscore, [
echo "main(){int i=1;} fnord(){int i=23; int ltuae=42;}" > conftest.c
${CC} -c conftest.c > /dev/null
if (nm conftest.$ac_objext | grep _fnord) > /dev/null; then
libltdl_cv_uscore=yes
else
libltdl_cv_uscore=no
fi])
AC_MSG_RESULT($libltdl_cv_uscore)
rm -f conftest*
fi
rm -f conftest*
])
if test $libltdl_cv_uscore = yes; then
if test $ac_cv_func_dlopen = yes || test $ac_cv_lib_dl_dlopen = yes ; then
AC_MSG_CHECKING(whether we have to add an underscore for dlsym)
AC_CACHE_VAL(libltdl_cv_need_uscore,AC_TRY_RUN([
AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
libltdl_cv_need_uscore,AC_TRY_RUN([
#include <dlfcn.h>
#include <stdio.h>
fnord() { int i=42;}
@ -46,8 +45,6 @@ main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
[libltdl_cv_need_uscore=yes
AC_DEFINE(NEED_USCORE)],
libltdl_cv_need_uscore=no))
AC_MSG_RESULT($libltdl_cv_need_uscore)
fi
fi

View File

@ -19,17 +19,31 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define _LTDL_COMPILE_
#include "ltdl.h"
#ifdef HAVE_STRING_H
#if HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STRINGS_H
#if HAVE_STRINGS_H
#include <strings.h>
#endif
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#if HAVE_STDLIB_H
#include <stdlib.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_STDIO_H
#include <stdio.h>
#endif
#include "ltdl.h"
typedef struct lt_dlhandle_t {
struct lt_dlhandle_t *next;
@ -87,7 +101,7 @@ strrchr(str, ch)
#endif
#ifdef STATIC
#ifdef LIBTOOL_STATIC
/* emulate dynamic linking using dld_preloaded_symbols */