File: autoconf.cook

package info (click to toggle)
libexplain 1.4.D001-16
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 42,228 kB
  • sloc: ansic: 156,043; makefile: 47,892; sh: 16,304; yacc: 1,898; awk: 245
file content (269 lines) | stat: -rw-r--r-- 7,388 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
/*
 * libexplain - Explain errno values returned by libc functions
 * Copyright (C) 2008-2014 Peter Miller
 * Written by Peter Miller <pmiller@opensource.org.au>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */

if [not [defined autoconf]] then
    autoconf = autoconf;
if [not [autoconf]] then
    autoconf = autoconf;

if [not [defined autoheader]] then
    autoheader = autoheader;
if [not [autoheader]] then
    autoheader = autoheader;

bin/%: script/%.sh.in: config.status
    set shallow
    single-thread conftest.subs
{
    function quiet_print Generate;
    if [not [exists script]] then
        mkdir script
            set clearstat;
    /* these 2 env vars control what is generated */
    CONFIG_FILES\=[target]\:[resolve script/%.sh.in] CONFIG_HEADERS\=
        sh [resolve config.status]
        ['if' [quiet] 'then' --quiet]
        ;
    chmod 755 [target];
}

/*
 * The configured files are generated using the config.status script
 * output by the configure script.  Not all of them are essential to a
 * build, or are already taken care of, and some are not meaningful.
 */
configured_files1 =
    [match_mask script/%.sh.in [source_files]]
    ;
configured_files2 =
    [stringset
        [match_mask %0%.in [source_files]]
    -
        [configured_files1]
    ];
configured_files =
    [fromto script/%.sh.in bin/% [configured_files1]]
    [fromto %0%.in %0% [configured_files2]]
    ;
configured_files =
    [stringset
        [configured_files]
    -
        Makefile /* only for integration builds */
        libexplain/config.h
        etc/configure
    ];
configured_files: [configured_files];

configure: etc/configure.ac install-sh(exists) config.guess config.sub
{
    function quiet_print Generate;

    /*
     * unfortunately,
     * install-sh must be in the current directory
     */
    if [not [exists install-sh]] then
        ln -s [resolve install-sh] install-sh
            set clearstat;
    if [not [exists config.guess]] then
        ln -s [resolve config.guess] config.guess
            set clearstat;
    if [not [exists config.sub]] then
        ln -s [resolve config.sub] config.sub
            set clearstat;
    if [not [exists test_mincore/main.c]] then
    {
        mkdir -p test_mincore;
        rm -f test_mincore/main.c;
        ln -s ../[resolve test_mincore/main.c] test_mincore/main.c
            set clearstat;
    }
    [autoconf]
        /* ['if' [quiet] 'then' --quiet] */
        [resolve etc/configure.ac]
        > [target];
    chmod 755 [target];
}

/*
 * The install-sh script can come from a huge range of places, depending
 * on what distribution you have installed (or whether you built it from
 * the tarball).
 *
 * Setting the install-sh variable make cook print the intended error
 * message instead of a syntax error when the install-sh script does not
 * exist.
 */
install-sh = ;
loop install-sh-maybe =
    /usr/share/autoconf/install-sh
    [glob /usr/share/automake*/install-sh]
    [glob /usr/local/share/autoconf*/install-sh]
    [glob /usr/local/share/automake*/install-sh]
{
    if [exists [install-sh-maybe]] then
    {
        install-sh = [install-sh-maybe];
        loopstop;
    }
}
if [not [install-sh]] then
    fail "Can't locate the \"install-sh\" script from GNU automake";

install-sh: [install-sh]
{
    function quiet_print Copy;
    cp [need] [target];
    chmod 755 [target];
}

config.sub = ;
loop config.sub-maybe =
    /usr/share/autoconf/config.sub
    /usr/share/automake/config.sub
    [glob /usr/share/automake*/config.sub]
    [glob /usr/local/share/autoconf*/config.sub]
    [glob /usr/local/share/automake*/config.sub]
{
    if [exists [config.sub-maybe]] then
    {
        config.sub = [config.sub-maybe];
        loopstop;
    }
}
if [not [config.sub]] then
    fail "Can't locate the \"config.sub\" script from GNU autoconf";

config.sub: [config.sub]
{
    function quiet_print Copy;
    cp [need] [target];
    chmod 755 [target];
}

config.guess = ;
loop config.guess-maybe =
    /usr/share/autoconf/config.guess
    /usr/share/automake/config.guess
    [glob /usr/share/automake*/config.guess]
    [glob /usr/local/share/autoconf*/config.guess]
    [glob /usr/local/share/automake*/config.guess]
{
    if [exists [config.guess-maybe]] then
    {
        config.guess = [config.guess-maybe];
        loopstop;
    }
}
if [not [config.guess]] then
    fail "Can't locate the \"config.guess\" script from GNU autoconf";

config.guess: [config.guess]
{
    function quiet_print Copy;
    cp [need] [target];
    chmod 755 [target];
}

config.status: configure install-sh(exists) config.sub config.guess
{
    function quiet_print Generate;
    if [not [exists install-sh]] then
        ln -s [resolve install-sh] install-sh
            set clearstat;

    if [not [exists config.sub]] then
        ln -s [resolve config.sub] config.sub
            set clearstat;

    if [not [exists config.guess]] then
        ln -s [resolve config.guess] config.guess
            set clearstat;

    local flags =;
    if [defined c++_flags] then
    {
        flags += CXXFLAGS\=[quote
            [unsplit " " [filter_out "-Werror" [split "%" [c++_flags]]]]];
    }

    if [defined ld_flags] then
    {
        flags += LDFLAGS\=[quote [unsplit " " [split "%" [ld_flags]]]];
    }

    if [defined libs] then
    {
        flags += LIBS\=[quote [unsplit " " [split "%" [libs]]]];
    }

    CC\=[quote [unsplit " " [CC]]]
    [flags]
    [pathname [resolve configure]]
        --cache-file\=/dev/null
        ['if' [quiet] 'then' --quiet]
        --no-create --srcdir\=.
        --sysconfdir\=/etc
    ;
}

libexplain/config.h.in: etc/configure.ac
{
    function quiet_print Generate;
    [autoheader] [resolve etc/configure.ac] > [target];
}


%0%.h: %0%.h.in config.status
    single-thread conftest.subs
{
    function quiet_print Generate;
    if [not [exists [dirname %0%.h]]] then
        mkdir -p [dirname %0%.h]
            set clearstat;
    /* these 2 env vars control what is generated */
    CONFIG_FILES\= CONFIG_HEADERS\=[target]\:[resolve %0%.h.in]
        sh [resolve config.status]
        ['if' [quiet] 'then' --quiet]
        ;
}

%0%: %0%.in config.status
    set ['if' [not [defined baseline]] 'then' shallow]
    single-thread conftest.subs
{
    function quiet_print Generate;
    if [not [exists [dirname %0%]]] then
        mkdir [dirname %0%]
            set clearstat;
    /* these 2 env vars control what is generated */
    CONFIG_FILES\=[target]\:[resolve %0%.in] CONFIG_HEADERS\=
       sh  [resolve config.status]
        ['if' [quiet] 'then' --quiet]
       ;

    /*
     * Make shell scripts and CGI scripts executable.
     */
    if [or [matches %%.cgi %] [matches %%.sh %]] then
        chmod a+rx [target];
}

/* vim: set ts=8 sw=4 et : */