File: aclocal_subcfg.m4

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (198 lines) | stat: -rw-r--r-- 8,556 bytes parent folder | download | duplicates (2)
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
dnl Sandbox configure with additional arguments
dnl Usage: PAC_CONFIG_SUBDIR_ARGS(subdir,configure-args,configure-args-to-remove,action-if-success,action-if-failure)
dnl
dnl The subconfigure argument list is created based on "ac_precious_vars"
dnl instead of explicitly use of well-known Makefile variables, like
dnl CC/CFLAGS/CPPFLAGS..., this generalization is effective as long as
dnl calling configure.ac declares the needed variables to be passed down
dnl to subconfigure as "precious" appropriately.  The precious variable
dnl can be created in the following ways:
dnl 1) implicit declaration through use of autoconf macros, like
dnl    AC_PROG_CC (declares CC/CFLAGS/CPPFLAGS/LIBS/LDFLAGS), or
dnl    AC_PROG_F77 (declares F77/FFLAGS/FLIBS) ... 
dnl    which are in turns invoked by other subconfigure.
dnl    When in doubt, check "ac_precious_var" in the calling configure.
dnl 2) explicit "precious" declaration through AC_ARG_VAR.
dnl Without correct "precious" declaration in the calling configure.ac,
dnl there would be variables not being included in the subconfigure
dnl argument list.
dnl
dnl Note: I suspect this DEFUN body is underquoted in places, but it does not
dnl seem to cause problems in practice yet. [goodell@ 2010-05-18]
AC_DEFUN([PAC_CONFIG_SUBDIR_ARGS],[
        dnl BWB: hack to make --help=recursive work with these
        dnl configure options.  Lifted from AC_CONFIG_SUBDIRS.
        m4_append([_AC_LIST_SUBDIRS], [$1], [
])dnl

        pac_dir="$1"
        AC_MSG_NOTICE([===== configuring $1 =====])

	pac_abs_srcdir=`(cd $srcdir && pwd)`

	if test -f $pac_abs_srcdir/$1/setup ; then
           AC_MSG_NOTICE([sourcing $pac_abs_srcdir/$1/setup])
	   . $pac_abs_srcdir/$1/setup
	fi

        # Adapted for MPICH from the autoconf-2.67 implementation of
        # AC_CONFIG_SUBDIRS.  Search for "MPICH note:" for relevant commentary and
        # local modifications.

        # Remove --cache-file, --srcdir, and --disable-option-checking arguments
        # so they do not pile up.  Otherwise relative paths (like --srcdir=.. from
        # make distcheck) will be incorrect.
        pac_sub_configure_args="$2"
        pac_prev=
        eval "set x $ac_configure_args"
        shift
        for pac_arg
        do
          if test -n "$pac_prev"; then
            pac_prev=
            continue
          fi
          case $pac_arg in
          -cache-file | --cache-file | --cache-fil | --cache-fi \
          | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
            pac_prev=cache_file ;;
          -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
          | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
          | --c=*)
            ;;
          --config-cache | -C)
            ;;
          -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
            pac_prev=srcdir ;;
          -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
            ;;
          -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
            pac_prev=prefix ;;
          -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
            ;;
          --disable-option-checking)
            ;;
          *)
            # strip out precious variables from ac_configure_args,
            # which will include precious variables that are currently
            # set and were set on the command line or in the
            # environment at the time configure was invoked.  Instead,
            # we add all precious variables which have been tagged as
            # set, so that we can more closely control the environment
            # of sub-configures.
            is_precious=0
            for pac_pvar in $ac_precious_vars ; do
                # check if configure argument token contains the
                # precious variable, i.e. "name_of_prec_var=".
                if ( echo $pac_arg | grep "^$pac_pvar=" >/dev/null 2>&1 ) ; then
                    is_precious=1
                    break
                fi
            done
            if test $is_precious -eq 0; then
              case $pac_arg in
              *\'*) pac_arg=`AS_ECHO(["$pac_arg"]) | sed "s/'/'\\\\\\\\''/g"` ;;
              esac
              AS_VAR_APPEND([pac_sub_configure_args], [" '$pac_arg'"]) 
            fi ;;
          esac
        done

        # add all precious values with a set token to the configure
        # args.  If the caller hasn't artificially manipulated the
        # environment, this will simply be any precious variables as
        # they were originally specified on the top-level configure
        # line (or in the environment at start of configure).
        # However, callers may manipulate that environment, preferably
        # with the OPAL_SUBDIR_ENV macros.
        for temp_var in $ac_precious_vars; do
            eval temp_var_set=\$ac_env_${temp_var}_set
            if test "$temp_var_set" = "set" ; then
                eval temp_val=\$$temp_var
                temp_arg="$temp_var=$temp_val"
                AS_VAR_APPEND([pac_sub_configure_args], [" '$temp_arg'"])
            fi
        done

        # Always prepend --prefix to ensure using the same prefix
        # in subdir configurations.
        # MPICH note: see tt#983 for an example of why this is necessary
        pac_arg="--prefix=$prefix"
        case $pac_arg in
        *\'*) pac_arg=`AS_ECHO(["$pac_arg"]) | sed "s/'/'\\\\\\\\''/g"` ;;
        esac
        pac_sub_configure_args="'$pac_arg' $pac_sub_configure_args"

        # Pass --silent
        if test "$silent" = yes; then
          pac_sub_configure_args="--silent $pac_sub_configure_args"
        fi

        # Always prepend --disable-option-checking to silence warnings, since
        # different subdirs can have different --enable and --with options.
        pac_sub_configure_args="--disable-option-checking $pac_sub_configure_args"

        # remove arguments specified in third argument from the
        # built-up list of arguments
        m4_ifnblank([$3],
                    [m4_foreach(opt, [$3], [pac_sub_configure_args=$(echo $pac_sub_configure_args | sed "s,'opt',,")
         ])])

        pac_popdir=`pwd`

        AS_MKDIR_P(["$pac_dir"])
        # MPICH note: we leave this internal macro reference for now.  We can clone
        # the macro locally if this turns out to be non-portable across several autoconf
        # versions.  It sets the following variables: ac_builddir,
        # ac_top_builddir_sub, ac_top_build_prefix, ac_srcdir, ac_top_srcdir,
        # ac_abs_top_builddir, ac_abs_builddir, ac_abs_top_srcdir, ac_abs_srcdir
        _AC_SRCDIRS(["$pac_dir"])

        cd "$pac_dir"

        # Check for guested configure; otherwise get Cygnus style
        # configure.  Look for configure in source tree and then the
        # build tree, as we sometimes configure from sub-tarballs
        # expanded in the build tree.
        if test -f "$ac_srcdir/configure.gnu"; then
          pac_sub_configure=$ac_srcdir/configure.gnu
        elif test -f "$ac_srcdir/configure"; then
          pac_sub_configure=$ac_srcdir/configure
        elif test -f "configure.gnu"; then
	  pac_sub_configure="configure.gnu"
          ac_srcdir="."
        elif test -f "configure"; then
	  pac_sub_configure="configure"
          ac_srcdir="."
        else
          AC_MSG_WARN([no configuration information is in $pac_dir])
          pac_sub_configure=
        fi

        # The recursion is here.
        if test -n "$pac_sub_configure"; then
          # MPICH note: overriding the cache file on purpose to prevent strange
          # issues resulting from inter-dir caching
          pac_sub_cache_file="/dev/null"

          AC_MSG_NOTICE([running $SHELL $pac_sub_configure $pac_sub_configure_args --cache-file=$pac_sub_cache_file --srcdir=$ac_srcdir])
          # The eval makes quoting arguments work.
          # MPICH note: we want to execute the provided actions, not be silent
          # or error out if the subconfigure succeeded/failed
          if eval "\$SHELL \"\$pac_sub_configure\" $pac_sub_configure_args \
               --cache-file=\"\$pac_sub_cache_file\" --srcdir=\"\$ac_srcdir\""
          then
            # restore the current dir for the provided actions
            cd "$pac_popdir"
            $4
          else
            # restore the current dir for the provided actions
            cd "$pac_popdir"
            $5
          fi
        fi

        cd "$pac_popdir"

        AC_MSG_NOTICE([===== done with $1 configure =====])
])