Commits

Anonymous committed dff0aed

build-and-install: fix getopt usage on BSD

  • Participants
  • Parent commits db6e5bc

Comments (0)

Files changed (1)

File build-and-install

 disable-posix-timers
 "
 
-opts=$(getopt -n ${BASH_SOURCE[0]} -o "j:h" \
-              -l "jobs:,help,$(echo -n $configflags | tr ' ' ,)" -- "$@")
+opts=
+if getopt -V | grep -q enhanced; then
+  opts=$(getopt -n ${BASH_SOURCE[0]} -o "j:h" \
+                -l "jobs:,help,$(echo -n $configflags | tr ' ' ,)" -- "$@")
+else
+  opts=$(getopt "j:h" $*)
+fi
+
 if [[ $? != 0 ]]; then usage; exit 1; fi
 
 set -e
 case $# in
     0) tree="."  ;;
     1) tree="$1" ;;
-    *) echo "too many anonymous arguments: $@" ;;
+    *) echo "too many anonymous arguments: $@"; exit 1 ;;
 esac
 
 # in dependency topological order