1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
|
dnl Nesting safe macros for saving variables
dnl Usage: PAC_PUSH_FLAG(CFLAGS)
AC_DEFUN([PAC_PUSH_FLAG],[
if test -z "${pac_save_$1_nesting}" ; then
pac_save_$1_nesting=0
fi
eval pac_save_$1_${pac_save_$1_nesting}='"$$1"'
pac_save_$1_nesting=`expr ${pac_save_$1_nesting} + 1`
])
dnl Usage: PAC_POP_FLAG(CFLAGS)
AC_DEFUN([PAC_POP_FLAG],[
pac_save_$1_nesting=`expr ${pac_save_$1_nesting} - 1`
eval $1="\$pac_save_$1_${pac_save_$1_nesting}"
eval pac_save_$1_${pac_save_$1_nesting}=""
])
dnl Usage: PAC_PUSH_ALL_FLAGS
AC_DEFUN([PAC_PUSH_ALL_FLAGS],[
PAC_PUSH_FLAG(CFLAGS)
PAC_PUSH_FLAG(CPPFLAGS)
PAC_PUSH_FLAG(CXXFLAGS)
PAC_PUSH_FLAG(FFLAGS)
PAC_PUSH_FLAG(FCFLAGS)
PAC_PUSH_FLAG(LDFLAGS)
PAC_PUSH_FLAG(LIBS)
])
dnl Usage: PAC_POP_ALL_FLAGS
AC_DEFUN([PAC_POP_ALL_FLAGS],[
PAC_POP_FLAG(CFLAGS)
PAC_POP_FLAG(CPPFLAGS)
PAC_POP_FLAG(CXXFLAGS)
PAC_POP_FLAG(FFLAGS)
PAC_POP_FLAG(FCFLAGS)
PAC_POP_FLAG(LDFLAGS)
PAC_POP_FLAG(LIBS)
])
dnl PAC_PREFIX_FLAG - Save flag with a prefix
dnl Usage: PAC_PREFIX_FLAG(PREFIX, FLAG)
AC_DEFUN([PAC_PREFIX_FLAG],[
$1_$2=$$2
export $1_$2
AC_SUBST($1_$2)
])
dnl PAC_PREFIX_ALL_FLAGS - Save flags with a prefix
dnl Usage: PAC_PREFIX_ALL_FLAGS(PREFIX)
AC_DEFUN([PAC_PREFIX_ALL_FLAGS],[
PAC_PREFIX_FLAG($1, CFLAGS)
PAC_PREFIX_FLAG($1, CPPFLAGS)
PAC_PREFIX_FLAG($1, CXXFLAGS)
PAC_PREFIX_FLAG($1, FFLAGS)
PAC_PREFIX_FLAG($1, FCFLAGS)
PAC_PREFIX_FLAG($1, LDFLAGS)
PAC_PREFIX_FLAG($1, LIBS)
PAC_PREFIX_FLAG($1, EXTRA_LIBS)
])
AC_DEFUN([PAC_CHECK_FGREP_WORD],[
AC_PROG_FGREP
AC_MSG_CHECKING([if fgrep support -w option])
if echo 'ab*c' | $FGREP -w -e 'ab*c' >/dev/null 2>&1 ; then
pac_has_fgrep_word="yes"
AC_MSG_RESULT([$pac_has_fgrep_word])
else
pac_has_fgrep_word="no"
AC_MSG_RESULT([$pac_has_fgrep_word])
AC_MSG_WARN([fgrep does not support -w option, skip flag deduplication])
fi
])
AC_DEFUN([PAC_FGREP_WORD],[
AC_REQUIRE([PAC_CHECK_FGREP_WORD])
if test x$pac_has_fgrep_word = "xyes"; then
AS_IF(
[echo "$$2" | $FGREP -w -e "$1" >/dev/null 2>&1],
[$3],
[$4]
)
else
$4
fi
])
dnl Usage: PAC_APPEND_FLAG([-02], [CFLAGS])
dnl appends the given argument to the specified shell variable unless the
dnl argument is already present in the variable
AC_DEFUN([PAC_APPEND_FLAG],[
PAC_FGREP_WORD(
[$1],
[$2],
[echo "$2(='$$2') contains '$1', not appending" >&AS_MESSAGE_LOG_FD],
[echo "$2(='$$2') does not contain '$1', appending" >&AS_MESSAGE_LOG_FD
$2="$$2 $1"]
)
])
dnl Usage: PAC_PREPEND_FLAG([-lpthread], [LIBS])
dnl Prepends the given argument to the specified shell variable unless the
dnl argument is already present in the variable.
dnl
dnl This is typically used for LIBS and similar variables because libraries
dnl should be added in reverse order.
AC_DEFUN([PAC_PREPEND_FLAG],[
PAC_FGREP_WORD(
[$1],
[$2],
[echo "$2(='$$2') contains '$1', not prepending" >&AS_MESSAGE_LOG_FD],
[echo "$2(='$$2') does not contain '$1', prepending" >&AS_MESSAGE_LOG_FD
$2="$1 $$2"]
)
])
dnl PAC_MKDIRS(path)
dnl Create any missing directories in the path
AC_DEFUN([PAC_MKDIRS],[
# Build any intermediate directories
for dir in $1 ; do
PAC_PUSH_FLAG([IFS])
IFS="/"
tmp_curdir=""
for tmp_subdir in $dir ; do
tmp_curdir="${tmp_curdir}$tmp_subdir"
if test ! -d "$tmp_curdir" ; then mkdir "$tmp_curdir" ; fi
tmp_curdir="${tmp_curdir}/"
done
PAC_POP_FLAG([IFS])
done
])
# Find something to use for mkdir -p. Eventually, this will have a
# script for backup. As of autoconf-2.63, AC_PROG_MKDIR_P was broken;
# it was checking to see if it recognized the "version" of mkdir and
# was deciding based on that. This should always be a feature test.
AC_DEFUN([PAC_PROG_MKDIR_P],[
AC_CACHE_CHECK([whether mkdir -p works],
pac_cv_mkdir_p,[
pac_cv_mkdir_p=no
rm -rf .tmp
if mkdir -p .tmp/.foo 1>/dev/null 2>&1 ; then
if test -d .tmp/.foo ; then
pac_cv_mkdir_p=yes
fi
fi
rm -rf .tmp
])
if test "$pac_cv_mkdir_p" = "yes" ; then
MKDIR_P="mkdir -p"
export MKDIR_P
else
AC_MSG_WARN([mkdir -p does not work; the install step may fail])
fi
AC_SUBST(MKDIR_P)
])
dnl Test for a clean VPATH directory. Provide this command with the names
dnl of all of the generated files that might cause problems
dnl (Makefiles won't cause problems because there's no VPATH usage for them)
dnl
dnl Synopsis
dnl PAC_VPATH_CHECK([file-names],[directory-names])
dnl file-names should be files other than config.status and any header (e.g.,
dnl fooconf.h) file that should be removed. It is optional
AC_DEFUN([PAC_VPATH_CHECK],[
# This is needed for Mac OSX 10.5
rm -rf conftest.dSYM
rm -f conftest*
date >conftest$$
# If creating a file in the current directory does not show up in the srcdir
# then we're doing a VPATH build (or something is very wrong)
if test ! -s $srcdir/conftest$$ ; then
pac_dirtyfiles=""
pac_dirtydirs=""
pac_header=""
ifdef([AC_LIST_HEADER],[pac_header=AC_LIST_HEADER])
for file in config.status $pac_header $1 ; do
if test -f $srcdir/$file ; then
pac_dirtyfiles="$pac_dirtyfiles $file"
fi
done
ifelse($2,,,[
for dir in $2 ; do
if test -d $srcdir/$dir ; then
pac_dirtydirs="$pac_dirtydirs $dir"
fi
done
])
if test -n "$pac_dirtyfiles" -o -n "$pac_dirtydirs" ; then
# Create a nice message about what to remove
rmmsg=""
if test -n "$pac_dirtyfiles" ; then
rmmsg="files $pac_dirtyfiles"
fi
if test -n "$pac_dirtydirs" ; then
if test -n "$rmmsg" ; then
rmmsg="$rmmsg and directories $pac_dirtydirs"
else
rmmsg="directories $pac_dirtydirs"
fi
fi
if test -f $srcdir/Makefile ; then
AC_MSG_ERROR([You cannot do a VPATH build if the source directory has been
configured. Run "make distclean" in $srcdir first and make sure that the
$rmmsg have been removed.])
else
AC_MSG_ERROR([You cannot do a VPATH build if the source directory has been
configured. Remove the $rmmsg in $srcdir.])
fi
fi
fi
# This is needed for Mac OSX 10.5
rm -rf conftest.dSYM
rm -f conftest*
])
dnl PAC_CONF_HEX_TO_DEC(value,out_var)
dnl
dnl Converts the given hexadecimal integer constant to an integer constant and
dnl stores the result in the shell variable given by 'out_var'.
dnl
dnl I think that printf like this will be sufficiently portable, but I don't
dnl have any guarantee of it. If not, we can fall back to AS_VAR_ARITH
dnl and/or AC_COMPUTE_INT (the latter will probably be slow)
AC_DEFUN([PAC_CONV_HEX_TO_DEC],[AS_VAR_SET([$2],[`printf "%d" $1`])])
dnl PAC_GET_EXENAME(exe_name, out_exe_name)
dnl
dnl Prepends and appends program prefix and suffix as supplied by --program_prefix
dnl and --program-sufix
AC_DEFUN([PAC_GET_EXENAME],[
$2=$1
if test "$program_prefix" != "NONE" ; then
$2="${program_prefix}$$2"
fi
if test "$program_suffix" != "NONE" ; then
$2="$$2$program_suffix"
fi
])
|