diff options
Diffstat (limited to 'build/ac-macros/svn-macros.m4')
-rw-r--r-- | build/ac-macros/svn-macros.m4 | 133 |
1 files changed, 47 insertions, 86 deletions
diff --git a/build/ac-macros/svn-macros.m4 b/build/ac-macros/svn-macros.m4 index 29e9624..39e53e0 100644 --- a/build/ac-macros/svn-macros.m4 +++ b/build/ac-macros/svn-macros.m4 @@ -46,65 +46,6 @@ EOF ]) -# SVN_EXTERNAL_PROJECT_SETUP() -# Internal helper for SVN_EXTERNAL_PROJECT. -AC_DEFUN([SVN_EXTERNAL_PROJECT_SETUP], [ - do_subdir_config="yes" - AC_ARG_ENABLE([subdir-config], - AS_HELP_STRING([--disable-subdir-config], - [do not reconfigure packages in subdirectories]), - [if test "$enableval" = "no"; then do_subdir_config="no"; fi]) - AC_SUBST([SVN_EXTERNAL_PROJECT_SUBDIRS], [""]) -]) - -# SVN_EXTERNAL_PROJECT(SUBDIR [, ADDITIONAL-CONFIGURE-ARGS]) -# Setup SUBDIR as an external project. This means: -# - Execute the configure script immediately at the point of macro invocation. -# - Add SUBDIR to the substitution variable SVN_EXTERNAL_PROJECT_SUBDIRS, -# for the Makefile.in to arrange to execute make in the subdir. -# -# Derived from APR_SUBDIR_CONFIG -AC_DEFUN([SVN_EXTERNAL_PROJECT], [ - AC_REQUIRE([SVN_EXTERNAL_PROJECT_SETUP]) - SVN_EXTERNAL_PROJECT_SUBDIRS="$SVN_EXTERNAL_PROJECT_SUBDIRS $1" - if test "$do_subdir_config" = "yes" ; then - # save our work to this point; this allows the sub-package to use it - AC_CACHE_SAVE - - AC_MSG_NOTICE([configuring package in $1 now]) - ac_popdir=`pwd` - ac_abs_srcdir=`(cd $srcdir/$1 && pwd)` - apr_config_subdirs="$1" - test -d $1 || $MKDIR $1 - cd $1 - - # A "../" for each directory in /$config_subdirs. - ac_dots=[`echo $apr_config_subdirs| $SED -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`] - - # Make the cache file name correct relative to the subdirectory. - case "$cache_file" in - /*) ac_sub_cache_file=$cache_file ;; - *) # Relative path. - ac_sub_cache_file="$ac_dots$cache_file" ;; - esac - - # The eval makes quoting arguments work. - if eval $SHELL $ac_abs_srcdir/configure $ac_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_abs_srcdir $2 - then : - echo "$1 configured properly" - else - echo "configure failed for $1" - exit 1 - fi - cd $ac_popdir - - # grab any updates from the sub-package - AC_CACHE_LOAD - else - AC_MSG_WARN([not running configure in $1]) - fi -]) - dnl dnl SVN_CONFIG_SCRIPT(path) dnl @@ -141,35 +82,14 @@ done $1="${svn_cur}" ]) -dnl SVN_MAYBE_ADD_TO_CFLAGS(option) -dnl -dnl Attempt to compile a trivial C program to test if the option passed -dnl is valid. If it is, then add it to CFLAGS. with the passed in option -dnl and see if it was successfully compiled. +dnl SVN_STRIP_FLAG(FLAG_VAR_NAME, FLAG) dnl -dnl This macro is usually used for stricter syntax checking flags. -dnl Therefore we include certain headers which may in turn include system -dnl headers, as system headers on some platforms may fail strictness checks -dnl we wish to use on other platforms. - -AC_DEFUN(SVN_MAYBE_ADD_TO_CFLAGS, +dnl Remove FLAG from the variable FLAG_VAR_NAME, if it exists. This macro +dnl is primarily used for removing unwanted compiler flags, but is really +dnl just a general wrapper around `sed'. +AC_DEFUN(SVN_STRIP_FLAG, [ - option="$1" - svn_maybe_add_to_cflags_saved_flags="$CFLAGS" - CFLAGS="$CFLAGS $option" - AC_MSG_CHECKING([if $CC accepts $option]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#include <apr_portable.h>]], - [[]])], - [svn_maybe_add_to_cflags_ok="yes"], - [svn_maybe_add_to_cflags_ok="no"] - ) - if test "$svn_maybe_add_to_cflags_ok" = "yes"; then - AC_MSG_RESULT([yes, will use it]) - else - AC_MSG_RESULT([no]) - CFLAGS="$svn_maybe_add_to_cflags_saved_flags" - fi + $1=`echo "$$1" | $SED -e 's/$2//'` ]) dnl SVN_REMOVE_STANDARD_LIB_DIRS(OPTIONS) @@ -202,3 +122,44 @@ AC_DEFUN([SVN_REMOVE_STANDARD_LIB_DIRS], printf "%s" "${output_flags# }" fi ]) + +AC_DEFUN([SVN_CHECK_FOR_ATOMIC_BUILTINS], +[ + AC_CACHE_CHECK([whether the compiler provides atomic builtins], [svn_cv_atomic_builtins], + [AC_TRY_RUN([ + int main() + { + unsigned long long val = 1010, tmp, *mem = &val; + + if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020) + return 1; + + tmp = val; + + if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010) + return 1; + + if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0) + return 1; + + tmp = 3030; + + if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp) + return 1; + + if (__sync_lock_test_and_set(&val, 4040) != 3030) + return 1; + + mem = &tmp; + + if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp) + return 1; + + __sync_synchronize(); + + if (mem != &val) + return 1; + + return 0; + }], [svn_cv_atomic_builtins=yes], [svn_cv_atomic_builtins=no], [svn_cv_atomic_builtins=no])]) +]) |