~ubuntu-branches/ubuntu/hardy/openmpi/hardy-updates

« back to all changes in this revision

Viewing changes to config/ompi_config_subdir.m4

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2006-10-15 00:46:11 UTC
  • Revision ID: james.westby@ubuntu.com-20061015004611-uuhxnaxyjmuxfd5h
Tags: upstream-1.1
ImportĀ upstreamĀ versionĀ 1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl -*- shell-script -*-
 
2
dnl
 
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
 
8
dnl                         reserved.
 
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.
 
13
dnl $COPYRIGHT$
 
14
dnl 
 
15
dnl Additional copyrights may follow
 
16
dnl 
 
17
dnl $HEADER$
 
18
dnl
 
19
 
 
20
AC_DEFUN([OMPI_CONFIG_SUBDIR],[
 
21
#
 
22
# Invoke configure in a specific subdirectory.
 
23
#
 
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
 
28
#
 
29
subdir_dir="$1"
 
30
subdir_args="$2"
 
31
subdir_success="$3"
 
32
subdir_failure="$4"
 
33
 
 
34
#
 
35
# Sanity checks
 
36
#
 
37
 
 
38
if test "$subdir_dir" != ":" -a -d $srcdir/$subdir_dir; then
 
39
    AC_MSG_NOTICE([OMPI configuring in $subdir_dir])
 
40
 
 
41
    #
 
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
 
44
    # into it.
 
45
    #
 
46
 
 
47
    case $srcdir in
 
48
    .) 
 
49
        ;;
 
50
    *) 
 
51
        { case $subdir_dir in
 
52
        [[\\/]]* | ?:[[\\/]]* ) total_dir=;;
 
53
        *)                      total_dir=.;;
 
54
        esac
 
55
        temp=$subdir_dir
 
56
        for dir_part in `IFS='/\\'; set X $temp; shift; echo "$[@]"`; do
 
57
            case $dir_part in
 
58
            # Skip DOS drivespec
 
59
            ?:) total_dir=$dir_part ;;
 
60
            *)  total_dir=$total_dir/$dir_part
 
61
                test -d "$total_dir" ||
 
62
                mkdir "$total_dir" ||
 
63
                AC_MSG_ERROR([cannot create $subdir_dir])
 
64
                ;;
 
65
            esac
 
66
        done; }
 
67
 
 
68
        if test -d ./$subdir_dir; then :;
 
69
        else
 
70
            AC_MSG_ERROR([cannot create `pwd`/$subdir_dir])
 
71
        fi
 
72
        ;;
 
73
    esac
 
74
 
 
75
    #
 
76
    # Move into the target directory
 
77
    #
 
78
 
 
79
    subdir_parent=`pwd`
 
80
    cd $subdir_dir
 
81
 
 
82
    #
 
83
    # Make a "../" for each directory in $subdir_dir.
 
84
    #
 
85
 
 
86
    subdir_dots=`[echo $subdir_dir | sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g]'`
 
87
    #
 
88
    # Construct the --srcdir argument
 
89
    #
 
90
 
 
91
    case $srcdir in
 
92
    .)
 
93
        # In place
 
94
        subdir_srcdir="$srcdir"
 
95
        ;;
 
96
    [[\\/]* | ?:[\\/]*] )
 
97
        # Absolute path
 
98
        subdir_srcdir="$srcdir/$subdir_dir"
 
99
        ;;
 
100
    *)
 
101
        # Relative path
 
102
        subdir_srcdir="$subdir_dots$srcdir/$subdir_dir"
 
103
        ;;
 
104
    esac
 
105
 
 
106
    #
 
107
    # Construct the --cache-file argument
 
108
    #
 
109
 
 
110
dnl    case $cache_file in
 
111
dnl    [[\\/]* | ?:[\\/]*] )
 
112
dnl     # Absolute path
 
113
dnl     subdir_cache_file="$cache_file"
 
114
dnl     ;;
 
115
dnl    *)
 
116
dnl     # Relative path
 
117
dnl        subdir_cache_file="$subdir_dots$cache_file"
 
118
dnl     ;;
 
119
dnl    esac
 
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"
 
123
 
 
124
    #
 
125
    # Invoke the configure script in the subdirectory
 
126
    #
 
127
 
 
128
    export CFLAGS CPPFLAGS
 
129
    export CXXFLAGS CXXCPPFLAGS
 
130
    export FFLAGS
 
131
    export LDFLAGS LIBS
 
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
 
137
        eval $subdir_success
 
138
        AC_MSG_NOTICE([$sub_configure succeeded for $subdir_dir])
 
139
    else
 
140
        eval $subdir_failure
 
141
        AC_MSG_NOTICE([$sub_configure *failed* for $subdir_dir])
 
142
    fi
 
143
 
 
144
    #
 
145
    # Go back to the topdir
 
146
    #
 
147
 
 
148
    cd $subdir_parent
 
149
fi
 
150
 
 
151
#
 
152
# Clean up
 
153
#
 
154
 
 
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