From b7bf93cad5b77c754ad3091f83080b0007e02b23 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Wed, 28 Sep 2016 20:13:05 -0500 Subject: [PATCH 01/44] Added a C++ version of dirname() which handles the maybe-modified/maybe-allocated/maybe-static arg and result strings for the caller. --- src/libext/filesystem.hpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/libext/filesystem.hpp b/src/libext/filesystem.hpp index 1fd46e4f..4c77c953 100644 --- a/src/libext/filesystem.hpp +++ b/src/libext/filesystem.hpp @@ -24,6 +24,17 @@ #include #include // for dev_t, ino_t +// Don't know where the name "libgen" comes from, but this is where POSIX says dirname() and basename() are declared. +/// There are two basename()s. GNU basename, from string.h, and POSIX basename() from libgen.h. +/// See notes here: https://linux.die.net/man/3/dirname +/// Of course they behave slightly differently: GNU version returns an empty string if the path has a trailing slash, and doesn't modify it's argument. +/// To complicate matters further, the glibc version of the POSIX function versions do modify their args. +/// And at least NetBSD behaves similarly. So, include the POSIX versions and we'll try to clean this mess up below. +#include + +/// @note Because we included libgen.h above, we shouldn't get the GNU version from this #include of string.h. +#include +#include #include "integer.hpp" @@ -71,4 +82,25 @@ inline bool is_same_file(int fd1, int fd2) } } + +/** + * A more usable and portable replacement for GNU and POSIX dirname(). + * + * @param path + * @return + */ +inline std::string dirname(const std::string &path) +{ + // Get a copy of the path string which dirname() can modify all it wants. + char * modifiable_path = strdup(path.c_str()); + + // Copy the output of dirname into a std:string. We don't ever free the string dirname() returns + // because it's either a static buffer, or it's a pointer to modifiable_path. The latter we'll free below. + std::string retval(dirname(modifiable_path)); + + free(modifiable_path); + + return retval; +} + #endif /* SRC_LIBEXT_FILESYSTEM_HPP_ */ From 147ee36c2473e41d18fe0505ec63f914ac577751 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Thu, 29 Sep 2016 19:19:51 -0500 Subject: [PATCH 02/44] Interim. --- src/ArgParse.cpp | 15 ++++++++------- src/libext/filesystem.hpp | 11 ++++++++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/ArgParse.cpp b/src/ArgParse.cpp index 430a277e..c3373259 100644 --- a/src/ArgParse.cpp +++ b/src/ArgParse.cpp @@ -57,7 +57,7 @@ #include #include // for GetUserHomeDir()-->getuid(). #include -#include // Don't know where the name "libgen" comes from, but this is where POSIX says dirname() and basename() are declared. +//#include // Don't know where the name "libgen" comes from, but this is where POSIX says dirname() and basename() are declared. #include #include @@ -752,16 +752,17 @@ std::string ArgParse::GetProjectRCFilename() const char *original_cwd = getcwd(NULL, 0); #endif + LOG(INFO) << "cwd = \'" << original_cwd << "\'"; - char *current_cwd = original_cwd; - while((current_cwd != nullptr) && (current_cwd[0] != '.')) + std::string current_cwd(original_cwd == nullptr ? "" : original_cwd); + while(!current_cwd.empty() && current_cwd[0] != '.') { // If we were able to get a file descriptor to $HOME above... if(home_fd != -1) { // ...check if this dir is the user's $HOME dir. - int cwd_fd = open(current_cwd, O_RDONLY); + int cwd_fd = open(current_cwd.c_str(), O_RDONLY); if(cwd_fd != -1) { /// @todo Should probably check for is-a-dir here. @@ -777,7 +778,7 @@ std::string ArgParse::GetProjectRCFilename() const } // Try to open the config file. - auto test_rc_filename = std::string(current_cwd); + auto test_rc_filename = current_cwd; if(*test_rc_filename.rbegin() != '/') { test_rc_filename += "/"; @@ -797,14 +798,14 @@ std::string ArgParse::GetProjectRCFilename() const /// @note GRVS - get_current_dir_name() under Cygwin will currently return a DOS path if this is started /// under the Eclipse gdb. This mostly doesn't cause problems, except for terminating the loop. /// The clause below after the || handles this. - if((std::strlen(current_cwd) == 1) || (std::strlen(current_cwd) <= 4 && current_cwd[1] == ':')) + if((current_cwd.length() == 1) || (current_cwd.length() <= 4 && current_cwd[1] == ':')) { // We've hit the root and didn't find a config file. break; } // Go up one directory. - current_cwd = dirname(current_cwd); + current_cwd = portable::dirname(current_cwd); } // Free the cwd string. diff --git a/src/libext/filesystem.hpp b/src/libext/filesystem.hpp index 4c77c953..5af02621 100644 --- a/src/libext/filesystem.hpp +++ b/src/libext/filesystem.hpp @@ -82,12 +82,15 @@ inline bool is_same_file(int fd1, int fd2) } } +namespace portable +{ /** - * A more usable and portable replacement for GNU and POSIX dirname(). + * A more usable and portable replacement for glibc and POSIX dirname(). * - * @param path - * @return + * @param path const ref to a path string. Guaranteed to not be modified in any way by the function call. + * @return A std::string representing the path to return the directory of. Guaranteed to be a normal std::string with which you may do + * whatever you can do with any other std::string. */ inline std::string dirname(const std::string &path) { @@ -103,4 +106,6 @@ inline std::string dirname(const std::string &path) return retval; } +} + #endif /* SRC_LIBEXT_FILESYSTEM_HPP_ */ From fc2c0f729dee3db0295878d4d07b49fcd86a02f8 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Thu, 29 Sep 2016 20:05:09 -0500 Subject: [PATCH 03/44] Fixed infinite recursion. --- src/libext/filesystem.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libext/filesystem.hpp b/src/libext/filesystem.hpp index 5af02621..6428d410 100644 --- a/src/libext/filesystem.hpp +++ b/src/libext/filesystem.hpp @@ -99,7 +99,7 @@ inline std::string dirname(const std::string &path) // Copy the output of dirname into a std:string. We don't ever free the string dirname() returns // because it's either a static buffer, or it's a pointer to modifiable_path. The latter we'll free below. - std::string retval(dirname(modifiable_path)); + std::string retval(::dirname(modifiable_path)); free(modifiable_path); From 5ee7e35fc8e3e87fe30d317e7f95decc22309380 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Thu, 29 Sep 2016 20:14:10 -0500 Subject: [PATCH 04/44] Add so we have a prototype for free(). --- src/libext/filesystem.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libext/filesystem.hpp b/src/libext/filesystem.hpp index 6428d410..71b4a9e7 100644 --- a/src/libext/filesystem.hpp +++ b/src/libext/filesystem.hpp @@ -34,6 +34,7 @@ /// @note Because we included libgen.h above, we shouldn't get the GNU version from this #include of string.h. #include +#include // For free(). #include #include "integer.hpp" From 8584819fe0c63ce72dc303c5efe80e7f5fe36b98 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Thu, 29 Sep 2016 20:50:31 -0500 Subject: [PATCH 05/44] Updated NEWS.md for bug/ISSUE96-dirname. --- NEWS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 1491588d..fe0ec5c9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -30,7 +30,8 @@ ### Fixed - Cygwin now requires AC_USE_SYSTEM_EXTENSIONS for access to get_current_dir_name(). Resolves #76. - Resolved issue with highlights on wrapped lines sometimes extending the full width of the terminal. Resolves #80. -- Resolved issue where matches spanning an eol (e.g. 'a\s+b' matching 'a\nb') would cause the program to throw an exception and terminate. Resolves #92. +- Resolved issue where matches spanning an eol (e.g. 'a\s+b' matching 'a\nb') would cause the program to throw an exception and terminate. Resolves #92. +- Resolved segfaults on some systems due to dirname() modifying its parameter. Resolves #96. ## [0.2.2] - 2016-04-09 From 038e498679dcce932469089ff794176e44d7024c Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Fri, 30 Sep 2016 08:40:33 -0500 Subject: [PATCH 06/44] Portability fix: test == to test =. --- configure.ac | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 042f3881..d23c5bab 100644 --- a/configure.ac +++ b/configure.ac @@ -149,7 +149,7 @@ AC_PROG_EGREP AC_PROG_FGREP AC_PROG_AWK AC_PROG_LN_S -AS_IF([test "$LN_S" == 'ln -s'], +AS_IF([test "$LN_S" = 'ln -s'], [AC_SUBST([TEST_LN_S], [$LN_S])], [AC_SUBST([TEST_LN_S], [:]) AC_MSG_WARN([couldn't find a real 'ln -s', will not be able to run all tests])]) @@ -345,7 +345,7 @@ AM_COND_IF([BUILD_X86_64_ISA_EXTENSIONS], # optionally use some pthreads functionality, e.g. naming threads for diagnostic, logging, and other purposes. # Macro docs: http://www.gnu.org/software/autoconf-archive/ax_pthread.html#ax_pthread AX_PTHREAD -AS_IF([test "x$ax_pthread_ok" == xyes], +AS_IF([test "x$ax_pthread_ok" = xyes], [ AC_MSG_NOTICE([found pthreads]) AC_MSG_CHECKING([if the C++11 underlying thread implementation is pthreads]) @@ -353,8 +353,7 @@ AS_IF([test "x$ax_pthread_ok" == xyes], [AC_LANG_PROGRAM([ #include #include - #include - + #include ], [ static_assert(std::is_same::value, "C++11 underlying thread implementation is not pthreads"); From 75a14441281732427512887eb849068cd54c3459 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Sat, 1 Oct 2016 20:51:24 -0500 Subject: [PATCH 07/44] Updated some M4 macros to GNU Autoconf Archive version 2016.09.16. --- m4/ax_count_cpus.m4 | 113 ++++--- m4/ax_cxx_compile_stdcxx.m4 | 14 +- m4/ax_cxx_compile_stdcxx_11.m4 | 8 +- m4/ax_gcc_builtin.m4 | 4 +- m4/ax_prog_doxygen.m4 | 5 +- m4/ax_pthread.m4 | 550 ++++++++++++++++----------------- 6 files changed, 369 insertions(+), 325 deletions(-) diff --git a/m4/ax_count_cpus.m4 b/m4/ax_count_cpus.m4 index eeecccf5..0922e702 100644 --- a/m4/ax_count_cpus.m4 +++ b/m4/ax_count_cpus.m4 @@ -4,18 +4,21 @@ # # SYNOPSIS # -# AX_COUNT_CPUS +# AX_COUNT_CPUS([ACTION-IF-DETECTED],[ACTION-IF-NOT-DETECTED]) # # DESCRIPTION # -# Attempt to count the number of processors present on the machine. If the -# detection fails, then a value of 1 is assumed. +# Attempt to count the number of logical processor cores (including +# virtual and HT cores) currently available to use on the machine and +# place detected value in CPU_COUNT variable. # -# The value is placed in the CPU_COUNT variable. +# On successful detection, ACTION-IF-DETECTED is executed if present. If +# the detection fails, then ACTION-IF-NOT-DETECTED is triggered. The +# default ACTION-IF-NOT-DETECTED is to set CPU_COUNT to 1. # # LICENSE # -# Copyright (c) 2014 Karlson2k (Evgeny Grin) +# Copyright (c) 2014,2016 Karlson2k (Evgeny Grin) # Copyright (c) 2012 Brian Aker # Copyright (c) 2008 Michael Paul Bailey # Copyright (c) 2008 Christophe Tournayre @@ -25,42 +28,74 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 11 +#serial 21 - AC_DEFUN([AX_COUNT_CPUS],[ - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_PROG_EGREP]) + AC_DEFUN([AX_COUNT_CPUS],[dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_EGREP])dnl AC_MSG_CHECKING([the number of available CPUs]) CPU_COUNT="0" - AS_CASE([$host_os],[ - *darwin*],[ - AS_IF([test -x /usr/sbin/sysctl],[ - sysctl_a=`/usr/sbin/sysctl -a 2>/dev/null| grep -c hw.cpu` - AS_IF([test sysctl_a],[ - CPU_COUNT=`/usr/sbin/sysctl -n hw.ncpu` - ]) - ])],[ - *linux*],[ - AS_IF([test "x$CPU_COUNT" = "x0" -a -e /proc/cpuinfo],[ - AS_IF([test "x$CPU_COUNT" = "x0" -a -e /proc/cpuinfo],[ - CPU_COUNT=`$EGREP -c '^processor' /proc/cpuinfo` - ]) - ])],[ - *mingw*],[ - AS_IF([test -n "$NUMBER_OF_PROCESSORS"],[ - CPU_COUNT="$NUMBER_OF_PROCESSORS" - ])],[ - *cygwin*],[ - AS_IF([test -n "$NUMBER_OF_PROCESSORS"],[ - CPU_COUNT="$NUMBER_OF_PROCESSORS" - ]) - ]) + # Try generic methods - AS_IF([test "x$CPU_COUNT" = "x0"],[ - CPU_COUNT="1" - AC_MSG_RESULT( [unable to detect (assuming 1)] ) - ],[ - AC_MSG_RESULT( $CPU_COUNT ) - ]) - ]) + # 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and + # 'NPROCESSORS_ONLN' are platform-specific + command -v getconf >/dev/null 2>&1 && \ + CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0" + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1]],[[: # empty]],[dnl + # 'nproc' is part of GNU Coreutils and is widely available + CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0" + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl + # Try platform-specific preferred methods + AS_CASE([[$host_os]],dnl + [[*linux*]],[[CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+,' -c` || CPU_COUNT="0"]],dnl + [[*darwin*]],[[CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0"]],dnl + [[freebsd*]],[[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0"]],dnl + [[netbsd*]], [[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0"]],dnl + [[solaris*]],[[command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^@<:@0-9@:>@.*on-line' -c 2>/dev/null` || CPU_COUNT="0"]],dnl + [[mingw*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl + [[msys*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl + [[cygwin*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]]dnl + )dnl + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1]],[[: # empty]],[dnl + # Try less preferred generic method + # 'hw.ncpu' exist on many platforms, but not on GNU/Linux + CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0" + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl + # Try platform-specific fallback methods + # They can be less accurate and slower then preferred methods + AS_CASE([[$host_os]],dnl + [[*linux*]],[[CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0"]],dnl + [[*darwin*]],[[CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0"]],dnl + [[freebsd*]],[[CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl + [[netbsd*]], [[CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^@<:@0-9@:>@+ .* online ' -c` || \ + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl + [[solaris*]],[[command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \ + CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0"]],dnl + [[mingw*]],[AS_IF([[CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\@<:@0-9@:>@+$' -c`]],dnl + [[: # empty]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]])],dnl + [[msys*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]],dnl + [[cygwin*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]]dnl + )dnl + ])dnl + + AS_IF([[test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null]],[dnl + AC_MSG_RESULT([[$CPU_COUNT]]) + m4_ifvaln([$1],[$1],)dnl + ],[dnl + m4_ifval([$2],[dnl + AS_UNSET([[CPU_COUNT]]) + AC_MSG_RESULT([[unable to detect]]) + $2 + ], [dnl + CPU_COUNT="1" + AC_MSG_RESULT([[unable to detect (assuming 1)]]) + ])dnl + ])dnl + ])dnl diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 index 8adc7656..2c18e49c 100644 --- a/m4/ax_cxx_compile_stdcxx.m4 +++ b/m4/ax_cxx_compile_stdcxx.m4 @@ -9,9 +9,9 @@ # DESCRIPTION # # Check for baseline language coverage in the compiler for the specified -# version of the C++ standard. If necessary, add switches to CXX to -# enable support. VERSION may be '11' (for the C++11 standard) or '14' -# (for the C++14 standard). +# version of the C++ standard. If necessary, add switches to CXX and +# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) +# or '14' (for the C++14 standard). # # The second argument, if specified, indicates whether you insist on an # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. @@ -39,7 +39,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 3 +#serial 4 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl (serial version number 13). @@ -82,6 +82,9 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi ac_success=yes break fi @@ -105,6 +108,9 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi ac_success=yes break fi diff --git a/m4/ax_cxx_compile_stdcxx_11.m4 b/m4/ax_cxx_compile_stdcxx_11.m4 index b3d4bfda..0aadeafe 100644 --- a/m4/ax_cxx_compile_stdcxx_11.m4 +++ b/m4/ax_cxx_compile_stdcxx_11.m4 @@ -9,7 +9,8 @@ # DESCRIPTION # # Check for baseline language coverage in the compiler for the C++11 -# standard; if necessary, add switches to CXX to enable support. +# standard; if necessary, add switches to CXX and CXXCPP to enable +# support. # # This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX # macro with the version set to C++11. The two optional arguments are @@ -32,8 +33,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 15 - -include([ax_cxx_compile_stdcxx.m4]) +#serial 17 +AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) diff --git a/m4/ax_gcc_builtin.m4 b/m4/ax_gcc_builtin.m4 index b28a91b1..54d87298 100644 --- a/m4/ax_gcc_builtin.m4 +++ b/m4/ax_gcc_builtin.m4 @@ -24,6 +24,7 @@ # The macro currently supports the following built-in functions: # # __builtin_assume_aligned +# __builtin_bswap16 # __builtin_bswap32 # __builtin_bswap64 # __builtin_choose_expr @@ -90,7 +91,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 2 +#serial 3 AC_DEFUN([AX_GCC_BUILTIN], [ AS_VAR_PUSHDEF([ac_var], [ax_cv_have_$1]) @@ -99,6 +100,7 @@ AC_DEFUN([AX_GCC_BUILTIN], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [ m4_case([$1], [__builtin_assume_aligned], [$1("", 0)], + [__builtin_bswap16], [$1(0)], [__builtin_bswap32], [$1(0)], [__builtin_bswap64], [$1(0)], [__builtin_choose_expr], [$1(0, 0, 0)], diff --git a/m4/ax_prog_doxygen.m4 b/m4/ax_prog_doxygen.m4 index b2a899f3..e92c9e44 100644 --- a/m4/ax_prog_doxygen.m4 +++ b/m4/ax_prog_doxygen.m4 @@ -97,7 +97,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 19 +#serial 20 ## ----------## ## Defaults. ## @@ -553,7 +553,8 @@ doxygen-doc: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL) ]])dnl [DX_CLEANFILES = \\] m4_foreach([DX_i], [DX_loop], -[[ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag \\ +[[ \$(DX_DOCDIR]DX_i[)/doxygen_sqlite3.db \\ + \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag \\ ]])dnl [ -r \\ \$(DX_CLEAN_HTML) \\ diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4 index d218d1af..4c4051ea 100644 --- a/m4/ax_pthread.m4 +++ b/m4/ax_pthread.m4 @@ -82,7 +82,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 22 +#serial 23 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ @@ -100,22 +100,22 @@ ax_pthread_ok=no # etcetera environment variables, and if threads linking works using # them: if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then - ax_pthread_save_CC="$CC" - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) - AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) - AC_MSG_RESULT([$ax_pthread_ok]) - if test "x$ax_pthread_ok" = "xno"; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - CC="$ax_pthread_save_CC" - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" + ax_pthread_save_CC="$CC" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) + AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) + AC_MSG_RESULT([$ax_pthread_ok]) + if test "x$ax_pthread_ok" = "xno"; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + CC="$ax_pthread_save_CC" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" fi # We must check for the threads library under a number of different @@ -152,50 +152,50 @@ ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread -- case $host_os in - freebsd*) + freebsd*) - # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) - # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) - ax_pthread_flags="-kthread lthread $ax_pthread_flags" - ;; + ax_pthread_flags="-kthread lthread $ax_pthread_flags" + ;; - hpux*) + hpux*) - # From the cc(1) man page: "[-mt] Sets various -D flags to enable - # multi-threading and also sets -lpthread." + # From the cc(1) man page: "[-mt] Sets various -D flags to enable + # multi-threading and also sets -lpthread." - ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" - ;; + ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" + ;; - openedition*) + openedition*) - # IBM z/OS requires a feature-test macro to be defined in order to - # enable POSIX threads at all, so give the user a hint if this is - # not set. (We don't define these ourselves, as they can affect - # other portions of the system API in unpredictable ways.) + # IBM z/OS requires a feature-test macro to be defined in order to + # enable POSIX threads at all, so give the user a hint if this is + # not set. (We don't define these ourselves, as they can affect + # other portions of the system API in unpredictable ways.) - AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], - [ -# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) - AX_PTHREAD_ZOS_MISSING -# endif - ], - [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) - ;; + AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], + [ +# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) + AX_PTHREAD_ZOS_MISSING +# endif + ], + [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) + ;; - solaris*) + solaris*) - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (N.B.: The stubs are missing - # pthread_cleanup_push, or rather a function called by this macro, - # so we could check for that, but who knows whether they'll stub - # that too in a future libc.) So we'll check first for the - # standard Solaris way of linking pthreads (-mt -lpthread). + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (N.B.: The stubs are missing + # pthread_cleanup_push, or rather a function called by this macro, + # so we could check for that, but who knows whether they'll stub + # 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,pthread 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) @@ -208,17 +208,17 @@ AS_IF([test "x$GCC" = "xyes"], # correctly enabled case $host_os in - darwin* | hpux* | linux* | osf* | solaris*) - ax_pthread_check_macro="_REENTRANT" - ;; + darwin* | hpux* | linux* | osf* | solaris*) + ax_pthread_check_macro="_REENTRANT" + ;; - aix* | freebsd*) - ax_pthread_check_macro="_THREAD_SAFE" - ;; + aix*) + ax_pthread_check_macro="_THREAD_SAFE" + ;; - *) - ax_pthread_check_macro="--" - ;; + *) + ax_pthread_check_macro="--" + ;; esac AS_IF([test "x$ax_pthread_check_macro" = "x--"], [ax_pthread_check_cond=0], @@ -231,13 +231,13 @@ AC_CACHE_CHECK([whether $CC is Clang], [ax_cv_PTHREAD_CLANG=no # Note that Autoconf sets GCC=yes for Clang as well as GCC if test "x$GCC" = "xyes"; then - AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], - [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ -# if defined(__clang__) && defined(__llvm__) - AX_PTHREAD_CC_IS_CLANG -# endif - ], - [ax_cv_PTHREAD_CLANG=yes]) + AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], + [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif + ], + [ax_cv_PTHREAD_CLANG=yes]) fi ]) ax_pthread_clang="$ax_cv_PTHREAD_CLANG" @@ -249,222 +249,222 @@ ax_pthread_clang_warning=no 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.) - - PTHREAD_CFLAGS="-pthread" - PTHREAD_LIBS= - - ax_pthread_ok=yes - - # 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. - - AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], - [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], - [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 - AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) - CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" - ac_link="$ax_pthread_save_ac_link" - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], - [ac_link="$ax_pthread_2step_ac_link" - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], - [break]) - ]) - done - ac_link="$ax_pthread_save_ac_link" - CFLAGS="$ax_pthread_save_CFLAGS" - AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) - ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" - ]) - - case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in - no | unknown) ;; - *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; - esac + # 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.) + + PTHREAD_CFLAGS="-pthread" + PTHREAD_LIBS= + + ax_pthread_ok=yes + + # 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. + + AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], + [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 + AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) + CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" + ac_link="$ax_pthread_save_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [ac_link="$ax_pthread_2step_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [break]) + ]) + done + ac_link="$ax_pthread_save_ac_link" + CFLAGS="$ax_pthread_save_CFLAGS" + AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" + ]) + + 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 - case $ax_pthread_try_flag in - none) - AC_MSG_CHECKING([whether pthreads work without any flags]) - ;; - - -mt,pthread) - AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) - PTHREAD_CFLAGS="-mt" - PTHREAD_LIBS="-lpthread" - ;; - - -*) - AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) - PTHREAD_CFLAGS="$ax_pthread_try_flag" - ;; - - pthread-config) - AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) - AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; - - *) - AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) - PTHREAD_LIBS="-l$ax_pthread_try_flag" - ;; - esac - - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include -# if $ax_pthread_check_cond -# error "$ax_pthread_check_macro must be defined" -# endif - static void routine(void *a) { a = 0; } - static void *start_routine(void *a) { return a; }], - [pthread_t th; pthread_attr_t attr; - pthread_create(&th, 0, start_routine, 0); - pthread_join(th, 0); - pthread_attr_init(&attr); - pthread_cleanup_push(routine, 0); - pthread_cleanup_pop(0) /* ; */])], - [ax_pthread_ok=yes], - []) - - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" - - AC_MSG_RESULT([$ax_pthread_ok]) - AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" + case $ax_pthread_try_flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -mt,pthread) + AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) + PTHREAD_CFLAGS="-mt" + PTHREAD_LIBS="-lpthread" + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) + PTHREAD_CFLAGS="$ax_pthread_try_flag" + ;; + + pthread-config) + AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) + AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) + PTHREAD_LIBS="-l$ax_pthread_try_flag" + ;; + esac + + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + AC_MSG_RESULT([$ax_pthread_ok]) + AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$ax_pthread_ok" = "xyes"; then - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - - # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - AC_CACHE_CHECK([for joinable pthread attribute], - [ax_cv_PTHREAD_JOINABLE_ATTR], - [ax_cv_PTHREAD_JOINABLE_ATTR=unknown - for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], - [int attr = $ax_pthread_attr; return attr /* ; */])], - [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], - []) - done - ]) - AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ - test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ - test "x$ax_pthread_joinable_attr_defined" != "xyes"], - [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], - [$ax_cv_PTHREAD_JOINABLE_ATTR], - [Define to necessary symbol if this constant - uses a non-standard name on your system.]) - ax_pthread_joinable_attr_defined=yes - ]) - - AC_CACHE_CHECK([whether more special flags are required for pthreads], - [ax_cv_PTHREAD_SPECIAL_FLAGS], - [ax_cv_PTHREAD_SPECIAL_FLAGS=no - case $host_os in - solaris*) - ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" - ;; - esac - ]) - AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ - test "x$ax_pthread_special_flags_added" != "xyes"], - [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" - ax_pthread_special_flags_added=yes]) - - AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], - [ax_cv_PTHREAD_PRIO_INHERIT], - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[int i = PTHREAD_PRIO_INHERIT;]])], - [ax_cv_PTHREAD_PRIO_INHERIT=yes], - [ax_cv_PTHREAD_PRIO_INHERIT=no]) - ]) - AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ - test "x$ax_pthread_prio_inherit_defined" != "xyes"], - [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) - ax_pthread_prio_inherit_defined=yes - ]) - - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" - - # More AIX lossage: compile with *_r variant - if test "x$GCC" != "xyes"; then - case $host_os in - aix*) - AS_CASE(["x/$CC"], - [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], - [#handle absolute path differently from PATH based program lookup - AS_CASE(["x$CC"], - [x/*], - [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], - [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) - ;; - esac - fi + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_CACHE_CHECK([for joinable pthread attribute], + [ax_cv_PTHREAD_JOINABLE_ATTR], + [ax_cv_PTHREAD_JOINABLE_ATTR=unknown + for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $ax_pthread_attr; return attr /* ; */])], + [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], + []) + done + ]) + AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ + test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ + test "x$ax_pthread_joinable_attr_defined" != "xyes"], + [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], + [$ax_cv_PTHREAD_JOINABLE_ATTR], + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + ax_pthread_joinable_attr_defined=yes + ]) + + AC_CACHE_CHECK([whether more special flags are required for pthreads], + [ax_cv_PTHREAD_SPECIAL_FLAGS], + [ax_cv_PTHREAD_SPECIAL_FLAGS=no + case $host_os in + solaris*) + ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" + ;; + esac + ]) + AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ + test "x$ax_pthread_special_flags_added" != "xyes"], + [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" + ax_pthread_special_flags_added=yes]) + + AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], + [ax_cv_PTHREAD_PRIO_INHERIT], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) + ]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ + test "x$ax_pthread_prio_inherit_defined" != "xyes"], + [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) + ax_pthread_prio_inherit_defined=yes + ]) + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + # More AIX lossage: compile with *_r variant + if test "x$GCC" != "xyes"; then + case $host_os in + aix*) + AS_CASE(["x/$CC"], + [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], + [#handle absolute path differently from PATH based program lookup + AS_CASE(["x$CC"], + [x/*], + [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], + [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + ;; + esac + fi fi test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" @@ -475,11 +475,11 @@ AC_SUBST([PTHREAD_CC]) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test "x$ax_pthread_ok" = "xyes"; then - ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) - : + ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) + : else - ax_pthread_ok=no - $2 + ax_pthread_ok=no + $2 fi AC_LANG_POP ])dnl AX_PTHREAD From 20a2cdb29709962532438097bc2a86511c1390d1 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Sun, 2 Oct 2016 15:01:52 -0500 Subject: [PATCH 08/44] AX_COUNT_CPUS's signature has changed. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index d23c5bab..0cff9512 100644 --- a/configure.ac +++ b/configure.ac @@ -59,7 +59,7 @@ AM_INIT_AUTOMAKE([ AC_USE_SYSTEM_EXTENSIONS # Determine how many CPUs we have on the build machine. -AX_COUNT_CPUS +AX_COUNT_CPUS([], []) AC_SUBST([CPU_COUNT]) # Set up the maintainer compiler flags. From 3f7e07ebc84b76c822a222c3d14cc159b3ce662e Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Sun, 2 Oct 2016 15:44:44 -0500 Subject: [PATCH 09/44] Not finding Argp needs to be a fatal configure error at this time. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 0cff9512..2fbbb7a9 100644 --- a/configure.ac +++ b/configure.ac @@ -390,7 +390,7 @@ AC_CHECK_DECLS([std::to_string(int)], ], [], [#include ]) -AC_SEARCH_LIBS([argp_parse],[argp]) +AC_SEARCH_LIBS([argp_parse], [argp], [], [AC_MSG_ERROR([cannot find the GNU Argp library or equivalent.])]) AC_CHECK_FUNCS([sched_setaffinity]) From c82b4af1645a5bf83d6081a3ef9eefb552afd5c1 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Sun, 2 Oct 2016 15:54:44 -0500 Subject: [PATCH 10/44] Moved function attributes from aligned_alloc() definition to declaration. --- src/ResizableArray.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ResizableArray.h b/src/ResizableArray.h index 3a3c75f6..9c7ccc23 100644 --- a/src/ResizableArray.h +++ b/src/ResizableArray.h @@ -27,7 +27,8 @@ // Nothing to do. #elif HAVE_POSIX_MEMALIGN // Create a thin wrapper around posix_memalign(). -inline void* aligned_alloc(size_t algn, size_t size) ATTR_ALLOC_SIZE(2) ATTR_MALLOC { void *p=0; posix_memalign(&p, algn, size); return p; }; +inline void* aligned_alloc(size_t algn, size_t size) ATTR_ALLOC_SIZE(2) ATTR_MALLOC; +inline void* aligned_alloc(size_t algn, size_t size) { void *p=0; posix_memalign(&p, algn, size); return p; }; #else #error "Could not find aligned memory allocator." #endif From fb57f6cca538efc6b356af4ae3f49ec306e2243b Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Sun, 2 Oct 2016 19:38:05 -0500 Subject: [PATCH 11/44] Travis matrix experiment. --- .travis.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index cd7f5a3f..d7467338 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,12 @@ language: cpp -sudo: required -dist: trusty -os: - - osx - - linux +matrix: + include: + - os: osx + osx_image: xcode8 + - os: linux + dist: trusty + sudo: required compiler: - clang From 1c9d76e04f6855e8f82e03c8d347d68b2cf2ae4b Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Sun, 2 Oct 2016 19:40:18 -0500 Subject: [PATCH 12/44] Travis matrix experiment. --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index d7467338..f4796ca8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,12 @@ language: cpp matrix: - include: - - os: osx - osx_image: xcode8 - - os: linux - dist: trusty - sudo: required + include: + - os: osx + osx_image: xcode8 + - os: linux + dist: trusty + sudo: required compiler: - clang From e68ce7be686d56d5f0a5f16429073239f678ceb8 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Sun, 2 Oct 2016 19:55:16 -0500 Subject: [PATCH 13/44] Travis matrix experiment. --- .travis.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4796ca8..d0fe1020 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,14 @@ matrix: - os: linux dist: trusty sudo: required - -compiler: - - clang - - gcc + compiler: gcc + - os: linux + dist: trusty + sudo: required + compiler: clang +#compiler: +# - clang +# - gcc before_install: - if [ $TRAVIS_OS_NAME == osx ]; then brew update; fi From e88173bf3102904f8c4f40942bcde047e4e72efd Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Sun, 2 Oct 2016 20:04:59 -0500 Subject: [PATCH 14/44] Travis matrix experiment. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d0fe1020..de1c0f02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,9 @@ language: cpp matrix: include: - os: osx - osx_image: xcode8 + osx_image: + - xcode8 + - beta-xcode6.1 - os: linux dist: trusty sudo: required From 2655269af3225bc83622a7be57adece9e0c51b49 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Sun, 2 Oct 2016 20:07:02 -0500 Subject: [PATCH 15/44] Travis matrix experiment. --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index de1c0f02..c69af7a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,7 @@ language: cpp matrix: include: - os: osx - osx_image: - - xcode8 - - beta-xcode6.1 + osx_image: [xcode8, beta-xcode6.1] - os: linux dist: trusty sudo: required From ef97f3dba9e4caab934023728eaaf81f7337efd3 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Sun, 2 Oct 2016 20:08:25 -0500 Subject: [PATCH 16/44] Travis matrix experiment. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c69af7a3..357249fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,9 @@ language: cpp matrix: include: - os: osx - osx_image: [xcode8, beta-xcode6.1] + osx_image: beta-xcode6.1 + - os: osx + osx_image: xcode8 - os: linux dist: trusty sudo: required From 745c436244337811af47a25ee61cb60469cf6996 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Sun, 2 Oct 2016 20:47:32 -0500 Subject: [PATCH 17/44] Don't throw exception if PCRE2 regex JIT compile indicates JIT is not available. --- src/FileScannerPCRE2.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/FileScannerPCRE2.cpp b/src/FileScannerPCRE2.cpp index 5166722d..4b89e920 100644 --- a/src/FileScannerPCRE2.cpp +++ b/src/FileScannerPCRE2.cpp @@ -141,9 +141,18 @@ FileScannerPCRE2::FileScannerPCRE2(sync_queue &in_queue, if(jit_retval != 0) { - // JIT compilation error. - pcre2_code_free(m_pcre2_regex); - throw FileScannerException(std::string("PCRE2 JIT compilation error: ") + PCRE2ErrorCodeToErrorString(jit_retval)); + // Was it a real error, or does the PCRE2 lib not have JIT compiled in? + if(jit_retval == PCRE2_ERROR_JIT_BADOPTION) + { + // No JIT support. + LOG(INFO) << "No PCRE2 JIT support: " << PCRE2ErrorCodeToErrorString(jit_retval); + } + else + { + // JIT compilation error. + pcre2_code_free(m_pcre2_regex); + throw FileScannerException(std::string("PCRE2 JIT compilation error: ") + PCRE2ErrorCodeToErrorString(jit_retval)); + } } // Only allow the one callout we use internally, no user callouts. From a09bbc07b79aae9e2d563b3e8304d3d3d3a2be1f Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Mon, 3 Oct 2016 08:44:30 -0500 Subject: [PATCH 18/44] Added XCode 7.1. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 357249fc..6c07689c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,8 @@ matrix: include: - os: osx osx_image: beta-xcode6.1 + - os: osx + osx_image: xcode7.1 - os: osx osx_image: xcode8 - os: linux From 040e5f5d0ab163168865ca5db350826df82571b0 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Mon, 3 Oct 2016 20:19:50 -0500 Subject: [PATCH 19/44] Added "stty raw" as part of invoking script utility to prevent tab expansion as seen in issue #103. --- configure.ac | 4 ++-- tests/atlocal.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 2fbbb7a9..73c39921 100644 --- a/configure.ac +++ b/configure.ac @@ -128,14 +128,14 @@ AS_IF([ test "x$ac_path_ESED_found" = "x:" ], # try to sort it out here. AC_PATH_PROG([PROG_SCRIPT], [script], [:]) AC_MSG_CHECKING([$PROG_SCRIPT's command line type]) -AS_IF([$PROG_SCRIPT -qfc "echo hello" /dev/null > /dev/null 2>&1], +AS_IF([$PROG_SCRIPT -qfc "stty raw && echo hello" /dev/null > /dev/null 2>&1], [ AC_SUBST([PROG_SCRIPT_TYPE], [linux]) AC_SUBST([PROG_SCRIPT_PRE_TEXT], ['-qfc']) AC_SUBST([PROG_SCRIPT_POST_TEXT], ['/dev/null']) AC_MSG_RESULT([Linux style]) ], - [$PROG_SCRIPT -q /dev/null echo "hello" > /dev/null 2>&1], + [$PROG_SCRIPT -q /dev/null stty raw && echo "hello" > /dev/null 2>&1], [ AC_SUBST([PROG_SCRIPT_TYPE], [bsd]) AC_SUBST([PROG_SCRIPT_PRE_TEXT], ['-q /dev/null']) diff --git a/tests/atlocal.in b/tests/atlocal.in index d80fb2f8..9b76c77b 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -213,8 +213,8 @@ ASX_SCRIPT () { # Note: '\r' removal in here because script outputs \r\n's, even on Linuxes. case $PROG_SCRIPT_TYPE in - linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "$*" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; - bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "${@}" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw && $(printf "%q " "${@}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT stty raw && "${@}" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; *) exit 1;; esac } From 971372bd0192f285609c0477a58df34a21b697be Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Tue, 4 Oct 2016 08:07:12 -0500 Subject: [PATCH 20/44] Interim. --- configure.ac | 2 +- tests/atlocal.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 73c39921..8008d92e 100644 --- a/configure.ac +++ b/configure.ac @@ -135,7 +135,7 @@ AS_IF([$PROG_SCRIPT -qfc "stty raw && echo hello" /dev/null > /dev/null 2>&1], AC_SUBST([PROG_SCRIPT_POST_TEXT], ['/dev/null']) AC_MSG_RESULT([Linux style]) ], - [$PROG_SCRIPT -q /dev/null stty raw && echo "hello" > /dev/null 2>&1], + [stty raw && $PROG_SCRIPT -q /dev/null echo "hello" > /dev/null 2>&1], [ AC_SUBST([PROG_SCRIPT_TYPE], [bsd]) AC_SUBST([PROG_SCRIPT_PRE_TEXT], ['-q /dev/null']) diff --git a/tests/atlocal.in b/tests/atlocal.in index 9b76c77b..81b7451e 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -214,7 +214,7 @@ ASX_SCRIPT () # Note: '\r' removal in here because script outputs \r\n's, even on Linuxes. case $PROG_SCRIPT_TYPE in linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw && $(printf "%q " "${@}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; - bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT stty raw && "${@}" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + bsd) stty raw && $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "${@}" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; *) exit 1;; esac } From ef3375a07c8956ab8c27296ffe029c11ac4e526c Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Tue, 4 Oct 2016 08:24:41 -0500 Subject: [PATCH 21/44] script vs. tty settings should be fixed for BSDs now. --- configure.ac | 2 +- tests/atlocal.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 8008d92e..1f9256b0 100644 --- a/configure.ac +++ b/configure.ac @@ -135,7 +135,7 @@ AS_IF([$PROG_SCRIPT -qfc "stty raw && echo hello" /dev/null > /dev/null 2>&1], AC_SUBST([PROG_SCRIPT_POST_TEXT], ['/dev/null']) AC_MSG_RESULT([Linux style]) ], - [stty raw && $PROG_SCRIPT -q /dev/null echo "hello" > /dev/null 2>&1], + [$PROG_SCRIPT -q /dev/null $SHELL -c 'stty raw && echo "hello"' > /dev/null 2>&1], [ AC_SUBST([PROG_SCRIPT_TYPE], [bsd]) AC_SUBST([PROG_SCRIPT_PRE_TEXT], ['-q /dev/null']) diff --git a/tests/atlocal.in b/tests/atlocal.in index 81b7451e..f61bc97e 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -214,7 +214,7 @@ ASX_SCRIPT () # Note: '\r' removal in here because script outputs \r\n's, even on Linuxes. case $PROG_SCRIPT_TYPE in linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw && $(printf "%q " "${@}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; - bsd) stty raw && $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "${@}" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "stty raw && $(printf "%q " "${@}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; *) exit 1;; esac } From 998f6b19c3133479dd6628bb1188f05102eaa68c Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Tue, 4 Oct 2016 08:42:59 -0500 Subject: [PATCH 22/44] Another try. --- tests/atlocal.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index f61bc97e..c876365f 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -214,7 +214,7 @@ ASX_SCRIPT () # Note: '\r' removal in here because script outputs \r\n's, even on Linuxes. case $PROG_SCRIPT_TYPE in linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw && $(printf "%q " "${@}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; - bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "stty raw && $(printf "%q " "${@}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "stty raw && "${@}"" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; *) exit 1;; esac } From ee37485f0d280caadb3cf6f4a6e0c7b15e70bc1d Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Tue, 4 Oct 2016 09:17:07 -0500 Subject: [PATCH 23/44] Another BSD fix. Works on PC-BSD. --- tests/atlocal.in | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index c876365f..37802792 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -212,9 +212,18 @@ get_system_info() ASX_SCRIPT () { # Note: '\r' removal in here because script outputs \r\n's, even on Linuxes. + # @note The BSD case here seems to work for our current purposes, but I suspect it may fail if + # we pass in args with nontrivial quoting or escapes. E.g., if you './run -x -d' the "--[no]column tests", + # you'll see this: + # ../../tests/file_presentation.at:59: { ASX_SCRIPT ucg --noenv --cpp --nocolor --column 'do_something' ; } > stdout_tty + # + ASX_SCRIPT ucg --noenv --cpp --nocolor --column do_something + # + printf %s 'ucg --noenv --cpp --nocolor --column do_something' + # + tr -d '\r' + # + /usr/bin/script -q /dev/null /bin/sh -c 'stty raw && ucg --noenv --cpp --nocolor --column do_something' + # i.e. 'do_something' gets changed into an unquoted do_something. case $PROG_SCRIPT_TYPE in linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw && $(printf "%q " "${@}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; - bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "stty raw && "${@}"" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "stty raw && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; *) exit 1;; esac } From 5a2ad5b329314490d0ba39d5f351740b15e921a6 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Tue, 4 Oct 2016 20:14:09 -0500 Subject: [PATCH 24/44] Interim. --- tests/atlocal.in | 4 +++- tests/file_presentation.at | 16 +++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index 37802792..45cd2e69 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -228,5 +228,7 @@ ASX_SCRIPT () esac } - +# Pipe output through this to convert to an ASCII+Hex text representation. +# Useful for detecting differences in non-printing characters. +PROG_TOHEX='od -t ax1' diff --git a/tests/file_presentation.at b/tests/file_presentation.at index f47b6f6e..377fad97 100644 --- a/tests/file_presentation.at +++ b/tests/file_presentation.at @@ -56,8 +56,11 @@ AT_DATA([test_file.cpp.expected],[test_file.cpp 4:2: do_something(); 6:5: do_something_else(); ]) -AT_CHECK([{ ASX_SCRIPT ucg --noenv --cpp --nocolor --column 'do_something' ; } > stdout_tty], [0], [stdout], [stderr]) -AT_CHECK([diff test_file.cpp.expected stdout_tty], [0], [stdout], [stderr]) + +AT_CHECK([cat test_file.cpp.expected | $PROG_TOHEX > test_file.cpp.expected.hex], [0]) + +AT_CHECK([{ ASX_SCRIPT ucg --noenv --cpp --nocolor --column 'do_something' ; } | $PROG_TOHEX > stdout_tty], [0], [stdout], [stderr]) +AT_CHECK([diff test_file.cpp.expected.hex stdout_tty], [0], [stdout], [stderr]) # Check for nocolumn output to a TTY. @@ -68,7 +71,7 @@ AT_CHECK([ASX_SCRIPT ucg --noenv --cpp --nocolor --nocolumn 'do_something'],[0], ]) # Check for default (nocolumn) output to a TTY. -AT_CHECK([ASX_SCRIPT ucg --noenv --cpp --nocolor 'do_something'],[0], +AT_CHECK([ASX_SCRIPT ucg --noenv --cpp --nocolor 'do_something'], [0], [test_file.cpp 4: do_something(); 6: do_something_else(); @@ -121,17 +124,16 @@ efgh abcd ]) -AT_DATA([expout], -[@<:@32;1m@<:@Ktest_file.cpp@<:@0m@<:@K +AT_DATA([expout],[@<:@32;1m@<:@Ktest_file.cpp@<:@0m@<:@K @<:@33;1m@<:@K1@<:@0m@<:@K:a@<:@30;43;1m@<:@Kbc@<:@0m@<:@Kd @<:@33;1m@<:@K3@<:@0m@<:@K:a@<:@30;43;1m@<:@Kbc@<:@0m@<:@Kd ]) # Check for color output to a TTY. -AT_CHECK([ASX_SCRIPT ucg --noenv --cpp --color 'bc'],[0],[expout]) +AT_CHECK([ASX_SCRIPT ucg --noenv --cpp --color 'bc'], [0], [expout]) # Check for nocolor to a TTY. -AT_CHECK([ASX_SCRIPT ucg --noenv --cpp --nocolor 'bc'],[0], +AT_CHECK([ASX_SCRIPT ucg --noenv --cpp --nocolor 'bc'], [0], [test_file.cpp 1:abcd 3:abcd From 58550501e0930fe489688c348e8c1abc64fd6631 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Tue, 4 Oct 2016 20:20:53 -0500 Subject: [PATCH 25/44] printf portability fix. --- tests/atlocal.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index 45cd2e69..5943d0e2 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -222,7 +222,7 @@ ASX_SCRIPT () # + /usr/bin/script -q /dev/null /bin/sh -c 'stty raw && ucg --noenv --cpp --nocolor --column do_something' # i.e. 'do_something' gets changed into an unquoted do_something. case $PROG_SCRIPT_TYPE in - linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw && $(printf "%q " "${@}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "stty raw && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; *) exit 1;; esac From 9f3c3946d315412413ed5cba52dafefdcd78b59b Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Tue, 4 Oct 2016 20:44:04 -0500 Subject: [PATCH 26/44] Interim. --- tests/file_presentation.at | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/file_presentation.at b/tests/file_presentation.at index 377fad97..73127a69 100644 --- a/tests/file_presentation.at +++ b/tests/file_presentation.at @@ -118,8 +118,7 @@ AT_CLEANUP # AT_SETUP([Color-vs-terminal tests]) -AT_DATA([test_file.cpp], -[abcd +AT_DATA([test_file.cpp],[abcd efgh abcd ]) @@ -133,13 +132,12 @@ AT_DATA([expout],[@<:@32;1m@<:@Ktest_file.cpp@<:@0m@<:@K AT_CHECK([ASX_SCRIPT ucg --noenv --cpp --color 'bc'], [0], [expout]) # Check for nocolor to a TTY. -AT_CHECK([ASX_SCRIPT ucg --noenv --cpp --nocolor 'bc'], [0], -[test_file.cpp +AT_CHECK([ASX_SCRIPT ucg --noenv --cpp --nocolor 'bc'], [0], [test_file.cpp 1:abcd 3:abcd ]) # Check for default (should be color). -AT_CHECK([ASX_SCRIPT ucg --noenv --cpp 'bc'],[0],[expout]) +AT_CHECK([ASX_SCRIPT ucg --noenv --cpp 'bc'], [0], [expout]) AT_CLEANUP From da58316bdc03d9983e265805681d5dc3473661a6 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Wed, 5 Oct 2016 08:33:09 -0500 Subject: [PATCH 27/44] script workaround for some OSX distro versions. --- tests/atlocal.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index 5943d0e2..2c4e4103 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -221,9 +221,13 @@ ASX_SCRIPT () # + tr -d '\r' # + /usr/bin/script -q /dev/null /bin/sh -c 'stty raw && ucg --noenv --cpp --nocolor --column do_something' # i.e. 'do_something' gets changed into an unquoted do_something. + # + # @note On some OSX systems (which detect as having a bsd-style 'script' utility), the below will prefix + # the output with '^D' (hex 5e 44 08 08). Not clear why. Until we figure that out, just + # strip those chars if they're there. case $PROG_SCRIPT_TYPE in linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; - bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "stty raw && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "stty raw && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | sed 's/^\^D\x08\x08//' | tr -d '\r';; *) exit 1;; esac } From ae768cc641c3b9ef370d22dd9c82c1f0bb7c22a9 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Wed, 5 Oct 2016 08:44:13 -0500 Subject: [PATCH 28/44] testsuite, capturing intermediate files. --- tests/file_presentation.at | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/file_presentation.at b/tests/file_presentation.at index 73127a69..100beb95 100644 --- a/tests/file_presentation.at +++ b/tests/file_presentation.at @@ -60,6 +60,8 @@ AT_DATA([test_file.cpp.expected],[test_file.cpp AT_CHECK([cat test_file.cpp.expected | $PROG_TOHEX > test_file.cpp.expected.hex], [0]) AT_CHECK([{ ASX_SCRIPT ucg --noenv --cpp --nocolor --column 'do_something' ; } | $PROG_TOHEX > stdout_tty], [0], [stdout], [stderr]) +AT_CAPTURE_FILE([test_file.cpp.expected.hex]) +AT_CAPTURE_FILE([stdout_tty]) AT_CHECK([diff test_file.cpp.expected.hex stdout_tty], [0], [stdout], [stderr]) From 43ef9b04929401dedcb1369c919c7d9a6697abeb Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Wed, 5 Oct 2016 08:55:24 -0500 Subject: [PATCH 29/44] Interim. --- configure.ac | 5 +++-- tests/atlocal.in | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 1f9256b0..6ca5e9eb 100644 --- a/configure.ac +++ b/configure.ac @@ -204,9 +204,10 @@ AC_PATH_PROG([PROG_PCRE2GREP], [pcre2grep], []) ### # Python, for generation of test suite. -### @note Python >= 2.7 is actually required to run the testsuite at the moment, and hence is +### @note Python >= 2.7 is actually required to run the benchmarks in the testsuite at the moment, and hence is ### not a maintainer-only tool. My hope is that this will soon become a pre-"make distcheck" requirement. -AM_PATH_PYTHON([2.7]) +AM_PATH_PYTHON([2.7],,[:]) +AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != ":"]) #<< Automake conditional for skipping tests which require python. # Autotest needs autom4te, or 'missing's stub for it post-distribution. AM_MISSING_PROG([AUTOM4TE], [autom4te]) diff --git a/tests/atlocal.in b/tests/atlocal.in index 2c4e4103..ade17eb3 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -222,17 +222,18 @@ ASX_SCRIPT () # + /usr/bin/script -q /dev/null /bin/sh -c 'stty raw && ucg --noenv --cpp --nocolor --column do_something' # i.e. 'do_something' gets changed into an unquoted do_something. # - # @note On some OSX systems (which detect as having a bsd-style 'script' utility), the below will prefix - # the output with '^D' (hex 5e 44 08 08). Not clear why. Until we figure that out, just - # strip those chars if they're there. case $PROG_SCRIPT_TYPE in linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; - bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "stty raw && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | sed 's/^\^D\x08\x08//' | tr -d '\r';; + bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "stty raw && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; *) exit 1;; esac } # Pipe output through this to convert to an ASCII+Hex text representation. # Useful for detecting differences in non-printing characters. -PROG_TOHEX='od -t ax1' +# @note On some OSX systems (which detect as having a bsd-style 'script' utility), tests such as this: +# AT_CHECK([{ ASX_SCRIPT ucg --noenv --cpp --nocolor --column 'do_something' ; } | $PROG_TOHEX > stdout_tty], [0], [stdout], [stderr]) +# will prefix stdout_tty with '^D' (hex 5e 44 08 08). Not clear why. Until we figure that out, just +# strip those chars with sed if they're there. +PROG_TOHEX='sed \'s/^\^D\x08\x08//\' | od -t ax1' From 9f45bc78e5fd2fbbb41fa4ae78395d37e2d3c92a Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Wed, 5 Oct 2016 09:04:28 -0500 Subject: [PATCH 30/44] Interim. --- tests/atlocal.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index ade17eb3..8489ec56 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -235,5 +235,5 @@ ASX_SCRIPT () # AT_CHECK([{ ASX_SCRIPT ucg --noenv --cpp --nocolor --column 'do_something' ; } | $PROG_TOHEX > stdout_tty], [0], [stdout], [stderr]) # will prefix stdout_tty with '^D' (hex 5e 44 08 08). Not clear why. Until we figure that out, just # strip those chars with sed if they're there. -PROG_TOHEX='sed \'s/^\^D\x08\x08//\' | od -t ax1' +PROG_TOHEX='eval sed s/^\^D\x08\x08// | od -t ax1' From 846d8bed79cefe950a4e86f391d192ffb31553a3 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Wed, 5 Oct 2016 09:17:25 -0500 Subject: [PATCH 31/44] Interim. --- tests/file_presentation.at | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/file_presentation.at b/tests/file_presentation.at index 100beb95..d71502ee 100644 --- a/tests/file_presentation.at +++ b/tests/file_presentation.at @@ -130,8 +130,13 @@ AT_DATA([expout],[@<:@32;1m@<:@Ktest_file.cpp@<:@0m@<:@K @<:@33;1m@<:@K3@<:@0m@<:@K:a@<:@30;43;1m@<:@Kbc@<:@0m@<:@Kd ]) +AT_CHECK([cat expout | $PROG_TOHEX > expout.hex], [0]) +AT_CAPTURE_FILE([expout.hex]) + # Check for color output to a TTY. -AT_CHECK([ASX_SCRIPT ucg --noenv --cpp --color 'bc'], [0], [expout]) +AT_CHECK([ASX_SCRIPT ucg --noenv --cpp --color 'bc' | $PROG_TOHEX > stdout.hex], [0], [stdout], [stderr]) +AT_CAPTURE_FILE([stdout.hex]) +AT_CHECK([diff expout.hex stdout.hex], [0], [stdout], [stderr]) # Check for nocolor to a TTY. AT_CHECK([ASX_SCRIPT ucg --noenv --cpp --nocolor 'bc'], [0], [test_file.cpp From e2671133922d1119e43654207e331892c976875e Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Wed, 5 Oct 2016 19:22:17 -0500 Subject: [PATCH 32/44] Interim. --- tests/atlocal.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index 8489ec56..32ffe00a 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -223,8 +223,8 @@ ASX_SCRIPT () # i.e. 'do_something' gets changed into an unquoted do_something. # case $PROG_SCRIPT_TYPE in - linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; - bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "stty raw && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw >/dev/null 2>&1 && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "stty raw >/dev/null 2>&1 && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; *) exit 1;; esac } From b84c408036a4a1d09474e23b710343ad8b9b20c1 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Wed, 5 Oct 2016 19:36:58 -0500 Subject: [PATCH 33/44] Interim. --- tests/file_presentation.at | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/file_presentation.at b/tests/file_presentation.at index d71502ee..02aa6209 100644 --- a/tests/file_presentation.at +++ b/tests/file_presentation.at @@ -59,7 +59,7 @@ AT_DATA([test_file.cpp.expected],[test_file.cpp AT_CHECK([cat test_file.cpp.expected | $PROG_TOHEX > test_file.cpp.expected.hex], [0]) -AT_CHECK([{ ASX_SCRIPT ucg --noenv --cpp --nocolor --column 'do_something' ; } | $PROG_TOHEX > stdout_tty], [0], [stdout], [stderr]) +AT_CHECK([( ASX_SCRIPT ucg --noenv --cpp --nocolor --column 'do_something' ) | $PROG_TOHEX > stdout_tty], [0], [stdout], [stderr]) AT_CAPTURE_FILE([test_file.cpp.expected.hex]) AT_CAPTURE_FILE([stdout_tty]) AT_CHECK([diff test_file.cpp.expected.hex stdout_tty], [0], [stdout], [stderr]) From 22277246cc3fde55678185db2b22950f3dc1c6b9 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Wed, 5 Oct 2016 20:38:04 -0500 Subject: [PATCH 34/44] Interim. --- tests/atlocal.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index 32ffe00a..831ff2c8 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -222,11 +222,14 @@ ASX_SCRIPT () # + /usr/bin/script -q /dev/null /bin/sh -c 'stty raw && ucg --noenv --cpp --nocolor --column do_something' # i.e. 'do_something' gets changed into an unquoted do_something. # + original_stty_state=$(stty -g); + stty raw >/dev/null 2>&1; case $PROG_SCRIPT_TYPE in - linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw >/dev/null 2>&1 && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; - bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "stty raw >/dev/null 2>&1 && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "$(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "$(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; *) exit 1;; esac + stty "$original_stty_state" >/dev/null 2>&1; } # Pipe output through this to convert to an ASCII+Hex text representation. From 3c5298c5fee1cc39713712639ae3040026560be9 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Wed, 5 Oct 2016 20:59:41 -0500 Subject: [PATCH 35/44] Interim. --- tests/atlocal.in | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index 831ff2c8..859a6eda 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -222,14 +222,11 @@ ASX_SCRIPT () # + /usr/bin/script -q /dev/null /bin/sh -c 'stty raw && ucg --noenv --cpp --nocolor --column do_something' # i.e. 'do_something' gets changed into an unquoted do_something. # - original_stty_state=$(stty -g); - stty raw >/dev/null 2>&1; case $PROG_SCRIPT_TYPE in linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "$(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; - bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT $SHELL -c "$(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw >/dev/null 2>&1 && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; *) exit 1;; esac - stty "$original_stty_state" >/dev/null 2>&1; } # Pipe output through this to convert to an ASCII+Hex text representation. From 9d101fed1d0bb713ea0ee10ca75753cc9e465e89 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Wed, 5 Oct 2016 21:07:11 -0500 Subject: [PATCH 36/44] Interim. --- tests/atlocal.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index 859a6eda..d16e22e5 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -224,7 +224,7 @@ ASX_SCRIPT () # case $PROG_SCRIPT_TYPE in linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "$(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; - bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw >/dev/null 2>&1 && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + bsd) echo $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw >/dev/null 2>&1 && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; *) exit 1;; esac } From 91dece5c70f5b5c63b1e69a60693b12e6c758536 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Wed, 5 Oct 2016 21:11:27 -0500 Subject: [PATCH 37/44] Interim. --- tests/atlocal.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index d16e22e5..87ed1fdc 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -224,7 +224,7 @@ ASX_SCRIPT () # case $PROG_SCRIPT_TYPE in linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "$(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; - bsd) echo $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw >/dev/null 2>&1 && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT exec "stty raw >/dev/null 2>&1 && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; *) exit 1;; esac } From e8b0c739e78763a6ce11f226bce7bf40eac04d10 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Wed, 5 Oct 2016 21:29:24 -0500 Subject: [PATCH 38/44] Interim. --- tests/atlocal.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index 87ed1fdc..15044236 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -224,7 +224,7 @@ ASX_SCRIPT () # case $PROG_SCRIPT_TYPE in linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "$(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; - bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT exec "stty raw >/dev/null 2>&1 && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT command eval "stty raw >/dev/null 2>&1 && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; *) exit 1;; esac } From d8a7047b2d766ccab09a13e74ef119431d298af8 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Thu, 6 Oct 2016 02:51:14 -0500 Subject: [PATCH 39/44] Travis. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6c07689c..d3c89201 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,8 @@ matrix: - os: osx osx_image: xcode7.1 - os: osx - osx_image: xcode8 + osx_image: xcode7.3 + #osx_image: xcode8 - os: linux dist: trusty sudo: required From 1792d0bcf5b5806265195080c9a2c2b875b7a259 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Thu, 6 Oct 2016 03:04:31 -0500 Subject: [PATCH 40/44] Travis change to add pcre2 to linux builds. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d3c89201..eee2e958 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,8 +27,10 @@ before_install: # This is the recommended work-around until they fix it. - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew uninstall libtool && brew install libtool; fi - if [ $TRAVIS_OS_NAME == osx ]; then brew install pcre pcre2 argp-standalone the_silver_searcher; fi - - if [ $TRAVIS_OS_NAME == osx ]; then brew tap homebrew/dupes; brew install grep; fi # Install gnu grep to test against. @todo Make things work so this can be installed only after a successful build. + # Install gnu grep to test against. @todo Make things work so this can be installed only after a successful build. + - if [ $TRAVIS_OS_NAME == osx ]; then brew tap homebrew/dupes; brew install grep; fi - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update -qq && sudo apt-get install -qq libpcre3-dev && sudo apt-get install -qq silversearcher-ag; fi + - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -qq libpcre2-dev; fi before_script: - echo "g++ --version:" && g++ --version && echo "====" From 35301b415f67b0a679e9681d49e46c80bcbea5db Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Thu, 6 Oct 2016 03:21:19 -0500 Subject: [PATCH 41/44] Put stty raw back for linux-style script. Trying to get travis to pull down a pcre2 for trusty. --- .travis.yml | 2 +- tests/atlocal.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index eee2e958..a94c0ee6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ before_install: # Install gnu grep to test against. @todo Make things work so this can be installed only after a successful build. - if [ $TRAVIS_OS_NAME == osx ]; then brew tap homebrew/dupes; brew install grep; fi - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update -qq && sudo apt-get install -qq libpcre3-dev && sudo apt-get install -qq silversearcher-ag; fi - - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -qq libpcre2-dev; fi + - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -qq pcre2; fi before_script: - echo "g++ --version:" && g++ --version && echo "====" diff --git a/tests/atlocal.in b/tests/atlocal.in index 15044236..f50cc95b 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -223,7 +223,7 @@ ASX_SCRIPT () # i.e. 'do_something' gets changed into an unquoted do_something. # case $PROG_SCRIPT_TYPE in - linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "$(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; + linux) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT "stty raw >/dev/null 2>&1 && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; bsd) $PROG_SCRIPT $PROG_SCRIPT_PRE_TEXT command eval "stty raw >/dev/null 2>&1 && $(printf '%s' "${*}")" $PROG_SCRIPT_POST_TEXT | tr -d '\r';; *) exit 1;; esac From 469d4f8715b82f5d818dee6262942378e8f09258 Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Thu, 6 Oct 2016 03:46:53 -0500 Subject: [PATCH 42/44] Removed OSX 10.11 from rotation due to stty issues from #103. --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index a94c0ee6..0bf6d525 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,9 +6,9 @@ matrix: osx_image: beta-xcode6.1 - os: osx osx_image: xcode7.1 - - os: osx - osx_image: xcode7.3 - #osx_image: xcode8 +# - os: osx # ==> OSX 10.11, +# osx_image: xcode7.3 +# osx_image: xcode8 - os: linux dist: trusty sudo: required @@ -30,7 +30,6 @@ before_install: # Install gnu grep to test against. @todo Make things work so this can be installed only after a successful build. - if [ $TRAVIS_OS_NAME == osx ]; then brew tap homebrew/dupes; brew install grep; fi - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update -qq && sudo apt-get install -qq libpcre3-dev && sudo apt-get install -qq silversearcher-ag; fi - - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -qq pcre2; fi before_script: - echo "g++ --version:" && g++ --version && echo "====" From 53a4ffa4c7fce44894253e70470854289f2adb2e Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Thu, 6 Oct 2016 03:53:09 -0500 Subject: [PATCH 43/44] Comment on OSX 10.11. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0bf6d525..646385d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ matrix: osx_image: beta-xcode6.1 - os: osx osx_image: xcode7.1 -# - os: osx # ==> OSX 10.11, +# - os: osx # ==> OSX 10.11, removed until we have a fix for #103, tabs->spaces. # osx_image: xcode7.3 # osx_image: xcode8 - os: linux From ba8636ac8ab8be128e525790a22bbaa9ec672cba Mon Sep 17 00:00:00 2001 From: "Gary R. Van Sickle" Date: Thu, 6 Oct 2016 04:02:23 -0500 Subject: [PATCH 44/44] Updated NEWS.md for issue #100. --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index fe0ec5c9..da47c698 100644 --- a/NEWS.md +++ b/NEWS.md @@ -32,7 +32,7 @@ - Resolved issue with highlights on wrapped lines sometimes extending the full width of the terminal. Resolves #80. - Resolved issue where matches spanning an eol (e.g. 'a\s+b' matching 'a\nb') would cause the program to throw an exception and terminate. Resolves #92. - Resolved segfaults on some systems due to dirname() modifying its parameter. Resolves #96. - +- No longer treating PCRE2 reporting no JIT support as an error. Resolves #100. ## [0.2.2] - 2016-04-09