1 dnl -*- shell-script -*-
3 dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4 dnl University Research and Technology
5 dnl Corporation. All rights reserved.
6 dnl Copyright (c) 2004-2005 The University of Tennessee and The University
7 dnl of Tennessee Research Foundation. All rights
9 dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10 dnl University of Stuttgart. All rights reserved.
11 dnl Copyright (c) 2004-2005 The Regents of the University of California.
12 dnl All rights reserved.
15 dnl Additional copyrights may follow
20 AC_DEFUN([OMPI_CONFIGURE_SETUP],[
22 # Some helper script functions. Unfortunately, we cannot use $1 kinds
23 # of arugments here because of the m4 substitution. So we have to set
24 # special variable names before invoking the function. :-\
29 ============================================================================
31 ============================================================================
36 ompi_show_subtitle() {
44 ompi_show_subsubtitle() {
51 ompi_show_subsubsubtitle() {
59 # Save some stats about this build
62 OMPI_CONFIGURE_USER="`whoami`"
63 OMPI_CONFIGURE_HOST="`hostname | head -n 1`"
64 OMPI_CONFIGURE_DATE="`date`"
67 # Save these details so that they can be used in ompi_info later
69 AC_SUBST(OMPI_CONFIGURE_USER)
70 AC_SUBST(OMPI_CONFIGURE_HOST)
71 AC_SUBST(OMPI_CONFIGURE_DATE)])dnl
73 dnl #######################################################################
74 dnl #######################################################################
75 dnl #######################################################################
77 AC_DEFUN([OMPI_BASIC_SETUP],[
79 # Save some stats about this build
82 OMPI_CONFIGURE_USER="`whoami`"
83 OMPI_CONFIGURE_HOST="`hostname | head -n 1`"
84 OMPI_CONFIGURE_DATE="`date`"
87 # Make automake clean emacs ~ files for "make clean"
94 # This is useful later (ompi_info, and therefore mpiexec)
98 AC_DEFINE_UNQUOTED(OMPI_ARCH, "$host", [OMPI architecture string])
101 # See if we can find an old installation of OMPI to overwrite
104 # Stupid autoconf 2.54 has a bug in AC_PREFIX_PROGRAM -- if ompi_clean
105 # is not found in the path and the user did not specify --prefix,
106 # we'll get a $prefix of "."
108 ompi_prefix_save="$prefix"
109 AC_PREFIX_PROGRAM(ompi_clean)
110 if test "$prefix" = "."; then
111 prefix="$ompi_prefix_save"
113 unset ompi_prefix_save
116 # Basic sanity checking; we can't install to a relative path
121 prefix="`dirname $prefix`"
122 echo installing to directory \"$prefix\"
125 echo installing to directory \"$prefix\"
128 echo installing to directory \"$ac_default_prefix\"
131 echo installing to directory \"$prefix\"
134 AC_MSG_ERROR(prefix \"$prefix\" must be an absolute directory path)
138 # Allow the --enable-dist flag to be passed in
141 AC_HELP_STRING([--enable-dist],
142 [guarantee that that the "dist" make target will be functional, although may not guarantee that any other make target will be functional.]),
143 OMPI_WANT_DIST=yes, OMPI_WANT_DIST=no)
145 if test "$OMPI_WANT_DIST" = "yes"; then
146 AC_MSG_WARN([Configuring in 'make dist' mode])
147 AC_MSG_WARN([Most make targets may be non-functional!])
150 dnl #######################################################################
151 dnl #######################################################################
152 dnl #######################################################################
154 AC_DEFUN([OMPI_LOG_MSG],[
156 # 2 is whether to put a prefix or not
157 if test -n "$2"; then
158 echo "configure:__oline__: $1" >&5
163 dnl #######################################################################
164 dnl #######################################################################
165 dnl #######################################################################
167 AC_DEFUN([OMPI_LOG_FILE],[
169 if test -n "$1" -a -f "$1"; then
173 dnl #######################################################################
174 dnl #######################################################################
175 dnl #######################################################################
177 AC_DEFUN([OMPI_LOG_COMMAND],[
179 # 2 is actions to do if success
180 # 3 is actions to do if fail
181 echo "configure:__oline__: $1" >&5
184 OMPI_LOG_MSG([\$? = $ompi_status], 1)
185 if test "$ompi_status" = "0"; then
193 dnl #######################################################################
194 dnl #######################################################################
195 dnl #######################################################################
197 AC_DEFUN([OMPI_UNIQ],[
198 # 1 is the variable name to be uniq-ized
201 # Go through each item in the variable and only keep the unique ones
209 # Loop over every token we've seen so far
211 ompi_done="`expr $ompi_i \> $ompi_count`"
212 while test "$ompi_found" = "0" -a "$ompi_done" = "0"; do
214 # Have we seen this token already? Prefix the comparison with
215 # "x" so that "-Lfoo" values won't be cause an error.
217 ompi_eval="expr x$val = x\$ompi_array_$ompi_i"
218 ompi_found=`eval $ompi_eval`
220 # Check the ending condition
222 ompi_done="`expr $ompi_i \>= $ompi_count`"
224 # Increment the counter
226 ompi_i="`expr $ompi_i + 1`"
229 # If we didn't find the token, add it to the "array"
231 if test "$ompi_found" = "0"; then
232 ompi_eval="ompi_array_$ompi_i=$val"
234 ompi_count="`expr $ompi_count + 1`"
236 ompi_i="`expr $ompi_i - 1`"
240 # Take all the items in the "array" and assemble them back into a
244 ompi_done="`expr $ompi_i \> $ompi_count`"
246 while test "$ompi_done" = "0"; do
247 ompi_eval="ompi_newval=\"$ompi_newval \$ompi_array_$ompi_i\""
250 ompi_eval="unset ompi_array_$ompi_i"
253 ompi_done="`expr $ompi_i \>= $ompi_count`"
254 ompi_i="`expr $ompi_i + 1`"
257 # Done; do the assignment
259 ompi_newval="`echo $ompi_newval`"
260 ompi_eval="$ompi_name=\"$ompi_newval\""
265 unset ompi_name ompi_i ompi_done ompi_newval ompi_eval ompi_count])dnl