mirror of
git://git.savannah.gnu.org/libtool.git
synced 2025-01-18 14:16:00 +08:00
misc win32 cleanups
This commit is contained in:
parent
45279c6d70
commit
7fe8f5c785
36
ChangeLog
36
ChangeLog
@ -1,3 +1,39 @@
|
||||
1998-12-21 Gary V. Vaughan <gvaughan@oranda.demon.co.uk>
|
||||
|
||||
* libtool.m4 (AM_SYS_NM_PARSE): apparently __ptr_t is predefined
|
||||
on some systems - use lt_ptr_t instead.
|
||||
* ltconfig.in: ditto.
|
||||
* ltmain.in: ditto.
|
||||
|
||||
* libtool.m4 (AM_SYS_SYMBOL_UNDERSCORE): use an AC_SUBST to pass
|
||||
the result of this into the compile rather than AC_DEFINE which
|
||||
breaks when building with older versions of autoconf.
|
||||
* ltconfig.in (symxfrm): Don't put the leading underscore back
|
||||
with the global_symbol_pipe.
|
||||
* demo/dlmain.c (main): No need to specialcase underscores in
|
||||
dld_preloaded_symbols - it is fixed by symxfrm above!
|
||||
* libltdl/configure.in: use AM_SYS_SYMBOL_UNDERSCORE from
|
||||
libtool.m4 rather than reincent the wheel here =)O|
|
||||
|
||||
* ltmain.in: Fix deplibs methods to not rely on a.out (cygwin
|
||||
uses a.exe!).
|
||||
|
||||
* libltdl/configure.in: Cleanups - fix header comment and emacs
|
||||
local-vars.
|
||||
|
||||
* demo/dlmain.c (win32_force_data_import_address): a nasty hack
|
||||
to force the address of imported data symbols into
|
||||
dld_preloaded_symbols on win32, which does data imports
|
||||
differently to function imports (sheesh!). This functionality
|
||||
needs to be moved into the dld_preloaded_symbols generation code.
|
||||
demo/helldl with static linking is broken on win32 by this change,
|
||||
probably until after libtool-1.3 =(O|
|
||||
* demo/foo.h: make sure __CYGWIN32__ is always defined on cygwin32
|
||||
systems. Use the correct __declspec macro for lib exports/imports
|
||||
on cygwin32.
|
||||
* demo/foo.c, demo/hello.c: Make sure we tell foo.h that these
|
||||
sources are inside libfoo, and want to export symbols.
|
||||
|
||||
1998-12-20 Thomas Tanner <tanner@gmx.de>
|
||||
|
||||
* autogen: configure demo, depdemo, libltdl and mdemo
|
||||
|
@ -29,6 +29,25 @@ struct dld_symlist
|
||||
|
||||
extern struct dld_symlist dld_preloaded_symbols[];
|
||||
|
||||
#ifdef __CYGWIN32__
|
||||
int
|
||||
win32_force_data_import_address __P((void))
|
||||
{
|
||||
struct dld_symlist *s;
|
||||
|
||||
s = dld_preloaded_symbols;
|
||||
while (s->name)
|
||||
{
|
||||
if (!strcmp ("nothing", s->name))
|
||||
s->address = ¬hing;
|
||||
s++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
@ -41,20 +60,17 @@ main (argc, argv)
|
||||
|
||||
printf ("Welcome to *modular* GNU Hell!\n");
|
||||
|
||||
#ifdef __CYGWIN32__
|
||||
/* runtime table initialisation */
|
||||
(void) win32_force_data_import_address();
|
||||
#endif
|
||||
|
||||
/* Look up the symbols we require for this demonstration. */
|
||||
s = dld_preloaded_symbols;
|
||||
while (s->name)
|
||||
{
|
||||
if (s->address) {
|
||||
char *name = s->name;
|
||||
#ifdef WITH_SYMBOL_UNDERSCORE
|
||||
if (*name != '_')
|
||||
{
|
||||
fprintf(stderr, "ERROR: configure detected leading underscores incorrectly.\n");
|
||||
exit(1);
|
||||
}
|
||||
name++;
|
||||
#endif
|
||||
printf ("found symbol: %s\n", name);
|
||||
if (!strcmp ("hello", name))
|
||||
phello = s->address;
|
||||
|
@ -18,12 +18,15 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA. */
|
||||
|
||||
#define _LIBFOO_COMPILATION_
|
||||
#include "foo.h"
|
||||
#undef _LIBFOO_COMPILATION
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
/* Give a global variable definition. */
|
||||
int nothing;
|
||||
int nothing = FOO_RET;
|
||||
|
||||
int
|
||||
foo ()
|
||||
|
25
demo/foo.h
25
demo/foo.h
@ -22,6 +22,16 @@ USA. */
|
||||
#ifndef _FOO_H_
|
||||
#define _FOO_H_ 1
|
||||
|
||||
/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
|
||||
* earlier do not define __CYGWIN__. This snippit allows us to check
|
||||
* for __CYGWIN32__ reliably for both old and (probable) future releases.
|
||||
*/
|
||||
#ifdef __CYGWIN__
|
||||
# ifndef __CYGWIN32__
|
||||
# define __CYGWIN32__
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* __BEGIN_DECLS should be used at the beginning of your declarations,
|
||||
so that C++ compilers don't mangle their names. Use __END_DECLS at
|
||||
the end of C declarations. */
|
||||
@ -39,21 +49,32 @@ USA. */
|
||||
that don't understand ANSI C prototypes still work, and ANSI C
|
||||
compilers can issue warnings about type mismatches. */
|
||||
#undef __P
|
||||
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus)
|
||||
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(__CYGWIN32__) || defined(__cplusplus)
|
||||
# define __P(protos) protos
|
||||
#else
|
||||
# define __P(protos) ()
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN32__
|
||||
# ifdef _LIBFOO_COMPILATION_
|
||||
# define EXTERN __declspec(dllexport)
|
||||
# else
|
||||
# define EXTERN extern __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# define EXTERN extern
|
||||
#endif
|
||||
|
||||
/* Silly constants that the functions return. */
|
||||
#define HELLO_RET 0xe110
|
||||
#define FOO_RET 0xf00
|
||||
|
||||
|
||||
/* Declarations. Note the wonderful use of the above macros. */
|
||||
__BEGIN_DECLS
|
||||
int foo __P((void));
|
||||
int hello __P((void));
|
||||
extern int nothing;
|
||||
EXTERN int nothing;
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_FOO_H_ */
|
||||
|
@ -18,7 +18,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA. */
|
||||
|
||||
/* Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu> */
|
||||
#define _LIBFOO_COMPILATION
|
||||
#include "foo.h"
|
||||
#undef _LIBFOO_COMPILATION
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
|
@ -1,4 +1,5 @@
|
||||
dnl Initialize the hell package.
|
||||
dnl Process this file with autoconf to create configure.
|
||||
dnl Initialize the ltdl package.
|
||||
AC_INIT(ltdl.c)
|
||||
AM_INIT_AUTOMAKE(libltdl,1.0)
|
||||
|
||||
@ -32,18 +33,8 @@ AC_CHECK_FUNCS(dlopen, AC_DEFINE(HAVE_LIBDL),
|
||||
)
|
||||
AC_SUBST(LIBADD_DL)
|
||||
|
||||
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
|
||||
rm -f conftest*
|
||||
])
|
||||
|
||||
if test x"$libltdl_cv_uscore" = xyes; then
|
||||
AM_SYS_SYMBOL_UNDERSCORE
|
||||
if test x"$USE_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],
|
||||
@ -67,3 +58,8 @@ fi
|
||||
|
||||
dnl Output the makefile
|
||||
AC_OUTPUT(Makefile)
|
||||
|
||||
# Local Variables:
|
||||
# mode:shell-script
|
||||
# sh-indentation:2
|
||||
# End:
|
||||
|
16
libtool.m4
vendored
16
libtool.m4
vendored
@ -428,9 +428,9 @@ EOF
|
||||
|
||||
cat <<EOF >> conftest.c
|
||||
#if defined (__STDC__) && __STDC__
|
||||
# define __ptr_t void *
|
||||
# define lt_ptr_t void *
|
||||
#else
|
||||
# define __ptr_t char *
|
||||
# define lt_ptr_t char *
|
||||
#endif
|
||||
|
||||
/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
|
||||
@ -439,16 +439,16 @@ int dld_preloaded_symbol_count = $ac_count;
|
||||
/* The mapping between symbol names and symbols. */
|
||||
struct {
|
||||
char *name;
|
||||
__ptr_t address;
|
||||
lt_ptr_t address;
|
||||
}
|
||||
changequote(,)dnl
|
||||
dld_preloaded_symbols[] =
|
||||
changequote([,])dnl
|
||||
{
|
||||
EOF
|
||||
sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
|
||||
sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
|
||||
cat <<\EOF >> conftest.c
|
||||
{0, (__ptr_t) 0}
|
||||
{0, (lt_ptr_t) 0}
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -537,8 +537,6 @@ fi
|
||||
rm -rf conftest*
|
||||
])
|
||||
AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
|
||||
if test x$ac_cv_sys_symbol_underscore = xyes; then
|
||||
AC_DEFINE(WITH_SYMBOL_UNDERSCORE,1,
|
||||
[define if compiled symbols have a leading underscore])
|
||||
fi
|
||||
USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
|
||||
AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl
|
||||
])
|
||||
|
12
ltconfig.in
12
ltconfig.in
@ -1382,7 +1382,6 @@ aix*)
|
||||
;;
|
||||
sunos* | cygwin32* | mingw32*)
|
||||
sympat='_\([_A-Za-z][_A-Za-z0-9]*\)'
|
||||
symxfrm='_\1 \1'
|
||||
;;
|
||||
irix*)
|
||||
# Cannot use undefined symbols on IRIX because inlined functions mess us up.
|
||||
@ -1455,9 +1454,9 @@ EOF
|
||||
|
||||
cat <<EOF >> conftest.c
|
||||
#if defined (__STDC__) && __STDC__
|
||||
# define __ptr_t void *
|
||||
# define lt_ptr_t void *
|
||||
#else
|
||||
# define __ptr_t char *
|
||||
# define lt_ptr_t char *
|
||||
#endif
|
||||
|
||||
/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
|
||||
@ -1466,14 +1465,14 @@ int dld_preloaded_symbol_count = $count;
|
||||
/* The mapping between symbol names and symbols. */
|
||||
struct {
|
||||
char *name;
|
||||
__ptr_t address;
|
||||
lt_ptr_t address;
|
||||
}
|
||||
dld_preloaded_symbols[] =
|
||||
{
|
||||
EOF
|
||||
sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> conftest.c
|
||||
sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c
|
||||
cat <<\EOF >> conftest.c
|
||||
{0, (__ptr_t) 0}
|
||||
{0, (lt_ptr_t) 0}
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -1606,6 +1605,7 @@ cygwin32* | mingw32*)
|
||||
dynamic_linker='Win32 ld.exe'
|
||||
libname_spec='$name'
|
||||
need_lib_prefix=no
|
||||
# FIXME: first we should search . and the directory the executable is in
|
||||
shlibpath_var=PATH
|
||||
;;
|
||||
|
||||
|
28
ltmain.in
28
ltmain.in
@ -1399,10 +1399,10 @@ compiler."
|
||||
cat > conftest.c <<EOF
|
||||
int main() { return 0; }
|
||||
EOF
|
||||
$rm a.out
|
||||
$C_compiler conftest.c $deplibs
|
||||
$rm conftest
|
||||
$C_compiler -o conftest conftest.c $deplibs
|
||||
if test $? -eq 0 ; then
|
||||
ldd_output=`ldd a.out`
|
||||
ldd_output=`ldd conftest`
|
||||
for i in $deplibs; do
|
||||
name="`expr $i : '-l\(.*\)'`"
|
||||
# If $name is empty we are operating on a -L argument.
|
||||
@ -1431,11 +1431,11 @@ EOF
|
||||
name="`expr $i : '-l\(.*\)'`"
|
||||
# If $name is empty we are operating on a -L argument.
|
||||
if test "$name" != "" ; then
|
||||
$rm a.out
|
||||
$C_compiler conftest.c $i
|
||||
$rm conftest
|
||||
$C_compiler -o conftest conftest.c $i
|
||||
# Did it work?
|
||||
if test $? -eq 0 ; then
|
||||
ldd_output=`ldd a.out`
|
||||
ldd_output=`ldd conftest`
|
||||
libname=`eval \\$echo \"$libname_spec\"`
|
||||
deplib_matches=`eval \\$echo \"$library_names_spec\"`
|
||||
set dummy $deplib_matches
|
||||
@ -1838,15 +1838,15 @@ extern \"C\" {
|
||||
#undef dld_preloaded_symbols
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
# define __ptr_t void *
|
||||
# define lt_ptr_t void *
|
||||
#else
|
||||
# define __ptr_t char *
|
||||
# define lt_ptr_t char *
|
||||
#endif
|
||||
|
||||
/* The mapping between symbol names and symbols. */
|
||||
struct {
|
||||
char *name;
|
||||
__ptr_t address;
|
||||
lt_ptr_t address;
|
||||
}
|
||||
dld_preloaded_symbols[] =
|
||||
{\
|
||||
@ -1854,25 +1854,25 @@ dld_preloaded_symbols[] =
|
||||
|
||||
if test -n "$export_symbols"; then
|
||||
echo >> "$output_objdir/$dlsyms" "\
|
||||
{\"${output}\", (__ptr_t) 0},"
|
||||
sed 's/^\(.*\)/ {"\1", (__ptr_t) \&\1},/' < "$export_symbols" >> "$output_objdir/$dlsyms"
|
||||
{\"${output}\", (lt_ptr_t) 0},"
|
||||
sed 's/^\(.*\)/ {"\1", (lt_ptr_t) \&\1},/' < "$export_symbols" >> "$output_objdir/$dlsyms"
|
||||
fi
|
||||
|
||||
for arg in $dlprefiles; do
|
||||
name=`echo "$arg" | sed -e 's%^.*/%%'`
|
||||
echo >> "$output_objdir/$dlsyms" "\
|
||||
{\"$name\", (__ptr_t) 0},"
|
||||
{\"$name\", (lt_ptr_t) 0},"
|
||||
eval "$NM $arg | $global_symbol_pipe > '$nlist'"
|
||||
|
||||
if test -f "$nlist"; then
|
||||
sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$output_objdir/$dlsyms"
|
||||
sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$nlist" >> "$output_objdir/$dlsyms"
|
||||
else
|
||||
echo '/* NONE */' >> "$output_objdir/$dlsyms"
|
||||
fi
|
||||
done
|
||||
|
||||
$echo >> "$output_objdir/$dlsyms" "\
|
||||
{0, (__ptr_t) 0}
|
||||
{0, (lt_ptr_t) 0}
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
Reference in New Issue
Block a user