diff mbox series

[v3,1/1] configure.ac: configurable tooldir install path

Message ID 20240111105027.3382376-1-neal.frager@amd.com
State Superseded
Headers show
Series [v3,1/1] configure.ac: configurable tooldir install path | expand

Commit Message

Frager, Neal Jan. 11, 2024, 10:50 a.m. UTC
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 <neal.frager@amd.com>
Co-developed-by: Chris Wardman <cjwfirmware@vxmdesign.com>
---
V1->V2:
 - migrated patch to configure.ac
 - changed option name to --with-tooldir=PATH
V2->V3;
 - removed quotes around ${with_tooldir}
---
 configure.ac | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Mike Frysinger Jan. 11, 2024, 3:41 p.m. UTC | #1
On 11 Jan 2024 10:50, Neal Frager wrote:
> +  [case x"$withval" in

use AS_CASE

> +	x/*) ;;
> +	*)
> +	with_tooldir=
> +	AC_MSG_WARN([argument to --with-tooldir must be an absolute path])

shouldn't this be AC_MSG_ERROR ?  otherwise you're leaving it unset below.
-mike
Frager, Neal Jan. 11, 2024, 4:22 p.m. UTC | #2
Hi Mike,

Thank you for your feedback.

> +  [case x"$withval" in

> use AS_CASE

Ok.

> +	x/*) ;;
> +	*)
> +	with_tooldir=
> +	AC_MSG_WARN([argument to --with-tooldir must be an absolute path])

> shouldn't this be AC_MSG_ERROR ?  otherwise you're leaving it unset below.
> -mike

Yes, good point.  If the user does not use an absolute
path, this should trigger an error and not just a warning.

I will make these changes in v4.

Best regards,
Neal Frager
AMD
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index f1bb72100..8ca8cf9fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2599,7 +2599,18 @@  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])],
+  [case x"$withval" in
+	x/*) ;;
+	*)
+	with_tooldir=
+	AC_MSG_WARN([argument to --with-tooldir must be an absolute path])
+	;;
+  esac],
+  [with_tooldir='${exec_prefix}'/${target_noncanonical}])
+tooldir=${with_tooldir}
 build_tooldir=${tooldir}
 
 # Create a .gdbinit file which runs the one in srcdir