diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index a56cdbc23..efd38b127 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -94,14 +94,14 @@ AC_PROG_AWK
AC_PROG_CC
AC_PROG_CXX
-dnl do not test gcc version on mac. clang as gcc will return version and it's not >= 4.8
+dnl do not test gcc version on mac. clang as gcc will return version and it's not >= 5
AS_IF([test "$ON_MAC" = "no"],[TR_GCC_VERSION],[])
-dnl if the compiler is gcc, test for gcc >= 4.8
+dnl if the compiler is gcc, test for gcc >= 5
AS_IF([test "x$GCC_VERSION" = "x"],[],
- [AC_MSG_CHECKING([gcc version >= 4.8])
- AX_COMPARE_VERSION([$GCC_VERSION],[ge],[4.8], [AC_MSG_RESULT([yes])],
+ [AC_MSG_CHECKING([gcc version >= 5])
+ AX_COMPARE_VERSION([$GCC_VERSION],[ge],[5], [AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
- AC_MSG_ERROR([Trick requires gcc version >= 4.8])
+ AC_MSG_ERROR([Trick requires gcc version >= 5])
])
])
dnl Save the full path of the compiler
@@ -210,12 +210,12 @@ AS_IF([test "$ac_cv_path_CLANG" = "noclang"],AC_MSG_ERROR([could not find clang]
AC_SUBST([LLVM_HOME])
TR_CLANG_VERSION
-dnl if llvm/clang, test for version >= 3.4.2
+dnl if llvm/clang, test for version >= 5
AS_IF([test "x$CLANG_VERSION" = "x"],[],
- [AC_MSG_CHECKING([clang version >= 3.4.2])
- AX_COMPARE_VERSION([$CLANG_VERSION],[ge],[3.4.2], [AC_MSG_RESULT([yes])],
+ [AC_MSG_CHECKING([clang version >= 5])
+ AX_COMPARE_VERSION([$CLANG_VERSION],[ge],[5], [AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
- AC_MSG_ERROR([Trick requires llvm/clang version >= 3.4.2])
+ AC_MSG_ERROR([Trick requires llvm/clang version >= 5])
])
])
diff --git a/configure b/configure
index a45fa995a..bcb84b84c 100755
--- a/configure
+++ b/configure
@@ -642,7 +642,6 @@ CLANG
LLVM_CONFIG
PTHREAD_CFLAGS
PTHREAD_LIBS
-PTHREAD_CXX
PTHREAD_CC
ax_pthread_config
CPP
@@ -4768,8 +4767,8 @@ fi
if test "x$GCC_VERSION" = "x"; then :
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking gcc version >= 4.8" >&5
-$as_echo_n "checking gcc version >= 4.8... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking gcc version >= 5" >&5
+$as_echo_n "checking gcc version >= 5... " >&6; }
@@ -4789,7 +4788,7 @@ $as_echo_n "checking gcc version >= 4.8... " >&6; }
-e 's/[^0-9]//g'`
- ax_compare_version_B=`echo "4.8" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+ ax_compare_version_B=`echo "5" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
-e 's/Z\([0-9]\)Z/Z0\1Z/g' \
-e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
-e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
@@ -4806,7 +4805,7 @@ x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version
$as_echo "yes" >&6; }
else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- as_fn_error $? "Trick requires gcc version >= 4.8" "$LINENO" 5
+ as_fn_error $? "Trick requires gcc version >= 5" "$LINENO" 5
fi
@@ -5758,9 +5757,7 @@ done
if test -z "$SWIG" ; then
as_fn_error $? "Trick requires SWIG version >= 3.0" "$LINENO" 5
- elif test -z "3.0" ; then
- :
- else
+ elif test -n "3.0" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SWIG version" >&5
$as_echo_n "checking SWIG version... " >&6; }
swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`
@@ -5773,12 +5770,12 @@ $as_echo "$swig_version" >&6; }
if test -z "$required_major" ; then
required_major=0
fi
- required=`echo $required. | sed 's/[0-9]*[^0-9]//'`
+ required=`echo $required | sed 's/[0-9]*[^0-9]//'`
required_minor=`echo $required | sed 's/[^0-9].*//'`
if test -z "$required_minor" ; then
required_minor=0
fi
- required=`echo $required. | sed 's/[0-9]*[^0-9]//'`
+ required=`echo $required | sed 's/[0-9]*[^0-9]//'`
required_patch=`echo $required | sed 's/[^0-9].*//'`
if test -z "$required_patch" ; then
required_patch=0
@@ -5815,7 +5812,7 @@ $as_echo "$as_me: WARNING: SWIG version >= 3.0 is required. You have $swig_vers
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SWIG library" >&5
$as_echo_n "checking for SWIG library... " >&6; }
- SWIG_LIB=`$SWIG -swiglib | tr '\r\n' ' '`
+ SWIG_LIB=`$SWIG -swiglib`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG_LIB" >&5
$as_echo "$SWIG_LIB" >&6; }
@@ -5881,9 +5878,7 @@ done
if test -z "$SWIG" ; then
as_fn_error $? "Trick requires SWIG version >= 3.0" "$LINENO" 5
- elif test -z "3.0" ; then
- :
- else
+ elif test -n "3.0" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SWIG version" >&5
$as_echo_n "checking SWIG version... " >&6; }
swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`
@@ -5896,12 +5891,12 @@ $as_echo "$swig_version" >&6; }
if test -z "$required_major" ; then
required_major=0
fi
- required=`echo $required. | sed 's/[0-9]*[^0-9]//'`
+ required=`echo $required | sed 's/[0-9]*[^0-9]//'`
required_minor=`echo $required | sed 's/[^0-9].*//'`
if test -z "$required_minor" ; then
required_minor=0
fi
- required=`echo $required. | sed 's/[0-9]*[^0-9]//'`
+ required=`echo $required | sed 's/[0-9]*[^0-9]//'`
required_patch=`echo $required | sed 's/[^0-9].*//'`
if test -z "$required_patch" ; then
required_patch=0
@@ -5938,7 +5933,7 @@ $as_echo "$as_me: WARNING: SWIG version >= 3.0 is required. You have $swig_vers
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SWIG library" >&5
$as_echo_n "checking for SWIG library... " >&6; }
- SWIG_LIB=`$SWIG -swiglib | tr '\r\n' ' '`
+ SWIG_LIB=`$SWIG -swiglib`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG_LIB" >&5
$as_echo "$SWIG_LIB" >&6; }
@@ -6384,9 +6379,6 @@ if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
ax_pthread_save_LIBS="$LIBS"
if test "x$PTHREAD_CC" != "x"; then :
CC="$PTHREAD_CC"
-fi
- if test "x$PTHREAD_CXX" != "x"; then :
- CXX="$PTHREAD_CXX"
fi
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
@@ -6431,12 +6423,10 @@ fi
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
-# Create a list of thread flags to try. Items with a "," contain both
-# C compiler flags (before ",") and linker flags (after ","). Other items
-# starting with a "-" are C compiler flags, and remaining items are
-# library names, except for "none" which indicates that we try without
-# any flags at all, and "pthread-config" which is a program returning
-# the flags for the Pth emulation library.
+# Create a list of thread flags to try. Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
@@ -6512,9 +6502,38 @@ rm -f conftest*
# that too in a future libc.) So we'll check first for the
# standard Solaris way of linking pthreads (-mt -lpthread).
- ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags"
+ ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags"
+ ;;
+esac
+
+# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
+
+if test "x$GCC" = "xyes"; then :
+ ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"
+fi
+
+# The presence of a feature test macro requesting re-entrant function
+# definitions is, on some systems, a strong hint that pthreads support is
+# correctly enabled
+
+case $host_os in
+ darwin* | hpux* | linux* | osf* | solaris*)
+ ax_pthread_check_macro="_REENTRANT"
+ ;;
+
+ aix*)
+ ax_pthread_check_macro="_THREAD_SAFE"
+ ;;
+
+ *)
+ ax_pthread_check_macro="--"
;;
esac
+if test "x$ax_pthread_check_macro" = "x--"; then :
+ ax_pthread_check_cond=0
+else
+ ax_pthread_check_cond="!defined($ax_pthread_check_macro)"
+fi
# Are we compiling with Clang?
@@ -6547,51 +6566,107 @@ fi
$as_echo "$ax_cv_PTHREAD_CLANG" >&6; }
ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
+ax_pthread_clang_warning=no
-# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
-
-# Note that for GCC and Clang -pthread generally implies -lpthread,
-# except when -nostdlib is passed.
-# This is problematic using libtool to build C++ shared libraries with pthread:
-# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
-# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333
-# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555
-# To solve this, first try -pthread together with -lpthread for GCC
+# Clang needs special handling, because older versions handle the -pthread
+# option in a rather... idiosyncratic way
-if test "x$GCC" = "xyes"; then :
- ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"
-fi
+if test "x$ax_pthread_clang" = "xyes"; then
-# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first
+ # Clang takes -pthread; it has never supported any other flag
-if test "x$ax_pthread_clang" = "xyes"; then :
- ax_pthread_flags="-pthread,-lpthread -pthread"
-fi
+ # (Note 1: This will need to be revisited if a system that Clang
+ # supports has POSIX threads in a separate library. This tends not
+ # to be the way of modern systems, but it's conceivable.)
+ # (Note 2: On some systems, notably Darwin, -pthread is not needed
+ # to get POSIX threads support; the API is always present and
+ # active. We could reasonably leave PTHREAD_CFLAGS empty. But
+ # -pthread does define _REENTRANT, and while the Darwin headers
+ # ignore this macro, third-party headers might not.)
-# The presence of a feature test macro requesting re-entrant function
-# definitions is, on some systems, a strong hint that pthreads support is
-# correctly enabled
+ PTHREAD_CFLAGS="-pthread"
+ PTHREAD_LIBS=
-case $host_os in
- darwin* | hpux* | linux* | osf* | solaris*)
- ax_pthread_check_macro="_REENTRANT"
- ;;
+ ax_pthread_ok=yes
- aix*)
- ax_pthread_check_macro="_THREAD_SAFE"
- ;;
+ # However, older versions of Clang make a point of warning the user
+ # that, in an invocation where only linking and no compilation is
+ # taking place, the -pthread option has no effect ("argument unused
+ # during compilation"). They expect -pthread to be passed in only
+ # when source code is being compiled.
+ #
+ # Problem is, this is at odds with the way Automake and most other
+ # C build frameworks function, which is that the same flags used in
+ # compilation (CFLAGS) are also used in linking. Many systems
+ # supported by AX_PTHREAD require exactly this for POSIX threads
+ # support, and in fact it is often not straightforward to specify a
+ # flag that is used only in the compilation phase and not in
+ # linking. Such a scenario is extremely rare in practice.
+ #
+ # Even though use of the -pthread flag in linking would only print
+ # a warning, this can be a nuisance for well-run software projects
+ # that build with -Werror. So if the active version of Clang has
+ # this misfeature, we search for an option to squash it.
- *)
- ax_pthread_check_macro="--"
- ;;
-esac
-if test "x$ax_pthread_check_macro" = "x--"; then :
- ax_pthread_check_cond=0
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5
+$as_echo_n "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; }
+if ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+:} false; then :
+ $as_echo_n "(cached) " >&6
else
- ax_pthread_check_cond="!defined($ax_pthread_check_macro)"
+ ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
+ # Create an alternate version of $ac_link that compiles and
+ # links in two steps (.c -> .o, .o -> exe) instead of one
+ # (.c -> exe), because the warning occurs only in the second
+ # step
+ ax_pthread_save_ac_link="$ac_link"
+ ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
+ ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
+ ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
+ ax_pthread_save_CFLAGS="$CFLAGS"
+ for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
+ if test "x$ax_pthread_try" = "xunknown"; then :
+ break
+fi
+ CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
+ ac_link="$ax_pthread_save_ac_link"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int main(void){return 0;}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_link="$ax_pthread_2step_ac_link"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int main(void){return 0;}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ break
fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ done
+ ac_link="$ax_pthread_save_ac_link"
+ CFLAGS="$ax_pthread_save_CFLAGS"
+ if test "x$ax_pthread_try" = "x"; then :
+ ax_pthread_try=no
+fi
+ ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5
+$as_echo "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; }
+
+ case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
+ no | unknown) ;;
+ *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
+ esac
+
+fi # $ax_pthread_clang = yes
if test "x$ax_pthread_ok" = "xno"; then
for ax_pthread_try_flag in $ax_pthread_flags; do
@@ -6602,11 +6677,11 @@ for ax_pthread_try_flag in $ax_pthread_flags; do
$as_echo_n "checking whether pthreads work without any flags... " >&6; }
;;
- *,*)
- PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"`
- PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"`
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with \"$PTHREAD_CFLAGS\" and \"$PTHREAD_LIBS\"" >&5
-$as_echo_n "checking whether pthreads work with \"$PTHREAD_CFLAGS\" and \"$PTHREAD_LIBS\"... " >&6; }
+ -mt,pthread)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with -mt -lpthread" >&5
+$as_echo_n "checking whether pthreads work with -mt -lpthread... " >&6; }
+ PTHREAD_CFLAGS="-mt"
+ PTHREAD_LIBS="-lpthread"
;;
-*)
@@ -6689,13 +6764,7 @@ $as_echo_n "checking for the pthreads library -l$ax_pthread_try_flag... " >&6; }
# if $ax_pthread_check_cond
# error "$ax_pthread_check_macro must be defined"
# endif
- static void *some_global = NULL;
- static void routine(void *a)
- {
- /* To avoid any unused-parameter or
- unused-but-set-parameter warning. */
- some_global = a;
- }
+ static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }
int
main ()
@@ -6730,104 +6799,6 @@ fi
done
fi
-
-# Clang needs special handling, because older versions handle the -pthread
-# option in a rather... idiosyncratic way
-
-if test "x$ax_pthread_clang" = "xyes"; then
-
- # Clang takes -pthread; it has never supported any other flag
-
- # (Note 1: This will need to be revisited if a system that Clang
- # supports has POSIX threads in a separate library. This tends not
- # to be the way of modern systems, but it's conceivable.)
-
- # (Note 2: On some systems, notably Darwin, -pthread is not needed
- # to get POSIX threads support; the API is always present and
- # active. We could reasonably leave PTHREAD_CFLAGS empty. But
- # -pthread does define _REENTRANT, and while the Darwin headers
- # ignore this macro, third-party headers might not.)
-
- # However, older versions of Clang make a point of warning the user
- # that, in an invocation where only linking and no compilation is
- # taking place, the -pthread option has no effect ("argument unused
- # during compilation"). They expect -pthread to be passed in only
- # when source code is being compiled.
- #
- # Problem is, this is at odds with the way Automake and most other
- # C build frameworks function, which is that the same flags used in
- # compilation (CFLAGS) are also used in linking. Many systems
- # supported by AX_PTHREAD require exactly this for POSIX threads
- # support, and in fact it is often not straightforward to specify a
- # flag that is used only in the compilation phase and not in
- # linking. Such a scenario is extremely rare in practice.
- #
- # Even though use of the -pthread flag in linking would only print
- # a warning, this can be a nuisance for well-run software projects
- # that build with -Werror. So if the active version of Clang has
- # this misfeature, we search for an option to squash it.
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5
-$as_echo_n "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; }
-if ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
- # Create an alternate version of $ac_link that compiles and
- # links in two steps (.c -> .o, .o -> exe) instead of one
- # (.c -> exe), because the warning occurs only in the second
- # step
- ax_pthread_save_ac_link="$ac_link"
- ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
- ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
- ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
- ax_pthread_save_CFLAGS="$CFLAGS"
- for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
- if test "x$ax_pthread_try" = "xunknown"; then :
- break
-fi
- CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
- ac_link="$ax_pthread_save_ac_link"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-int main(void){return 0;}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_link="$ax_pthread_2step_ac_link"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-int main(void){return 0;}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- break
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- done
- ac_link="$ax_pthread_save_ac_link"
- CFLAGS="$ax_pthread_save_CFLAGS"
- if test "x$ax_pthread_try" = "x"; then :
- ax_pthread_try=no
-fi
- ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5
-$as_echo "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; }
-
- case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
- no | unknown) ;;
- *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
- esac
-
-fi # $ax_pthread_clang = yes
-
-
-
# Various other checks:
if test "x$ax_pthread_ok" = "xyes"; then
ax_pthread_save_CFLAGS="$CFLAGS"
@@ -6909,7 +6880,6 @@ int
main ()
{
int i = PTHREAD_PRIO_INHERIT;
- return i;
;
return 0;
}
@@ -6946,19 +6916,11 @@ fi
#handle absolute path differently from PATH based program lookup
case "x$CC" in #(
x/*) :
-
- if as_fn_executable_p ${CC}_r; then :
+ if as_fn_executable_p ${CC}_r; then :
PTHREAD_CC="${CC}_r"
-fi
- if test "x${CXX}" != "x"; then :
- if as_fn_executable_p ${CXX}_r; then :
- PTHREAD_CXX="${CXX}_r"
-fi
-fi
- ;; #(
+fi ;; #(
*) :
-
- for ac_prog in ${CC}_r
+ for ac_prog in ${CC}_r
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
@@ -7000,56 +6962,8 @@ fi
test -n "$PTHREAD_CC" && break
done
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
-
- if test "x${CXX}" != "x"; then :
- for ac_prog in ${CXX}_r
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_PTHREAD_CXX+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$PTHREAD_CXX"; then
- ac_cv_prog_PTHREAD_CXX="$PTHREAD_CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_PTHREAD_CXX="$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-PTHREAD_CXX=$ac_cv_prog_PTHREAD_CXX
-if test -n "$PTHREAD_CXX"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CXX" >&5
-$as_echo "$PTHREAD_CXX" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$PTHREAD_CXX" && break
-done
-test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
-
-fi
-
- ;;
-esac
- ;; #(
+ ;;
+esac ;; #(
*) :
;;
esac
@@ -7059,8 +6973,6 @@ esac
fi
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
-test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
-
@@ -7457,8 +7369,8 @@ fi
if test "x$CLANG_VERSION" = "x"; then :
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking clang version >= 3.4.2" >&5
-$as_echo_n "checking clang version >= 3.4.2... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking clang version >= 5" >&5
+$as_echo_n "checking clang version >= 5... " >&6; }
@@ -7478,7 +7390,7 @@ $as_echo_n "checking clang version >= 3.4.2... " >&6; }
-e 's/[^0-9]//g'`
- ax_compare_version_B=`echo "3.4.2" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+ ax_compare_version_B=`echo "5" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
-e 's/Z\([0-9]\)Z/Z0\1Z/g' \
-e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
-e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
@@ -7495,7 +7407,7 @@ x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version
$as_echo "yes" >&6; }
else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- as_fn_error $? "Trick requires llvm/clang version >= 3.4.2" "$LINENO" 5
+ as_fn_error $? "Trick requires llvm/clang version >= 5" "$LINENO" 5
fi
@@ -7763,6 +7675,7 @@ then
LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
fi
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -7831,6 +7744,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# If both library and header were found, action-if-found
#
+ CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
+ LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
LIBS="-lz $LIBS"
$as_echo "#define HAVE_LIBZ 1" >>confdefs.h
@@ -8385,9 +8300,6 @@ $as_echo "no" >&6; }
PKG_CONFIG=""
fi
fi
-if test -z "$PKG_CONFIG"; then
- as_fn_error $? "pkg-config not found" "$LINENO" 5
-fi
# Check whether --with-gtest was given.
diff --git a/docs/documentation/install_guide/Install-Guide.md b/docs/documentation/install_guide/Install-Guide.md
index f52b22151..8920b66e0 100644
--- a/docs/documentation/install_guide/Install-Guide.md
+++ b/docs/documentation/install_guide/Install-Guide.md
@@ -11,8 +11,8 @@ Trick requires various free third party utilities in order to function. All the
| Utility | Version | Description | Usage | Notes |
| --------------: | :-----: | :---------------------: | :------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| [gcc] and `g++` | 4.8+ | C/C++ Compiler | Compiles Trick and Trick simulations. | |
-| [clang]/[llvm] | <=22 | C/C++ Compiler | Utilized by the interface code generator. | Trick Versions <= 19.3 should use LLVM <= 9. Trick Versions < 25.0 should use LLVM < 20. Please open an issue if you encounter a problem related to newer versions of LLVM. |
+| [gcc] and `g++` | 5+ | C/C++ Compiler | Compiles Trick and Trick simulations. | |
+| [clang]/[llvm] | 5 - 22 | C/C++ Compiler | Utilized by the interface code generator. | Trick Versions <= 19.3 should use LLVM <= 9. Trick Versions < 25.0 should use LLVM < 20. Please open an issue if you encounter a problem related to newer versions of LLVM. |
| [python] | 3.x | Programming Language | Lets the user interact with a simulation. | Trick has been tested up to python 3.13.2 as of 04/2025. |
| [perl] | 5.6+ | Programming Language | Allows executable scripts in the bin directory to run. | |
| [java] | 11+ | Programming Language | Necessary for Trick GUIs. | |
diff --git a/docs/not_referenced/Monte-Carlo.md b/docs/not_referenced/Monte-Carlo.md
index fb7417b96..1974b0f2f 100644
--- a/docs/not_referenced/Monte-Carlo.md
+++ b/docs/not_referenced/Monte-Carlo.md
@@ -184,27 +184,17 @@ generate the value for the variable from run to run.
(use Trick::MonteVarRandom::set_min_is_relative, Trick::MonteVarRandom::set_max_is_relative)
- FLAT: Uniform distribution. No bell. Returns uniform random values between (-\f$\infty\f$, +\f$\infty\f$) bracketed
optionally by [min, max]. (use Trick::MonteVarRandom::set_min, Trick::MonteVarRandom::set_max)
- - engine - the C++11 predefined pseudo-random engine type. NO_ENGINE is the default (results in Trick coded random number engine).
- Other options using the C++11 facilities of the Standard Template Library:
- (Requires --std=c++0x or --std=c++11 on Trick configure command line when building Trick.)
- - TRICK_DEFAULT_ENGINE - SUGGESTED FOR USE. std::ranlux_base_01 for c++0x, std::mt19937 for c++11
- - C++ TR1 options: (pre-C++11 compiler, GCC versions 4.4 through 4.6).
- (Requires --std=c++0x on Trick configure command line when building Trick.)
- - RANLUX_BASE_01_ENGINE - std::ranlux_base_01 Engine
- - RANLUX_64_BASE_01_ENGINE - std::ranlux64_base_01 Engine
- - (others such as std::mt19937 not provided, because they return
- outside the canonical 0 <= x < 1 range in some GCC versions,
- which can cause infinite loops in distributions.)
- - C++11 options: (C++11 compiler, versions 4.7, 4.8).
- (Requires --std=c++11 on Trick configure command line when building Trick.)
- - MINSTD_RAND_ENGINE - std::minstd_rand Minimal Standard Linear Congruential Engine
- - MT19937_ENGINE - std::mt19937 Mersenne Twister Engine. Said to provide better behavior than Linear Congruential Engines.
- - MT19937_64_ENGINE - std::mt19937_64 64 bit Mersenne Twister Engine.
- - RANLUX_24_BASE_ENGINE - std::ranlux24_base Engine
- - RANLUX_44_BASE_ENGINE - std::ranlux48_base Engine
- - RANLUX_24_ENGINE - std::ranlux24 Engine
- - RANLUX_44_ENGINE - std::ranlux48 Engine
- - KNUTH_B_ENGINE - std::knuth_b Engine
+ - engine - the predefined pseudo-random engine type. NO_ENGINE is the default (results in Trick coded random number engine).
+ All other options use the <random> facilities of the C++ Standard Library:
+ - TRICK_DEFAULT_ENGINE - SUGGESTED FOR USE. std::mt19937 Mersenne Twister Engine
+ - MINSTD_RAND_ENGINE - std::minstd_rand Minimal Standard Linear Congruential Engine
+ - MT19937_ENGINE - std::mt19937 Mersenne Twister Engine. Said to provide better behavior than Linear Congruential Engines.
+ - MT19937_64_ENGINE - std::mt19937_64 64 bit Mersenne Twister Engine.
+ - RANLUX_24_BASE_ENGINE - std::ranlux24_base Engine
+ - RANLUX_44_BASE_ENGINE - std::ranlux48_base Engine
+ - RANLUX_24_ENGINE - std::ranlux24 Engine
+ - RANLUX_44_ENGINE - std::ranlux48 Engine
+ - KNUTH_B_ENGINE - std::knuth_b Engine
After constructing such a variable, it can be added via:
@@ -429,4 +419,4 @@ This is the order in which jobs are executed in a MonteCarlo sim:
- ::mc_read
- ::mc_get_connection_device
- ::mc_set_current_run
-- ::mc_get_current_run
\ No newline at end of file
+- ::mc_get_current_run
diff --git a/include/trick/Euler_Cromer_Integrator.hh b/include/trick/Euler_Cromer_Integrator.hh
index d62ef8315..87a993cef 100644
--- a/include/trick/Euler_Cromer_Integrator.hh
+++ b/include/trick/Euler_Cromer_Integrator.hh
@@ -108,13 +108,9 @@ namespace Trick {
void deriv2_in(double* arg1, ...)
#ifndef SWIGPYTHON
- #ifdef __GNUC__
- #if __GNUC__ >= 4
- __attribute__((sentinel))
- #endif
- #endif
+ __attribute__((sentinel))
#endif
- ;
+ ;
void initialize( int State_size, double Dt);
int integrate();
Integrator_type get_Integrator_type() { return(Euler_Cromer); } ;
diff --git a/include/trick/Event.hh b/include/trick/Event.hh
index d54dd0fbe..2773ff6af 100644
--- a/include/trick/Event.hh
+++ b/include/trick/Event.hh
@@ -204,16 +204,13 @@ class Event {
#ifndef SWIG
- // No need to inherit from binary_function for c++11 or later
- #if __cplusplus >= 201103L
- struct CompareEventPtrs {
- #else
- struct CompareEventPtrs : public std::binary_function {
- #endif
- bool operator()(const Trick::Event * lhs, const Trick::Event * rhs) const {
- return lhs->get_next_tics() < rhs->get_next_tics();
- }
- };
+struct CompareEventPtrs
+{
+ bool operator()(const Trick::Event* lhs, const Trick::Event* rhs) const
+ {
+ return lhs->get_next_tics() < rhs->get_next_tics();
+ }
+};
#endif
}
diff --git a/include/trick/ExecutiveException.hh b/include/trick/ExecutiveException.hh
index d3b5b152b..49919b84b 100644
--- a/include/trick/ExecutiveException.hh
+++ b/include/trick/ExecutiveException.hh
@@ -34,11 +34,10 @@ namespace Trick {
/** This constructor assignes ret_code, file, and message to the incoming arguments */
ExecutiveException( int in_ret , std::string in_file , int line , std::string in_message ) ;
- virtual ~ExecutiveException() throw () ;
- virtual const char* what() const throw() ;
+ virtual ~ExecutiveException();
+ virtual const char* what() const noexcept;
} ;
}
#endif
-
diff --git a/include/trick/Integrator.hh b/include/trick/Integrator.hh
index eb055f621..84b85b56e 100644
--- a/include/trick/Integrator.hh
+++ b/include/trick/Integrator.hh
@@ -71,52 +71,36 @@ namespace Trick {
#ifndef SWIGPYTHON
virtual void state_in(double* arg1, va_list argp);
#endif
- void state_in (double* arg1, ...)
+ void state_in(double* arg1, ...)
#ifndef SWIGPYTHON
- #ifdef __GNUC__
- #if __GNUC__ >= 4
- __attribute__((sentinel))
- #endif
- #endif
+ __attribute__((sentinel))
#endif
- ;
+ ;
#ifndef SWIGPYTHON
virtual void deriv_in(double* arg1, va_list argp);
#endif
- void deriv_in (double* arg1, ...)
+ void deriv_in(double* arg1, ...)
#ifndef SWIGPYTHON
- #ifdef __GNUC__
- #if __GNUC__ >= 4
- __attribute__((sentinel))
- #endif
- #endif
+ __attribute__((sentinel))
#endif
- ;
+ ;
#ifndef SWIGPYTHON
virtual void state_out(double* arg1, va_list argp);
#endif
void state_out(double* arg1, ...)
#ifndef SWIGPYTHON
- #ifdef __GNUC__
- #if __GNUC__ >= 4
- __attribute__((sentinel))
- #endif
- #endif
+ __attribute__((sentinel))
#endif
- ;
+ ;
#ifndef SWIGPYTHON
virtual void deriv2_in(double* arg1, va_list argp);
#endif
- void deriv2_in (double* arg1, ...)
+ void deriv2_in(double* arg1, ...)
#ifndef SWIGPYTHON
- #ifdef __GNUC__
- #if __GNUC__ >= 4
- __attribute__((sentinel))
- #endif
- #endif
+ __attribute__((sentinel))
#endif
- ;
+ ;
int num_state;
diff --git a/include/trick/MonteVarRandom.hh b/include/trick/MonteVarRandom.hh
index 12867c450..bb8d836d8 100644
--- a/include/trick/MonteVarRandom.hh
+++ b/include/trick/MonteVarRandom.hh
@@ -42,47 +42,33 @@ namespace Trick {
class MonteVarRandom : public Trick::MonteVar {
public:
- ///@brief Random number generation engine type.
- ///
- ///@details Used for TR1 and C++11 random number generation facilities
- ///
- ///@note: Values for this type must match those of StlRandomGenerator::StlEngine
- ///
- enum StlEngine {
- NO_ENGINE = 0, /**< -- This selection causes the Trick hand coded fallback algorithms to be used */
-
- TRICK_DEFAULT_ENGINE = 1, /**< -- std::ranlux_base_01 for TR1, std::mt19937 for _HAVE_STD_RANDOM */
-
-#ifdef _HAVE_TR1_RANDOM
- RANLUX_BASE_01_ENGINE = 2, /**< -- TR1 only std::ranlux_base_01 Engine, note: replaced for c++11 */
- RANLUX_64_BASE_01_ENGINE = 3, /**< -- TR1 only std::ranlux64_base_01 Engine, note: replaced for c++11 */
-#endif
-
-#ifdef _HAVE_STL_RANDOM
- // NOTE: MINSTD_RAND_ENGINE and MT19937_ENGINE return out of canonical range
- // for (at least) GCC 4.4.7,so are not provided for _HAVE_TR1_RANDOM
-
- MINSTD_RAND_ENGINE = 2, /**< -- std::minstd_rand Minimal Standard Linear Congruential Engine */
- MT19937_ENGINE = 3, /**< -- std::mt19937 Mersenne Twister Engine */
-
- MT19937_64_ENGINE = 4, /**< -- std::mt19937_64 64 bit Mersenne Twister Engine. Not available TR1 */
-
- RANLUX_24_BASE_ENGINE = 5, /**< -- std::ranlux24_base Engine */
- RANLUX_44_BASE_ENGINE = 6, /**< -- std::ranlux48_base Engine */
-
- RANLUX_24_ENGINE = 7, /**< -- std::ranlux24 Engine */
- RANLUX_44_ENGINE = 8, /**< -- std::ranlux48 Engine */
-
- KNUTH_B_ENGINE = 9 /**< -- std::knuth_b Engine */
-#endif
- };
-
- /** A random distribution. */
- enum Distribution {
- GAUSSIAN = TRICK_GSL_GAUSS, /**< Gaussian distribution */
- FLAT = TRICK_GSL_FLAT, /**< flat distribution */
- POISSON = TRICK_GSL_POISSON /**< Poisson distribution */
- };
+ ///@brief Random number generation engine type.
+ ///
+ ///@details Used for the C++ number generation facilities
+ ///
+ ///@note: Values for this type must match those of StlRandomGenerator::StlEngine
+ ///
+ enum StlEngine
+ {
+ NO_ENGINE = 0, /**< -- This selection causes the Trick hand coded fallback algorithms to be used */
+ TRICK_DEFAULT_ENGINE = 1, /**< -- std::mt19937 Mersenne Twister Engine */
+ MINSTD_RAND_ENGINE = 2, /**< -- std::minstd_rand Minimal Standard Linear Congruential Engine */
+ MT19937_ENGINE = 3, /**< -- std::mt19937 Mersenne Twister Engine */
+ MT19937_64_ENGINE = 4, /**< -- std::mt19937_64 64 bit Mersenne Twister Engine */
+ RANLUX_24_BASE_ENGINE = 5, /**< -- std::ranlux24_base Engine */
+ RANLUX_44_BASE_ENGINE = 6, /**< -- std::ranlux48_base Engine */
+ RANLUX_24_ENGINE = 7, /**< -- std::ranlux24 Engine */
+ RANLUX_44_ENGINE = 8, /**< -- std::ranlux48 Engine */
+ KNUTH_B_ENGINE = 9 /**< -- std::knuth_b Engine */
+ };
+
+ /** A random distribution. */
+ enum Distribution
+ {
+ GAUSSIAN = TRICK_GSL_GAUSS, /**< Gaussian distribution */
+ FLAT = TRICK_GSL_FLAT, /**< flat distribution */
+ POISSON = TRICK_GSL_POISSON /**< Poisson distribution */
+ };
protected:
/** Engine. */
diff --git a/include/trick/StlRandomGenerator.hh b/include/trick/StlRandomGenerator.hh
index d3524a5e9..b8cd13bf6 100644
--- a/include/trick/StlRandomGenerator.hh
+++ b/include/trick/StlRandomGenerator.hh
@@ -35,19 +35,13 @@
#include "trick/rand_generator.h"
-#if (defined(_HAVE_TR1_RANDOM) || defined(_HAVE_STL_RANDOM))
#include
-// The template types of the std::poisson_distribution differ between c++0x and c++11
-#if (defined(_HAVE_TR1_RANDOM) && !defined(STL_POISSON_TEMPLATE_TYPES))
-#define STL_POISSON_TEMPLATE_TYPES int, double
-#endif
-
-#if (defined(_HAVE_STL_RANDOM) && !defined(STL_POISSON_TEMPLATE_TYPES))
-#define STL_POISSON_TEMPLATE_TYPES int
-#endif
-
-#endif
+///@brief The concrete engine that StlRandomGenerator::TRICK_DEFAULT_ENGINE selects.
+///
+///@details This is the single source of truth for Trick's default engine. Change it
+/// here to re-point TRICK_DEFAULT_ENGINE; the factory follows automatically.
+using TrickDefaultEngine = std::mt19937;
class StlRandomGeneratorFactory;
@@ -55,99 +49,74 @@ class StlRandomGeneratorFactory;
///@brief Abstract Base class for object that contains a specified engine and distribution together
class StlRandomGenerator
{
-public:
-
- /**@brief A random number generation engine type enum.
- Used for TR1 and C++11 random number generation facilities
- */
- ///@warning with GCC 4.4.7, -std=c++0x, MINSTD_RAND_ENGINE,MT19937_ENGINE
- /// 'engines' return pseudo-random numbers outside the cannonical range of 0 <= x < 1.
- ///
- /// This causes an __INFINITE LOOP__ within the std::normal_distribution.
- ///
- ///
- /// For TR1 compilers with this problem, use RANLUX_BASE_01_ENGINE or RANLUX_64_BASE_01_ENGINE
- /// which return within the cannonical range.
- ///
- ///@note when adding new engine types, coordinate values with MonteVarRandom.
- enum StlEngine {
- TRICK_DEFAULT_ENGINE = 1, /**< -- std::ranlux_base_01 for TR1, std::mt19937 for _HAVE_STD_RANDOM */
-
-#ifdef _HAVE_TR1_RANDOM
- RANLUX_BASE_01_ENGINE = 2, /**< -- TR1 only std::ranlux_base_01 Engine, note: replaced for c++11 */
- RANLUX_64_BASE_01_ENGINE = 3, /**< -- TR1 only std::ranlux64_base_01 Engine, note: replaced for c++11 */
-#endif
-
-#ifdef _HAVE_STL_RANDOM
- // NOTE: MINSTD_RAND_ENGINE and MT19937_ENGINE return out of canonical range
- // for (at least) GCC 4.4.7,so are not provided for _HAVE_TR1_RANDOM
- MINSTD_RAND_ENGINE = 2, /**< -- std::minstd_rand Minimal Standard Linear Congruential Engine */
- MT19937_ENGINE = 3, /**< -- std::mt19937 Mersenne Twister Engine */
-
- MT19937_64_ENGINE = 4, /**< -- std::mt19937_64 64 bit Mersenne Twister Engine. Not available TR1 */
-
- RANLUX_24_BASE_ENGINE = 5, /**< -- std::ranlux24_base Engine */
- RANLUX_44_BASE_ENGINE = 6, /**< -- std::ranlux48_base Engine */
-
- RANLUX_24_ENGINE = 7, /**< -- std::ranlux24 Engine */
- RANLUX_44_ENGINE = 8, /**< -- std::ranlux48 Engine */
-
- KNUTH_B_ENGINE = 9 /**< -- std::knuth_b Engine */
-#endif
- };
-
- /** A random distribution. */
- enum StlDistribution {
- GAUSSIAN = TRICK_GSL_GAUSS, /**< -- Gaussian distribution */
- FLAT = TRICK_GSL_FLAT, /**< -- flat distribution */
- POISSON = TRICK_GSL_POISSON /**< -- Poisson distribution */
- };
-
- ///@param in_param_a first parameter in distribution::param_type
- /// min for FLAT, mean for GAUSSIAN and POISSON
- ///
- ///@param in_param_b second parameter in distribution::param_type
- /// max for FLAT, std deviation for GAUSSIAN, (unused for POISSON)
- ///
- ///@param in_seed starting seed for random number engine
- ///@param in_engine_type Engine type enumeration for random number engine
- ///@param in_dist_type Distribution type enumeration for random number distribution
- ///
- explicit StlRandomGenerator(double in_param_a = 0.0,
- double in_param_b = 1.0,
- unsigned long in_seed = 12345,
- StlRandomGenerator::StlDistribution in_dist_type = StlRandomGenerator::FLAT,
- StlRandomGenerator::StlEngine in_engine_type = StlRandomGenerator::TRICK_DEFAULT_ENGINE
- );
-
- virtual ~StlRandomGenerator();
-
- ///@brief return next pseudo-random number
- ///@note POISSON distribution returns an int type,
- /// so this would need to either cast to double or return a union class like
- /// the Trick rand routines already do in order to fit in.
- virtual TRICK_GSL_RETURN_TYPE operator()() = 0;
-
- ///@brief reset seed for pseudo-random number engine
- virtual void set_seed(unsigned long in_seed) = 0;
-
- ///@brief reset parameters for the distribution
- ///@param a is min for FLAT, mean for GAUSSION and POISSON
- ///@param b is max for FLAT, sigma for GAUSSION and unused for POISSON
- ///@note For TR1, set_param replaces the distribution via operator=
- virtual void set_param(double a, double b = 0.0) = 0;
-
- double get_param_a() const { return param_a; }
- double get_param_b() const { return param_b; }
-
-protected:
-
- double param_a; /**< -- first param in distribution::param_type, min for FLAT, mean for GAUSSIAN and POISSON */
- double param_b; /**< -- second param in distribution::param_type, max for FLAT, std deviation for GAUSSIAN, (unused for POISSON) */
- int initialSeed; /**< -- starting seed */
-
- StlEngine engineEnum; /**< -- STL random number engine type enumeration */
- StlDistribution distEnum; /**< -- STL random number distribution type enumeration */
+ public:
+ /**@brief A random number generation engine type enum.
+ Used for the C++ number generation facilities
+ */
+ ///@note when adding new engine types, coordinate values with MonteVarRandom.
+ enum StlEngine
+ {
+ TRICK_DEFAULT_ENGINE = 1, /**< -- whichever engine ::TrickDefaultEngine names */
+ MINSTD_RAND_ENGINE = 2, /**< -- std::minstd_rand Minimal Standard Linear Congruential Engine */
+ MT19937_ENGINE = 3, /**< -- std::mt19937 Mersenne Twister Engine */
+ MT19937_64_ENGINE = 4, /**< -- std::mt19937_64 64 bit Mersenne Twister Engine */
+ RANLUX_24_BASE_ENGINE = 5, /**< -- std::ranlux24_base Engine */
+ RANLUX_44_BASE_ENGINE = 6, /**< -- std::ranlux48_base Engine */
+ RANLUX_24_ENGINE = 7, /**< -- std::ranlux24 Engine */
+ RANLUX_44_ENGINE = 8, /**< -- std::ranlux48 Engine */
+ KNUTH_B_ENGINE = 9 /**< -- std::knuth_b Engine */
+ };
+
+ /** A random distribution. */
+ enum StlDistribution
+ {
+ GAUSSIAN = TRICK_GSL_GAUSS, /**< -- Gaussian distribution */
+ FLAT = TRICK_GSL_FLAT, /**< -- flat distribution */
+ POISSON = TRICK_GSL_POISSON /**< -- Poisson distribution */
+ };
+
+ ///@param in_param_a first parameter in distribution::param_type
+ /// min for FLAT, mean for GAUSSIAN and POISSON
+ ///
+ ///@param in_param_b second parameter in distribution::param_type
+ /// max for FLAT, std deviation for GAUSSIAN, (unused for POISSON)
+ ///
+ ///@param in_seed starting seed for random number engine
+ ///@param in_engine_type Engine type enumeration for random number engine
+ ///@param in_dist_type Distribution type enumeration for random number distribution
+ ///
+ explicit StlRandomGenerator(double in_param_a = 0.0, double in_param_b = 1.0, unsigned long in_seed = 12345,
+ StlRandomGenerator::StlDistribution in_dist_type = StlRandomGenerator::FLAT,
+ StlRandomGenerator::StlEngine in_engine_type
+ = StlRandomGenerator::TRICK_DEFAULT_ENGINE);
+
+ virtual ~StlRandomGenerator();
+
+ ///@brief return next pseudo-random number
+ ///@note POISSON distribution returns an int type,
+ /// so this would need to either cast to double or return a union class like
+ /// the Trick rand routines already do in order to fit in.
+ virtual TRICK_GSL_RETURN_TYPE operator()() = 0;
+
+ ///@brief reset seed for pseudo-random number engine
+ virtual void set_seed(unsigned long in_seed) = 0;
+
+ ///@brief reset parameters for the distribution
+ ///@param a is min for FLAT, mean for GAUSSION and POISSON
+ ///@param b is max for FLAT, sigma for GAUSSION and unused for POISSON
+ virtual void set_param(double a, double b = 0.0) = 0;
+
+ double get_param_a() const { return param_a; }
+ double get_param_b() const { return param_b; }
+
+ protected:
+ double param_a; /**< -- first param in distribution::param_type, min for FLAT, mean for GAUSSIAN and POISSON */
+ double param_b; /**< -- second param in distribution::param_type, max for FLAT, std deviation for GAUSSIAN,
+ (unused for POISSON) */
+ int initialSeed; /**< -- starting seed */
+
+ StlEngine engineEnum; /**< -- STL random number engine type enumeration */
+ StlDistribution distEnum; /**< -- STL random number distribution type enumeration */
};
///@brief Factory for StlRandomGenerator objects
@@ -168,19 +137,7 @@ protected:
~StlRandomGeneratorFactory() { }
};
-
-
-#if (defined(_HAVE_TR1_RANDOM) || defined(_HAVE_STL_RANDOM))
-
// include StlRandomGenerator subclass
#include "trick/StlRandomGeneratorSub.hh"
-
-#else
- // do nothing class may be needed if no ??
- // may not if the base class is always a pointer (nullpointer) if not instantiated.
-
-#endif // _HAVE_TR1_RANDOM or _HAVE_STL_RANDOM
-
-
#endif // StlRandomGenerator_EXISTS
diff --git a/include/trick/StlRandomGeneratorSub.hh b/include/trick/StlRandomGeneratorSub.hh
index aa93e9961..e4552d602 100644
--- a/include/trick/StlRandomGeneratorSub.hh
+++ b/include/trick/StlRandomGeneratorSub.hh
@@ -2,8 +2,6 @@
#ifndef STLRANDOMGENERATORSUB_HH
#define STLRANDOMGENERATORSUB_HH
-#ifdef _HAVE_STL_RANDOM
-
///@brief return the correct param_type loaded with the input values
///
///@details Provides a way for a common input interface to return the correct param_type
@@ -38,9 +36,12 @@ public:
param(__attribute__((unused)) const std::normal_distribution& dist, double mean, double std_dev = 0.0)
{ return std::normal_distribution::param_type(mean,std_dev); }
- static std::poisson_distribution::param_type
- param(__attribute__((unused)) const std::poisson_distribution& dist, double mean, __attribute__((unused)) double unused = 0.0)
- { return std::poisson_distribution::param_type(mean); }
+ static std::poisson_distribution::param_type param(__attribute__((unused))
+ const std::poisson_distribution& dist,
+ double mean, __attribute__((unused)) double unused = 0.0)
+ {
+ return std::poisson_distribution::param_type(mean);
+ }
///@}
private:
@@ -48,22 +49,12 @@ private:
~ParamWrapper();
};
-#endif
-
-
-#if (defined(_HAVE_TR1_RANDOM) || defined(_HAVE_STL_RANDOM))
-
///@brief Return the appropriate union bit pattern for each distribution
///@note Implement one for each available distribution type.
class StlReturnWrapper {
public:
-
-#ifdef _HAVE_TR1_RANDOM
- static TRICK_GSL_RETURN_TYPE return_value(__attribute__((unused)) const std::uniform_real& dist, double ret_val)
-#endif
-#ifdef _HAVE_STL_RANDOM
- static TRICK_GSL_RETURN_TYPE return_value(__attribute__((unused)) const std::uniform_real_distribution& dist, double ret_val)
-#endif
+ static TRICK_GSL_RETURN_TYPE
+ return_value(__attribute__((unused)) const std::uniform_real_distribution& dist, double ret_val)
{
TRICK_GSL_RETURN_TYPE output;
output.d = ret_val;
@@ -77,73 +68,43 @@ public:
return output;
}
- static TRICK_GSL_RETURN_TYPE return_value(__attribute__((unused)) const std::poisson_distribution& dist, int ret_val)
+ static TRICK_GSL_RETURN_TYPE return_value(__attribute__((unused)) const std::poisson_distribution& dist,
+ int ret_val)
{
TRICK_GSL_RETURN_TYPE output;
output.ii = ret_val;
return output;
}
-
};
-#endif
///@brief Sub class for object that includes a engine and a distribution
///
-///@note partial specialization exists for Distribution = std::poisson_distribution
-/// because TR1 doesn't implement param_type system, thus has no way to generally
-/// init the class! (No way to use a common 2 parameter interface and ignore the
-/// second parameter for single parameter param_type distributions.)
-///
-///@note The partial specialization is NOT required when c++0x support is dropped.
-///
-/// Also, TR1 Distributions can not have their parameters changed after construction.
-/// This results in the need for template full method specialization to provide the type specific init.
-///
template
class StlRandomGeneratorSub : public StlRandomGenerator
{
-public:
-
-#ifdef _HAVE_STD_RANDOM // (Concept doesn't exist in TR1)
- typedef typename Distribution::param_type ParamType;
-#endif
-
- ///@note The input in_engine_type and in_dist_type must match the template parameters.
- /// This is intended to be assured by using StlRandomGeneratorFactory for construction.
- ///
- explicit StlRandomGeneratorSub(
- double in_param_a = 0.0,
- double in_param_b = 1.0,
- unsigned long in_seed = 12345,
- StlRandomGenerator::StlDistribution in_dist_type = FLAT,
- StlRandomGenerator::StlEngine in_engine_type = TRICK_DEFAULT_ENGINE
- )
- : StlRandomGenerator(in_param_a, in_param_b, in_seed, in_dist_type, in_engine_type),
- engine(in_seed)
- {
- // (Note: distribution member can't be input initialized in the initializer list
- // because various distributions have different signatures.
- //
- // NOTE: For the TR1 implementation, The set_param method
- // _re-constructs_ the object with the desired parameters.
- // (TR1 Distributions can only be initialized at construction time.)
- //
- set_param(in_param_a, in_param_b);
- }
+ public:
+ typedef typename Distribution::param_type ParamType;
+
+ ///@note The input in_engine_type and in_dist_type must match the template parameters.
+ /// This is intended to be assured by using StlRandomGeneratorFactory for construction.
+ ///
+ explicit StlRandomGeneratorSub(double in_param_a = 0.0, double in_param_b = 1.0, unsigned long in_seed = 12345,
+ StlRandomGenerator::StlDistribution in_dist_type = FLAT,
+ StlRandomGenerator::StlEngine in_engine_type = TRICK_DEFAULT_ENGINE)
+ : StlRandomGenerator(in_param_a, in_param_b, in_seed, in_dist_type, in_engine_type)
+ , engine(in_seed)
+ {
+ // (Note: distribution member can't be input initialized in the initializer list
+ // because various distributions have different signatures.
+ set_param(in_param_a, in_param_b);
+ }
virtual ~StlRandomGeneratorSub() { }
///@brief return next pseudo-random number
virtual TRICK_GSL_RETURN_TYPE operator()()
{
-#if (defined(_HAVE_TR1_RANDOM) || defined(_HAVE_STL_RANDOM))
return StlReturnWrapper::return_value(distribution, distribution(engine));
-#else
- // without either, won't ever be called. But to compile, return zero.
- TRICK_GSL_RETURN_TYPE output;
- output.d = 0.0;
- return output;
-#endif
}
///@brief reset seed for underlying uniform pseudo-random number generator
@@ -158,107 +119,18 @@ public:
///@param a is min for FLAT, mean for GAUSSION and POISSON
///@param b is max for FLAT, sigma for GAUSSION and unused for POISSON
///
- ///@note For the TR1 implementation, The set_param method
- /// _re-constructs_ the object with the desired parameters.
- ///
- /// (C++11 allows changing the parameters on the fly.)
- ///
virtual void set_param(double a, double b = 0.0)
{
param_a = a;
param_b = b;
-#ifdef _HAVE_STL_RANDOM
- // (this param_type interface is not provided in TR1)
- distribution.param( ParamWrapper::param(distribution, a,b) );
-#else
- // TR1 implementation must use this hokey
- // full template specialization solution.
- tr1_init_distribution(a, b);
-#endif
+ distribution.param(ParamWrapper::param(distribution, a, b));
}
protected:
Engine engine; /**< -- STL random number engine object */
- Distribution distribution; /**< -- STL random number distribution object */
-
-private:
-
-#ifdef _HAVE_TR1_RANDOM
- ///@brief For TR1, replace the default initialized distribution with a new one.
- ///
- ///@details because TR1 only allows initialization of Distribution parameters at
- /// construction time (C++11 provides the param_type system for doing this post-construction),
- /// this method with full template specializations is used to get around this
- /// lack of generality for the few so-far implemented distribution options.
- ///
- /// Once C++11 is required, these can be removed and the simpler C++11 set_param
- /// method used for all.
- ///
- void tr1_init_distribution(double a, double b)
- {
- // All two parameter signature distributions can use this method.
- // Deviant sets must implement a full template specialization for this method.
- distribution = Distribution(a, b);
- }
-#endif
-
+ Distribution distribution; /**< -- STL random number distribution object */
};
-#ifdef _HAVE_TR1_RANDOM
-
-// implement one of these template FULL specializations
-// for each implemented TR1 StlRandomGenerator::StlEngine enums
-//
-// So far, only the Poisson distribution requires a single parameter,
-// causing the issue.
-
-/*
-// these engines are no longer allowed for TR1 (caused infinite loops in normal_distribution)
-
-template<>
-inline
-void
-StlRandomGeneratorSub
- >::tr1_init_distribution(double a, double __attribute__((unused)) b)
-{
- distribution = std::poisson_distribution(a);
-}
-
-template<>
-inline
-void
-StlRandomGeneratorSub
- >::tr1_init_distribution(double a, double __attribute__((unused)) b)
-{
- distribution = std::poisson_distribution(a);
-}
-
-*/
-
-template<>
-inline
-void
-StlRandomGeneratorSub
- >::tr1_init_distribution(double a, double __attribute__((unused)) b)
-{
- distribution = std::poisson_distribution(a);
-}
-
-template<>
-inline
-void
-StlRandomGeneratorSub
- >::tr1_init_distribution(double a, double __attribute__((unused)) b)
-{
- distribution = std::poisson_distribution(a);
-}
-
-#endif
-
#endif
diff --git a/include/trick/checkpoint_map.hh b/include/trick/checkpoint_map.hh
index 65916c384..7264d8295 100644
--- a/include/trick/checkpoint_map.hh
+++ b/include/trick/checkpoint_map.hh
@@ -8,22 +8,21 @@
#ifndef CHECKPOINT_MAP_HH
#define CHECKPOINT_MAP_HH
-#include