]> granicus.if.org Git - sudo/commitdiff
Add --enable-package-build to give configure a hint that we are
authorTodd C. Miller <Todd.Miller@sudo.ws>
Wed, 22 Aug 2018 14:09:46 +0000 (08:09 -0600)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Wed, 22 Aug 2018 14:09:46 +0000 (08:09 -0600)
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
configure.ac
include/sudo_compat.h
mkpkg

index 64e8dac27d2b5ee67bd109dd98cd588f72ddbfea..21875393bb080c3c85598ddfc7c14f2e2e0ac684 100755 (executable)
--- 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
 
                # 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
index ed3027f142f78172cb2dfe78532b3586480e5e41..3d8b0484bd3744d1bc34067e9e38a216b6dd05df 100644 (file)
@@ -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
index 535b4e950ada5dc66171b995c0d621fc9854dea4..1355f950a2e7fe094f6ab396be0ff4a63dac619b 100644 (file)
@@ -26,9 +26,6 @@
 #include <stdarg.h>
 #ifndef HAVE_MEMSET_S
 # include <stddef.h>   /* for rsize_t */
-# ifdef HAVE_STRING_H
-#  include <string.h>  /* for rsize_t on some systems */
-# endif /* HAVE_STRING_H */
 #endif /* HAVE_MEMSET_S */
 
 /*
diff --git a/mkpkg b/mkpkg
index dce45920cc441eca56cd1dd7e2c7fc241a21ab9c..bd465e74ee267406293db286bd909a9498f4c658 100755 (executable)
--- a/mkpkg
+++ b/mkpkg
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (c) 2010-2015 Todd C. Miller <Todd.Miller@sudo.ws>
+# Copyright (c) 2010-2018 Todd C. Miller <Todd.Miller@sudo.ws>
 #
 # 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