xref: /netbsd-src/external/bsd/am-utils/dist/config.guess.long (revision 4bcd344e8f8eea3bd23d5d3f3ad54b0a6f472aaa)
1a53f50b9Schristos#!/bin/sh
2a53f50b9Schristos# generate long version of output from config.guess
3a53f50b9Schristos# part of am-utils-6.x
4a53f50b9Schristos# Erez Zadok <ezk@cs.columbia.edu>
5a53f50b9Schristos#
6a53f50b9Schristos#set -x
7a53f50b9Schristos
8a53f50b9Schristos# find a single word that prints the version number of the release
9a53f50b9Schristosgetver () {
10a53f50b9Schristos    l=`head $1`
11a53f50b9Schristos    set $l
12a53f50b9Schristos    for i in $*
13a53f50b9Schristos    do
14a53f50b9Schristos	case "$i" in
15a53f50b9Schristos	    # look for one digit followed by a sequence of non-spaces
16a53f50b9Schristos	    # so it'll catch 7.3 as well as 2.1AW
17a53f50b9Schristos	    *[0-9]* ) echo $i; return ;;
18a53f50b9Schristos        esac
19a53f50b9Schristos    done
20a53f50b9Schristos}
21a53f50b9Schristos
22a53f50b9Schristosif test "x$GCONFIG" = "x" ; then
23a53f50b9Schristos    # find dirname of this script
24a53f50b9Schristos    base=`echo $0 | sed 's/\/[^\/]*$//' 2>/dev/null`
25a53f50b9Schristos    PATH=$base:$PATH
26a53f50b9Schristos    export PATH
27a53f50b9Schristos    GCONFIG=`config.guess || echo unknown-config`
28a53f50b9Schristosfi
29a53f50b9Schristoscase "${GCONFIG}" in
30a53f50b9Schristos    *linux* )
31a53f50b9Schristos	GCONFIG=`echo ${GCONFIG} | sed -e 's/i.86/i386/' -e 's/linux-gnu/linux/'`
32a53f50b9Schristos	if test -f /etc/redhat-release ; then
33a53f50b9Schristos	    long=`getver /etc/redhat-release`
34a53f50b9Schristos	    if grep 'Red Hat Enterprise Linux' /etc/redhat-release > /dev/null 2>&1 ; then
35a53f50b9Schristos		echo ${GCONFIG}-rhel${long}
36*4bcd344eSchristos	    elif grep 'Fedora ' /etc/redhat-release > /dev/null 2>&1 ; then
37a53f50b9Schristos		echo ${GCONFIG}-fc${long}
38a53f50b9Schristos	    elif grep 'CentOS' /etc/redhat-release > /dev/null 2>&1 ; then
39a53f50b9Schristos		echo ${GCONFIG}-centos${long}
40a53f50b9Schristos	    else
41a53f50b9Schristos		echo ${GCONFIG}-rh${long}
42a53f50b9Schristos	    fi
43a53f50b9Schristos	    exit 0
44a53f50b9Schristos	elif test -f /etc/SuSE-release ; then
45a53f50b9Schristos	    long=`getver /etc/SuSE-release`
46a53f50b9Schristos	    if grep 'Enterprise Server' /etc/SuSE-release > /dev/null 2>&1 ; then
47a53f50b9Schristos		echo ${GCONFIG}-sles${long}
48a53f50b9Schristos	    else
49a53f50b9Schristos		echo ${GCONFIG}-suse${long}
50a53f50b9Schristos	    fi
51a53f50b9Schristos	    exit 0
52a53f50b9Schristos	elif test -f /etc/debian_version ; then
53a53f50b9Schristos	    long=`getver /etc/debian_version`
54a53f50b9Schristos	    echo ${GCONFIG}-deb${long}
55a53f50b9Schristos	    exit 0
56a53f50b9Schristos	elif test -f /etc/gentoo-release ; then
57a53f50b9Schristos	    long=`getver /etc/gentoo-release`
58a53f50b9Schristos	    echo ${GCONFIG}-gentoo${long}
59a53f50b9Schristos	    exit 0
60a53f50b9Schristos	elif test -f /etc/yellowdog-release ; then
61a53f50b9Schristos	    long=`getver /etc/yellowdog-release`
62a53f50b9Schristos	    echo ${GCONFIG}-yellowdog${long}
63a53f50b9Schristos	    exit 0
64a53f50b9Schristos	else
65a53f50b9Schristos	    echo ${GCONFIG}
66a53f50b9Schristos	fi
67a53f50b9Schristos	;;
68a53f50b9Schristos    *netbsdelf3* )		# remove trailing '.' from beta
69a53f50b9Schristos	echo ${GCONFIG} | sed 's/\.$//g'
70a53f50b9Schristos	;;
71a53f50b9Schristos
72a53f50b9Schristos    *solaris* )
73a53f50b9Schristos	if grep -i nexentaos /etc/release > /dev/null 2>&1 ; then
74a53f50b9Schristos	    echo ${GCONFIG}-nexentaos
75a53f50b9Schristos	else
76a53f50b9Schristos	    echo ${GCONFIG}
77a53f50b9Schristos	fi
78a53f50b9Schristos	;;
79a53f50b9Schristos    * )
80a53f50b9Schristos	echo ${GCONFIG}
81a53f50b9Schristos	;;
82a53f50b9Schristosesac
83a53f50b9Schristosexit 0
84