summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorivmai <ivmai>2009-09-30 10:42:33 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:48 +0200
commit6d651f61d1690ffae0528830151159f21d27de26 (patch)
tree5e1a00386b36f6eeba36e77aa4c19c41c88d0dd5 /configure.ac
parent1de3109f677b5eb8a03d7d835b5ec798d5ded455 (diff)
2009-09-30 Ivan Maidanski <ivmai@mail.ru> (really Petter Urkedal)
* configure.ac: Rewrite the tests for external or internal libatomic_ops. * configure.ac: In particular, drop the symbolic links. Add option --with-libatomic-ops for forced selection. * Makefile.am: Adjust the path of source files from libatomic_ops to not use the links. * Makefile.am (libgc_la_LIBADD): Add $(ATOMIC_OPS_LIBS). This will be empty if we use the bundled AO sources. * configure: Regenerate. * Makefile.in: Ditto.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac82
1 files changed, 31 insertions, 51 deletions
diff --git a/configure.ac b/configure.ac
index ff1e07b..f1dcd65 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ AC_INIT(gc,7.2alpha3,Hans.Boehm@hp.com)
AC_CONFIG_SRCDIR(gcj_mlc.c)
AC_CANONICAL_TARGET
AC_PREREQ(2.53)
-AC_REVISION($Revision: 1.50 $)
+AC_REVISION($Revision: 1.51 $)
GC_SET_VERSION
AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects nostdinc])
AM_CONFIG_HEADER([include/private/config.h])
@@ -687,57 +687,37 @@ fi
AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
-dnl Atomic Ops
-dnl ----------
-
-atomic_ops_libs=-latomic_ops
-AC_CHECK_HEADER(atomic_ops.h,
- [ AC_MSG_NOTICE([Using pre-installed libatomic_ops]) ],
- [ ao_dir=
- for candidate in ${srcdir}/libatomic_ops*; do
- case $candidate in
- *.tar.gz)
- ;;
- *install)
- dnl generated by alternate Makefile.
- ;;
- *)
- if test -e "$candidate"; then
- ao_dir="$candidate"
- fi
- ;;
- esac
- done
- if test -z "$ao_dir"; then
- AC_MSG_ERROR([Missig libatomic_ops.])
- fi
- ao_version="${ao_dir#*libatomic_ops-}"
- AC_MSG_NOTICE([Using internal version of libatomic_ops])
-
- dnl Automake does not accept shell variables in AC_CONFIG_SUBDIRS
- test -e libatomic_ops \
- || ln -s ${ao_dir} libatomic_ops
- AC_CONFIG_SUBDIRS(libatomic_ops)
-
- dnl Also copy the source files to be linked in.
- test -e atomic_ops.c \
- || ln -s libatomic_ops/src/atomic_ops.c \
- atomic_ops.c
-
- test -e atomic_ops_sysdeps.S \
- || ln -s libatomic_ops/src/atomic_ops_sysdeps.S \
- atomic_ops_sysdeps.S
-
- dnl This gets the source include files, which is often close enough.
- dnl It also makes atomic_ops_sysdeps.S assemble.
- GC_CFLAGS="${GC_CFLAGS} -I libatomic_ops/src"
- maybe_libatomic_ops="libatomic_ops"
+# Atomic Ops
+# ----------
+
+# Do we want to use an external libatomic_ops? By default use it if it's
+# found.
+AC_ARG_WITH([libatomic-ops],
+ [AS_HELP_STRING([--with-libatomic-ops[=yes|no|check]],
+ [Use a pre-installed libatomic_ops? (default: check)])],
+ [], [with_libatomic_ops=check])
+
+# Check for an external libatomic_ops if the answer was yes or check. If not
+# found, fail on yes, and convert check to no.
+AS_IF([test x"$with_libatomic_ops" != xno],
+ [ AC_CHECK_HEADER([atomic_ops.h], [],
+ [ AS_IF([test x"$with_libatomic_ops" != xcheck],
+ [AC_MSG_ERROR([A pre-installed libatomic_ops was not found.])])
+ with_libatomic_ops=no ]) ])
+
+# Finally, emit the definitions for bundled or pre-installed AO.
+AC_MSG_CHECKING([which libatomic_ops to use])
+AS_IF([test x"$with_libatomic_ops" != xno],
+ [ AC_MSG_RESULT([pre-installed])
+ ATOMIC_OPS_LIBS="-latomic_ops"
+ AC_SUBST([ATOMIC_OPS_LIBS]) ],
+ [ AC_MSG_RESULT([bundled])
+ AC_CONFIG_SUBDIRS([libatomic_ops])
])
-
-AM_CONDITIONAL(USE_INTERNAL_LIBATOMIC_OPS,
- test -n "$maybe_libatomic_ops" -a "$THREADS" != "none")
-AM_CONDITIONAL(NEED_ATOMIC_OPS_ASM, test -n "$maybe_libatomic_ops" -a x$need_atomic_ops_asm = xtrue)
-AC_SUBST(atomic_ops_libs)
+AM_CONDITIONAL([USE_INTERNAL_LIBATOMIC_OPS],
+ [test x$with_libatomic_ops = xno -a x"$THREADS" != xnone])
+AM_CONDITIONAL([NEED_ATOMIC_OPS_ASM],
+ [test x$with_libatomic_ops = xno -a x$need_atomic_ops_asm = xtrue])
dnl Produce the Files
dnl -----------------