author | Olivier Brunel
<jjk@jjacky.com> 2023-01-27 07:56:17 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-01-27 07:56:17 UTC |
parent | e382a79cbbc3457f457a9e1fd040b73ef6dcc705 |
configure | +32 | -22 |
diff --git a/configure b/configure index 62dce59..216b710 100755 --- a/configure +++ b/configure @@ -27,6 +27,11 @@ usageoptions() usage() { local r="$1" + s= + if test $has_skalibs -eq 1; then + s=" + --sysdeps=DIR Use skalibs' sysdeps from DIR [LIBDIR/skalibs/sysdeps]" + fi cat <<EOF usage: $0 [OPTION..] @@ -37,8 +42,7 @@ usage: $0 [OPTION..] --libdir=DIR Set library directory to DIR [PREFIX/lib] --incdir=DIR Set include directory to DIR [PREFIX/include] --sharedir=DIR Set share directory to DIR [PREFIX/share] - - --sysdeps=DIR Use skalibs' sysdeps from DIR [LIBDIR/skalibs/sysdeps] +$s --prefer-shared Prefer to link shared libraires [default] --prefer-static Prefer to link static libraires --set-shared=DEP Use shared linking for dependency DEP @@ -63,6 +67,9 @@ libdir= incdir= sharedir= +# this isn't quite right, since skalibs could be optional, but it'll do. +has_skalibs=0 +if test -d meta/deps/skalibs; then has_skalibs=1; fi sysdeps= prefer=shared @@ -88,7 +95,8 @@ for arg ; do --incdir=*) incdir=${arg#*=} ;; --sharedir=*) sharedir=${arg#*=} ;; - --sysdeps=*) sysdeps=${arg#*=} ;; + --sysdeps=*) if test $has_skalibs -eq 1; then sysdeps=${arg#*=}; + else error 1 "invalid option '$arg'"; fi;; --prefer-shared) ;; --prefer-static) prefer=static ;; --set-shared=*) eval "link${arg#*=}=1" ;; @@ -367,24 +375,25 @@ trycmd AR "ar" trycmd RANLIB "$RANLIB" trycmd RANLIB "ranlib" -echo " => Checking sysdeps... $sysdeps" -echon " -> Checking target.." -if test -z "$target" ; then - target=$($CC -dumpmachine 2>/dev/null) || target=unknown -fi -BITS=32 -case "$target" in - *x86_64*) BITS=64 ;; -esac -echo ".. $target [${BITS}bit]" -if test ! -d $sysdeps || test ! -f $sysdeps/target; then - error 2 "$sysdeps is not a valid sysdeps directory" -fi -if test "x$target" != "x$(cat $sysdeps/target)"; then - error 2 "target $target does not match the contents of $sysdeps/target ($(cat $sysdeps/target))" +if test $has_skalibs -eq 1; then + echo " => Checking sysdeps... $sysdeps" + echon " -> Checking target.." + if test -z "$target" ; then + target=$($CC -dumpmachine 2>/dev/null) || target=unknown + fi + BITS=32 + case "$target" in + *x86_64*) BITS=64 ;; + esac + echo ".. $target [${BITS}bit]" + if test ! -d $sysdeps || test ! -f $sysdeps/target; then + error 2 "$sysdeps is not a valid sysdeps directory" + fi + if test "x$target" != "x$(cat $sysdeps/target)"; then + error 2 "target $target does not match the contents of $sysdeps/target ($(cat $sysdeps/target))" + fi fi - echo " => Testing C compiler..." tryflag CFLAGS -std=c99 tryflag CFLAGS -fomit-frame-pointer @@ -435,8 +444,10 @@ echo "# $0 $@" echo "# Any changes you make in here will be lost on the next ./configure" echo "" -echo "BITS := $BITS" -echo "" +if test -n "$BITS"; then + echo "BITS := $BITS" + echo "" +fi echo "CC = $CC" echo "AR = $AR" @@ -553,7 +564,6 @@ cat <<EOF #ifndef ${prefix}_CONFIG_H #define ${prefix}_CONFIG_H -#define ${prefix}_BITS $BITS #define ${prefix}_CURYEAR "$(date +%Y)" #define ${prefix}_AUTHOR "Olivier Brunel" #define ${prefix}_VERSION "$version"