From 81da78ff3d18a8c101232675edeed0fdae33b968 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sat, 20 Nov 2010 16:26:53 -0500 Subject: [PATCH] Add workaround for an error in sys/types.h on HP-UX 11.23 when large file support is enabled. Defining _XOPEN_SOURCE_EXTENDED avoids the broken bits of the header file. --- configure | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++-- configure.in | 20 ++++++++++++++++++ 2 files changed, 78 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 7d7abcfc0..ec5166f6c 100755 --- a/configure +++ b/configure @@ -14219,6 +14219,63 @@ rm -rf conftest* fi fi +case "$host" in + *-*-hpux11.*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h needs _XOPEN_SOURCE_EXTENDED" >&5 +$as_echo_n "checking whether sys/types.h needs _XOPEN_SOURCE_EXTENDED... " >&6; } +if test "${sudo_cv_xopen_source_extended+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + #include +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + sudo_cv_xopen_source_extended=no +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _XOPEN_SOURCE_EXTENDED + $ac_includes_default + #include +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + sudo_cv_xopen_source_extended=yes +else + sudo_cv_xopen_source_extended=error +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_xopen_source_extended" >&5 +$as_echo "$sudo_cv_xopen_source_extended" >&6; } + if test "$sudo_cv_xopen_source_extended" = "yes"; then + OSDEFS="${OSDEFS} -D_XOPEN_SOURCE_EXTENDED" + cat >>confdefs.h <<\EOF +#define _XOPEN_SOURCE_EXTENDED 1 +EOF + + fi + ;; +esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking POSIX termios" >&5 $as_echo_n "checking POSIX termios... " >&6; } if test "${ac_cv_sys_posix_termios+set}" = set; then : @@ -14260,11 +14317,10 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #include -int main() {char *p = _PATH_MAILDIR;} int main () { - +char *p = _PATH_MAILDIR; ; return 0; } diff --git a/configure.in b/configure.in index 4a1b52766..82db26ea5 100644 --- a/configure.in +++ b/configure.in @@ -1876,7 +1876,27 @@ AC_HEADER_STDC AC_HEADER_DIRENT AC_HEADER_TIME AC_CHECK_HEADERS(malloc.h paths.h utime.h netgroup.h sys/sockio.h sys/bsdtypes.h sys/select.h sys/stropts.h) +dnl +dnl Check for large file support. HP-UX 11.23 has a broken sys/type.h +dnl when large files support is enabled so work around it. +dnl AC_SYS_LARGEFILE +case "$host" in + *-*-hpux11.*) + AC_CACHE_CHECK([whether sys/types.h needs _XOPEN_SOURCE_EXTENDED], [sudo_cv_xopen_source_extended], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT + #include ], [])], [sudo_cv_xopen_source_extended=no], [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#define _XOPEN_SOURCE_EXTENDED + AC_INCLUDES_DEFAULT + #include ], [])], [sudo_cv_xopen_source_extended=yes], + [sudo_cv_xopen_source_extended=error]) + ])]) + if test "$sudo_cv_xopen_source_extended" = "yes"; then + OSDEFS="${OSDEFS} -D_XOPEN_SOURCE_EXTENDED" + SUDO_DEFINE(_XOPEN_SOURCE_EXTENDED) + fi + ;; +esac AC_SYS_POSIX_TERMIOS if test "$ac_cv_sys_posix_termios" != "yes"; then AC_MSG_ERROR([Must have POSIX termios to build sudo]) -- 2.40.0