~ubuntu-branches/ubuntu/utopic/libexif/utopic-proposed

« back to all changes in this revision

Viewing changes to autogen.sh

  • Committer: Bazaar Package Importer
  • Author(s): Emmanuel Bouthenot
  • Date: 2009-04-19 17:53:15 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090419175315-2h14ges5fp4yqtvg
Tags: 0.6.17-1
* 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.
* New upstream release:
  - remove patches merged upsteam:
    + 30_olympus_makernote.dpatch
    + 40_crash_looking_up_invalid_values.dpatch
    + 50_relibtoolize.dpatch
    + CVE-2007-6351.dpatch
    + CVE-2007-6352.dpatch
  - convert existing patches from dpatch to quilt.
  - Fix a bug while reading exif datas in some cases (Closes: #447907)
* Switch packaging to debhelper 7
* Update debian/control:
  - Drop duplicate section field for exif12
  - Bump Standards-Version to 3.8.1
  - Replace deprecated ${Source-Version} by ${binary:Version}
  - Enhance libexif-dev long description.
  - Add homepage field.
  - Add DM-Upload-Allowed field.
* Force remove of files not fully cleaned
* Remove empty doc files in libexif-dev.
* Update debian/copyright.

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.5"
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, AUTORECONF, ACLOCAL,
65
 
AUTOPOINT, LIBTOOLIZE to use specific version of these tools, and
66
 
AUTORECONF_OPTS to add options to the call to autoreconf.
67
 
 
68
 
If none of these variables are set, ${self} tries to find the most
69
 
adequate version in \$PATH.
70
 
__HELP_EOF__
71
 
}
72
 
 
73
 
 
74
 
########################################################################
75
 
# Print software versions
76
 
 
77
 
print_versions() {
78
 
    echo "${self} (ndim's autogen) ${autogen_version}"
79
 
    for tool in \
80
 
        "${AUTOCONF-autoconf}" \
81
 
        "${AUTOMAKE-automake}" \
82
 
        "${AUTOPOINT-autopoint}" \
83
 
        "${LIBTOOLIZE-libtoolize}"
84
 
    do
85
 
        "$tool" --version 2>&1 | sed '1q'
86
 
    done
87
 
}
88
 
 
89
 
 
90
 
########################################################################
91
 
# Initialize variables for configure.{in,ac} in $1
92
 
 
93
 
init_vars() {
94
 
    dir="$1"
95
 
    echo -n "Looking for \`${dir}/configure.{ac,in}'..."
96
 
    # There are shells which don't understand {,} wildcards
97
 
    CONFIGURE_AC=""
98
 
    for tmp in "${dir}/configure.ac" "${dir}/configure.in"; do
99
 
        if test -f "$tmp"; then
100
 
            CONFIGURE_AC="$tmp"
101
 
            echo " $tmp"
102
 
            break
103
 
        fi
104
 
    done
105
 
    if test "x$CONFIGURE_AC" = "x"; then
106
 
        echo " no."
107
 
        exit 1
108
 
    fi
109
 
 
110
 
    if "$debug"; then
111
 
        if test "$(uname -o)" = "Cygwin"; then
112
 
            # Cygwin autoreconf doesn't understand -Wall
113
 
            AUTORECONF_OPTS="$AUTORECONF_OPTS --verbose"
114
 
        else
115
 
            AUTORECONF_OPTS="$AUTORECONF_OPTS --verbose -Wall"
116
 
        fi
117
 
    fi
118
 
 
119
 
    "$debug" && echo -n "Initializing variables for \`${dir}'..."
120
 
    # FIXME: Just getting those directories and cleaning them isn't enough.
121
 
    #        OK, the "init" part is done recursively by autopoint, so that is easy.
122
 
    #        But the cleaning should also work recursively, but that is difficult
123
 
    #        with the current structure of the script.
124
 
    AG_SUBDIRS="$(for k in $(sed -n 's/^[[:space:]]*GP_AUTOGEN_SUBDIR(\[\{0,1\}\([^])]*\).*/\1/p' "$CONFIGURE_AC"); do echo "${k}"; done)"
125
 
    AG_LIBLTDL_DIR="$(sed -n 's/^[[:space:]]*AC_LIBLTDL_\(INSTALLABLE\|CONVENIENCE\)(\[\{0,1\}\([^])]*\).*/\2/p' < "$CONFIGURE_AC")"
126
 
    if test "x$AG_LIBLTDL_DIR" = "x"; then
127
 
        tmp="$(sed -n 's/^[[:space:]]*\(AC_LIBLTDL_\)\(INSTALLABLE\|CONVENIENCE\)(\[\{0,1\}\([^])]*\).*/\1/p' < "$CONFIGURE_AC")"
128
 
        if test "x$tmp" = "xAC_LIBLTDL_"; then
129
 
            AG_LIBLTDL_DIR="libltdl"
130
 
        else
131
 
            AG_LIBLTDL_DIR=""
132
 
        fi
133
 
    fi
134
 
    AG_AUX="$(sed -n 's/^AC_CONFIG_AUX_DIR(\[\{0,1\}\([^])]*\).*/\1/p' < "$CONFIGURE_AC")"
135
 
    if test "x$AG_AUX" = "x"; then
136
 
        AG_AUX="."
137
 
    fi
138
 
    AG_CONFIG_H="$(sed -n 's/^\(A[CM]_CONFIG_HEADERS\?\)(\[\{0,1\}\([^]),]*\).*/\2/p' < "$CONFIGURE_AC")"
139
 
    AG_CONFIG_K="$(sed -n 's/^\(A[CM]_CONFIG_HEADERS\?\)(\[\{0,1\}\([^]),]*\).*/\1/p' < "$CONFIGURE_AC")"
140
 
    if echo "x$AG_CONFIG_H" | grep -q ':'; then
141
 
        echo "$AG_CONFIG_K contains unsupported \`:' character: \`$AG_CONFIG_H'"
142
 
        exit 13
143
 
    fi
144
 
    if test "x$AG_CONFIG_H" != "x"; then
145
 
        AG_CONFIG_DIR="$(dirname "${AG_CONFIG_H}")"
146
 
        AG_GEN_CONFIG_H="${AG_CONFIG_H} ${AG_CONFIG_H}.in ${AG_CONFIG_DIR}/stamp-h1 ${AG_CONFIG_DIR}/stamp-h2"
147
 
    else
148
 
        AG_CONFIG_DIR=""
149
 
        AG_GEN_CONFIG_H=""
150
 
    fi
151
 
    for d in "$AG_AUX" "$AG_CONFIG_DIR"; do
152
 
        if test -n "$d" && test ! -d "$d"; then
153
 
            mkdir "$d"
154
 
        fi
155
 
    done
156
 
    AG_GEN_ACAM="aclocal.m4 configure $AG_AUX/config.guess $AG_AUX/config.sub $AG_AUX/compile"
157
 
    AG_GEN_RECONF="$AG_AUX/install-sh $AG_AUX/missing $AG_AUX/depcomp"
158
 
    AG_GEN_LIBTOOL="$AG_AUX/ltmain.sh libtool"
159
 
    while read file; do
160
 
        AG_GEN_LIBTOOL="${AG_GEN_LIBTOOL} ${AG_LIBLTDL_DIR}/${file}"
161
 
    done <<EOF
162
 
aclocal.m4
163
 
config.guess
164
 
config-h.in
165
 
config.sub
166
 
configure
167
 
configure.ac
168
 
COPYING.LIB
169
 
install-sh
170
 
ltdl.c
171
 
ltdl.h
172
 
ltmain.sh
173
 
Makefile.am
174
 
Makefile.in
175
 
missing
176
 
README
177
 
EOF
178
 
    AG_GEN_GETTEXT="$AG_AUX/mkinstalldirs $AG_AUX/config.rpath ABOUT-NLS"
179
 
    while read file; do
180
 
        AG_GEN_GETTEXT="${AG_GEN_GETTEXT} m4/${file} m4m/${file}"
181
 
    done <<EOF
182
 
codeset.m4
183
 
gettext.m4
184
 
glibc21.m4
185
 
iconv.m4
186
 
intdiv0.m4
187
 
intmax.m4
188
 
inttypes-pri.m4
189
 
inttypes.m4
190
 
inttypes_h.m4
191
 
isc-posix.m4
192
 
lcmessage.m4
193
 
lib-ld.m4
194
 
lib-link.m4
195
 
lib-prefix.m4
196
 
longdouble.m4
197
 
longlong.m4
198
 
nls.m4
199
 
po.m4
200
 
printf-posix.m4
201
 
progtest.m4
202
 
signed.m4
203
 
size_max.m4
204
 
stdint_h.m4
205
 
uintmax_t.m4
206
 
ulonglong.m4
207
 
wchar_t.m4
208
 
wint_t.m4
209
 
xsize.m4
210
 
EOF
211
 
    while read file; do
212
 
        AG_GEN_GETTEXT="${AG_GEN_GETTEXT} po/${file}"
213
 
    done <<EOF
214
 
Makefile.in.in
215
 
Makevars.template
216
 
Rules-quot
217
 
boldquot.sed
218
 
en@boldquot.header
219
 
en@quot.header
220
 
insert-header.sin
221
 
quot.sed
222
 
remove-potcdate.sin
223
 
stamp-po
224
 
EOF
225
 
    AG_GEN_CONF="config.status config.log"
226
 
    AG_GEN_FILES="$AG_GEN_ACAM $AG_GEN_RECONF $AG_GEN_GETTEXT"
227
 
    AG_GEN_FILES="$AG_GEN_FILES $AG_GEN_CONFIG_H $AG_GEN_CONF $AG_GEN_LIBTOOL"
228
 
    AG_GEN_DIRS="autom4te.cache ${AG_LIBLTDL_DIR}/autom4te.cache ${AG_LIBLTDL_DIR}"
229
 
    "$debug" && echo " done."
230
 
 
231
 
    if "$debug"; then set | grep '^AG_'; fi
232
 
    dryrun_param=""
233
 
    if "$dryrun"; then dryrun_param="--dry-run"; fi
234
 
}
235
 
 
236
 
 
237
 
########################################################################
238
 
# Print command to be executed and, if not dryrun, actually execute it.
239
 
 
240
 
execute_command() {
241
 
    if "$dryrun" || "$debug"; then
242
 
        echo "Running <<" "$@" ">>"
243
 
    fi
244
 
    if "$dryrun"; then :; else
245
 
        "$@"
246
 
    fi
247
 
}
248
 
 
249
 
 
250
 
########################################################################
251
 
# Clean generated files from $* directories
252
 
 
253
 
command_clean() {
254
 
    if test "x$AG_GEN_FILES" = "x"; then echo "Internal error"; exit 2; fi
255
 
    dir="$1"
256
 
    #while test "$dir"; do
257
 
        echo "$self:clean: Entering directory \`${dir}'"
258
 
        (
259
 
            if cd "$dir"; then
260
 
                echo -n "Cleaning autogen generated files..."
261
 
                execute_command rm -rf ${AG_GEN_DIRS}
262
 
                execute_command rm -f ${AG_GEN_FILES}
263
 
                echo " done."
264
 
                if test -h INSTALL; then execute_command rm -f INSTALL; fi
265
 
                echo -n "Cleaning generated Makefile, Makefile.in files..."
266
 
                if "$debug"; then echo; fi
267
 
                find . -type f -name 'Makefile.am' -print | \
268
 
                    while read file; do
269
 
                    echo "$file" | grep -q '/{arch}' && continue
270
 
                    echo "$file" | grep -q '/\.svn'  && continue
271
 
                    echo "$file" | grep -q '/CVS'    && continue
272
 
                    base="$(dirname "$file")/$(basename "$file" .am)"
273
 
                    if "$debug"; then
274
 
                        echo -e "  Removing files created from ${file}"
275
 
                    fi
276
 
                    execute_command rm -f "${base}" "${base}.in"
277
 
                done
278
 
                if "$debug"; then :; else echo " done."; fi
279
 
                echo -n "Removing *~ backup files..."
280
 
                find . -type f -name '*~' -print | while read fname; do
281
 
                    execute_command rm -f "$fname"
282
 
                done
283
 
                echo " done."
284
 
                if test -n "${AG_SUBDIRS}"; then
285
 
                    "$0" --clean ${dryrun_param} --recursive ${AG_SUBDIRS}
286
 
                fi
287
 
            fi
288
 
        )
289
 
        echo "$self:clean: Left directory \`${dir}'"
290
 
        #shift
291
 
        #dir="$1"
292
 
    #done
293
 
}
294
 
 
295
 
 
296
 
########################################################################
297
 
# Initialize build system in $1 directory
298
 
 
299
 
command_init() {
300
 
    dir="$1"
301
 
    if test "x$AG_GEN_FILES" = "x"; then echo "Internal error"; exit 2; fi
302
 
    echo "$self:init: Entering directory \`${dir}'"
303
 
(
304
 
if cd "${dir}"; then
305
 
    if test "x$AG_LIBLTDL_DIR" != "x"; then
306
 
        # We have to run libtoolize --ltdl ourselves because
307
 
        #   - autoreconf doesn't run it at all
308
 
        execute_command "${LIBTOOLIZE-"libtoolize"}" --ltdl
309
 
        # And we have to clean up the generated files after libtoolize because
310
 
        #   - we still want symlinks for the files
311
 
        #   - but we want to (implicitly) AC_CONFIG_SUBDIR and that writes to
312
 
        #     these files.
313
 
        if test ! -d "${AG_LIBLTDL_DIR}" || test ! -f "${AG_LIBLTDL_DIR}/Makefile.am"; then
314
 
                echo "Could not create libltdl directory \`${AG_LIBLTDL_DIR}'."
315
 
                echo "Leaving \`$(pwd)' and aborting."
316
 
                exit 2
317
 
        fi
318
 
        (cd "${AG_LIBLTDL_DIR}" && execute_command rm -f aclocal.m4 config.guess config.sub configure install-sh ltmain.sh Makefile.in missing)
319
 
    fi
320
 
    if test -n "${AG_SUBDIRS}"; then
321
 
        "$0" --init ${dryrun_param} --recursive ${AG_SUBDIRS}
322
 
        status="$?"
323
 
        if test "$status" -ne 0; then exit "$status"; fi
324
 
    fi
325
 
    if "$recursive"; then :; else
326
 
        if execute_command ${AUTORECONF-"autoreconf"} --install --symlink ${AUTORECONF_OPTS}; then
327
 
            :; else
328
 
            status="$?"
329
 
            echo "autoreconf quit with exit code $status, aborting."
330
 
            exit "$status"
331
 
        fi    
332
 
        echo "You may run ./configure now in \`${dir}'."
333
 
        echo "Run as \"./configure --help\" to find out about config options."
334
 
    fi
335
 
else
336
 
    exit "$?"
337
 
fi
338
 
)
339
 
    # Just error propagation
340
 
    status="$?"
341
 
    echo "$self:init: Left directory \`${dir}'"
342
 
    if "$recursive"; then 
343
 
        :
344
 
    elif test "$status" -ne "0"; then
345
 
        exit "$status"
346
 
    fi
347
 
}
348
 
 
349
 
 
350
 
########################################################################
351
 
# Parse command line.
352
 
# This still accepts more than the help text says it does, but that
353
 
# isn't supported.
354
 
 
355
 
commands="init" # default command in case none is given
356
 
pcommands=""
357
 
check_versions=false
358
 
dirs="$(dirname "$0")"
359
 
#dirs="$(cd "$dirs" && pwd)"
360
 
pdirs=""
361
 
# Yes, unquoted $@ isn't space safe, but it works with simple shells.
362
 
for param in $@; do
363
 
    case "$param" in
364
 
        --clean)
365
 
            pcommands="$pcommands clean"
366
 
            ;;
367
 
        --init)
368
 
            pcommands="$pcommands init"
369
 
            check_versions=:
370
 
            ;;
371
 
        --verbose)
372
 
            debug=:
373
 
            ;;
374
 
        --dry-run)
375
 
            dryrun=:
376
 
            ;;
377
 
        --recursive)
378
 
            recursive=:
379
 
            ;;
380
 
        --version)
381
 
            print_versions
382
 
            exit 0
383
 
            ;;
384
 
        -h|--help)
385
 
            print_help
386
 
            exit 0
387
 
            ;;
388
 
        -*)
389
 
            echo "Unhandled $self option: $param"
390
 
            exit 1
391
 
            ;;
392
 
        *)
393
 
            pdirs="${pdirs} ${param}"
394
 
            ;;
395
 
    esac
396
 
done
397
 
if test "x$pcommands" != "x"; then
398
 
    # commands given on command line? use them!
399
 
    commands="$pcommands"
400
 
else
401
 
    check_versions=:
402
 
fi
403
 
if test "x$pdirs" != "x"; then
404
 
    # dirs given on command line? use them!
405
 
    dirs="$pdirs"
406
 
fi
407
 
 
408
 
 
409
 
########################################################################
410
 
# If not explicitly given, try to find most convenient tools in $PATH
411
 
#
412
 
# This method only works for tools made for parallel installation with
413
 
# a version suffix, i.e. autoconf and automake.
414
 
#
415
 
# libtool and gettext do not support that, so you'll still have to
416
 
# manually set the respective variables if the default does not work
417
 
# for you.
418
 
 
419
 
skip="false"
420
 
oldversion="oldversion"
421
 
while read flag variable binary version restofline; do
422
 
        case "$flag" in
423
 
        +)
424
 
                if "$skip"; then skip=false; fi
425
 
                if test -n "`eval echo \$\{$variable+"set"\}`"; then
426
 
                        skip=:
427
 
                else
428
 
                        if test -x "`which ${binary}${version}`"; then
429
 
                                export "$variable"="${binary}${version}"
430
 
                                oldversion="${version}"
431
 
                        else
432
 
                                skip=:
433
 
                        fi
434
 
                fi
435
 
                ;;
436
 
        -)
437
 
                if "$skip"; then :; else
438
 
                        export "$variable"="${binary}${oldversion}"
439
 
                fi
440
 
                ;;
441
 
        esac
442
 
done<<EOF
443
 
+ AUTOMAKE      automake        -1.9
444
 
- ACLOCAL       aclocal
445
 
+ AUTOMAKE      automake        -1.8
446
 
- ACLOCAL       aclocal
447
 
+ AUTOCONF      autoconf        2.59
448
 
- AUTOHEADER    autoheader
449
 
- AUTORECONF    autoreconf
450
 
+ AUTOCONF      autoconf        2.50
451
 
- AUTOHEADER    autoheader
452
 
- AUTORECONF    autoreconf
453
 
EOF
454
 
 
455
 
 
456
 
########################################################################
457
 
# Check that tool versions satisfy our needs
458
 
 
459
 
if "$check_versions"; then
460
 
        # check tool versions
461
 
        errors=false
462
 
        lf="
463
 
"
464
 
        while read tool minversion; do
465
 
                version="$("$tool" --version | sed 's/^.*(.*) *\(.*\)$/\1/g;1q')"
466
 
                # compare version and minversion
467
 
                first="$(echo "$version$lf$minversion" | sort -n | sed '1q')"
468
 
                if test "x$minversion" != "x$first" && test "x$version" = "x$first"; then
469
 
                        echo "Version \`$version' of \`$tool' not sufficient. At least \`$minversion' required."
470
 
                        errors=:
471
 
                fi
472
 
        done <<EOF
473
 
${ACLOCAL-"aclocal"}    1.8
474
 
${AUTOMAKE-"automake"}  1.8
475
 
${AUTOCONF-"autoconf"}  2.59
476
 
${AUTOHEADER-"autoheader"}      2.59
477
 
${AUTOPOINT-"autopoint"}        0.14.1
478
 
${LIBTOOLIZE-"libtoolize"}      1.4
479
 
EOF
480
 
        if "$errors"; then
481
 
                echo "Please update your toolset."
482
 
                echo "If you want to continue regardless of your old toolset, press ENTER."
483
 
                read
484
 
        fi
485
 
fi
486
 
 
487
 
 
488
 
########################################################################
489
 
# Actually run the commands
490
 
 
491
 
for dir in ${dirs}; do
492
 
    "$debug" && echo "Running commands on directory \`${dir}'"
493
 
    if test ! -d "$dir"; then
494
 
        echo "Could not find directory \`${dir}'"
495
 
    else
496
 
        init_vars "$dir"
497
 
        for command in ${commands}; do
498
 
            "command_$command" "$dir"
499
 
        done
500
 
    fi
501
 
done
502
 
 
503
 
exit 0
504
 
 
505
 
# Please do not remove this:
506
 
# filetype: 89b1e88e-4cf2-44f1-980d-730067367775
507
 
# I use this to find all the different instances of this file which 
508
 
# are supposed to be synchronized.