From 957f284bba669df51fce82beaee8f24d8f31de36 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 22 Aug 2018 08:09:46 -0600 Subject: [PATCH] Add --enable-package-build to give configure a hint that we are building a package. This can be used to avoid relying on libc functions that may not be present in all libc versions for a particular system. For instance, AIX 7.1 may or may not have memset_s() and getline() present. --- configure | 22 ++++++++++++++++++---- configure.ac | 16 ++++++++++++---- include/sudo_compat.h | 3 --- mkpkg | 6 +++++- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 64e8dac27..21875393b 100755 --- a/configure +++ b/configure @@ -967,6 +967,7 @@ with_selinux enable_sasl enable_timestamp_type enable_offensive_insults +enable_package_build enable_gss_krb5_ccache_name enable_shared enable_static @@ -1655,6 +1656,7 @@ Optional Features: ppid or tty. --enable-offensive-insults Enable potentially offensive sudo insults. + --enable-package-build Enable options for package building. --enable-gss-krb5-ccache-name Use GSS-API to set the Kerberos V cred cache name --enable-shared[=PKGS] build shared libraries [default=yes] @@ -6859,6 +6861,14 @@ if test "$enable_offensive_insults" = "yes"; then fi +# Check whether --enable-package_build was given. +if test "${enable_package_build+set}" = set; then : + enableval=$enable_package_build; +else + enable_package_build=no +fi + + # Check whether --enable-gss_krb5_ccache_name was given. if test "${enable_gss_krb5_ccache_name+set}" = set; then : enableval=$enable_gss_krb5_ccache_name; check_gss_krb5_ccache_name=$enableval @@ -15495,14 +15505,18 @@ fi # getline() may or may ont be present on AIX <= 6.1. # bos610 is missing getline/getdelim but bos61J has it. - if test $OSMAJOR -le 6; then - ac_cv_func_getline=no + if test "$enable_package_build" = "yes"; then + if test $OSMAJOR -le 6; then + ac_cv_func_getline=no + fi fi # memset_s() may or may ont be present on AIX <= 7.1. # bos710 is missing memset_s but bos71L has it. - if test $OSMAJOR -le 7; then - ac_cv_func_memset_s=no + if test "$enable_package_build" = "yes"; then + if test $OSMAJOR -le 7; then + ac_cv_func_memset_s=no + fi fi # Remove timedir on boot, AIX does not have /var/run diff --git a/configure.ac b/configure.ac index ed3027f14..3d8b0484b 100644 --- a/configure.ac +++ b/configure.ac @@ -1603,6 +1603,10 @@ if test "$enable_offensive_insults" = "yes"; then AC_DEFINE(OFFENSIVE_INSULTS) fi +AC_ARG_ENABLE(package_build, +[AS_HELP_STRING([--enable-package-build], [Enable options for package building.])], +[], [enable_package_build=no]) + dnl dnl gss_krb5_ccache_name() may not work on Heimdal so we don't use it by default dnl @@ -1824,14 +1828,18 @@ case "$host" in # getline() may or may ont be present on AIX <= 6.1. # bos610 is missing getline/getdelim but bos61J has it. - if test $OSMAJOR -le 6; then - ac_cv_func_getline=no + if test "$enable_package_build" = "yes"; then + if test $OSMAJOR -le 6; then + ac_cv_func_getline=no + fi fi # memset_s() may or may ont be present on AIX <= 7.1. # bos710 is missing memset_s but bos71L has it. - if test $OSMAJOR -le 7; then - ac_cv_func_memset_s=no + if test "$enable_package_build" = "yes"; then + if test $OSMAJOR -le 7; then + ac_cv_func_memset_s=no + fi fi # Remove timedir on boot, AIX does not have /var/run diff --git a/include/sudo_compat.h b/include/sudo_compat.h index 535b4e950..1355f950a 100644 --- a/include/sudo_compat.h +++ b/include/sudo_compat.h @@ -26,9 +26,6 @@ #include #ifndef HAVE_MEMSET_S # include /* for rsize_t */ -# ifdef HAVE_STRING_H -# include /* for rsize_t on some systems */ -# endif /* HAVE_STRING_H */ #endif /* HAVE_MEMSET_S */ /* diff --git a/mkpkg b/mkpkg index dce45920c..bd465e74e 100755 --- a/mkpkg +++ b/mkpkg @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2010-2015 Todd C. Miller +# Copyright (c) 2010-2018 Todd C. Miller # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -147,6 +147,10 @@ if [ "$crossbuild" = "false" ]; then esac fi +# Give configure a hint that we are building a package. +# Some libc functions are only available on certain OS revisions. +configure_opts="${configure_opts}${configure_opts+$tab}--enable-package-build" + # Choose configure options by osversion. # We use the same configure options as vendor packages when possible. case "$osversion" in -- 2.40.0