[v2] configure.ac: option for user-defined-trusted-dirs

Message ID 1578007510-24831-1-git-send-email-justinpopo6@gmail.com
State DCO or assignment missing, archived
Headers

Commit Message

Justin Chen Jan. 2, 2020, 11:25 p.m. UTC
  From: Justin Chen <justinpopo6@gmail.com>

User-defined-trusted-dirs is a variable used for adding additional
default library search dirs for the dynamic loader. Add the ability
to allow users to set it from the configure script.
---
 INSTALL             |  4 ++++
 configure           | 34 ++++++++++++++++++++++++++++++++--
 configure.ac        | 12 ++++++++++++
 manual/install.texi |  5 +++++
 4 files changed, 53 insertions(+), 2 deletions(-)
  

Comments

Siddhesh Poyarekar Dec. 21, 2020, 4:17 a.m. UTC | #1
On 1/3/20 4:55 AM, justinpopo6@gmail.com wrote:
> From: Justin Chen <justinpopo6@gmail.com>
> 
> User-defined-trusted-dirs is a variable used for adding additional
> default library search dirs for the dynamic loader. Add the ability
> to allow users to set it from the configure script.

Hi Justin,

Could you please confirm if you have signed a copyright assignment with 
the FSF?  The change is large enough that it ought to need an assignment 
before proceeding with a review.

Thanks,
Siddhesh
  
Justin Chen Dec. 21, 2020, 6:48 p.m. UTC | #2
On Sun, Dec 20, 2020 at 8:17 PM Siddhesh Poyarekar <siddhesh@gotplt.org> wrote:
>
> On 1/3/20 4:55 AM, justinpopo6@gmail.com wrote:
> > From: Justin Chen <justinpopo6@gmail.com>
> >
> > User-defined-trusted-dirs is a variable used for adding additional
> > default library search dirs for the dynamic loader. Add the ability
> > to allow users to set it from the configure script.
>
> Hi Justin,
>
> Could you please confirm if you have signed a copyright assignment with
> the FSF?  The change is large enough that it ought to need an assignment
> before proceeding with a review.
Hello Siddhesh,

No, I have not done this yet. Let me get this done and I will get back to you.

Thanks,
Justin
>
> Thanks,
> Siddhesh
  

Patch

diff --git a/INSTALL b/INSTALL
index 392537c..1062f53 100644
--- a/INSTALL
+++ b/INSTALL
@@ -282,6 +282,10 @@  if 'CFLAGS' is specified it must enable optimization.  For example:
      the GNU C Library.  The default value refers to the main
      bug-reporting information for the GNU C Library.
 
+'--with-user-defined-trusted-dirs=LIB-FOLDERS'
+     Specify additional trustworthy directories to look for shared
+     libraries.  This is in addition to the default ld library path.
+
    To build the library and related programs, type 'make'.  This will
 produce a lot of output, some of which may look like errors from 'make'
 but aren't.  Look for error messages from 'make' containing '***'.
diff --git a/configure b/configure
index b959d2d..2bb5534 100755
--- a/configure
+++ b/configure
@@ -733,6 +733,7 @@  infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -795,6 +796,7 @@  enable_tunables
 enable_mathvec
 enable_cet
 with_cpu
+with_user_defined_trusted_dirs
 '
       ac_precious_vars='build_alias
 host_alias
@@ -846,6 +848,7 @@  datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1098,6 +1101,15 @@  do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1235,7 +1247,7 @@  fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1388,6 +1400,7 @@  Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1488,6 +1501,8 @@  Optional Packages:
   --with-nonshared-cflags=CFLAGS
                           build nonshared libraries with additional CFLAGS
   --with-cpu=CPU          select code for CPU variant
+  --with-user-defined-trusted-dirs=DIRS
+                          Additional default ld search dirs
 
 Some influential environment variables:
   CC          C compiler command
@@ -3785,7 +3800,7 @@  main ()
 {
 
 #ifndef __CET__
-#error no CET compiler support
+# error no CET compiler support
 #endif
   ;
   return 0;
@@ -3839,6 +3854,21 @@  if test "${with_cpu+set}" = set; then :
 fi
 
 
+user_defined_trusted_dirs=
+
+# Check whether --with-user-defined-trusted-dirs was given.
+if test "${with_user_defined_trusted_dirs+set}" = set; then :
+  withval=$with_user_defined_trusted_dirs;   case "$withval" in
+  yes|'') as_fn_error $? "--with-user-defined-trusted-dirs requires an argument" "$LINENO" 5 ;;
+  no) ;;
+  *) user_defined_trusted_dirs="$withval" ;;
+  esac
+
+fi
+
+config_vars="$config_vars
+user-defined-trusted-dirs = $user_defined_trusted_dirs"
+
 # An preconfigure script can set this when it wants to disable the sanity
 # check below.
 libc_config_ok=no
diff --git a/configure.ac b/configure.ac
index 49b900c..a46532d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -517,6 +517,18 @@  AC_ARG_WITH([cpu],
   esac
 ])
 
+user_defined_trusted_dirs=
+AC_ARG_WITH([user-defined-trusted-dirs],
+	    AS_HELP_STRING([--with-user-defined-trusted-dirs=DIRS], [Additional default ld search dirs]),
+	    [dnl
+  case "$withval" in
+  yes|'') AC_MSG_ERROR([--with-user-defined-trusted-dirs requires an argument]) ;;
+  no) ;;
+  *) user_defined_trusted_dirs="$withval" ;;
+  esac
+])
+LIBC_CONFIG_VAR([user-defined-trusted-dirs], [$user_defined_trusted_dirs])
+
 # An preconfigure script can set this when it wants to disable the sanity
 # check below.
 libc_config_ok=no
diff --git a/manual/install.texi b/manual/install.texi
index b2d569a..31ea4c1 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -312,6 +312,11 @@  Specify the URL that users should visit if they wish to report a bug,
 to be included in @option{--help} output from programs installed with
 @theglibc{}.  The default value refers to the main bug-reporting
 information for @theglibc{}.
+
+@item --with-user-defined-trusted-dirs=@var{lib-folders}
+Specify additional trustworthy directories to look for shared libraries.
+This is in addition to the default ld library path.
+
 @end table
 
 To build the library and related programs, type @code{make}.  This will