Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[build] fix configure with komplex enviroments
- add ldflags
- fix multivalued options like --cflags="-m64 -I/include/extra"
  • Loading branch information
InuSasha authored and perexg committed Sep 1, 2014
1 parent f2a5c41 commit ae56b48
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 32 deletions.
31 changes: 30 additions & 1 deletion configure
Expand Up @@ -47,7 +47,36 @@ OPTIONS=(
#

. "$ROOTDIR/support/configure.inc"
parse_args $*

# ###########################################################################
# Parse arguments
# ###########################################################################
opt=
val=
for opt do
val=${opt#*=}
opt=${opt%=*}
opt=${opt#*--}
case "$opt" in
help)
show_help
;;
*dir|prefix)
eval "$opt=$val"
;;
cc|cflags|ldflags|arch|cpu|platform|python)
eval "$(toupper $opt)=\"$val\""
;;
enable-*)
opt=${opt#*-}
enable $opt 1
;;
disable-*)
opt=${opt#*-}
disable $opt 1
;;
esac
done

# ###########################################################################
# Checks
Expand Down
32 changes: 1 addition & 31 deletions support/configure.inc
Expand Up @@ -165,6 +165,7 @@ show_help ()
echo "Compiler/Arch"
printf " $fmt Build using compiler [$CC]\n" "--cc=CC"
printf " $fmt Build using C flags\n" "--cflags=CFLAGS"
printf " $fmt Build using LD flags\n" "--ldflags=LDFLAGS"
printf " $fmt Build and optimize for specific CPU\n" "--cpu=CPU"
printf " $fmt Build for architecture [$ARCH]\n" "--arch=ARCH"
printf " $fmt Build for platform [$PLATFORM]\n" "--platform=PLATFORM"
Expand All @@ -186,37 +187,6 @@ show_help ()
exit 0
}

# Process command line
parse_args ()
{
local opt= val=
for opt do
val=${opt#*=}
opt=${opt%=*}
opt=${opt#*--}
case "$opt" in
help)
show_help
;;
*dir|prefix)
eval "$opt=$val"
;;
cc|cflags|arch|cpu|platform|python)
eval "$(toupper $opt)=$val"
;;
enable-*)
opt=${opt#*-}
enable $opt 1
;;
disable-*)
opt=${opt#*-}
disable $opt 1
;;
esac
done
}


# ###########################################################################
# Package tests
# ###########################################################################
Expand Down

0 comments on commit ae56b48

Please sign in to comment.