~ubuntu-branches/ubuntu/wily/afnix/wily

« back to all changes in this revision

Viewing changes to .pc/support-gcc-5.x.patch/cnf/bin/afnix-vcomp

  • Committer: Package Import Robot
  • Author(s): Nobuhiro Iwamatsu
  • Date: 2015-07-11 02:00:35 UTC
  • mfrom: (10.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20150711020035-2nhpztq7s15qyc0v
Tags: 2.5.1-1
* New upstream release. (Closes: #789968)
* Update debian/control.
  - Update Standards-Version to 3.9.6.
* Add support mips64(el) and ppc64el. (Closes: #741508, #748146)
* Add patches/support-gcc-5.x.patch. (Closes: #777767)
  - Fix build with gcc-5.x.
* Add patches/Disable-NET0001.als.patch.
  - Disable test of NET0001.als.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# ----------------------------------------------------------------------------
 
3
# - afnix-vcomp                                                              -
 
4
# - afnix compiler version detection                                         -
 
5
# ----------------------------------------------------------------------------
 
6
# - This program is  free software;  you can  redistribute it and/or  modify -
 
7
# - it provided that this copyright notice is kept intact.                   -
 
8
# -                                                                          -
 
9
# - This  program  is  distributed in the hope  that it  will be useful, but -
 
10
# - without  any   warranty;  without  even   the   implied    warranty   of -
 
11
# - merchantability  or fitness for a particular purpose. In not event shall -
 
12
# - the copyright holder be  liable for  any direct, indirect, incidental or -
 
13
# - special damages arising in any way out of the use of this software.      -
 
14
# ----------------------------------------------------------------------------
 
15
# - copyright (c) 1999-2015 amaury darsch                                    -
 
16
# ----------------------------------------------------------------------------
 
17
 
 
18
# ----------------------------------------------------------------------------
 
19
# - set default variables                                                    -
 
20
# ----------------------------------------------------------------------------
 
21
 
 
22
# the program name
 
23
prgnam="$0"
 
24
# the platform name
 
25
pltnam=
 
26
# the ccname to check
 
27
ccname=
 
28
# the cc name to map
 
29
ccmake=
 
30
# result version
 
31
ccvers=
 
32
 
 
33
# ----------------------------------------------------------------------------
 
34
# - local function always make life easier                                   -
 
35
# ----------------------------------------------------------------------------
 
36
 
 
37
# print a usage message
 
38
usage () {
 
39
    echo "usage: afnix-vcomp [options]"
 
40
    echo "       -h           print this help message"
 
41
    echo "       --compiler   set the compiler name"
 
42
    exit 0
 
43
}
 
44
 
 
45
# print an error message
 
46
error () {
 
47
    echo "error: $1"
 
48
    exit 1
 
49
}
 
50
 
 
51
# get the platform and the ccname
 
52
getdef () {
 
53
    # get the platform name
 
54
    basdir=`dirname $prgnam`
 
55
    pltexe="$basdir/afnix-guess"
 
56
    pltnam=`$pltexe -n`
 
57
    # get the compiler name if not defined
 
58
    if test -z "$ccname" ; then
 
59
        qryexe="$basdir/afnix-query"
 
60
        ccname=`$qryexe --default=gcc compiler`
 
61
    fi
 
62
}
 
63
 
 
64
# get the compiler makefile
 
65
getccm () {
 
66
    # check for gcc
 
67
    if test "$ccname" = "gcc" ; then
 
68
        ccmake="gcc"
 
69
    fi
 
70
    # check for g++
 
71
    if test "$ccname" = "g++" ; then
 
72
        ccmake="gcc"
 
73
    fi
 
74
    # check for clang
 
75
    if test "$ccname" = "clang"; then
 
76
        ccmake="clg"
 
77
    fi
 
78
    # check for clang++
 
79
    if test "$ccname" = "clang++"; then
 
80
        ccmake="clg"
 
81
    fi
 
82
}
 
83
 
 
84
# get the compiler version
 
85
getccv () {
 
86
    # check for gcc
 
87
    if test "$ccname" = "gcc" ; then
 
88
        # get gcc version 
 
89
        vers=`gcc -dumpversion`
 
90
        case $vers in
 
91
        2.*) ccvers=2 ;;
 
92
        3.*) ccvers=3 ;;
 
93
        4.*) ccvers=4 ;;
 
94
        esac
 
95
    fi
 
96
    # check for g++
 
97
    if test "$ccname" = "g++" ; then
 
98
        # get gcc version 
 
99
        vers=`g++ -dumpversion`
 
100
        case $vers in
 
101
        2.*) ccvers=2 ;;
 
102
        3.*) ccvers=3 ;;
 
103
        4.*) ccvers=4 ;;
 
104
        esac
 
105
    fi
 
106
    # check for clang
 
107
    if test "$ccname" = "clang" ; then
 
108
        # get clang version 
 
109
        vers=`clang -dumpversion`
 
110
        case $vers in
 
111
        3.*) ccvers=3 ;;
 
112
        4.*) ccvers=4 ;;
 
113
        esac
 
114
    fi
 
115
    # check for clang++
 
116
    if test "$ccname" = "clang++" ; then
 
117
        # get clang version 
 
118
        vers=`clang++ -dumpversion`
 
119
        case $vers in
 
120
        3.*) ccvers=3 ;;
 
121
        4.*) ccvers=4 ;;
 
122
        esac
 
123
    fi
 
124
}
 
125
 
 
126
# ----------------------------------------------------------------------------
 
127
# - parse options - this is where we really start                            -
 
128
# ----------------------------------------------------------------------------
 
129
 
 
130
# get the default settings
 
131
getdef
 
132
 
 
133
# parse the options
 
134
preopt=
 
135
for nxtopt
 
136
do
 
137
    # assign the previous option argument
 
138
    if test -n "$preopt"; then
 
139
        eval "$preopt=\$nxtopt"
 
140
        preopt=
 
141
        continue
 
142
    fi
 
143
 
 
144
    # extract options
 
145
    case "$nxtopt" in
 
146
    -*=*) argopt=`echo "$nxtopt" | sed 's/[-_a-zA-Z0-9]*=//'`;;
 
147
       *) argopt=;;
 
148
    esac
 
149
 
 
150
    # process options now
 
151
    case "$nxtopt" in
 
152
    -h | --help)   usage ;;
 
153
 
 
154
    --compiler)    preopt=ccname;;
 
155
    --compiler=*)  ccname="$argopt";;
 
156
 
 
157
    *)             error "illegal option $nxtopt";;
 
158
    esac
 
159
done
 
160
 
 
161
# get the cc make/version
 
162
getccm
 
163
getccv
 
164
# check for final result
 
165
if test -z "$ccmake" ; then
 
166
    error "cannot find compile makefile for $ccname"
 
167
fi
 
168
if test -z "$ccvers" ; then
 
169
    error "cannot find version for compiler $ccname"
 
170
fi
 
171
 
 
172
# format result
 
173
result=${ccmake}${ccvers}
 
174
echo $result
 
175
exit 0