author | Olivier Brunel
<jjk@jjacky.com> 2023-02-28 19:07:19 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-02-28 19:07:19 UTC |
parent | c88c2adc14b705a423de9b0b421c153da4faa311 |
configure | +12 | -4 |
libcomain | +5 | -0 |
diff --git a/configure b/configure index 870dd9d..701d65a 100755 --- a/configure +++ b/configure @@ -85,6 +85,14 @@ BUILD_DEPS= loadoptions +setoption() +{ + local opt=$1 + local v=$2 + if test ! $(optexist $opt) = "1"; then error 1 "unknown option: $opt"; fi + eval optdisabled$opt=$v +} + for arg ; do case "$arg" in --target=*) target=${arg#*=} ;; @@ -101,10 +109,10 @@ for arg ; do --prefer-static) prefer=static ;; --set-shared=*) eval "link${arg#*=}=1" ;; --set-static=*) eval "link${arg#*=}=2" ;; - --with-*) eval optdisabled$(expr substr "$arg" 8 ${#arg})=0 ;; - --without-*) eval optdisabled$(expr substr "$arg" 11 ${#arg})=1 ;; - --enable-*) eval optdisabled$(expr substr "$arg" 10 ${#arg})=0 ;; - --disable-*) eval optdisabled$(expr substr "$arg" 11 ${#arg})=1 ;; + --with-*) setoption $(expr substr "$arg" 8 ${#arg}) 0 ;; + --without-*) setoption $(expr substr "$arg" 11 ${#arg}) 1 ;; + --enable-*) setoption $(expr substr "$arg" 10 ${#arg}) 0 ;; + --disable-*) setoption $(expr substr "$arg" 11 ${#arg}) 1 ;; -h|--help) usage 0 ;; -*) error 1 "invalid option '$arg'" ;; diff --git a/libcomain b/libcomain index 2314c28..b5d50c4 100644 --- a/libcomain +++ b/libcomain @@ -172,6 +172,11 @@ loadoptions() return 1 } +optexist() +{ + if test -e meta/options/"$1"; then echo 1; else echo 0; fi +} + setneeddep() { local dep=$1