3 # Copyright 2005 Timo Hirvonen
5 # This file is licensed under the GPLv2.
7 .
scripts
/utils.sh ||
exit 1
8 .
scripts
/checks.sh ||
exit 1
10 # Usage: parse_command_line "$@"
11 # USAGE string must be defined in configure (used for --help)
22 test $# -eq 0 && die
"-f requires an argument"
26 die
"unrecognized option \`$1'"
29 _var
=`echo "$1" | sed "s/=.*//"`
30 _val
=`echo "$1" | sed "s/${_var}=//"`
31 set_var
"$_var" "$_val"
34 die
"unrecognized argument \`$1'"
41 # check function [variable]
45 # check check_vorbis CONFIG_VORBIS
51 $1 || die
"configure failed."
60 $1 || die
"configure failed."
71 die
"invalid value for $2. 'y', 'n', 'a' or '' expected"
76 # Set and register variable to be added to config.mk
78 # @name name of the variable
79 # @value value of the variable
82 argc makefile_var
$# 2 2
87 # Register variables to be added to config.mk
90 makefile_variables
="$makefile_variables $*"
96 CFLAGS
="$CFLAGS $EXTRA_CFLAGS"
97 CXXFLAGS
="$CXXFLAGS $EXTRA_CXXFLAGS"
98 if test -z "$GINSTALL"
100 GINSTALL
=`path_find ginstall`
101 test "$GINSTALL" || GINSTALL
=install
105 makefile_vars GINSTALL topdir
107 __tmp
=`tmp_file config.mk`
108 for __i
in $makefile_variables
110 echo "$__i = `get_var $__i`"
112 update_file
$__tmp config.mk
115 # -----------------------------------------------------------------------------
116 # Config header generation
120 # Guesses variable types:
123 # anything else -> str
126 # CONFIG_FOO=y # bool
127 # VERSION=2.0.1 # string
129 # config_header config.h CONFIG_FOO VERSION DEBUG
132 argc config_header
$# 2
133 config_header_begin
"$1"
143 if test "$__var" && test "$__var" = "`echo $__var | sed 's/[^0-9]//g'`"
156 # Low-level interface
159 # config_header_begin config.h
160 # config_str PACKAGE VERSION
161 # config_bool CONFIG_ALSA
164 config_header_begin
()
166 argc config_header_begin
$# 1 1
167 config_header_file
="$1"
168 config_header_tmp
=`tmp_file config_header`
170 __def
=`echo $config_header_file | to_upper | sed 's/[-\.\/]/_/g'`
171 cat <<EOF > "$config_header_tmp"
182 echo "#define $1 \"`get_var $1`\"" >> "$config_header_tmp"
191 echo "#define $1 `get_var $1`" >> "$config_header_tmp"
200 case "`get_var $1`" in
202 echo "/* #define $1 */" >> "$config_header_tmp"
205 echo "#define $1 1" >> "$config_header_tmp"
208 die
"bool '$1' has invalid value '`get_var $1`'"
217 argc config_header_end
$# 0 0
218 echo "" >> "$config_header_tmp"
219 echo "#endif" >> "$config_header_tmp"
220 mkdir
-p `dirname "$config_header_file"`
221 update_file
"$config_header_tmp" "$config_header_file"