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