1 # Miscellaneous additional macros for Subversion's own use.
3 # SVN_CONFIG_NICE(FILENAME)
4 # Write a shell script to FILENAME (typically 'config.nice') which reinvokes
5 # configure with all of the arguments. Reserves use of the filename
6 # FILENAME.old for its own use.
7 # This is different from 'config.status --recheck' in that it does add implicit
8 # --no-create --no-recursion options, and stores _just_ the configure
9 # invocation, instead of the entire configured state.
10 AC_DEFUN([SVN_CONFIG_NICE], [
11 AC_MSG_NOTICE([creating $1])
12 # This little dance satisfies Cygwin, which cannot overwrite in-use files.
20 # Created by configure
22 '[$]0' $ac_configure_args "\[$]@"
30 # SVN_EXTERNAL_PROJECT_SETUP()
31 # Internal helper for SVN_EXTERNAL_PROJECT.
32 AC_DEFUN([SVN_EXTERNAL_PROJECT_SETUP], [
33 do_subdir_config="yes"
34 AC_ARG_ENABLE([subdir-config],
35 AS_HELP_STRING([--disable-subdir-config],
36 [do not reconfigure packages in subdirectories]),
37 [if test "$enableval" = "no"; then do_subdir_config="no"; fi])
38 AC_SUBST([SVN_EXTERNAL_PROJECT_SUBDIRS], [""])
41 # SVN_EXTERNAL_PROJECT(SUBDIR [, ADDITIONAL-CONFIGURE-ARGS])
42 # Setup SUBDIR as an external project. This means:
43 # - Execute the configure script immediately at the point of macro invocation.
44 # - Add SUBDIR to the substitution variable SVN_EXTERNAL_PROJECT_SUBDIRS,
45 # for the Makefile.in to arrange to execute make in the subdir.
47 # Derived from APR_SUBDIR_CONFIG
48 AC_DEFUN([SVN_EXTERNAL_PROJECT], [
49 AC_REQUIRE([SVN_EXTERNAL_PROJECT_SETUP])
50 SVN_EXTERNAL_PROJECT_SUBDIRS="$SVN_EXTERNAL_PROJECT_SUBDIRS $1"
51 if test "$do_subdir_config" = "yes" ; then
52 # save our work to this point; this allows the sub-package to use it
55 AC_MSG_NOTICE([configuring package in $1 now])
57 ac_abs_srcdir=`(cd $srcdir/$1 && pwd)`
58 apr_config_subdirs="$1"
59 test -d $1 || $MKDIR $1
62 # A "../" for each directory in /$config_subdirs.
63 ac_dots=[`echo $apr_config_subdirs|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`]
65 # Make the cache file name correct relative to the subdirectory.
67 /*) ac_sub_cache_file=$cache_file ;;
69 ac_sub_cache_file="$ac_dots$cache_file" ;;
72 # The eval makes quoting arguments work.
73 if eval $SHELL $ac_abs_srcdir/configure $ac_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_abs_srcdir $2
75 echo "$1 configured properly"
77 echo "configure failed for $1"
82 # grab any updates from the sub-package
85 AC_MSG_WARN([not running configure in $1])
90 dnl SVN_CONFIG_SCRIPT(path)
92 dnl Make AC_OUTPUT create an executable file.
93 dnl Accumulate filenames in $SVN_CONFIG_SCRIPT_FILES for AC_SUBSTing to
94 dnl use in, for example, Makefile distclean rules.
96 AC_DEFUN(SVN_CONFIG_SCRIPT, [
97 SVN_CONFIG_SCRIPT_FILES="$SVN_CONFIG_SCRIPT_FILES $1"
98 AC_CONFIG_FILES([$1], [chmod +x $1])])
100 dnl Iteratively interpolate the contents of the second argument
101 dnl until interpolation offers no new result. Then assign the
102 dnl final result to $1.
104 dnl Based on APR_EXPAND_VAR macro
111 dnl SVN_EXPAND_VAR(fraz, $baz)
112 dnl $fraz is now "1/2/3"
114 AC_DEFUN(SVN_EXPAND_VAR,[
117 while test "x${svn_cur}" != "x${svn_last}";
119 svn_last="${svn_cur}"
120 svn_cur=`eval "echo ${svn_cur}"`
125 dnl SVN_MAYBE_ADD_TO_CFLAGS(option)
127 dnl Attempt to compile a trivial C program to test if the option passed
128 dnl is valid. If it is, then add it to CFLAGS. with the passed in option
129 dnl and see if it was successfully compiled.
131 dnl This macro is usually used for stricter syntax checking flags.
132 dnl Therefore we include certain headers which may in turn include system
133 dnl headers, as system headers on some platforms may fail strictness checks
134 dnl we wish to use on other platforms.
136 AC_DEFUN(SVN_MAYBE_ADD_TO_CFLAGS,
139 svn_maybe_add_to_cflags_saved_flags="$CFLAGS"
140 CFLAGS="$CFLAGS $option"
141 AC_MSG_CHECKING([if $CC accepts $option])
142 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
143 [[#include <apr_portable.h>]],
145 [svn_maybe_add_to_cflags_ok="yes"],
146 [svn_maybe_add_to_cflags_ok="no"]
148 if test "$svn_maybe_add_to_cflags_ok" = "yes"; then
149 AC_MSG_RESULT([yes, will use it])
152 CFLAGS="$svn_maybe_add_to_cflags_saved_flags"