[PATCH] Add --with-sdkdir flag for controlling target library installation location

Jonathan Roelofs jonathan@codesourcery.com
Tue Jan 20 01:03:00 GMT 2015


The backstory is that I'd like to be able to have newlib install target 
libraries in a directory other than the one named after the target 
triple, so I can customize the layout of my toolchain's sysroots.

2015-01-19  Jonathan Roelofs  <jonathan@codesourcery.com>

	* configure.ac: Add new flag: --with-sdkdir=.
	* configure: Regenerate.

-- 
Jon Roelofs
jonathan@codesourcery.com
CodeSourcery / Mentor Embedded
-------------- next part --------------
diff --git a/configure b/configure
index ae23ce4..e66c3c9 100755
--- a/configure
+++ b/configure
@@ -743,6 +743,7 @@ alphaieee_frag
 ospace_frag'
 ac_user_opts='
 enable_option_checking
+with_sdkdir
 with_build_libsubdir
 enable_gold
 enable_ld
@@ -1497,6 +1498,8 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-sdkdir=PATH      specify sysroot install location for installed
+                          target libraries
   --with-build-libsubdir=DIR  Directory where to find libraries for build system
   --with-mpc=PATH         specify prefix directory for installed MPC package.
                           Equivalent to --with-mpc-include=PATH/include plus
@@ -2373,6 +2376,17 @@ esac
 
 
 
+
+# Check whether --with-sdkdir was given.
+if test "${with_sdkdir+set}" = set; then :
+  withval=$with_sdkdir;
+fi
+
+case ${with_sdkdir} in
+  "") sdkdir=${target_noncanonical} ;;
+  *) sdkdir=${with_sdkdir} ;;
+esac
+
 test "$host_noncanonical" = "$target_noncanonical" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
@@ -6802,7 +6816,7 @@ fi
 
 
 # Handle --with-headers=XXX.  If the value is not "yes", the contents of
-# the named directory are copied to $(tooldir)/sys-include.
+# the named directory are copied to $(sdkdir)/sys-include.
 if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
   if test x${is_cross_compiler} = xno ; then
     echo 1>&2 '***' --with-headers is only supported when cross compiling
@@ -6810,12 +6824,12 @@ if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
   fi
   if test x"${with_headers}" != xyes ; then
     x=${gcc_cv_tool_prefix}
-    copy_dirs="${copy_dirs} ${with_headers} $x/${target_noncanonical}/sys-include"
+    copy_dirs="${copy_dirs} ${with_headers} $x/${sdkdir}/sys-include"
   fi
 fi
 
 # Handle --with-libs=XXX.  If the value is not "yes", the contents of
-# the name directories are copied to $(tooldir)/lib.  Multiple directories
+# the name directories are copied to $(sdkdir)/lib.  Multiple directories
 # are permitted.
 if test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
   if test x${is_cross_compiler} = xno ; then
@@ -6827,7 +6841,7 @@ if test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
     # library override files in subsequent libraries.
     x=${gcc_cv_tool_prefix}
     for l in ${with_libs}; do
-      copy_dirs="$l $x/${target_noncanonical}/lib ${copy_dirs}"
+      copy_dirs="$l $x/${sdkdir}/lib ${copy_dirs}"
     done
   fi
 fi
@@ -6985,7 +6999,7 @@ esac
 
 # Some systems (e.g., one of the i386-aix systems the gas testers are
 # using) don't handle "\$" correctly, so don't use it here.
-tooldir='${exec_prefix}'/${target_noncanonical}
+tooldir='${exec_prefix}'/${sdkdir}
 build_tooldir=${tooldir}
 
 # Create a .gdbinit file which runs the one in srcdir
diff --git a/configure.ac b/configure.ac
index 80313d0..65b96f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,6 +68,14 @@ ACX_NONCANONICAL_BUILD
 ACX_NONCANONICAL_HOST
 ACX_NONCANONICAL_TARGET
 
+AC_ARG_WITH(sdkdir,
+[AS_HELP_STRING([--with-sdkdir=PATH],
+		[specify sysroot install location for installed target libraries])])
+case ${with_sdkdir} in
+  "") sdkdir=${target_noncanonical} ;;
+  *) sdkdir=${with_sdkdir} ;;
+esac
+
 dnl Autoconf 2.5x and later will set a default program prefix if
 dnl --target was used, even if it was the same as --host.  Disable
 dnl that behavior.  This must be done before AC_CANONICAL_SYSTEM
@@ -2231,7 +2239,7 @@ AC_SUBST(CXXFLAGS_FOR_TARGET)
 AC_SUBST(LDFLAGS_FOR_TARGET)
 
 # Handle --with-headers=XXX.  If the value is not "yes", the contents of
-# the named directory are copied to $(tooldir)/sys-include.
+# the named directory are copied to $(sdkdir)/sys-include.
 if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
   if test x${is_cross_compiler} = xno ; then
     echo 1>&2 '***' --with-headers is only supported when cross compiling
@@ -2239,12 +2247,12 @@ if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
   fi
   if test x"${with_headers}" != xyes ; then
     x=${gcc_cv_tool_prefix}
-    copy_dirs="${copy_dirs} ${with_headers} $x/${target_noncanonical}/sys-include"
+    copy_dirs="${copy_dirs} ${with_headers} $x/${sdkdir}/sys-include"
   fi
 fi
 
 # Handle --with-libs=XXX.  If the value is not "yes", the contents of
-# the name directories are copied to $(tooldir)/lib.  Multiple directories
+# the name directories are copied to $(sdkdir)/lib.  Multiple directories
 # are permitted.
 if test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
   if test x${is_cross_compiler} = xno ; then
@@ -2256,7 +2264,7 @@ if test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
     # library override files in subsequent libraries.
     x=${gcc_cv_tool_prefix}
     for l in ${with_libs}; do
-      copy_dirs="$l $x/${target_noncanonical}/lib ${copy_dirs}"
+      copy_dirs="$l $x/${sdkdir}/lib ${copy_dirs}"
     done
   fi
 fi
@@ -2414,7 +2422,7 @@ esac
 
 # Some systems (e.g., one of the i386-aix systems the gas testers are
 # using) don't handle "\$" correctly, so don't use it here.
-tooldir='${exec_prefix}'/${target_noncanonical}
+tooldir='${exec_prefix}'/${sdkdir}
 build_tooldir=${tooldir}
 
 # Create a .gdbinit file which runs the one in srcdir


More information about the Newlib mailing list