2008-10-28 20:22:29 +03:00
|
|
|
dnl -*- shell-script -*-
|
|
|
|
dnl
|
|
|
|
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
dnl University Research and Technology
|
|
|
|
dnl Corporation. All rights reserved.
|
|
|
|
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
dnl of Tennessee Research Foundation. All rights
|
|
|
|
dnl reserved.
|
2015-06-24 06:59:57 +03:00
|
|
|
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2008-10-28 20:22:29 +03:00
|
|
|
dnl University of Stuttgart. All rights reserved.
|
|
|
|
dnl Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
dnl All rights reserved.
|
2015-04-14 16:48:04 +03:00
|
|
|
dnl Copyright (c) 2012-2015 Cisco Systems, Inc. All rights reserved.
|
2014-05-06 20:27:38 +04:00
|
|
|
dnl Copyright (c) 2014 Intel, Inc. All rights reserved.
|
2015-02-03 09:19:22 +03:00
|
|
|
dnl Copyright (c) 2015 Research Organization for Information Science
|
|
|
|
dnl and Technology (RIST). All rights reserved.
|
2008-10-28 20:22:29 +03:00
|
|
|
dnl $COPYRIGHT$
|
2015-06-24 06:59:57 +03:00
|
|
|
dnl
|
2008-10-28 20:22:29 +03:00
|
|
|
dnl Additional copyrights may follow
|
2015-06-24 06:59:57 +03:00
|
|
|
dnl
|
2008-10-28 20:22:29 +03:00
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
|
|
|
|
2014-05-06 20:27:38 +04:00
|
|
|
AC_DEFUN([OPAL_CONFIG_SUBDIR],[
|
2015-04-14 16:48:24 +03:00
|
|
|
OPAL_VAR_SCOPE_PUSH([subdir_parent sub_configure subdir_dir subdir_srcdir subdir_cache_file subdir_args subdir_dots total_dir dir_part temp])
|
|
|
|
|
2008-10-28 20:22:29 +03:00
|
|
|
#
|
|
|
|
# Invoke configure in a specific subdirectory.
|
|
|
|
#
|
|
|
|
# $1 is the directory to invoke in
|
|
|
|
# $2 is the list of arguments to pass
|
|
|
|
# $3 is actions to execute upon success
|
|
|
|
# $4 is actions to execute upon failure
|
|
|
|
#
|
|
|
|
subdir_dir="$1"
|
|
|
|
subdir_args="$2"
|
|
|
|
subdir_success="$3"
|
|
|
|
subdir_failure="$4"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Sanity checks
|
|
|
|
#
|
|
|
|
|
2015-02-03 09:19:22 +03:00
|
|
|
if test "$subdir_dir" != ":" && test -d $srcdir/$subdir_dir; then
|
2014-05-06 20:27:38 +04:00
|
|
|
AC_MSG_NOTICE([OPAL configuring in $subdir_dir])
|
2008-10-28 20:22:29 +03:00
|
|
|
|
|
|
|
#
|
|
|
|
# Gotta check where srcdir is for VPATH builds. If srcdir is not
|
|
|
|
# ., then we need to mkdir the subdir. Otherwise, we can just cd
|
|
|
|
# into it.
|
|
|
|
#
|
|
|
|
|
|
|
|
case $srcdir in
|
2015-06-24 06:59:57 +03:00
|
|
|
.)
|
2008-10-28 20:22:29 +03:00
|
|
|
;;
|
2015-06-24 06:59:57 +03:00
|
|
|
*)
|
2008-10-28 20:22:29 +03:00
|
|
|
{ case $subdir_dir in
|
|
|
|
[[\\/]]* | ?:[[\\/]]* ) total_dir=;;
|
|
|
|
*) total_dir=.;;
|
|
|
|
esac
|
|
|
|
temp=$subdir_dir
|
|
|
|
for dir_part in `IFS='/\\'; set X $temp; shift; echo "$[@]"`; do
|
|
|
|
case $dir_part in
|
|
|
|
# Skip DOS drivespec
|
|
|
|
?:) total_dir=$dir_part ;;
|
|
|
|
*) total_dir=$total_dir/$dir_part
|
|
|
|
test -d "$total_dir" ||
|
|
|
|
mkdir "$total_dir" ||
|
|
|
|
AC_MSG_ERROR([cannot create $subdir_dir])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done; }
|
|
|
|
|
|
|
|
if test -d ./$subdir_dir; then :;
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([cannot create `pwd`/$subdir_dir])
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
#
|
|
|
|
# Move into the target directory
|
|
|
|
#
|
|
|
|
|
|
|
|
subdir_parent=`pwd`
|
|
|
|
cd $subdir_dir
|
|
|
|
|
|
|
|
#
|
|
|
|
# Make a "../" for each directory in $subdir_dir.
|
|
|
|
#
|
|
|
|
|
|
|
|
subdir_dots=`[echo $subdir_dir | sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g]'`
|
|
|
|
#
|
|
|
|
# Construct the --srcdir argument
|
|
|
|
#
|
|
|
|
|
|
|
|
case $srcdir in
|
|
|
|
.)
|
|
|
|
# In place
|
|
|
|
subdir_srcdir="$srcdir"
|
|
|
|
;;
|
|
|
|
[[\\/]* | ?:[\\/]*] )
|
|
|
|
# Absolute path
|
|
|
|
subdir_srcdir="$srcdir/$subdir_dir"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# Relative path
|
|
|
|
subdir_srcdir="$subdir_dots$srcdir/$subdir_dir"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
#
|
|
|
|
# Construct the --cache-file argument
|
|
|
|
#
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
# BWB - subdir caching is a pain since we change CFLAGS and all that.
|
2008-10-28 20:22:29 +03:00
|
|
|
# Just disable it for now
|
|
|
|
subdir_cache_file="/dev/null"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Invoke the configure script in the subdirectory
|
|
|
|
#
|
|
|
|
|
|
|
|
sub_configure="$SHELL '$subdir_srcdir/configure'"
|
2009-05-23 01:45:23 +04:00
|
|
|
AC_MSG_NOTICE([running $sub_configure $subdir_args --cache-file=$subdir_cache_file --srcdir=$subdir_srcdir --disable-option-checking])
|
2008-10-28 20:22:29 +03:00
|
|
|
eval "$sub_configure $subdir_args \
|
2009-05-23 01:45:23 +04:00
|
|
|
--cache-file=\"\$subdir_cache_file\" --srcdir=\"$subdir_srcdir\" --disable-option-checking"
|
2008-10-28 20:22:29 +03:00
|
|
|
if test "$?" = "0"; then
|
|
|
|
eval $subdir_success
|
|
|
|
AC_MSG_NOTICE([$sub_configure succeeded for $subdir_dir])
|
|
|
|
else
|
|
|
|
eval $subdir_failure
|
|
|
|
AC_MSG_NOTICE([$sub_configure *failed* for $subdir_dir])
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Go back to the topdir
|
|
|
|
#
|
|
|
|
|
|
|
|
cd $subdir_parent
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Clean up
|
|
|
|
#
|
|
|
|
|
2015-04-14 16:48:24 +03:00
|
|
|
OPAL_VAR_SCOPE_POP])dnl
|