From 3d9e3a309f794faf0df53c00b15d406f14931938 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 8 Nov 2012 17:20:50 -0500 Subject: [PATCH] fix "configure --prefix=" and improve path/arg handling in configure previously, empty string was treated as "use default". this is apparently not compatible with standard configure semantics where an empty prefix puts everything under /. the new logic should be a lot cleaner and not suffer from such issues. --- configure | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/configure b/configure index 46d83fcf..cee817e4 100755 --- a/configure +++ b/configure @@ -50,9 +50,8 @@ fnmatch () { eval "case \"\$2\" in $1) return 0 ;; *) return 1 ;; esac" ; } cmdexists () { type "$1" >/dev/null 2>&1 ; } trycc () { test -z "$CC" && cmdexists "$1" && CC=$1 ; } -setdir () { -if eval "test -z \"\${$1}\"" ; then eval "$1=\$2" -else eval "fnmatch '*/' \"\${$1}\"" && eval "$1=\${$1%/}" ; fi +stripdir () { +while eval "fnmatch '*/' \"\${$1}\"" ; do eval "$1=\${$1%/}" ; done } tryflag () { @@ -90,15 +89,15 @@ fi CFLAGS_C99FSE= CFLAGS_AUTO= LDFLAGS_AUTO= -prefix= -exec_prefix= -bindir= -libdir= -includedir= -syslibdir= +prefix=/usr/local/musl +exec_prefix='$(prefix)' +bindir='$(exec_prefix)/bin' +libdir='$(prefix)/lib' +includedir='$(prefix)/include' +syslibdir='/lib' target= debug=no -warnings= +warnings=no shared=yes static=yes @@ -135,12 +134,9 @@ LIBCC=*) LIBCC=${arg#*=} ;; esac done -setdir prefix /usr/local/musl -setdir exec_prefix '$(prefix)' -setdir bindir '$(exec_prefix)/bin' -setdir libdir '$(prefix)/lib' -setdir includedir '$(prefix)/include' -setdir syslibdir '/lib' +for i in prefix exec_prefix bindir libdir includedir syslibdir ; do +stripdir $i +done # # Get a temp filename we can use -- 2.25.1