Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed autoconf issues whereby HAVE_PTHREAD_GETATTR_NP was not being u…

…sed on Ubuntu systemd (and others, presumably) that have the function
  • Loading branch information...
commit 981b3fc5808ff176719ed7d09a644190465768ed 1 parent 2368828
raw authored
View
4 Makefile.in
@@ -65,7 +65,9 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/config/ax_lib_mysql.m4 \
$(top_srcdir)/config/ax_mysql_bin.m4 \
$(top_srcdir)/config/pcre.m4 $(top_srcdir)/config/ghmysql.m4 \
- $(top_srcdir)/config/ax_pthread.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/config/ax_pthread.m4 \
+ $(top_srcdir)/config/ax_pthread_np.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
View
1  README.md
@@ -92,7 +92,6 @@ Known Issues & Caveats
- Version 1.1 changes the way NULLs are handled. To restore the legacy NULL handling, use configure --enable-legacy-nulls
- pcre_study should be used (but isn't) for constant patterns;
- there is no localization or locale support
-- there is no multi-byte character set support
- some program locations that should be set in autoconf are not
- It would be nice if there were a persistent cache of compiled regexes
- It would also be nice if there were a peresistent cache of regex matches.
View
6 config.h.in
@@ -24,9 +24,15 @@
/* Do we want a BSD-like thread-attribute interface? */
#undef HAVE_PTHREAD_ATTR_GET_NP
+/* Define to 1 if you have the `pthread_attr_setstacksize' function. */
+#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE
+
/* Do we want a Linux-like thread-attribute interface? */
#undef HAVE_PTHREAD_GETATTR_NP
+/* Define to 1 if you have the `pthread_get_stacksize_np' function. */
+#undef HAVE_PTHREAD_GET_STACKSIZE_NP
+
/* Have PTHREAD_PRIO_INHERIT. */
#undef HAVE_PTHREAD_PRIO_INHERIT
View
54 config/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 19
+#serial 20
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
@@ -162,6 +162,10 @@ case ${host_os} in
darwin*)
ax_pthread_flags="-pthread $ax_pthread_flags"
;;
+
+ linux-gnu*) # R.A.W. Otherwise none gets chosen and that leaves the pthread_getattr_np stuff not found
+ ax_pthread_flags="pthread $ax_pthread_flags"
+ ;;
esac
if test x"$ax_pthread_ok" = xno; then
@@ -190,40 +194,6 @@ for flag in $ax_pthread_flags; do
;;
esac
-
- # from tcl.m4 http://svn.apache.org/repos/asf/trafficserver/attic/traffic/trunk/build/tcl.m4
- AC_CHECK_FUNC(pthread_attr_get_np,tcl_ok=yes,tcl_ok=no)
- if test $tcl_ok = yes ; then
- AC_DEFINE(HAVE_PTHREAD_ATTR_GET_NP, 1,
- [Do we want a BSD-like thread-attribute interface?])
- AC_CACHE_CHECK([for pthread_attr_get_np declaration],
- tcl_cv_grep_pthread_attr_get_np, [
- AC_EGREP_HEADER(pthread_attr_get_np, pthread.h,
- tcl_cv_grep_pthread_attr_get_np=present,
- tcl_cv_grep_pthread_attr_get_np=missing)])
- if test $tcl_cv_grep_pthread_attr_get_np = missing ; then
- AC_DEFINE(ATTRGETNP_NOT_DECLARED, 1,
- [Is pthread_attr_get_np() declared in <pthread.h>?])
- fi
- else
- AC_CHECK_FUNC(pthread_getattr_np,tcl_ok=yes,tcl_ok=no)
- if test $tcl_ok = yes ; then
- AC_DEFINE(HAVE_PTHREAD_GETATTR_NP, 1,
- [Do we want a Linux-like thread-attribute interface?])
- AC_CACHE_CHECK([for pthread_getattr_np declaration],
- tcl_cv_grep_pthread_getattr_np, [
- AC_EGREP_HEADER(pthread_getattr_np, pthread.h,
- tcl_cv_grep_pthread_getattr_np=present,
- tcl_cv_grep_pthread_getattr_np=missing)])
- if test $tcl_cv_grep_pthread_getattr_np = missing ; then
- AC_DEFINE(GETATTRNP_NOT_DECLARED, 1,
- [Is pthread_getattr_np declared in <pthread.h>?])
- fi
- fi
- fi
-
-
-
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
@@ -326,21 +296,15 @@ if test "x$ax_pthread_ok" = xyes; then
[#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"],[PTHREAD_CC="$CC"])],
- [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])],
- [PTHREAD_CC="$CC"])
- ;;
-
- *)
- PTHREAD_CC="$CC"
+ [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
+ [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
;;
esac
fi
-else
- PTHREAD_CC="$CC"
fi
+test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
+
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
View
46 config/ax_pthread_np.m4
@@ -0,0 +1,46 @@
+
+AC_DEFUN([AX_PTHREAD_NP], [
+
+
+ # from tcl.m4 http://svn.apache.org/repos/asf/trafficserver/attic/traffic/trunk/build/tcl.m4
+ # Does the pthread-implementation provide
+ # 'pthread_attr_setstacksize' ?
+
+ ac_saved_libs=$LIBS
+ LIBS="$LIBS $PTHREAD_LIBS"
+ AC_CHECK_FUNCS(pthread_attr_setstacksize)
+ AC_CHECK_FUNC(pthread_attr_get_np,tcl_ok=yes,tcl_ok=no)
+ if test $tcl_ok = yes ; then
+ AC_DEFINE(HAVE_PTHREAD_ATTR_GET_NP, 1,
+ [Do we want a BSD-like thread-attribute interface?])
+ AC_CACHE_CHECK([for pthread_attr_get_np declaration],
+ tcl_cv_grep_pthread_attr_get_np, [
+ AC_EGREP_HEADER(pthread_attr_get_np, pthread.h,
+ tcl_cv_grep_pthread_attr_get_np=present,
+ tcl_cv_grep_pthread_attr_get_np=missing)])
+ if test $tcl_cv_grep_pthread_attr_get_np = missing ; then
+ AC_DEFINE(ATTRGETNP_NOT_DECLARED, 1,
+ [Is pthread_attr_get_np() declared in <pthread.h>?])
+ fi
+ else
+ AC_CHECK_FUNC(pthread_getattr_np,tcl_ok=yes,tcl_ok=no)
+ if test $tcl_ok = yes ; then
+ AC_DEFINE(HAVE_PTHREAD_GETATTR_NP, 1,
+ [Do we want a Linux-like thread-attribute interface?])
+ AC_CACHE_CHECK([for pthread_getattr_np declaration],
+ tcl_cv_grep_pthread_getattr_np, [
+ AC_EGREP_HEADER(pthread_getattr_np, pthread.h,
+ tcl_cv_grep_pthread_getattr_np=present,
+ tcl_cv_grep_pthread_getattr_np=missing)])
+ if test $tcl_cv_grep_pthread_getattr_np = missing ; then
+ AC_DEFINE(GETATTRNP_NOT_DECLARED, 1,
+ [Is pthread_getattr_np declared in <pthread.h>?])
+ fi
+ fi
+ fi
+ if test $tcl_ok = no; then
+ # Darwin thread stacksize API
+ AC_CHECK_FUNCS(pthread_get_stacksize_np)
+ fi
+ LIBS=$ac_saved_libs
+] )
View
219 configure
@@ -2350,7 +2350,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 19
+#serial 20
# This is what autoupdate's m4 run will expand. It fires
# the warning (with _au_warn_XXX), outputs it into the
@@ -2373,6 +2373,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
am__api_version='1.13'
# Find a good install program. We prefer a C program (faster),
@@ -12916,6 +12918,10 @@ case ${host_os} in
darwin*)
ax_pthread_flags="-pthread $ax_pthread_flags"
;;
+
+ linux-gnu*) # R.A.W. Otherwise none gets chosen and that leaves the pthread_getattr_np stuff not found
+ ax_pthread_flags="pthread $ax_pthread_flags"
+ ;;
esac
if test x"$ax_pthread_ok" = xno; then
@@ -12984,90 +12990,6 @@ $as_echo_n "checking for the pthreads library -l$flag... " >&6; }
;;
esac
-
- # from tcl.m4 http://svn.apache.org/repos/asf/trafficserver/attic/traffic/trunk/build/tcl.m4
- ac_fn_c_check_func "$LINENO" "pthread_attr_get_np" "ac_cv_func_pthread_attr_get_np"
-if test "x$ac_cv_func_pthread_attr_get_np" = xyes; then :
- tcl_ok=yes
-else
- tcl_ok=no
-fi
-
- if test $tcl_ok = yes ; then
-
-$as_echo "#define HAVE_PTHREAD_ATTR_GET_NP 1" >>confdefs.h
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_attr_get_np declaration" >&5
-$as_echo_n "checking for pthread_attr_get_np declaration... " >&6; }
-if ${tcl_cv_grep_pthread_attr_get_np+:} false; then :
- $as_echo_n "(cached) " >&6
-else
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <pthread.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "pthread_attr_get_np" >/dev/null 2>&1; then :
- tcl_cv_grep_pthread_attr_get_np=present
-else
- tcl_cv_grep_pthread_attr_get_np=missing
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_grep_pthread_attr_get_np" >&5
-$as_echo "$tcl_cv_grep_pthread_attr_get_np" >&6; }
- if test $tcl_cv_grep_pthread_attr_get_np = missing ; then
-
-$as_echo "#define ATTRGETNP_NOT_DECLARED 1" >>confdefs.h
-
- fi
- else
- ac_fn_c_check_func "$LINENO" "pthread_getattr_np" "ac_cv_func_pthread_getattr_np"
-if test "x$ac_cv_func_pthread_getattr_np" = xyes; then :
- tcl_ok=yes
-else
- tcl_ok=no
-fi
-
- if test $tcl_ok = yes ; then
-
-$as_echo "#define HAVE_PTHREAD_GETATTR_NP 1" >>confdefs.h
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_getattr_np declaration" >&5
-$as_echo_n "checking for pthread_getattr_np declaration... " >&6; }
-if ${tcl_cv_grep_pthread_getattr_np+:} false; then :
- $as_echo_n "(cached) " >&6
-else
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <pthread.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "pthread_getattr_np" >/dev/null 2>&1; then :
- tcl_cv_grep_pthread_getattr_np=present
-else
- tcl_cv_grep_pthread_getattr_np=missing
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_grep_pthread_getattr_np" >&5
-$as_echo "$tcl_cv_grep_pthread_getattr_np" >&6; }
- if test $tcl_cv_grep_pthread_getattr_np = missing ; then
-
-$as_echo "#define GETATTRNP_NOT_DECLARED 1" >>confdefs.h
-
- fi
- fi
- fi
-
-
-
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
@@ -13228,8 +13150,6 @@ fi
x/*) :
if as_fn_executable_p ${CC}_r; then :
PTHREAD_CC="${CC}_r"
-else
- PTHREAD_CC="$CC"
fi ;; #(
*) :
for ac_prog in ${CC}_r
@@ -13277,19 +13197,15 @@ test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
;;
esac ;; #(
*) :
- PTHREAD_CC="$CC" ;;
+ ;;
esac
;;
-
- *)
- PTHREAD_CC="$CC"
- ;;
esac
fi
-else
- PTHREAD_CC="$CC"
fi
+test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
+
@@ -13313,6 +13229,121 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ # from tcl.m4 http://svn.apache.org/repos/asf/trafficserver/attic/traffic/trunk/build/tcl.m4
+ # Does the pthread-implementation provide
+ # 'pthread_attr_setstacksize' ?
+
+ ac_saved_libs=$LIBS
+ LIBS="$LIBS $PTHREAD_LIBS"
+ for ac_func in pthread_attr_setstacksize
+do :
+ ac_fn_c_check_func "$LINENO" "pthread_attr_setstacksize" "ac_cv_func_pthread_attr_setstacksize"
+if test "x$ac_cv_func_pthread_attr_setstacksize" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
+_ACEOF
+
+fi
+done
+
+ ac_fn_c_check_func "$LINENO" "pthread_attr_get_np" "ac_cv_func_pthread_attr_get_np"
+if test "x$ac_cv_func_pthread_attr_get_np" = xyes; then :
+ tcl_ok=yes
+else
+ tcl_ok=no
+fi
+
+ if test $tcl_ok = yes ; then
+
+$as_echo "#define HAVE_PTHREAD_ATTR_GET_NP 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_attr_get_np declaration" >&5
+$as_echo_n "checking for pthread_attr_get_np declaration... " >&6; }
+if ${tcl_cv_grep_pthread_attr_get_np+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <pthread.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "pthread_attr_get_np" >/dev/null 2>&1; then :
+ tcl_cv_grep_pthread_attr_get_np=present
+else
+ tcl_cv_grep_pthread_attr_get_np=missing
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_grep_pthread_attr_get_np" >&5
+$as_echo "$tcl_cv_grep_pthread_attr_get_np" >&6; }
+ if test $tcl_cv_grep_pthread_attr_get_np = missing ; then
+
+$as_echo "#define ATTRGETNP_NOT_DECLARED 1" >>confdefs.h
+
+ fi
+ else
+ ac_fn_c_check_func "$LINENO" "pthread_getattr_np" "ac_cv_func_pthread_getattr_np"
+if test "x$ac_cv_func_pthread_getattr_np" = xyes; then :
+ tcl_ok=yes
+else
+ tcl_ok=no
+fi
+
+ if test $tcl_ok = yes ; then
+
+$as_echo "#define HAVE_PTHREAD_GETATTR_NP 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_getattr_np declaration" >&5
+$as_echo_n "checking for pthread_getattr_np declaration... " >&6; }
+if ${tcl_cv_grep_pthread_getattr_np+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <pthread.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "pthread_getattr_np" >/dev/null 2>&1; then :
+ tcl_cv_grep_pthread_getattr_np=present
+else
+ tcl_cv_grep_pthread_getattr_np=missing
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_grep_pthread_getattr_np" >&5
+$as_echo "$tcl_cv_grep_pthread_getattr_np" >&6; }
+ if test $tcl_cv_grep_pthread_getattr_np = missing ; then
+
+$as_echo "#define GETATTRNP_NOT_DECLARED 1" >>confdefs.h
+
+ fi
+ fi
+ fi
+ if test $tcl_ok = no; then
+ # Darwin thread stacksize API
+ for ac_func in pthread_get_stacksize_np
+do :
+ ac_fn_c_check_func "$LINENO" "pthread_get_stacksize_np" "ac_cv_func_pthread_get_stacksize_np"
+if test "x$ac_cv_func_pthread_get_stacksize_np" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_PTHREAD_GET_STACKSIZE_NP 1
+_ACEOF
+
+fi
+done
+
+ fi
+ LIBS=$ac_saved_libs
+
+
+
# Check whether --enable-legacy-nulls was given.
if test "${enable_legacy_nulls+set}" = set; then :
enableval=$enable_legacy_nulls; GHMYSQL_CFLAGS="-DGH_1_0_NULL_HANDLING=1"
View
2  configure.ac
@@ -9,6 +9,7 @@ m4_include([config/ax_mysql_bin.m4])
m4_include([config/pcre.m4])
m4_include([config/ghmysql.m4])
m4_include([config/ax_pthread.m4])
+m4_include([config/ax_pthread_np.m4])
AM_INIT_AUTOMAKE
@@ -28,6 +29,7 @@ fi
AM_PATH_PCRE(1,,AC_MSG_ERROR( "Can't find libpcre" ) )
AX_PTHREAD(,AC_MSG_ERROR( "Can't find libpthread" ) )
+AX_PTHREAD_NP(,AC_MSG_ERROR( "Can't find libpthread" ) )
AX_GHMYSQL
View
4 doc/Makefile.in
@@ -55,7 +55,9 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/config/ax_lib_mysql.m4 \
$(top_srcdir)/config/ax_mysql_bin.m4 \
$(top_srcdir)/config/pcre.m4 $(top_srcdir)/config/ghmysql.m4 \
- $(top_srcdir)/config/ax_pthread.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/config/ax_pthread.m4 \
+ $(top_srcdir)/config/ax_pthread_np.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
View
12 preg_utils.c
@@ -37,6 +37,10 @@
#include "preg_utils.h"
#include "ghfcns.h"
+#ifndef GH_PREG_NO_MYSQL
+#include "config.h"
+#endif
+
/**
* @fn void pregSetLimits( pcre_extra *extra )
*
@@ -73,7 +77,7 @@ void pregSetLimits(pcre_extra *extra)
#ifdef HAVE_PTHREAD
#ifdef HAVE_PTHREAD_GETATTR_NP
-
+
pthread_attr_t thread_attr;
void * thread_stack_addr=0;
void * thread_stack_cur = alloca(1); // End of the stack (hopefully....)
@@ -94,9 +98,10 @@ void pregSetLimits(pcre_extra *extra)
pthread_attr_destroy(&thread_attr);
}
+#elifdef HAVE_PTHREAD_GET_STACKSIZE_NP
+ // TODO: Figure this out and get thread_stack_avail properly set for OSX.
#endif
-
#ifdef GH_PREG_NO_MYSQL
if( !thread_stack_avail ) {
// Cannot get information from current thread; Use default thread information, since compiling for use outside of mysqld
@@ -128,7 +133,7 @@ void pregSetLimits(pcre_extra *extra)
if( !thread_stack_size ) {
// Checks failed, assume the MySQL defaults (64/32 bit)
// Shouldn't ever really get here, though.
- ghlogprintf( "Ignoring mysqld:thread_stack. Using mysql defaults.") ;
+ ghlogprintf( "Ignoring mysqld:thread_stack. Using mysql defaults.\n") ;
#ifdef _LP64
thread_stack_size = 256*1024;
#else
@@ -138,6 +143,7 @@ void pregSetLimits(pcre_extra *extra)
// And assume a current usage of 25% (_wild_ guess!)
thread_stack_avail = thread_stack_size*0.75;
}
+ ghlogprintf( "thread_stack_avaid333333 %d\n",thread_stack_avail ) ;
// PCRE >= 8.30 has a magic call preg_exec(NULL, NULL, NULL, -1, ....) to determine the stack requirements
View
4 test/Makefile.in
@@ -55,7 +55,9 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/config/ax_lib_mysql.m4 \
$(top_srcdir)/config/ax_mysql_bin.m4 \
$(top_srcdir)/config/pcre.m4 $(top_srcdir)/config/ghmysql.m4 \
- $(top_srcdir)/config/ax_pthread.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/config/ax_pthread.m4 \
+ $(top_srcdir)/config/ax_pthread_np.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
Please sign in to comment.
Something went wrong with that request. Please try again.