Commit faab09fe authored by Lynn Garren's avatar Lynn Garren
Browse files

adding RefCount to the head of the repository

parent dd8b571b
Makefile.in
configure
aclocal.m4
autom4te.cache
config.h.in
#-------------------------------------------------------------
# installing from a source code tar ball
#-------------------------------------------------------------
Unwind the source code tar ball in some relevant directory.
Autoconf and automake will aready have been run.
Determine where the files will be installed.
Create a build directory that is NOT in the source code directory tree.
cd <build_directory>
<source_code_direcotry>/configure --prefix=<install_dir>
(Note that files will be installed under /usr/local if you do not
specify a prefix.)
make
(Build temporary copies of libraries and executables.)
make check
(Run the tests.)
make install
(Copy libraries, headers, executables, etc. to relevant
subdirectories under <install_dir>.)
#-------------------------------------------------------------
# building from cvs
#-------------------------------------------------------------
You will need current versions of automake, autoconf, and libtool.
See building autotools below.
cvs co CLHEP/package OR cvs co package
cd [CLHEP/]package
bootstrap
Now continue with directions as if you unpacked a source code tarball.
#-------------------------------------------------------------
# building autotools
#-------------------------------------------------------------
If you do not have at least autoconf 2.57 and automake 1.6, you will
need to build autoconf, automake, and libtool. On some platforms,
you may also need to build m4 and texinfo.
Download the relevant tarballs from gnu.org.
Untar them in a common source code tree.
Decide whether you want to install them in /usr/local or your own
install directory. If you use your own install directory, use
--prefix=<install_dir>
with configure.
For each autotool package:
<source_code_dir>/configure [--prefix=<install_dir>]
make
make install
Make sure that <install_dir>/bin is at the front of your path.
#-------------------------------------------------------------
## Process this file with automake to produce Makefile.in
includedir = $(prefix)/include/CLHEP
# put . first so that CLHEP directory is built before anything else
SUBDIRS = RefCount . src
# list all subdirectories - for distribution and cleaning
DIST_SUBDIRS = RefCount . src
bin_SCRIPTS = RefCount-config
all-local: $(top_builddir)/CLHEP
# create temporary CLHEP header tree
# search for header directories in the following order:
# 1. $(top_srcdir)/..
# 2. $(CLHEPSOURCE_DIR)/CLHEP
# 3. $(CLHEP_DIR)/CLHEP
#
# abs_ => absolute path
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
$(top_builddir)/CLHEP:
mkdir $(top_builddir)/CLHEP;
cd $(abs_top_builddir); list=`ls $(abs_top_srcdir)/..`; \
for pkg in $$list; do \
if test -d $(abs_top_srcdir)/../"$$pkg"/"$$pkg"; then \
(cd $(abs_top_builddir)/CLHEP; mkdir $$pkg; cd $$pkg; \
hdrs=`ls $(abs_top_srcdir)/../$$pkg/$$pkg`; \
for hdr in $$hdrs; do $(LN_S) $(abs_top_srcdir)/../$$pkg/$$pkg/$$hdr $$hdr; done; \
if test -f $(abs_top_builddir)/../"$$pkg"/"$$pkg"/defs.h; then $(LN_S) $(abs_top_builddir)/../$$pkg/$$pkg/defs.h defs.h; fi; \
if test -f $(abs_top_builddir)/"$$pkg"/defs.h && test ! -e defs.h ; then $(LN_S) $(abs_top_builddir)/$$pkg/defs.h defs.h; fi); \
fi; done
cd $(abs_top_builddir); \
if test -n "$(CLHEPSOURCE_DIR)" && test -d $(CLHEPSOURCE_DIR)/CLHEP; then \
(list=`ls $(CLHEPSOURCE_DIR)/CLHEP`; \
for pkg in $$list; do cd $(abs_top_builddir)/CLHEP; \
if test -d $(CLHEPSOURCE_DIR)/CLHEP/"$$pkg"/"$$pkg" && test ! -d "$$pkg"; then \
(mkdir $$pkg; cd $$pkg; \
hdrs=`ls $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg`; \
for hdr in $$hdrs; do $(LN_S) $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $$hdr; done); \
fi; done); fi
cd $(abs_top_builddir); \
if test -n "$(CLHEP_DIR)" && test -d $(CLHEP_DIR)/CLHEP; then \
(list=`ls $(CLHEP_DIR)/CLHEP`; \
for pkg in $$list; do cd $(abs_top_builddir)/CLHEP; \
if test -d $(CLHEP_DIR)/CLHEP/"$$pkg"/"$$pkg" && test ! -d "$$pkg"; then \
(mkdir $$pkg; cd $$pkg; \
hdrs=`ls $(CLHEP_DIR)/CLHEP/$$pkg/$$pkg`; \
for hdr in $$hdrs; do $(LN_S) $(CLHEP_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $$hdr; done); \
fi; done); fi
docs:
cd doc; $(MAKE) $(AM_MAKEFLAGS)
install-docs:
cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs
# extra clean rule
clean-local:
rm -rf $(top_builddir)/CLHEP
#! /bin/sh
# @configure_input@
prefix=@prefix@
exec_prefix=@exec_prefix@
includedir=@includedir@
usage()
{
cat >2 <<EOF
Usage: RefCount-config [OPTION]
Known values for OPTION are:
--prefix show installation prefix
--cxx print compilation command
--cppflags print pre-processor flags
--cxxflags print C++ compiler flags
--ldflags print linker flags
--libs print libraries to link against
--help display this help and exit
--version output version information
EOF
exit $1
}
if test $# -eq 0; then
usage 1
fi
while test $# -gt 0; do
case "$1" in
-*=*)
optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
;;
*)
optarg=
;;
esac
case "$1" in
--prefix=*)
prefix="$optarg"
;;
--prefix)
echo "$prefix"
;;
--version)
echo @PACKAGE@ @VERSION@
exit 0
;;
--help)
usage 0
;;
--cxx)
echo @CXX@
;;
--cppflags)
echo @AM_CPPFLAGS@ @CPPFLAGS@ @RefCount_CPPFLAGS@
;;
--cxxflags)
echo @AM_CXXFLAGS@ @CXXFLAGS@
;;
--ldflags)
echo @AM_LDFLAGS@ @LDFLAGS@ @RefCount_LDFLAGS@
;;
--libs)
echo @LIBS@ @RefCount_LIBS@ -lm
;;
*)
usage
exit 1
;;
esac
shift
done
exit 0
CLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@
Makefile.in
defs.h.in
## Process this file with automake to produce Makefile.in
includedir = $(prefix)/include/CLHEP
pkginclude_HEADERS = \
ZMhandleTo.h \
ZMhandleTo.icc \
ZMuseCount.h \
ZMuseCount.icc \
defs.h
# Identify generated file(s) to be removed when 'make clean' is requested:
CLEANFILES = defs.h
#ifndef ZMHANDLETO_H
#define ZMHANDLETO_H
// ----------------------------------------------------------------------
//
// ZMhandleTo.h - generic handle class for objects that need to be
// reference-counted
//
// History:
// 19-Sep-1997 WEB Design stolen, and code adapted, from
// Stroustrup: "The C++ Programming Language, 3rd edition" (1997), p 783
// Koenig & Moo: "Ruminations on C++" (1996), ch 7
//
// ----------------------------------------------------------------------
#ifndef ZMUSECOUNT_H
#include "CLHEP/RefCount/ZMuseCount.h"
#endif
template< class T >
class ZMhandleTo {
public:
ZMhandleTo();
ZMhandleTo( const ZMhandleTo & h );
~ZMhandleTo();
ZMhandleTo & operator=( const ZMhandleTo & rhs );
protected:
ZMhandleTo( const T & t );
ZMhandleTo( const T * t );
ZMuseCount u_;
T * rep_;
}; // ZMhandleTo<>
#include "CLHEP/RefCount/ZMhandleTo.icc"
#endif // ZMHANDLETO_H
// ----------------------------------------------------------------------
//
// ZMhandleTo.icc - generic handle class for objects that need to be
// reference-counted
//
// History:
// 19-Sep-1997 WEB Design stolen, and code adapted, from
// Stroustrup: "The C++ Programming Language, 3rd ed" (1997), p 783
// Koenig & Moo: "Ruminations on C++" (1996), ch 7
// 22-Sep-1997 WEB Updated to require (& use) clone() operator
// for reference-counted objects; this is to insure against a user's
// destroying the object while one or more handles are still pointing
// to it
//
// ----------------------------------------------------------------------
template< class T>
inline ZMhandleTo<T>::ZMhandleTo()
: u_()
, rep_( new T )
{ ; }
template< class T>
inline ZMhandleTo<T>::ZMhandleTo( const ZMhandleTo<T> & h )
: u_ ( h.u_ )
, rep_( h.rep_ )
{ ; } // copy constructor, share the representation
template< class T>
inline ZMhandleTo<T>::~ZMhandleTo() {
if ( u_.only() )
delete rep_;
} // destructor
template< class T>
inline ZMhandleTo<T> & ZMhandleTo<T>::operator=( const ZMhandleTo<T> & rhs ) {
if ( u_.reattach( rhs.u_) )
delete rep_;
rep_ = rhs.rep_;
return *this;
} // operator=()
template< class T>
inline ZMhandleTo<T>::ZMhandleTo( const T & t )
: rep_( t.clone() )
{ ; }
template< class T>
inline ZMhandleTo<T>::ZMhandleTo( const T * t )
: rep_( t->clone() )
{ ; }
#ifndef ZMUSECOUNT_H
#define ZMUSECOUNT_H
// ----------------------------------------------------------------------
//
// ZMuseCount.h - utility class for use in reference-counting
//
//
// History:
// 19-Sep-1997 WEB Design stolen, and code adapted, from pp 70-73 of
// Koenig & Moo: "Ruminations on C++" (1996)
//
// ----------------------------------------------------------------------
class ZMuseCount {
public:
// --------------------------
// Constructors & destructor:
// --------------------------
ZMuseCount();
// Constructor
ZMuseCount( const ZMuseCount & u );
// Copy constructor
~ZMuseCount();
// Destructor
// -----------------------------------
// Functions useful to a handle class:
// -----------------------------------
bool only();
// Is there exactly one copy of the referent?
bool makeonly();
// Enables the handle (to a ClassType) to refer to a unique (copy of)
// the referent via the following usage:
// if ( u.makeonly() ) /* ZMuseCount u; */
// p = new ClassType( *p ); /* ClassType * p; */
// This is useful in implementing copy-on-write semantics
// (i.e., non-shared or value semantics), and would appear just before
// updating (any part of) *p in such a context.
bool reattach( const ZMuseCount & u );
// Simplifies a handle's implementation of assignment via the following
// usage:
// if ( u.reattach(h.u) ) /* Handle<ClassType> h; */
// delete p; /* p and u as above */
// p = h.p;
private:
int * p;
// *p is the reference counter itself
ZMuseCount & operator=( const ZMuseCount & );
// Forbidden operation on a ZMuseCount object
}; // ZMuseCount
//#include "CLHEP/RefCount/ZMuseCount.icc"
#endif // ZMUSECOUNT_H
// ----------------------------------------------------------------------
//
// ZMuseCount.icc - utility class for use in reference-counting
//
//
// History:
// 19-Sep-1997 WEB Design stolen, and code adapted, from pp 70-73 of
// Koenig & Moo: "Ruminations on C++" (1996)
// 23-Sep-1997 WEB Furnished overlooked body of copy constructor.
//
// ----------------------------------------------------------------------
ZMuseCount::ZMuseCount()
: p( new int(1) )
{
// DEBUG if ( p == 0 )
// DEBUG std::cerr << "ZMuseCount memory allocation failure!" << std::endl;
}
ZMuseCount::ZMuseCount( const ZMuseCount & u )
: p( u.p )
{
++*p;
}
ZMuseCount::~ZMuseCount() {
if ( --*p == 0 )
delete p;
}
bool ZMuseCount::only() {
return *p == 1;
}
config.sub
config.guess
depcomp
install-sh
missing
mkinstalldirs
This diff is collapsed.
#! /bin/sh
# run autotool commands
set -x
aclocal -I autotools
autoheader
automake --add-missing --copy
autoconf
# ready to make a source code distribution tarball
# ======================================================================
# This is the RefCount configuration input file
# Process this file with autoconf to produce a configure script.
# ======================================================================
# ----------------------------------------------------------------------
# Identify the package and initialize the autotools:
# ----------------------------------------------------------------------
AC_PREREQ(2.57)
AC_INIT(CLHEP RefCount, 2.0.0.0, CLHEP@cern.ch, RefCount)
AC_CONFIG_AUX_DIR(autotools)
AC_CANONICAL_TARGET
AC_CONFIG_SRCDIR([src/ZMuseCount.cc])
AM_INIT_AUTOMAKE(1.6 foreign)
AC_PROG_LIBTOOL
AC_PROG_LN_S
AC_PROG_INSTALL
# ----------------------------------------------------------------------
# Identify the files that 'configure' is to produce:
# ----------------------------------------------------------------------
# Header containing #defines:
AM_CONFIG_HEADER([RefCount/defs.h])
# Makefiles:
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([RefCount/Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([RefCount-deps])
# Configuration inquiry program/script:
AC_CONFIG_FILES([RefCount-config], [chmod +x RefCount-config])
# ----------------------------------------------------------------------
# Capture post-install information:
# ----------------------------------------------------------------------
RefCount_CPPFLAGS="-I$includedir"
RefCount_LDFLAGS="-L$libdir"
RefCount_LIBS="-lCLHEP-$PACKAGE-$VERSION"
AC_SUBST(RefCount_CPPFLAGS)
AC_SUBST(RefCount_LIBS)
AC_SUBST(RefCount_LDFLAGS)
# ----------------------------------------------------------------------
# Supply boilerplate for RefCount/defs.h source header:
# ----------------------------------------------------------------------
AH_TOP([#ifndef REFCOUNT_DEFS_H
#define REFCOUNT_DEFS_H])
## the undefs are converted by configure
AH_VERBATIM([PACKAGE],[/* Name of package */
#ifndef PACKAGE
#undef PACKAGE
#endif])
AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */
#ifndef PACKAGE_BUGREPORT
#undef PACKAGE_BUGREPORT
#endif])
AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */
#ifndef PACKAGE_NAME
#undef PACKAGE_NAME
#endif])
AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */
#ifndef PACKAGE_STRING
#undef PACKAGE_STRING
#endif])
AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */
#ifndef PACKAGE_TARNAME
#undef PACKAGE_TARNAME
#endif])
AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */
#ifndef PACKAGE_VERSION
#undef PACKAGE_VERSION
#endif])
AH_VERBATIM([VERSION],[/* Version number of package */
#ifndef VERSION
#undef VERSION
#endif])
## backwards compatibility
AH_VERBATIM([ENABLE_BACKWARDS_COMPATIBILITY],[/* backwards compatibility will be enabled ONLY in CLHEP 1.9 */
#ifndef ENABLE_BACKWARDS_COMPATIBILITY
#define ENABLE_BACKWARDS_COMPATIBILITY
#endif])
AH_BOTTOM([#endif // REFCOUNT_DEFS_H])
# ----------------------------------------------------------------------
# Account for any user configuration options:
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Check for needed programs:
# ----------------------------------------------------------------------
# Locate a C++ compiler:
AC_PROG_CXX(g++ c++ aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC gpp)
# Use it hereinafter:
AC_LANG(C++)
# Ensure we've found a preprocessor:
AC_REQUIRE_CPP
# worry about compiler flags
case "$target" in
*-*-win32*)
case "$CXX" in
cl) CXXFLAGS="-DWIN32 -O -GX -GR -MD";;
g++) CXXFLAGS="-O";;
c++) CXXFLAGS="-O";;
*) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX
esac;;
*-*-cygwin*)
case "$CXX" in
cl) CXXFLAGS="-DWIN32 -O -GX -GR -MD";;
g++) CXXFLAGS="-O -ansi -pedantic -Wall";;
c++) CXXFLAGS="-O -ansi -pedantic -Wall";;
*) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX
esac;;
*-*-solaris*)
case "$CXX" in
CC) CXXFLAGS="-O -mt";;
g++) CXXFLAGS="-O -ansi -pedantic -Wall";;
c++) CXXFLAGS="-O -ansi -pedantic -Wall";;
*) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX
esac;;
*-*-linux*)
case "$CXX" in
g++) CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE";;
c++) CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE";;
*) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX
esac;;
alpha*-dec-osf*)
case "$CXX" in
cxx) CXXFLAGS="-O -std strict_ansi -timplicit_local";;
g++) CXXFLAGS="-O -ansi -pedantic -Wall";;
c++) CXXFLAGS="-O -ansi -pedantic -Wall";;
*) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX
esac;;
*-*-hpux*)
case "$CXX" in
aCC) CXXFLAGS="-O -Aa +DAportable +Onolimit";;
CC) CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit";;
g++) CXXFLAGS="-O -ansi -pedantic -Wall";;
c++) CXXFLAGS="-O -ansi -pedantic -Wall";;
*) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX