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_CONFIG_SUBDIR],[
22
# Invoke configure in a specific subdirectory.
24
# $1 is the directory to invoke in
25
# $2 is the list of arguments to pass
26
# $3 is actions to execute upon success
27
# $4 is actions to execute upon failure
38
if test "$subdir_dir" != ":" -a -d $srcdir/$subdir_dir; then
39
AC_MSG_NOTICE([OMPI configuring in $subdir_dir])
42
# Gotta check where srcdir is for VPATH builds. If srcdir is not
43
# ., then we need to mkdir the subdir. Otherwise, we can just cd
52
[[\\/]]* | ?:[[\\/]]* ) total_dir=;;
56
for dir_part in `IFS='/\\'; set X $temp; shift; echo "$[@]"`; do
59
?:) total_dir=$dir_part ;;
60
*) total_dir=$total_dir/$dir_part
61
test -d "$total_dir" ||
63
AC_MSG_ERROR([cannot create $subdir_dir])
68
if test -d ./$subdir_dir; then :;
70
AC_MSG_ERROR([cannot create `pwd`/$subdir_dir])
76
# Move into the target directory
83
# Make a "../" for each directory in $subdir_dir.
86
subdir_dots=`[echo $subdir_dir | sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g]'`
88
# Construct the --srcdir argument
94
subdir_srcdir="$srcdir"
98
subdir_srcdir="$srcdir/$subdir_dir"
102
subdir_srcdir="$subdir_dots$srcdir/$subdir_dir"
107
# Construct the --cache-file argument
110
dnl case $cache_file in
111
dnl [[\\/]* | ?:[\\/]*] )
113
dnl subdir_cache_file="$cache_file"
117
dnl subdir_cache_file="$subdir_dots$cache_file"
120
# BWB - subdir caching is a pain since we change CFLAGS and all that.
121
# Just disable it for now
122
subdir_cache_file="/dev/null"
125
# Invoke the configure script in the subdirectory
128
export CFLAGS CPPFLAGS
129
export CXXFLAGS CXXCPPFLAGS
132
sub_configure="$SHELL '$subdir_srcdir/configure'"
133
AC_MSG_NOTICE([running $sub_configure $subdir_args --cache-file=$subdir_cache_file --srcdir=$subdir_srcdir])
134
eval "$sub_configure $subdir_args \
135
--cache-file=\"\$subdir_cache_file\" --srcdir=\"$subdir_srcdir\""
136
if test "$?" = "0"; then
138
AC_MSG_NOTICE([$sub_configure succeeded for $subdir_dir])
141
AC_MSG_NOTICE([$sub_configure *failed* for $subdir_dir])
145
# Go back to the topdir
155
unset subdir_parent sub_configure subdir_dir subdir_srcdir subdir_cache_file
156
unset subdir_args subdir_dots total_dir dir_part temp])dnl