From 90d6966b88392dbcef01c64766eb452c645a7bfe Mon Sep 17 00:00:00 2001 From: Neal Frager Date: Thu, 11 Jan 2024 18:30:19 +0000 Subject: configure.ac: configurable tooldir install path This patch is required to fix how the newlib headers are installed when using a sysroot install directory. The cross compiler expects headers to be in .../host/usr/arm-none-eabi/sysroot/usr/include/newlib.h by default newlib installed the headers into .../host/usr/arm-none-eabi/sysroot/usr/arm-none-eabi/include/newlib.h ${exec_prefix} provides the .../host/usr/arm-none-eabi/sysroot path ${target_noncanonical} provides an extra arm-none-eabi/ that must be removed. With this patch, users can specify the tooldir path that is needed. Signed-off-by: Neal Frager Co-developed-by: Chris Wardman --- configure | 32 ++++++++++++++++++++++++++++++-- configure.ac | 10 +++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/configure b/configure index eb0ba840b..947715305 100755 --- a/configure +++ b/configure @@ -755,6 +755,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -822,6 +823,7 @@ enable_stage1_languages enable_objc_gc with_build_sysroot with_debug_prefix_map +with_tooldir with_build_config enable_vtable_verify enable_serial_configure @@ -915,6 +917,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}' @@ -1167,6 +1170,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=* \ @@ -1304,7 +1316,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. @@ -1464,6 +1476,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] @@ -1592,6 +1605,7 @@ Optional Packages: use sysroot as the system root during the build --with-debug-prefix-map='A=B C=D ...' map A to B, C to D ... in debug information + --with-tooldir=PATH use given path to install target tools after build --with-build-config='NAME NAME2...' use config/NAME.mk build configuration --with-build-time-tools=PATH @@ -7057,7 +7071,21 @@ 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} + +# Check whether --with-tooldir was given. +if test "${with_tooldir+set}" = set; then : + withval=$with_tooldir; case x"$withval" in #( + x/*) : + ;; #( + *) : + as_fn_error $? "argument to --with-tooldir must be an absolute path" "$LINENO" 5 ;; +esac + +else + with_tooldir='${exec_prefix}'/${target_noncanonical} +fi + +tooldir=${with_tooldir} build_tooldir=${tooldir} # Create a .gdbinit file which runs the one in srcdir diff --git a/configure.ac b/configure.ac index f1bb72100..05ddf6987 100644 --- a/configure.ac +++ b/configure.ac @@ -2599,7 +2599,15 @@ 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} +AC_ARG_WITH([tooldir], + [AS_HELP_STRING([--with-tooldir=PATH], + [use given path to install target tools after build])], + [AS_CASE([x"$withval"], + [x/*],, + [AC_MSG_ERROR([argument to --with-tooldir must be an absolute path])]) + ], + [with_tooldir='${exec_prefix}'/${target_noncanonical}]) +tooldir=${with_tooldir} build_tooldir=${tooldir} # Create a .gdbinit file which runs the one in srcdir -- cgit v1.2.3