summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in80
-rw-r--r--gmp-h.in73
-rwxr-xr-xmacos/configure6
-rw-r--r--mp-h.in13
4 files changed, 77 insertions, 95 deletions
diff --git a/configure.in b/configure.in
index aa959b037..316781495 100644
--- a/configure.in
+++ b/configure.in
@@ -1421,23 +1421,6 @@ case $host in
[*-*-aix[34]*])
if test -z "$enable_shared"; then enable_shared=no; fi ;;
- # On Windows, build only static by default, and don't allow both static
- # and DLL. libtool -no-undefined is needed for a DLL, as per the
- # AC_LIBTOOL_WIN32_DLL doco.
- #
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- if test -z "$enable_shared"; then
- enable_shared=no
- fi
- if test "$enable_shared" != no && test "$enable_static" != no; then
- AC_MSG_ERROR([cannot build both static and DLL, since gmp.h is different for each.
-Use "--disable-static --enable-shared" to build just a DLL.])
- fi
- if test "$enable_shared" = yes; then
- GMP_LDFLAGS="$GMP_LDFLAGS -no-undefined"
- fi
- ;;
-
# FIXME: Libtool recognises djgpp can't build shared libraries, but still
# makes tests/.libs/libtests.al out of PIC objects, which then fail to
# link into the test programs. Forcibly disable shared stuff until
@@ -1467,18 +1450,45 @@ Use "--disable-static --enable-shared" to build just a DLL.])
enable_shared=no ;;
esac
-# Libtool runs an impgen.c program on the build system when making windows
-# DLLs. If we're cross compiling then look for a suitable build system
-# compiler, since $CC can't be expected to work.
-# FIXME: Libtool ought to do this itself.
+
+# Configs for Windows DLLs.
+
+AC_LIBTOOL_WIN32_DLL
+
+__GMP_LIBGMP_DLL=0
+case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ # By default, build only static.
+ if test -z "$enable_shared"; then
+ enable_shared=no
+ fi
+ # Don't allow both static and DLL.
+ if test "$enable_shared" != no && test "$enable_static" != no; then
+ AC_MSG_ERROR([cannot build both static and DLL, since gmp.h is different for each.
+Use "--disable-static --enable-shared" to build just a DLL.])
+ fi
+ if test "$enable_shared" = yes; then
+ # libtool requires "-no-undefined", see AC_LIBTOOL_WIN32_DLL doco.
+ GMP_LDFLAGS="$GMP_LDFLAGS -no-undefined"
+ AC_SUBST(__GMP_LIBGMP_DLL,1)
+ fi
+ ;;
+esac
+
+# When cross compiling a DLL, libtool requires $HOST_CC, to compile impgen.c
+# on the build system. It's a well-known misfeature that libtool doesn't
+# hunt around for a useful HOST_CC on its own.
+# FIXME: Newer libtool looks like it'll need this only for "*-*-mingw* |
+# *-*-pw32*", not *-*-cygwin*.
#
-if test "$cross_compiling" != no && test "$enable_shared" != no; then
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32*)
+case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32*)
+ if test "$cross_compiling" != no && test "$enable_shared" != no; then
GMP_PROG_HOST_CC
- ;;
- esac
-fi
+ fi
+ ;;
+esac
+
# Enable CXX in libtool only if we want it, and never enable GCJ, nor RC on
# mingw and cygwin. Under --disable-cxx this avoids some error messages
@@ -1496,7 +1506,6 @@ if test "${with_tags+set}" != set; then
fi
fi
-AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
# Generate an error here if attempting to build both shared and static when
@@ -1511,21 +1520,6 @@ if test "$enable_shared" = yes && test "$enable_static" = yes; then
esac
fi
-# Encode in gmp.h whether a shared or static library is available.
-# Currently only used for the windows DLL stuff.
-#
-case $enable_shared in
-yes) __GMP_LIBGMP_SHARED=1 ;;
-no) __GMP_LIBGMP_SHARED=0 ;;
-esac
-AC_SUBST(__GMP_LIBGMP_SHARED)
-
-case $enable_static in
-yes) __GMP_LIBGMP_STATIC=1 ;;
-no) __GMP_LIBGMP_STATIC=0 ;;
-esac
-AC_SUBST(__GMP_LIBGMP_STATIC)
-
# How to assemble, used with CFLAGS etc, see mpn/Makeasm.am.
# Using the compiler is a lot easier than figuring out how to invoke the
diff --git a/gmp-h.in b/gmp-h.in
index b0e371cf7..babf5c71f 100644
--- a/gmp-h.in
+++ b/gmp-h.in
@@ -52,13 +52,10 @@ MA 02111-1307, USA. */
#endif
#undef __need_size_t
-/* Instantiated by configure, for internal use only */
+/* Instantiated by configure. */
#if ! __GMP_WITHIN_CONFIGURE
@DEFN_LONG_LONG_LIMB@
-
-/* Whether static, shared or both has been built. */
-#define __GMP_LIBGMP_STATIC @__GMP_LIBGMP_STATIC@
-#define __GMP_LIBGMP_SHARED @__GMP_LIBGMP_SHARED@
+#define __GMP_LIBGMP_DLL @__GMP_LIBGMP_DLL@
#endif
@@ -104,32 +101,34 @@ MA 02111-1307, USA. */
#endif
-/* __GMP_DECLSPEC marks a function or variable for import or export for a
- windows DLL, or is empty on other systems.
+/* __GMP_DECLSPEC supports Windows DLL versions of libgmp, and is empty in
+ all other circumstances.
+
+ When compiling objects for libgmp, __GMP_DECLSPEC is an export directive,
+ or when compiling for an application it's an import directive. The two
+ cases are differentiated by __GMP_WITHIN_GMP defined by the GMP Makefiles
+ (and not defined from an application).
- When building GMP, libtool gives us DLL_EXPORT when making objects that
- will go into a DLL and hence should have export directives. Notice
- DLL_EXPORT is only tested under __GMP_WITHIN_GMP, since if some other
- libtool based package is using gmp.h then DLL_EXPORT will be telling it
- what to do, not us.
+ __GMP_DECLSPEC_XX is similarly used for libgmpxx. __GMP_WITHIN_GMPXX
+ indicates when building libgmpxx, and in that case libgmpxx functions are
+ exports, but libgmp functions which might get called are imports.
- When compiling an application, __GMP_LIBGMP_SHARED indicates whether the
- installed GMP is a DLL or not. For a DLL we use import directives.
+ libmp.la uses __GMP_DECLSPEC, just as if it were libgmp.la. libgmp and
+ libmp don't call each other, so there's no conflict or confusion.
- There's no attempt here to support GMP installed both static and DLL,
- doing so would mean applications would have to tell us which of the two
- is going to be used, and that seems very tedious and error prone when
+ Libtool DLL_EXPORT define is not used.
+
+ There's no attempt to support GMP built both static and DLL. Doing so
+ would mean applications would have to tell us which of the two is going
+ to be used when linking, and that seems very tedious and error prone if
using GMP by hand, and equally tedious from a package since autoconf and
automake don't give much help.
- Note that __GMP_DECLSPEC is only wanted on documented global functions
- and variables. Internals in gmp-impl.h etc should be left unadorned and
- won't be visible to applications using a DLL.
-
- For testing on a non-windows system, __GMP_DECLSPEC can be set to
- __attribute__ ((section ("foo"))) or similar, and the resulting objects
- checked with readelf or whatever to see if all the expected globals have
- ended up with that attribute. */
+ __GMP_DECLSPEC is required on all documented global functions and
+ variables, the various internals in gmp-impl.h etc can be left unadorned.
+ But internals used by the test programs or speed measuring programs
+ should have __GMP_DECLSPEC, and certainly constants or variables must
+ have it or the wrong address will be resolved. */
#if defined (__GNUC__) || defined (_MSC_VER) || defined (__BORLANDC__)
#define __GMP_DECLSPEC_EXPORT __declspec(dllexport)
@@ -144,18 +143,16 @@ MA 02111-1307, USA. */
#define __GMP_DECLSPEC_IMPORT _Import
#endif
+#if __GMP_LIBGMP_DLL
#if __GMP_WITHIN_GMP
-#ifdef DLL_EXPORT
+/* compiling to go into a DLL libgmp */
#define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT
-#endif
#else
-#if (defined (_WIN32) /* Microsoft C */ \
- || defined (__WIN32__)) /* Borland C */ \
- && __GMP_LIBGMP_SHARED
+/* compiling to go into an application which will link to a DLL libgmp */
#define __GMP_DECLSPEC __GMP_DECLSPEC_IMPORT
#endif
-#endif
-#ifndef __GMP_DECLSPEC
+#else
+/* all other cases */
#define __GMP_DECLSPEC
#endif
@@ -263,18 +260,16 @@ typedef __mpq_struct *mpq_ptr;
/* This is not wanted in mp.h, so put it outside the __GNU_MP__ common
section. */
+#if __GMP_LIBGMP_DLL
#if __GMP_WITHIN_GMPXX
-#ifdef DLL_EXPORT
+/* compiling to go into a DLL libgmpxx */
#define __GMP_DECLSPEC_XX __GMP_DECLSPEC_EXPORT
-#endif
#else
-#if (defined (_WIN32) /* Microsoft C */ \
- || defined (__WIN32__)) /* Borland C */ \
- && __GMP_LIBGMP_SHARED
+/* compiling to go into a application which will link to a DLL libgmpxx */
#define __GMP_DECLSPEC_XX __GMP_DECLSPEC_IMPORT
#endif
-#endif
-#ifndef __GMP_DECLSPEC_XX
+#else
+/* all other cases */
#define __GMP_DECLSPEC_XX
#endif
diff --git a/macos/configure b/macos/configure
index 91a037690..7a430f3cb 100755
--- a/macos/configure
+++ b/macos/configure
@@ -2,7 +2,7 @@
# Note that this script can't be run directly from MPW perl
# because it has the wrong end-of-line characters. See README.
-# Copyright 2000, 2001 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
#
# This file is part of the GNU MP Library.
#
@@ -109,9 +109,9 @@ my %vars =
'__GMP_BITS_PER_MP_LIMB' => 32,
'__GMP_HAVE_HOST_CPU_FAMILY_power' => 0,
'__GMP_HAVE_HOST_CPU_FAMILY_powerpc' => 1,
+ 'GMP_NAIL_BITS' => 0,
'DEFN_LONG_LONG_LIMB' => '',
- '__GMP_LIBGMP_STATIC' => 0,
- '__GMP_LIBGMP_SHARED' => 0,
+ '__GMP_LIBGMP_DLL' => 0,
);
my $make_in = 'Makefile.in';
diff --git a/mp-h.in b/mp-h.in
index af2262786..cbb706c53 100644
--- a/mp-h.in
+++ b/mp-h.in
@@ -41,8 +41,7 @@ MA 02111-1307, USA. */
/* The following instantiated by configure, for internal use only */
#if ! __GMP_WITHIN_CONFIGURE
@DEFN_LONG_LONG_LIMB@
-#define __GMP_LIBGMP_STATIC @__GMP_LIBGMP_STATIC@
-#define __GMP_LIBGMP_SHARED @__GMP_LIBGMP_SHARED@
+#define __GMP_LIBGMP_DLL @__GMP_LIBGMP_DLL@
#endif
#if defined (__STDC__) \
@@ -83,19 +82,13 @@ MA 02111-1307, USA. */
#define __GMP_DECLSPEC_IMPORT _Import
#endif
+#if __GMP_LIBGMP_DLL
#if __GMP_WITHIN_GMP
-#ifdef DLL_EXPORT
#define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT
-#endif
#else
-#if (defined (_WIN32) /* Microsoft C */ \
- || defined (__WIN32__)) /* Borland C */ \
- && __GMP_LIBGMP_SHARED
#define __GMP_DECLSPEC __GMP_DECLSPEC_IMPORT
#endif
-#endif
-
-#ifndef __GMP_DECLSPEC
+#else
#define __GMP_DECLSPEC
#endif