~ubuntu-branches/ubuntu/raring/exif/raring

« back to all changes in this revision

Viewing changes to autogen.sh

  • Committer: Bazaar Package Importer
  • Author(s): Emmanuel Bouthenot
  • Date: 2008-03-31 19:39:44 UTC
  • mfrom: (4.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080331193944-xndxlofl9m7h7a83
Tags: 0.6.15-5
* Adopt the package within pkg-phototools:
  - Set the Maintainer to the group
  - Add Frederic Peters and myself as Uploaders.
  - Add Vcs-Browser and Vcs-Git fields accordingly.
* debian/control:
  - Add a Homepage field.
  - Update Standards-Version to 3.7.3
  - Fix build dep version for libexif-dev.
  - Add build dep on quilt for patches extracted from package diff.
  - Add build dep on gettext for swedish translation.
* debian/copyright:
  - convert file to utf-8.
  - Point to LGPL-2 rather than just LGPL, which now points to
    LGPL-3.
* debian/rules
  - Fix autotools timestamp issues which causes FTBFS (closes: #445609)
  - Fix lintian 'clean error' warning.
* debian/patches
  - Extract swedish translation patch from package diff (cf. bug 397370).
  - Extract patch related to default ifd from package diff (cf. bug 428255).
  - Extract patch related to manpage improvements from package diff (cf.
    bugs 320497 and 321855).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# autogen.sh - initialize and clean automake&co based build trees
 
3
#
 
4
# For more detailed info, run "autogen.sh --help" or scroll down to the
 
5
# print_help() function.
 
6
 
 
7
 
 
8
if test "$(pwd)" != "`pwd`"
 
9
then
 
10
        echo "Urgh. Dinosaur shell, eh?"
 
11
        exit 1
 
12
fi
 
13
 
 
14
 
 
15
########################################################################
 
16
# Constant and initial values
 
17
 
 
18
debug="false"
 
19
recursive="false"
 
20
dryrun="false"
 
21
self="$(basename "$0")"
 
22
autogen_version="0.4.2"
 
23
 
 
24
 
 
25
########################################################################
 
26
# Print help message
 
27
 
 
28
print_help() {
 
29
    cat<<__HELP_EOF__
 
30
${self} - initialize automake/autoconf/gettext/libtool based build system
 
31
 
 
32
Usage:
 
33
    ${self} [<command>|<flag>|...] [<directory>...]
 
34
 
 
35
Runs given command sequence on all given directories, in sequence.
 
36
If there is no command given, --init is assumed.
 
37
If there is no directory given, the location of ${self} is assumed.
 
38
 
 
39
Commands:
 
40
    --help
 
41
        Print this help text
 
42
    --version
 
43
        Print the tool versions
 
44
 
 
45
    --clean
 
46
        Clean all files and directories generated by "$self --init"
 
47
    --init
 
48
        Converts untouched CVS checkout into a build tree which
 
49
        can be processed further by running the classic
 
50
          ./configure && make && make install
 
51
 
 
52
Flags:
 
53
    --verbose
 
54
        Verbose output
 
55
    --dry-run
 
56
        Only print the commands to be run, not actually execute
 
57
        them.
 
58
    --recursive
 
59
        Used internally. Do everything which doesn't recurse on
 
60
        its own.
 
61
 
 
62
${self} depends on automake, autoconf, libtool and gettext.
 
63
 
 
64
You may want to set AUTOCONF, AUTOHEADER, AUTOMAKE, ACLOCAL,
 
65
AUTOPOINT, LIBTOOLIZE to use specific version of these tools, and
 
66
AUTORECONF_OPTS to add options to the call to autoreconf.
 
67
__HELP_EOF__
 
68
}
 
69
 
 
70
 
 
71
########################################################################
 
72
# Print software versions
 
73
 
 
74
print_versions() {
 
75
    echo "${self} (ndim's autogen) ${autogen_version}"
 
76
    for tool in \
 
77
        "${AUTOCONF-autoconf}" \
 
78
        "${AUTOMAKE-automake}" \
 
79
        "${AUTOPOINT-autopoint}" \
 
80
        "${LIBTOOLIZE-libtoolize}"
 
81
    do
 
82
        "$tool" --version 2>&1 | sed '1q'
 
83
    done
 
84
}
 
85
 
 
86
 
 
87
########################################################################
 
88
# Initialize variables for configure.{in,ac} in $1
 
89
 
 
90
init_vars() {
 
91
    dir="$1"
 
92
    echo -n "Looking for \`${dir}/configure.{ac,in}'..."
 
93
    # There are shells which don't understand {,} wildcards
 
94
    CONFIGURE_AC=""
 
95
    for tmp in "${dir}/configure.ac" "${dir}/configure.in"; do
 
96
        if test -f "$tmp"; then
 
97
            CONFIGURE_AC="$tmp"
 
98
            echo " $tmp"
 
99
            break
 
100
        fi
 
101
    done
 
102
    if test "x$CONFIGURE_AC" = "x"; then
 
103
        echo " no."
 
104
        exit 1
 
105
    fi
 
106
 
 
107
    if "$debug"; then
 
108
        if test "$(uname -o)" = "Cygwin"; then
 
109
            # Cygwin autoreconf doesn't understand -Wall
 
110
            AUTORECONF_OPTS="$AUTORECONF_OPTS --verbose"
 
111
        else
 
112
            AUTORECONF_OPTS="$AUTORECONF_OPTS --verbose -Wall"
 
113
        fi
 
114
    fi
 
115
 
 
116
    "$debug" && echo -n "Initializing variables for \`${dir}'..."
 
117
    # FIXME: Just getting those directories and cleaning them isn't enough.
 
118
    #        OK, the "init" part is done recursively by autopoint, so that is easy.
 
119
    #        But the cleaning should also work recursively, but that is difficult
 
120
    #        with the current structure of the script.
 
121
    AG_SUBDIRS="$(for k in $(sed -n 's/^[[:space:]]*AC_CONFIG_SUBDIRS(\[\{0,1\}\([^])]*\).*/\1/p' "$CONFIGURE_AC"); do echo "${k}"; done)"
 
122
    AG_LIBLTDL_DIR="$(sed -n 's/^[[:space:]]*AC_LIBLTDL_\(INSTALLABLE\|CONVENIENCE\)(\[\{0,1\}\([^])]*\).*/\2/p' < "$CONFIGURE_AC")"
 
123
    if test "x$AG_LIBLTDL_DIR" = "x"; then
 
124
        tmp="$(sed -n 's/^[[:space:]]*\(AC_LIBLTDL_\)\(INSTALLABLE\|CONVENIENCE\)(\[\{0,1\}\([^])]*\).*/\1/p' < "$CONFIGURE_AC")"
 
125
        if test "x$tmp" = "xAC_LIBLTDL_"; then
 
126
            AG_LIBLTDL_DIR="libltdl"
 
127
        else
 
128
            AG_LIBLTDL_DIR=""
 
129
        fi
 
130
    fi
 
131
    AG_AUX="$(sed -n 's/^AC_CONFIG_AUX_DIR(\[\{0,1\}\([^])]*\).*/\1/p' < "$CONFIGURE_AC")"
 
132
    if test "x$AG_AUX" = "x"; then
 
133
        AG_AUX="."
 
134
    fi
 
135
    AG_CONFIG_H="$(sed -n 's/^\(A[CM]_CONFIG_HEADERS\?\)(\[\{0,1\}\([^]),]*\).*/\2/p' < "$CONFIGURE_AC")"
 
136
    AG_CONFIG_K="$(sed -n 's/^\(A[CM]_CONFIG_HEADERS\?\)(\[\{0,1\}\([^]),]*\).*/\1/p' < "$CONFIGURE_AC")"
 
137
    if echo "x$AG_CONFIG_H" | grep -q ':'; then
 
138
        echo "$AG_CONFIG_K contains unsupported \`:' character: \`$AG_CONFIG_H'"
 
139
        exit 13
 
140
    fi
 
141
    if test "x$AG_CONFIG_H" != "x"; then
 
142
        AG_CONFIG_DIR="$(dirname "${AG_CONFIG_H}")"
 
143
        AG_GEN_CONFIG_H="${AG_CONFIG_H} ${AG_CONFIG_H}.in ${AG_CONFIG_DIR}/stamp-h1 ${AG_CONFIG_DIR}/stamp-h2"
 
144
    else
 
145
        AG_CONFIG_DIR=""
 
146
        AG_GEN_CONFIG_H=""
 
147
    fi
 
148
    for d in "$AG_AUX" "$AG_CONFIG_DIR"; do
 
149
        if test -n "$d" && test ! -d "$d"; then
 
150
            mkdir "$d"
 
151
        fi
 
152
    done
 
153
    AG_GEN_ACAM="aclocal.m4 configure $AG_AUX/config.guess $AG_AUX/config.sub $AG_AUX/compile"
 
154
    AG_GEN_RECONF="$AG_AUX/install-sh $AG_AUX/missing $AG_AUX/depcomp"
 
155
    AG_GEN_LIBTOOL="$AG_AUX/ltmain.sh libtool"
 
156
    while read file; do
 
157
        AG_GEN_LIBTOOL="${AG_GEN_LIBTOOL} ${AG_LIBLTDL_DIR}/${file}"
 
158
    done <<EOF
 
159
aclocal.m4
 
160
config.guess
 
161
config-h.in
 
162
config.sub
 
163
configure
 
164
configure.ac
 
165
COPYING.LIB
 
166
install-sh
 
167
ltdl.c
 
168
ltdl.h
 
169
ltmain.sh
 
170
Makefile.am
 
171
Makefile.in
 
172
missing
 
173
README
 
174
EOF
 
175
    AG_GEN_GETTEXT="$AG_AUX/mkinstalldirs $AG_AUX/config.rpath ABOUT-NLS"
 
176
    while read file; do
 
177
        AG_GEN_GETTEXT="${AG_GEN_GETTEXT} m4/${file} m4m/${file}"
 
178
    done <<EOF
 
179
codeset.m4
 
180
gettext.m4
 
181
glibc21.m4
 
182
iconv.m4
 
183
intdiv0.m4
 
184
intmax.m4
 
185
inttypes-pri.m4
 
186
inttypes.m4
 
187
inttypes_h.m4
 
188
isc-posix.m4
 
189
lcmessage.m4
 
190
lib-ld.m4
 
191
lib-link.m4
 
192
lib-prefix.m4
 
193
longdouble.m4
 
194
longlong.m4
 
195
nls.m4
 
196
po.m4
 
197
printf-posix.m4
 
198
progtest.m4
 
199
signed.m4
 
200
size_max.m4
 
201
stdint_h.m4
 
202
uintmax_t.m4
 
203
ulonglong.m4
 
204
wchar_t.m4
 
205
wint_t.m4
 
206
xsize.m4
 
207
EOF
 
208
    while read file; do
 
209
        AG_GEN_GETTEXT="${AG_GEN_GETTEXT} po/${file}"
 
210
    done <<EOF
 
211
Makefile.in.in
 
212
Makevars.template
 
213
Rules-quot
 
214
boldquot.sed
 
215
en@boldquot.header
 
216
en@quot.header
 
217
insert-header.sin
 
218
quot.sed
 
219
remove-potcdate.sin
 
220
stamp-po
 
221
EOF
 
222
    AG_GEN_CONF="config.status config.log"
 
223
    AG_GEN_FILES="$AG_GEN_ACAM $AG_GEN_RECONF $AG_GEN_GETTEXT"
 
224
    AG_GEN_FILES="$AG_GEN_FILES $AG_GEN_CONFIG_H $AG_GEN_CONF $AG_GEN_LIBTOOL"
 
225
    AG_GEN_DIRS="autom4te.cache ${AG_LIBLTDL_DIR}/autom4te.cache ${AG_LIBLTDL_DIR}"
 
226
    "$debug" && echo " done."
 
227
 
 
228
    if "$debug"; then set | grep '^AG_'; fi
 
229
    dryrun_param=""
 
230
    if "$dryrun"; then dryrun_param="--dry-run"; fi
 
231
}
 
232
 
 
233
 
 
234
########################################################################
 
235
# Print command to be executed and, if not dryrun, actually execute it.
 
236
 
 
237
execute_command() {
 
238
    if "$dryrun" || "$debug"; then
 
239
        echo "Running <<" "$@" ">>"
 
240
    fi
 
241
    if "$dryrun"; then :; else
 
242
        "$@"
 
243
    fi
 
244
}
 
245
 
 
246
 
 
247
########################################################################
 
248
# Clean generated files from $* directories
 
249
 
 
250
command_clean() {
 
251
    if test "x$AG_GEN_FILES" = "x"; then echo "Internal error"; exit 2; fi
 
252
    dir="$1"
 
253
    #while test "$dir"; do
 
254
        echo "$self:clean: Entering directory \`${dir}'"
 
255
        (
 
256
            if cd "$dir"; then
 
257
                echo -n "Cleaning autogen generated files..."
 
258
                execute_command rm -rf ${AG_GEN_DIRS}
 
259
                execute_command rm -f ${AG_GEN_FILES}
 
260
                echo " done."
 
261
                if test -h INSTALL; then execute_command rm -f INSTALL; fi
 
262
                echo -n "Cleaning generated Makefile, Makefile.in files..."
 
263
                if "$debug"; then echo; fi
 
264
                find . -type f -name 'Makefile.am' -print | \
 
265
                    while read file; do
 
266
                    echo "$file" | grep -q '/{arch}' && continue
 
267
                    echo "$file" | grep -q '/\.svn'  && continue
 
268
                    echo "$file" | grep -q '/CVS'    && continue
 
269
                    base="$(dirname "$file")/$(basename "$file" .am)"
 
270
                    if "$debug"; then
 
271
                        echo -e "  Removing files created from ${file}"
 
272
                    fi
 
273
                    execute_command rm -f "${base}" "${base}.in"
 
274
                done
 
275
                if "$debug"; then :; else echo " done."; fi
 
276
                echo -n "Removing *~ backup files..."
 
277
                find . -type f -name '*~' -print | while read fname; do
 
278
                    execute_command rm -f "$fname"
 
279
                done
 
280
                echo " done."
 
281
                if test -n "${AG_SUBDIRS}"; then
 
282
                    "$0" --clean ${dryrun_param} --recursive ${AG_SUBDIRS}
 
283
                fi
 
284
            fi
 
285
        )
 
286
        echo "$self:clean: Left directory \`${dir}'"
 
287
        #shift
 
288
        #dir="$1"
 
289
    #done
 
290
}
 
291
 
 
292
 
 
293
########################################################################
 
294
# Initialize build system in $1 directory
 
295
 
 
296
command_init() {
 
297
    dir="$1"
 
298
    if test "x$AG_GEN_FILES" = "x"; then echo "Internal error"; exit 2; fi
 
299
    echo "$self:init: Entering directory \`${dir}'"
 
300
(
 
301
if cd "${dir}"; then
 
302
    if test "x$AG_LIBLTDL_DIR" != "x"; then
 
303
        # We have to run libtoolize --ltdl ourselves because
 
304
        #   - autoreconf doesn't run it at all
 
305
        execute_command "${LIBTOOLIZE-"libtoolize"}" --ltdl
 
306
        # And we have to clean up the generated files after libtoolize because
 
307
        #   - we still want symlinks for the files
 
308
        #   - but we want to (implicitly) AC_CONFIG_SUBDIR and that writes to
 
309
        #     these files.
 
310
        if test ! -d "${AG_LIBLTDL_DIR}" || test ! -f "${AG_LIBLTDL_DIR}/Makefile.am"; then
 
311
                echo "Could not create libltdl directory \`${AG_LIBLTDL_DIR}'."
 
312
                echo "Leaving \`$(pwd)' and aborting."
 
313
                exit 2
 
314
        fi
 
315
        (cd "${AG_LIBLTDL_DIR}" && execute_command rm -f aclocal.m4 config.guess config.sub configure install-sh ltmain.sh Makefile.in missing)
 
316
    fi
 
317
    if test -n "${AG_SUBDIRS}"; then
 
318
        "$0" --init ${dryrun_param} --recursive ${AG_SUBDIRS}
 
319
        status="$?"
 
320
        if test "$status" -ne 0; then exit "$status"; fi
 
321
    fi
 
322
    if "$recursive"; then :; else
 
323
        if execute_command autoreconf --install --symlink ${AUTORECONF_OPTS}; then
 
324
            :; else
 
325
            status="$?"
 
326
            echo "autoreconf quit with exit code $status, aborting."
 
327
            exit "$status"
 
328
        fi    
 
329
        echo "You may run ./configure now in \`${dir}'."
 
330
        echo "Run as \"./configure --help\" to find out about config options."
 
331
    fi
 
332
else
 
333
    exit "$?"
 
334
fi
 
335
)
 
336
    # Just error propagation
 
337
    status="$?"
 
338
    echo "$self:init: Left directory \`${dir}'"
 
339
    if test "$status" -ne "0"; then
 
340
        exit "$status"
 
341
    fi
 
342
}
 
343
 
 
344
 
 
345
########################################################################
 
346
# Parse command line.
 
347
# This still accepts more than the help text says it does, but that
 
348
# isn't supported.
 
349
 
 
350
commands="init" # default command in case none is given
 
351
pcommands=""
 
352
check_versions=false
 
353
dirs="$(dirname "$0")"
 
354
#dirs="$(cd "$dirs" && pwd)"
 
355
pdirs=""
 
356
# Yes, unquoted $@ isn't space safe, but it works with simple shells.
 
357
for param in $@; do
 
358
    case "$param" in
 
359
        --clean)
 
360
            pcommands="$pcommands clean"
 
361
            ;;
 
362
        --init)
 
363
            pcommands="$pcommands init"
 
364
            check_versions=:
 
365
            ;;
 
366
        --verbose)
 
367
            debug=:
 
368
            ;;
 
369
        --dry-run)
 
370
            dryrun=:
 
371
            ;;
 
372
        --recursive)
 
373
            recursive=:
 
374
            ;;
 
375
        --version)
 
376
            print_versions
 
377
            exit 0
 
378
            ;;
 
379
        -h|--help)
 
380
            print_help
 
381
            exit 0
 
382
            ;;
 
383
        -*)
 
384
            echo "Unhandled $self option: $param"
 
385
            exit 1
 
386
            ;;
 
387
        *)
 
388
            pdirs="${pdirs} ${param}"
 
389
            ;;
 
390
    esac
 
391
done
 
392
if test "x$pcommands" != "x"; then
 
393
    # commands given on command line? use them!
 
394
    commands="$pcommands"
 
395
else
 
396
    check_versions=:
 
397
fi
 
398
if test "x$pdirs" != "x"; then
 
399
    # dirs given on command line? use them!
 
400
    dirs="$pdirs"
 
401
fi
 
402
 
 
403
if "$check_versions"; then
 
404
        # check tool versions
 
405
        errors=false
 
406
        lf="
 
407
"
 
408
        while read tool minversion; do
 
409
                version="$("$tool" --version | sed 's/^.*(.*) *\(.*\)$/\1/g;1q')"
 
410
                # compare version and minversion
 
411
                first="$(echo "$version$lf$minversion" | sort -n | sed '1q')"
 
412
                if test "x$minversion" != "x$first" && test "x$version" = "x$first"; then
 
413
                        echo "Version \`$version' of \`$tool' not sufficient. At least \`$minversion' required."
 
414
                        errors=:
 
415
                fi
 
416
        done <<EOF
 
417
${ACLOCAL-"aclocal"}    1.8
 
418
${AUTOMAKE-"automake"}  1.8
 
419
${AUTOCONF-"autoconf"}  2.59
 
420
${AUTOHEADER-"autoheader"}      2.59
 
421
${AUTOPOINT-"autopoint"}        0.14.1
 
422
${LIBTOOLIZE-"libtoolize"}      1.4
 
423
EOF
 
424
        if "$errors"; then
 
425
                echo "Please update your toolset."
 
426
                echo "If you want to continue regardless of your old toolset, press ENTER."
 
427
                read
 
428
        fi
 
429
fi
 
430
 
 
431
 
 
432
########################################################################
 
433
# Actually run the commands
 
434
 
 
435
for dir in ${dirs}; do
 
436
    "$debug" && echo "Running commands on directory \`${dir}'"
 
437
    if test ! -d "$dir"; then
 
438
        echo "Could not find directory \`${dir}'"       
 
439
    fi
 
440
    init_vars "$dir"
 
441
    for command in ${commands}; do
 
442
        "command_$command" "$dir"
 
443
    done
 
444
done
 
445
 
 
446
exit 0
 
447
 
 
448
# Please do not remove this:
 
449
# filetype: 89b1e88e-4cf2-44f1-980d-730067367775
 
450
# I use this to find all the different instances of this file which 
 
451
# are supposed to be synchronized.