2004-01-07 10:39:52 +03:00
|
|
|
dnl -*- shell-script -*-
|
|
|
|
dnl
|
2004-11-22 04:38:40 +03:00
|
|
|
dnl Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
dnl All rights reserved.
|
|
|
|
dnl Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
dnl All rights reserved.
|
|
|
|
dnl $COPYRIGHT$
|
|
|
|
dnl
|
|
|
|
dnl Additional copyrights may follow
|
|
|
|
dnl
|
2004-01-07 10:39:52 +03:00
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
define([OMPI_CXX_FIND_TEMPLATE_REPOSITORY],[
|
2004-01-07 10:39:52 +03:00
|
|
|
#
|
|
|
|
# Arguments: None
|
|
|
|
#
|
|
|
|
# Dependencies: None
|
|
|
|
#
|
|
|
|
# See if the compiler makes template repository directories
|
|
|
|
# Warning: this is a really screwy example! -JMS
|
|
|
|
#
|
2004-06-07 19:33:53 +04:00
|
|
|
# Sets OMPI_CXX_TEMPLATE_REPOSITORY to the template repository, or blank.
|
2004-01-07 10:39:52 +03:00
|
|
|
# Must call AC_SUBST manually
|
|
|
|
#
|
|
|
|
|
|
|
|
# Find the repository
|
|
|
|
AC_MSG_CHECKING([for C++ template repository directory])
|
|
|
|
mkdir conf_tmp_$$
|
|
|
|
cd conf_tmp_$$
|
|
|
|
cat > conftest.h <<EOF
|
|
|
|
template <class T>
|
|
|
|
class foo {
|
|
|
|
public:
|
|
|
|
foo(T yow) : data(yow) { yow.member(3); };
|
|
|
|
void member(int i);
|
|
|
|
private:
|
|
|
|
T data;
|
|
|
|
};
|
|
|
|
|
|
|
|
class bar {
|
|
|
|
public:
|
|
|
|
bar(int i) { data = i; };
|
|
|
|
void member(int j) { data = data * j; };
|
|
|
|
|
|
|
|
private:
|
|
|
|
int data;
|
|
|
|
};
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat > conftest2.C <<EOF
|
|
|
|
#include "conftest.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
some_other_function(void)
|
|
|
|
{
|
|
|
|
foo<bar> var1(6);
|
|
|
|
foo< foo<bar> > var2(var1);
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat > conftest1.C <<EOF
|
|
|
|
#include "conftest.h"
|
|
|
|
|
|
|
|
void some_other_function(void);
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
void
|
|
|
|
foo<T>::member(int i)
|
|
|
|
{
|
|
|
|
i += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
foo<bar> var1(6);
|
|
|
|
foo< foo<bar> > var2(var1);
|
|
|
|
|
|
|
|
some_other_function();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_template_failed=
|
2004-01-07 10:39:52 +03:00
|
|
|
echo configure:__oline__: $CXX $CXXFLAGS -c conftest1.C >&5
|
|
|
|
$CXX $CXXFLAGS -c conftest1.C >&5 2>&5
|
|
|
|
if test ! -f conftest1.o ; then
|
|
|
|
AC_MSG_RESULT([templates not supported?])
|
|
|
|
echo configure:__oline__: here is the program that failed: >&5
|
|
|
|
cat conftest1.C >&5
|
|
|
|
echo configure:__oline__: here is conftest.h: >&5
|
|
|
|
cat conftest.h >&5
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_template_failed=1
|
2004-01-07 10:39:52 +03:00
|
|
|
else
|
|
|
|
echo configure:__oline__: $CXX $CXXFLAGS -c conftest2.C >&5
|
|
|
|
$CXX $CXXFLAGS -c conftest2.C >&5 2>&5
|
|
|
|
if test ! -f conftest2.o ; then
|
|
|
|
AC_MSG_RESULT([unknown error])
|
|
|
|
echo configure:__oline__: here is the program that failed: >&5
|
|
|
|
cat conftest2.C >&5
|
|
|
|
echo configure:__oline__: here is conftest.h: >&5
|
|
|
|
cat conftest.h >&5
|
|
|
|
else
|
|
|
|
rm -rf conftest*
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
for ompi_file in `ls`
|
2004-01-07 10:39:52 +03:00
|
|
|
do
|
2004-06-07 19:33:53 +04:00
|
|
|
if test "$ompi_file" != "." -a "$ompi_file" != ".."; then
|
2004-01-07 10:39:52 +03:00
|
|
|
# Is it a directory?
|
2004-06-07 19:33:53 +04:00
|
|
|
if test -d "$ompi_file"; then
|
|
|
|
ompi_template_dir="$ompi_file $ompi_template_dir"
|
2004-01-07 10:39:52 +03:00
|
|
|
|
|
|
|
# Or is it a file?
|
|
|
|
else
|
2004-06-07 19:33:53 +04:00
|
|
|
name="`echo $ompi_file | cut -d. -f1`"
|
2004-01-07 10:39:52 +03:00
|
|
|
|
|
|
|
temp_mask=
|
|
|
|
if test "$name" = "main" -o "$name" = "other"; then
|
2004-06-07 19:33:53 +04:00
|
|
|
temp_mask="`echo $ompi_file | cut -d. -f2`"
|
|
|
|
if test "$ompi_template_filemask" = ""; then
|
|
|
|
ompi_template_filemask="$temp_mask";
|
|
|
|
elif test "`echo $ompi_template_filemask | grep $temp_mask`" = ""; then
|
|
|
|
ompi_template_filemask="$ompi_template_filemask $temp_mask"
|
2004-01-07 10:39:52 +03:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
2004-06-07 19:33:53 +04:00
|
|
|
if test "$ompi_template_filemask" != ""; then
|
2004-01-07 10:39:52 +03:00
|
|
|
temp_mask=
|
2004-06-07 19:33:53 +04:00
|
|
|
for mask in $ompi_template_filemask
|
2004-01-07 10:39:52 +03:00
|
|
|
do
|
|
|
|
temp_mask="*.$mask $temp_mask"
|
|
|
|
done
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_template_filemask=$temp_mask
|
2004-01-07 10:39:52 +03:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_CXX_TEMPLATE_REPOSITORY="$ompi_template_dir $ompi_template_filemask"
|
2004-01-07 10:39:52 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
if test "`echo $OMPI_CXX_TEMPLATE_REPOSITORY`" != ""; then
|
|
|
|
AC_MSG_RESULT([$OMPI_CXX_TEMPLATE_REPOSITORY])
|
2004-01-07 10:39:52 +03:00
|
|
|
else
|
|
|
|
AC_MSG_RESULT([not used])
|
|
|
|
fi
|
|
|
|
cd ..
|
|
|
|
rm -rf conf_tmp_$$
|
|
|
|
|
|
|
|
# Clean up
|
2004-06-07 19:33:53 +04:00
|
|
|
unset ompi_file ompi_template_failed ompi_template_dir])dnl
|