Please check the GNU Autoconf Macro Archive for Updates
AC-Archive
Autoconf Macro Archive

ac-archive.sf.net: - Project CVS - Download
Macro Index
- AM Support
- C++ Support
- C Support
- Fortran Support
- Java Support
- Cross Compilation
- Installed Packages
- Miscellaneous
- LaTeX Support
- Uncategorized
- archive macros
- adl's macros
- bkorb's macros
- guidod's macros
- latex's macros
- other's macros
- rleigh's macros
- obsoleted macros
- released macros
- search index

Documentation
- Contribute!
- History
- acincludedir m4
- acinclude (tool)
- macro howto
- ax tricks
- maintainers
- License
- Topics

generated...
2007-08-05

(C) 2007 guidod
Download the M4 Source.

ac_cxx_template_objs

Back to the Main Page.

Synopsis
AC_CXX_TEMPLATE_OBJS
, 
Version

2005-01-25

Author

Luc Maisonobe <luc@spaceroots.org>

License

AllPermissive
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. Users of this software should generally follow the principles of the MIT License includings its disclaimer.

Category

cryp.to ac-archive's Obsoleted (obsoleted)

Documentation

  • obsoleted Unnecessary with recent versions of libtool.

NOTE: AC_CXX_TEMPLATE_OBJS macro is not needed anymore, recent versions of libtool handle correctly these extra object files by recognizing the SUN compiler "CC" and using it with the "-xar" switch to pack libraries instead of using the more classical "ar" command. Using recent libtool with the SUN compiler AND this macro does not work at all.

This macro tries to find the place where the objects files resulting from templates instantiations are stored and the associated compiler flags. This is particularly useful to include these files in libraries. Currently only g++/egcs and SUN CC are supported (there is nothing to be done for the formers while the latter uses directory ./Templates.DB if you use the -ptr. flag). This macro sets the CXXFLAGS if needed, it also sets the output variable TEMPLATES_OBJ. Note that if you use libtool, this macro does work correctly with the SUN compilers ONLY while building static libraries. Since there are sometimes problems with exception handling with multiple levels of shared libraries even with g++ on this platform, you may wish to enforce the usage of static libraires there. You can do this by putting the following statements in your configure.in file:

  AC_CANONICAL_HOST
  case x$host_os in
    xsolaris*) AC_DISABLE_SHARED ;;
  esac
  AM_PROG_LIBTOOL

M4 Source Code
AC_DEFUN([AC_CXX_TEMPLATE_OBJS],
dnl
dnl This macro is OBSOLETE; do not use.
dnl
[AC_CACHE_CHECK(where template objects are stored, ac_cv_cxx_templobjs,
 [ ac_cv_cxx_templobjs='unknown'
   if test "$GXX" = yes; then
     ac_cv_cxx_templobjs='nowhere'
   else
     case $CXX in
       CC|*/CC)
        cat &gt; conftest.cc &lt;&lt;EOF
template&lt;class T&gt; class A { public : A () {} };
template&lt;class T&gt; void f (const A&lt;T&gt;&amp;) {}
main()
{ A&lt;double&gt; d;
  A&lt;int&gt; i;
  f (d);
  f (i);
  return 0;
}
EOF
        if test "$ac_cv_cxx_templobjs" = 'unknown' ; then
          if test -d Templates.DB ; then
            rm -fr Templates.DB
          fi
          if $CXX $CXXFLAGS -ptr. -c conftest.cc 1&gt; /dev/null 2&gt;&amp;1; then
            if test -d Templates.DB ; then
#             this should be Sun CC &lt;= 4.2
              CXXFLAGS="$CXXFLAGS -ptr."
              if test x"$LIBTOOL" = x ; then
                ac_cv_cxx_templobjs='Templates.DB/*.o'
              else
                ac_cv_cxx_templobjs='Templates.DB/*.lo'
              fi
              rm -fr Templates.DB
            fi
          fi
        fi
        if test "$ac_cv_cxx_templobjs" = 'unknown' ; then
          if test -d SunWS_cache ; then
            rm -fr SunWS_cache
          fi
          if $CXX $CXXFLAGS -c conftest.cc 1&gt; /dev/null 2&gt;&amp;1; then
            if test -d SunWS_cache ; then
#             this should be Sun WorkShop C++ compiler 5.x
#             or Sun Forte C++ compiler &gt;= 6.x
              if test x"$LIBTOOL" = x ; then
                ac_cv_cxx_templobjs='SunWS_cache/*/*.o'
              else
                ac_cv_cxx_templobjs='SunWS_cache/*/*.lo'
              fi
              rm -fr SunWS_cache
            fi
          fi
        fi
        rm -f conftest* ;;
     esac
   fi
   case "x$ac_cv_cxx_templobjs" in
     xunknown|xnowhere)
     TEMPLATE_OBJS="" ;;
     *)
     TEMPLATE_OBJS="$ac_cv_cxx_templobjs" ;;
   esac
   AC_SUBST(TEMPLATE_OBJS)])])