Allow using a preinstalled copy of libatomic-ops

This commit is contained in:
Juan Jose Garcia Ripoll 2012-10-31 21:42:10 +01:00
parent e6038ce113
commit 4a4c2289d7
6 changed files with 98 additions and 16 deletions

39
src/aclocal.m4 vendored
View file

@ -873,18 +873,43 @@ dnl ----------------------------------------------------------------------
dnl Configure libatomic-ops
dnl
AC_DEFUN([ECL_LIBATOMIC_OPS],[
case "${enable_libatomic}" in
auto|system|included) ;;
*) AC_MSG_ERROR( [Invalid value of --enable-libatomic: ${enable_libatomic}] );;
esac
if test "x${enable_threads}" != "xno"; then
test -d atomic || mkdir atomic
(destdir=`${PWDCMD}`; cd atomic && CC="${CC} ${PICFLAG}" \
$srcdir/${ECL_GC_DIR}/libatomic*/configure --disable-shared --prefix=${destdir} \
AC_CHECK_HEADER([atomic_ops.h],[system_libatomic=yes],[system_libatomic=no],[])
AC_MSG_CHECKING( [libatomic-ops version] )
if test "${enable_libatomic}" = auto; then
if test "${system_libatomic}" = yes; then
enable_libatomic=system
else
enable_libatomic=included
fi
fi
if test "${enable_libatomic}" = system; then
if test "${system_libatomic}" = no; then
AC_MSG_ERROR( [Cannot find libatomic-ops in the system] )
enable_libatomic=included
fi
fi
AC_MSG_RESULT( [${enable_libatomic}] )
if test "${enable_libatomic}" = included; then
test -d atomic || mkdir atomic
(destdir=`${PWDCMD}`; cd atomic && CC="${CC} ${PICFLAG}" \
$srcdir/${ECL_GC_DIR}/libatomic*/configure --disable-shared --prefix=${destdir} \
--infodir=${destdir}/doc --includedir=${destdir}/ecl --with-pic \
--libdir=${destdir} --build=${build_alias} --host=${host_alias} \
CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" CPPFLAGS="$CPPFLAGS" CC="${CC} \
${PICFLAG}")
SUBDIRS="${SUBDIRS} atomic"
CORE_LIBS="-leclatomic ${CORE_LIBS}"
if test "${enable_shared}" = "no"; then
LIBRARIES="${LIBRARIES} ${LIBPREFIX}eclatomic.${LIBEXT}"
SUBDIRS="${SUBDIRS} atomic"
if test "${enable_shared}" = "no"; then
LIBRARIES="${LIBRARIES} ${LIBPREFIX}eclatomic.${LIBEXT}"
fi
AC_DEFINE(ECL_LIBATOMIC_OPS_H)
CORE_LIBS="-leclatomic ${CORE_LIBS}"
else
CORE_LIBS="-latomic_ops ${CORE_LIBS}"
fi
fi
])

View file

@ -15,7 +15,7 @@
#ifndef ECL_ATOMICS_H
#define AO_ASSUME_WINDOWS98
#include <ecl/atomic_ops.h>
#include <ecl/internal.h>
#if !defined(AO_HAVE_compare_and_swap_full)
# error "ECL needs AO_compare_and_swap_full or an equivalent"

60
src/configure vendored
View file

@ -763,6 +763,7 @@ enable_shared
enable_rpath
enable_threads
enable_boehm
enable_libatomic
enable_slow_config
enable_soname
with_system_boehm
@ -1444,6 +1445,8 @@ Optional Features:
default=NO).
--enable-boehm use the Boehm-Weiser garbage collector
(no|included|system|auto, default=auto)
--enable-libatomic version of the libatomic-ops library
(auto|included|system, default=auto)
DEPRECATED: use --with-system-boehm=no
--enable-soname link and install the library using version numbers
@ -2617,6 +2620,14 @@ else
fi
# Check whether --enable-libatomic was given.
if test "${enable_libatomic+set}" = set; then :
enableval=$enable_libatomic;
else
enable_libatomic=auto
fi
# Check whether --enable-slow-config was given.
if test "${enable_slow_config+set}" = set; then :
enableval=$enable_slow_config;
@ -9136,18 +9147,53 @@ fi
fi
case "${enable_libatomic}" in
auto|system|included) ;;
*) as_fn_error $? "Invalid value of --enable-libatomic: ${enable_libatomic} " "$LINENO" 5;;
esac
if test "x${enable_threads}" != "xno"; then
test -d atomic || mkdir atomic
(destdir=`${PWDCMD}`; cd atomic && CC="${CC} ${PICFLAG}" \
$srcdir/${ECL_GC_DIR}/libatomic*/configure --disable-shared --prefix=${destdir} \
ac_fn_c_check_header_mongrel "$LINENO" "atomic_ops.h" "ac_cv_header_atomic_ops_h" "$ac_includes_default"
if test "x$ac_cv_header_atomic_ops_h" = xyes; then :
system_libatomic=yes
else
system_libatomic=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking libatomic-ops version " >&5
$as_echo_n "checking libatomic-ops version ... " >&6; }
if test "${enable_libatomic}" = auto; then
if test "${system_libatomic}" = yes; then
enable_libatomic=system
else
enable_libatomic=included
fi
fi
if test "${enable_libatomic}" = system; then
if test "${system_libatomic}" = no; then
as_fn_error $? "Cannot find libatomic-ops in the system " "$LINENO" 5
enable_libatomic=included
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${enable_libatomic} " >&5
$as_echo "${enable_libatomic} " >&6; }
if test "${enable_libatomic}" = included; then
test -d atomic || mkdir atomic
(destdir=`${PWDCMD}`; cd atomic && CC="${CC} ${PICFLAG}" \
$srcdir/${ECL_GC_DIR}/libatomic*/configure --disable-shared --prefix=${destdir} \
--infodir=${destdir}/doc --includedir=${destdir}/ecl --with-pic \
--libdir=${destdir} --build=${build_alias} --host=${host_alias} \
CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" CPPFLAGS="$CPPFLAGS" CC="${CC} \
${PICFLAG}")
SUBDIRS="${SUBDIRS} atomic"
CORE_LIBS="-leclatomic ${CORE_LIBS}"
if test "${enable_shared}" = "no"; then
LIBRARIES="${LIBRARIES} ${LIBPREFIX}eclatomic.${LIBEXT}"
SUBDIRS="${SUBDIRS} atomic"
if test "${enable_shared}" = "no"; then
LIBRARIES="${LIBRARIES} ${LIBPREFIX}eclatomic.${LIBEXT}"
fi
$as_echo "#define ECL_LIBATOMIC_OPS_H 1" >>confdefs.h
CORE_LIBS="-leclatomic ${CORE_LIBS}"
else
CORE_LIBS="-latomic_ops ${CORE_LIBS}"
fi
fi

View file

@ -50,6 +50,12 @@ AC_ARG_ENABLE(boehm,
[(no|included|system|auto, default=auto)] ),
[], [enable_boehm=auto] )
AC_ARG_ENABLE(libatomic,
AS_HELP_STRING( [--enable-libatomic],
[version of the libatomic-ops library]
[(auto|included|system, default=auto)] ),
[], [enable_libatomic=auto] )
AC_ARG_ENABLE(slow-config,
AS_HELP_STRING( [DEPRECATED: use --with-system-boehm=no] ),
[], [enable_slow_config=no] )

View file

@ -89,6 +89,7 @@
# undef _endthreadex
# endif
#endif
#undef ECL_LIBATOMIC_OPS_H
/* Network streams */
#undef TCP

View file

@ -419,7 +419,11 @@ extern void cl_write_object(cl_object x, cl_object stream);
#endif /* ECL_THREADS */
#ifdef ECL_THREADS
# include <ecl/atomic_ops.h>
# ifdef ECL_LIBATOMIC_OPS_H
# include <ecl/atomic_ops.h>
# else
# include <atomic_ops.h>
# endif
#else
# define AO_load(x) (x)
# define AO_store(x,y) ((x)=(y))