49
# SVN_EXTERNAL_PROJECT_SETUP()
50
# Internal helper for SVN_EXTERNAL_PROJECT.
51
AC_DEFUN([SVN_EXTERNAL_PROJECT_SETUP], [
52
do_subdir_config="yes"
53
AC_ARG_ENABLE([subdir-config],
54
AS_HELP_STRING([--disable-subdir-config],
55
[do not reconfigure packages in subdirectories]),
56
[if test "$enableval" = "no"; then do_subdir_config="no"; fi])
57
AC_SUBST([SVN_EXTERNAL_PROJECT_SUBDIRS], [""])
60
# SVN_EXTERNAL_PROJECT(SUBDIR [, ADDITIONAL-CONFIGURE-ARGS])
61
# Setup SUBDIR as an external project. This means:
62
# - Execute the configure script immediately at the point of macro invocation.
63
# - Add SUBDIR to the substitution variable SVN_EXTERNAL_PROJECT_SUBDIRS,
64
# for the Makefile.in to arrange to execute make in the subdir.
66
# Derived from APR_SUBDIR_CONFIG
67
AC_DEFUN([SVN_EXTERNAL_PROJECT], [
68
AC_REQUIRE([SVN_EXTERNAL_PROJECT_SETUP])
69
SVN_EXTERNAL_PROJECT_SUBDIRS="$SVN_EXTERNAL_PROJECT_SUBDIRS $1"
70
if test "$do_subdir_config" = "yes" ; then
71
# save our work to this point; this allows the sub-package to use it
74
AC_MSG_NOTICE([configuring package in $1 now])
76
ac_abs_srcdir=`(cd $srcdir/$1 && pwd)`
77
apr_config_subdirs="$1"
78
test -d $1 || $MKDIR $1
81
# A "../" for each directory in /$config_subdirs.
82
ac_dots=[`echo $apr_config_subdirs| $SED -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`]
84
# Make the cache file name correct relative to the subdirectory.
86
/*) ac_sub_cache_file=$cache_file ;;
88
ac_sub_cache_file="$ac_dots$cache_file" ;;
91
# The eval makes quoting arguments work.
92
if eval $SHELL $ac_abs_srcdir/configure $ac_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_abs_srcdir $2
94
echo "$1 configured properly"
96
echo "configure failed for $1"
101
# grab any updates from the sub-package
104
AC_MSG_WARN([not running configure in $1])
109
50
dnl SVN_CONFIG_SCRIPT(path)
144
dnl SVN_MAYBE_ADD_TO_CFLAGS(option)
146
dnl Attempt to compile a trivial C program to test if the option passed
147
dnl is valid. If it is, then add it to CFLAGS. with the passed in option
148
dnl and see if it was successfully compiled.
150
dnl This macro is usually used for stricter syntax checking flags.
151
dnl Therefore we include certain headers which may in turn include system
152
dnl headers, as system headers on some platforms may fail strictness checks
153
dnl we wish to use on other platforms.
155
AC_DEFUN(SVN_MAYBE_ADD_TO_CFLAGS,
85
dnl SVN_STRIP_FLAG(FLAG_VAR_NAME, FLAG)
87
dnl Remove FLAG from the variable FLAG_VAR_NAME, if it exists. This macro
88
dnl is primarily used for removing unwanted compiler flags, but is really
89
dnl just a general wrapper around `sed'.
90
AC_DEFUN(SVN_STRIP_FLAG,
158
svn_maybe_add_to_cflags_saved_flags="$CFLAGS"
159
CFLAGS="$CFLAGS $option"
160
AC_MSG_CHECKING([if $CC accepts $option])
161
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
162
[[#include <apr_portable.h>]],
164
[svn_maybe_add_to_cflags_ok="yes"],
165
[svn_maybe_add_to_cflags_ok="no"]
167
if test "$svn_maybe_add_to_cflags_ok" = "yes"; then
168
AC_MSG_RESULT([yes, will use it])
171
CFLAGS="$svn_maybe_add_to_cflags_saved_flags"
92
$1=`echo "$$1" | $SED -e 's/$2//'`
175
95
dnl SVN_REMOVE_STANDARD_LIB_DIRS(OPTIONS)
202
122
printf "%s" "${output_flags# }"
126
AC_DEFUN([SVN_CHECK_FOR_ATOMIC_BUILTINS],
128
AC_CACHE_CHECK([whether the compiler provides atomic builtins], [svn_cv_atomic_builtins],
132
unsigned long long val = 1010, tmp, *mem = &val;
134
if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020)
139
if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010)
142
if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0)
147
if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp)
150
if (__sync_lock_test_and_set(&val, 4040) != 3030)
155
if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp)
158
__sync_synchronize();
164
}], [svn_cv_atomic_builtins=yes], [svn_cv_atomic_builtins=no], [svn_cv_atomic_builtins=no])])