PageRenderTime 25ms CodeModel.GetById 18ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/libs/m4/shell.m4.in

#
Autoconf | 63 lines | 58 code | 5 blank | 0 comment | 1 complexity | 2a858c2c394e5146a6c9f2fd151b28dc MD5 | raw file
 1m4_dnl
 2m4_dnl Copyright (C) 2008, 2009 Francesco Salvestrini
 3m4_dnl
 4m4_dnl This program is free software; you can redistribute it and/or modify
 5m4_dnl it under the terms of the GNU General Public License as published by
 6m4_dnl the Free Software Foundation; either version 2 of the License, or
 7m4_dnl (at your option) any later version.
 8m4_dnl
 9m4_dnl This program is distributed in the hope that it will be useful,
10m4_dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11m4_dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12m4_dnl GNU General Public License for more details.
13m4_dnl
14m4_dnl You should have received a copy of the GNU General Public License along
15m4_dnl with this program; if not, write to the Free Software Foundation, Inc.,
16m4_dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17m4_dnl
18
19m4_dnl
20m4_dnl CT_EXIT(EXIT-VALUE)
21m4_dnl
22m4_define([CT_EXIT],[m4_dnl
23exit $1
24])
25
26m4_define([_CT_IF],[
27  m4_ifval([$2$3],[
28    elif $1 ; then
29      m4_default([$2], [:])
30      m4_ifval([$3], [$0(m4_shiftn(2, $@))])
31  ],[
32    m4_ifval([$1],[
33    else
34      $1
35    ])
36  ])
37])
38
39m4_define([CT_IF],[
40  m4_ifval([$2$3],[
41    if $1; then
42      m4_default([$2], [:])
43      m4_ifval([$3], [_$0(m4_shiftn(2, $@))])
44    fi
45  ])
46])
47
48m4_define([_CT_CASE],[
49  m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
50        [$#], 1, [  *) $1 ;;],
51        [$#], 2, [  $1) m4_default([$2], [:]) ;;],
52        [  $1) m4_default([$2], [:]) ;;
53  $0(m4_shiftn(2, $@))
54  ])
55])
56
57m4_define([CT_CASE],[
58  m4_ifval([$2$3],[
59    case $1 in
60    _CT_CASE(m4_shift($@))
61    esac
62  ])
63])