e217a9
# Probe system for multilib information.
e217a9
# Copyright (C) 2016 Red Hat, Inc.
e217a9
# Written by Pavel Raiskup <praiskup@redhat.com>
e217a9
#
e217a9
# This program is free software; you can redistribute it and/or modify
e217a9
# it under the terms of the GNU General Public License as published by
e217a9
# the Free Software Foundation; either version 2 of the License, or
e217a9
# (at your option) any later version.
e217a9
#
e217a9
# This program is distributed in the hope that it will be useful,
e217a9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
e217a9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e217a9
# GNU General Public License for more details.
e217a9
#
e217a9
# You should have received a copy of the GNU General Public License along
e217a9
# with this program; if not, write to the Free Software Foundation, Inc.,
e217a9
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
e217a9
e217a9
@LIB@
e217a9
e217a9
opt_multilib_capable=false
e217a9
e217a9
print_help ()
e217a9
{
e217a9
    _h_exit=false
e217a9
    test -n "$1" && _h_exit=:
e217a9
e217a9
    cat <
e217a9
Usage: $progname [OPTIONS]
e217a9
e217a9
Probe system for interesting multilib information.
e217a9
e217a9
--multilib-capable   could package built on this box play some role on multilib
e217a9
                capable system?  Prints 'true' or 'false'.
e217a9
--arch          override arch detection (mostly for testing purposes)
e217a9
EOF
e217a9
    $_h_exit && exit "$1"
e217a9
}
e217a9
e217a9
while test $# -gt 0
e217a9
do
e217a9
    _opt=$1 ; shift
e217a9
    case $_opt in
e217a9
        --arch)
e217a9
            _raw_opt=$(echo "$_opt" | sed -e 's/^--//' -e 's/-/_/g')
e217a9
            eval "opt_$_raw_opt=\$1"
e217a9
            shift || die "$_opt requires argument"
e217a9
            ;;
e217a9
        --multilib-capable)
e217a9
            _raw_opt=$(echo "$_opt" | sed -e 's/^--//' -e 's/-/_/g')
e217a9
            eval "opt_$_raw_opt=:"
e217a9
            ;;
e217a9
        --help)
e217a9
            print_help 0
e217a9
            ;;
e217a9
        *)
e217a9
            error "unexpected '$_opt' program argument"
e217a9
            ;;
e217a9
    esac
e217a9
done
e217a9
$error_occurred && print_help 1
e217a9
fix_arch opt_arch
e217a9
e217a9
$opt_multilib_capable && {
e217a9
    if is_multilib "$opt_arch"; then
e217a9
        echo true
e217a9
    else
e217a9
        echo false
e217a9
    fi
e217a9
    exit 0
e217a9
}
e217a9
e217a9
print_help 1