From 598fd371adfa9d1a6b59d870342458e23c584db7 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 09 Oct 2012 16:27:03 -0400 Subject: Update configure. Apply changes made to configure in opkbuild 3.0.0-alpha1 --- diff --git a/configure b/configure index d74d3b6..2d6a814 100755 --- a/configure +++ b/configure @@ -23,17 +23,16 @@ package_name='opkhelper' package_version='2.0.0' package_description='opkg Build Helper Tools' -srcdir=$(dirname "${0}") -srcdir=$(cd ${srcdir} && pwd) +srcdir="$(cd "${0%/*}" && pwd)" prefix='/usr/local' bindir='$(prefix)/bin' -libdir='$(prefix)/lib/opkhelper' +libdir='$(prefix)/share' datadir='$(prefix)/share' mandir='$(datadir)/man' localedir='$(datadir)/locale' -quiet=false -missing_deps=false +quiet='false' +missing_deps='false' dep_cmds=' sh opkg @@ -49,24 +48,58 @@ mandir localedir ' -features="${dep_cmds}" +features=" +${dep_cmds} +${dep_libs} +${opt_dep_cmds} +${opt_dep_libs} +" -subst_vars="package_name +subst_vars=" +package_name package_version package_description ${long_opts_with_args} -${dep_cmds}" +${features} +" main() { parse_options "${@}" + shift ${optind} + if [ ${#} -ne 0 ]; then + print_usage + exit + fi for dep in ${dep_cmds}; do - dep_val=$(eval echo \$\{"${dep}"\}) + dep_name="$(printf '%s' "${dep}" | tr -c '[a-z0-9]' '_')" + dep_val="$(eval echo \$\{"${dep_name}"\})" + if [ -z "${dep_val}" ]; then + find_dep_cmd "${dep}" || missing_deps='true' + fi + done + for dep in ${dep_libs}; do + dep_name="$(printf '%s' "${dep}" | tr -c '[a-z0-9]' '_')" + dep_val="$(eval echo \$\{"${dep_name}"\})" + if [ -z "${dep_val}" ]; then + find_dep_lib "${dep}" || missing_deps='true' + fi + done + for dep in ${opt_dep_cmds}; do + dep_name="$(printf '%s' "${dep}" | tr -c '[a-z0-9]' '_')" + dep_val="$(eval echo \$\{"${dep_name}"\})" if [ -z "${dep_val}" ]; then find_dep_cmd "${dep}" fi done + for dep in ${opt_dep_libs}; do + dep_name="$(printf '%s' "${dep}" | tr -c '[a-z0-9]' '_')" + dep_val="$(eval echo \$\{"${dep_name}"\})" + if [ -z "${dep_val}" ]; then + find_dep_lib "${dep}" + fi + done if ${missing_deps}; then cat <&2 - exit 1 + break ;; esac @@ -199,11 +237,14 @@ EOF exit 1 fi if ${_optarg_set}; then - eval ${_opt}=\$\{_optarg\} + _opt="$(printf '%s' "${_opt}" | tr -c '[a-z0-9]' '_')" + eval "${_opt}"=\"\$\{_optarg\}\" else _prev="${_opt}" fi + optind=$(($optind + 1)) + done } @@ -211,36 +252,61 @@ find_dep_cmd() { _dep="${1}" - ${quiet} || printf 'checking for %s... ' "${dep}" + ${quiet} || printf 'checking for %s... ' "${_dep}" - _old_ifs="${IFS}" - IFS=: + IFS=':' for _element in ${PATH}; do + unset IFS : ${_element=-.} if [ -f "${_element}/${_dep}" -a -x "${_element}/${_dep}" ]; then ${quiet} || printf '%s/%s\n' "${_element}" "${_dep}" - eval "${_dep}=${_element}/${_dep}" - IFS="${_old_ifs}" + eval "${_dep}"=\"${_element}/${_dep}\" return 0 fi done - IFS="${_old_ifs}" + unset IFS + + ${quiet} || printf 'not found\n' + return 1 +} + +find_dep_lib() +{ + _dep="${1}" + + ${quiet} || printf 'checking for %s... ' "${_dep}" + + IFS=':' + + for _element in ${libdir}:${PATH}; do + unset IFS + : ${_element=-.} + if [ -f "${_element}/${_dep}" -a -x "${_element}/${_dep}" ]; then + ${quiet} || printf '%s/%s\n' "${_element}" "${_dep}" + eval "${_dep}"=\"${_element}/${_dep}\" + return 0 + fi + done + + unset IFS + ${quiet} || printf 'not found\n' - missing_deps=true return 1 } write_makefiles() { # Make a script to edit input makefiles. - _sed_script= + _sed_script='' for _var in ${subst_vars}; do + _var="$(printf '%s' "${_var}" | tr -c '[a-z0-9]' '_')" _sed_script="${_sed_script}s&@${_var}@&$(eval echo \$\{"${_var}"\})&g;" done for _dir in . src lib locale man; do + mkdir -p "${_dir}" sed "${_sed_script}" "${srcdir}/${_dir}/Makefile.in" >"${_dir}/Makefile" done } -- cgit v0.9.1