From 09b07fe21a916b577f00194af421a197da76dfa5 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 19 Jun 2015 12:35:51 -0600 Subject: [PATCH] Add back _REENTRANT define on HP-UX to expose strtok_r on some versions. We may need to define it on other systems too. --- config.h.in | 5 +++++ configure | 15 +++------------ configure.ac | 8 +++++++- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/config.h.in b/config.h.in index 4fde90561..a4088d109 100644 --- a/config.h.in +++ b/config.h.in @@ -1267,6 +1267,11 @@ # undef _XOPEN_SOURCE_EXTENDED #endif +/* Enable reentrant versions of the standard C API (obsolete). */ +#ifndef _REENTRANT +# undef _REENTRANT +#endif + /* Enable "safer" versions of the standard C API (ISO C11). */ #ifndef __STDC_WANT_LIB_EXT1__ # undef __STDC_WANT_LIB_EXT1__ diff --git a/configure b/configure index d69eb2f12..469cb5a22 100755 --- a/configure +++ b/configure @@ -14966,18 +14966,7 @@ $as_echo "$sudo_cv_var_daportable" >&6; } # order of libs in 9.X is important. -lc_r must be last SUDOERS_LIBS="${SUDOERS_LIBS} -ldce -lM -lc_r" LIBS="${LIBS} -ldce -lM -lc_r" - - case "${CPPFLAGS}" in - *"-D_REENTRANT"|*"-D_REENTRANT ") - ;; - *) - if test X"${CPPFLAGS}" = X""; then - CPPFLAGS="-D_REENTRANT" - else - CPPFLAGS="${CPPFLAGS} -D_REENTRANT" - fi - ;; - esac + $as_echo "#define _REENTRANT 1" >>confdefs.h case "${CPPFLAGS}" in @@ -23530,6 +23519,8 @@ if test "x$ac_cv_lib_pthread_main" = xyes; then : SUDO_LIBS="${SUDO_LIBS} -lpthread" fi + $as_echo "#define _REENTRANT 1" >>confdefs.h + ;; esac diff --git a/configure.ac b/configure.ac index 2d277c57e..1cf276db6 100644 --- a/configure.ac +++ b/configure.ac @@ -1836,7 +1836,7 @@ case "$host" in # order of libs in 9.X is important. -lc_r must be last SUDOERS_LIBS="${SUDOERS_LIBS} -ldce -lM -lc_r" LIBS="${LIBS} -ldce -lM -lc_r" - SUDO_APPEND_CPPFLAGS(-D_REENTRANT) + AC_DEFINE(_REENTRANT) SUDO_APPEND_CPPFLAGS(-I/usr/include/reentrant) fi ;; @@ -3814,6 +3814,7 @@ fi case "$host_os" in hpux*) AC_CHECK_LIB(pthread, main, [SUDO_LIBS="${SUDO_LIBS} -lpthread"]) + AC_DEFINE(_REENTRANT) ;; esac @@ -4373,6 +4374,11 @@ AH_BOTTOM([/* BSD compatibility on some SVR4 systems. */ # undef _XOPEN_SOURCE_EXTENDED #endif +/* Enable reentrant versions of the standard C API (obsolete). */ +#ifndef _REENTRANT +# undef _REENTRANT +#endif + /* Enable "safer" versions of the standard C API (ISO C11). */ #ifndef __STDC_WANT_LIB_EXT1__ # undef __STDC_WANT_LIB_EXT1__ -- 2.40.0