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 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
|
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2001-2004 The Trustees of Indiana University.
dnl All rights reserved.
dnl Copyright (c) 1998-2001 University of Notre Dame.
dnl All rights reserved.
dnl Copyright (c) 1994-1998 The Ohio State University.
dnl All rights reserved.
dnl
dnl This file is part of the LAM/MPI software package. For license
dnl information, see the LICENSE file in the top level directory of the
dnl LAM/MPI source distribution.
dnl
dnl $Id: lam_functions.m4,v 1.17 2004/01/20 03:41:47 jsquyres Exp $
dnl
AC_DEFUN([LAM_CONFIGURE_SETUP],[
# Some helper script functions. Unfortunately, we cannot use $1 kinds
# of arugments here because of the m4 substitution. So we have to set
# special variable names before invoking the function. :-\
lam_show_title() {
cat <<EOF
============================================================================
== ${1}
============================================================================
EOF
}
lam_show_subtitle() {
cat <<EOF
*** ${1}
EOF
}])
dnl #######################################################################
AC_DEFUN([LAM_BASIC_SETUP],[
#
# Save some stats about this build
#
LAM_CONFIGURE_USER="`whoami`"
LAM_CONFIGURE_HOST="`hostname | head -n 1`"
LAM_CONFIGURE_DATE="`date`"
#
# Make automake clean emacs ~ files for "make clean"
#
CLEANFILES="*~"
AC_SUBST(CLEANFILES)
#
# This is useful later
#
AC_CANONICAL_HOST
#
# See if we can find an old installation of LAM to overwrite
#
# Stupid autoconf 2.54 has a bug in AC_PREFIX_PROGRAM -- if lamclean
# is not found in the path and the user did not specify --prefix,
# we'll get a $prefix of "."
lam_prefix_save="$prefix"
AC_PREFIX_PROGRAM(lamclean)
if test "$prefix" = "."; then
prefix="$lam_prefix_save"
fi
unset lam_prefix_save
#
# Basic sanity checking; we can't install to a relative path
#
case "$prefix" in
/*/bin)
prefix="`dirname $prefix`"
LAM_PREFIX="$prefix"
;;
/*)
LAM_PREFIX="$prefix"
;;
NONE)
LAM_PREFIX="$ac_default_prefix"
;;
*)
AC_MSG_ERROR(prefix \"$prefix\" must be an absolute directory path)
;;
esac
echo installing to directory \"$LAM_PREFIX\"
#
# Figure out exec_prefix as well
#
case "$exec_prefix" in
/*/bin)
exec_prefix="`dirname $exec_prefix`"
LAM_EXEC_PREFIX="$exec_prefix"
;;
/*)
LAM_EXEC_PREFIX="$exec_prefix"
;;
NONE)
LAM_EXEC_PREFIX="$LAM_PREFIX"
;;
*)
AC_MSG_ERROR(prefix \"$exec_prefix\" must be an absolute directory path)
;;
esac
#
# Calculate bindir and mandir based on this
# (for use in the lam_module.tcl modulefile and shell script setup files)
#
if test "$bindir" = '${exec_prefix}/bin'; then
LAM_BINDIR="$LAM_EXEC_PREFIX/bin";
else
LAM_BINDIR="$bindir";
fi
if test "$mandir" = '${prefix}/man'; then
LAM_MANDIR="$LAM_PREFIX/man";
else
LAM_MANDIR="$mandir";
fi
AC_SUBST(LAM_PREFIX)
AC_SUBST(LAM_EXEC_PREFIX)
AC_SUBST(LAM_BINDIR)
AC_SUBST(LAM_MANDIR)
# Allow the --enable-dist flag to be passed in
AC_ARG_ENABLE(dist,
AC_HELP_STRING([--enable-dist],
[guarantee that that the "dist" make target will be functional, although may not guarantee that any other make target will be functional.]),
LAM_WANT_DIST=yes, LAM_WANT_DIST=no)
if test "$LAM_WANT_DIST" = "yes"; then
AC_MSG_WARN([Configuring in 'make dist' mode])
AC_MSG_WARN([Most make targets may be non-functional!])
fi])dnl
dnl #######################################################################
AC_DEFUN([LAM_LOG_MSG],[
# 1 is the message
# 2 is whether to put a prefix or not
if test -n "$2"; then
echo "configure:__oline__: $1" >&5
else
echo $1 >&5
fi])dnl
dnl #######################################################################
AC_DEFUN([LAM_LOG_FILE],[
# 1 is the filename
if test -n "$1" -a -f "$1"; then
cat $1 >&5
fi])dnl
dnl #######################################################################
AC_DEFUN([LAM_LOG_COMMAND],[
# 1 is the command
# 2 is actions to do if success
# 3 is actions to do if fail
echo "configure:__oline__: $1" >&5
$1 1>&5 2>&1
lam_status=$?
LAM_LOG_MSG([\$? = $lam_status], 1)
if test "$lam_status" = "0"; then
unset lam_status
$2
else
unset lam_status
$3
fi])dnl
dnl #######################################################################
AC_DEFUN([LAM_UNIQ],[
# 1 is the variable name to be uniq-ized
lam_name=$1
# Go through each item in the variable and only keep the unique ones
lam_count=0
for val in ${$1}; do
lam_done=0
lam_i=1
lam_found=0
# Loop over every token we've seen so far
lam_done="`expr $lam_i \> $lam_count`"
while test "$lam_found" = "0" -a "$lam_done" = "0"; do
# Have we seen this token already? Prefix the comparison with
# "x" so that "-Lfoo" values won't be cause an error.
lam_eval="expr x$val = x\$lam_array_$lam_i"
lam_found=`eval $lam_eval`
# Check the ending condition
lam_done="`expr $lam_i \>= $lam_count`"
# Increment the counter
lam_i="`expr $lam_i + 1`"
done
# If we didn't find the token, add it to the "array"
if test "$lam_found" = "0"; then
lam_eval="lam_array_$lam_i=$val"
eval $lam_eval
lam_count="`expr $lam_count + 1`"
else
lam_i="`expr $lam_i - 1`"
fi
done
# Take all the items in the "array" and assemble them back into a
# single variable
lam_i=1
lam_done="`expr $lam_i \> $lam_count`"
lam_newval=
while test "$lam_done" = "0"; do
lam_eval="lam_newval=\"$lam_newval \$lam_array_$lam_i\""
eval $lam_eval
lam_eval="unset lam_array_$lam_i"
eval $lam_eval
lam_done="`expr $lam_i \>= $lam_count`"
lam_i="`expr $lam_i + 1`"
done
# Done; do the assignment
lam_newval="`echo $lam_newval`"
lam_eval="$lam_name=\"$lam_newval\""
eval $lam_eval
# Clean up
unset lam_name lam_i lam_done lam_newval lam_eval lam_count])dnl
dnl #######################################################################
AC_DEFUN([LAM_SSI_CONFIGURE_ABORT],[
# 1 is the kind
# 2 is the module name
file=ssi_$1_$2_config.sh
cat > $file <<EOF
ABORT=yes
EOF])dnl
|