~ubuntu-branches/ubuntu/oneiric/xfce4-dev-tools/oneiric

« back to all changes in this revision

Viewing changes to scripts/xdt-autogen.in.in

  • Committer: Bazaar Package Importer
  • Author(s): Yves-Alexis Perez
  • Date: 2009-09-20 21:58:40 UTC
  • mfrom: (0.2.9 upstream) (3.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090920215840-zx9q0lzfhyfebbi8
Tags: 4.7.2-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
XDT_AUTOGEN_VERSION_REVISION="@VERSION_REVISION@"
34
34
 
35
35
 
 
36
##
 
37
## a few portability tests
 
38
##
 
39
 
 
40
if test -z "$EGREP"; then
 
41
  if type egrep >/dev/null 2>&1; then
 
42
    EGREP=egrep
 
43
  else
 
44
    EGREP="grep -E"
 
45
  fi
 
46
fi
 
47
 
 
48
awk_tests="gawk mawk nawk awk"
 
49
if test -z "$AWK"; then
 
50
  for a in $awk_tests; do
 
51
    if type $a >/dev/null 2>&1; then
 
52
      AWK=$a
 
53
      break
 
54
    fi
 
55
  done
 
56
else
 
57
  if ! type $AWK >/dev/null 2>/dev/null; then
 
58
    unset AWK
 
59
  fi
 
60
fi
 
61
if test -z "$AWK"; then
 
62
  echo "xdt-autogen: The 'awk' program (one of $awk_tests) is" >&2
 
63
  echo "             required, but cannot be found." >&2
 
64
  exit 1
 
65
fi
 
66
 
 
67
##
 
68
## figures out any subdirs that should be configured as a part
 
69
## of recursive configure.
 
70
##
36
71
parse_configure_subdirs()
37
72
{
38
73
  cat "$1" | tr '\\n\\t\\\\' '   ' | sed -ne 's|.*AC_CONFIG_SUBDIRS(\[\{0,1\}\([[:alnum:]_ @/-]\{1,\}\).*|\1|p'
39
74
}
40
75
 
41
76
##
42
 
## Helper function to lookup configure.{in,ac} files recursively.
43
 
## Sets $CONFIGURE_FILES to the list of configure files found.
 
77
## Helper function to look up configure.{in,ac} files recursively.
44
78
##
45
 
lookup_configure_files()
 
79
lookup_configure_ac_files()
46
80
{
 
81
  configure_ac_file=""
 
82
 
47
83
  if test -f "$1/configure.ac"; then
48
 
    configure_file="$1/configure.ac";
 
84
    configure_ac_file="$1/configure.ac";
49
85
  elif test -f "$1/configure.in"; then
50
 
    configure_file="$1/configure.in";
 
86
    configure_ac_file="$1/configure.in";
51
87
  else
52
88
    cat >&2 <<EOF
53
89
xdt-autogen: Directory "$1" does not look like a package
57
93
    exit 1
58
94
  fi
59
95
 
60
 
  if test x"$CONFIGURE_FILES" = x""; then
61
 
    CONFIGURE_FILES="$configure_file";
62
 
  else
63
 
    CONFIGURE_FILES="$CONFIGURE_FILES $configure_file";
64
 
  fi
 
96
  test "x$configure_ac_file" != "x" && echo -n "$configure_ac_file "
65
97
 
66
 
  subdirs=`parse_configure_subdirs ${configure_file}`
 
98
  subdirs=`parse_configure_subdirs ${configure_ac_file}`
67
99
  for subdir in $subdirs; do
68
 
    lookup_configure_files "$1/$subdir";
 
100
    lookup_configure_ac_files "$1/$subdir";
69
101
  done
70
102
}
71
103
 
 
104
##
 
105
## Helper function to look up configure.{in,ac}.in files recursively.
 
106
##
72
107
lookup_configure_ac_in_files()
73
108
{
74
 
  configure_file=""
 
109
  configure_ac_in_file=""
75
110
 
76
111
  if test -f "$1/configure.ac.in"; then
77
 
    configure_file="$1/configure.ac.in";
 
112
    configure_ac_in_file="$1/configure.ac.in";
78
113
  elif test -f "$1/configure.in.in"; then
79
 
    configure_file="$1/configure.in.in";
 
114
    configure_ac_in_file="$1/configure.in.in";
80
115
  fi
81
116
 
82
 
  test "x$configure_file" != "x" && echo -n "$configure_file "
 
117
  test "x$configure_ac_in_file" != "x" && echo -n "$configure_ac_in_file "
83
118
 
84
 
  subdirs=`parse_configure_subdirs ${configure_file}`
 
119
  subdirs=`parse_configure_subdirs ${configure_ac_in_file}`
85
120
  for subdir in $subdirs; do
86
121
    lookup_configure_ac_in_files "$1/$subdir";
87
122
  done
114
149
  test $XDT_AUTOGEN_VERSION_MINOR -gt $minor && return 0
115
150
 
116
151
  micro=`echo $XDT_AUTOGEN_REQUIRED_VERSION | cut -d. -f3`
117
 
  if echo "$micro" | grep -E -q "svn|git"; then
 
152
  if echo "$micro" | $EGREP -q "svn|git"; then
118
153
    revision=`echo "$micro" | sed -e 's/[[:digit:].]\+\(.*\)/\1/'`
119
154
    micro=`echo "$micro" | sed -e 's/\([[:digit:].]\+\).*/\1/'`
120
155
  fi
151
186
      XDT_AUTOGEN_VERSION_REV_NUM=`echo "$XDT_AUTOGEN_VERSION_REVISION" | sed -e 's/svn-r\([[:digit:]]\+\)/\1/'`
152
187
      test $rev_num -le $XDT_AUTOGEN_VERSION_REV_NUM || return 1
153
188
    elif echo "$revision" | grep -q "git"; then
154
 
      echo "Error: git revision comparison not yet implemented.  Please file a bug:"
155
 
      echo "@PACKAGE_BUGREPORT@"
156
 
      exit 1
 
189
      # since git rev info is of the form "git-$SHORT_SHA1", they cannot
 
190
      # be ordered without knowing the full git history.
 
191
      echo "xdt-autogen: Git revision comparison is not reliable.  Continuing anyway." >&2
 
192
      echo "             If you experience problems, upgrade xfce4-dev-tools." >&2
157
193
    fi
158
194
  fi
159
195
 
182
218
## First we do some substitutions to generate configure.{ac,in} if necessary
183
219
##
184
220
CONFIGURE_AC_IN_FILES=`lookup_configure_ac_in_files "$MASTER_DIR"`
185
 
for conf_ac_in in $CONFIGURE_AC_IN_FILES; do
186
 
  conf_ac="`echo $conf_ac_in | sed -e 's:\.in$::'`"
 
221
for configure_ac_in_file in $CONFIGURE_AC_IN_FILES; do
 
222
  configure_ac_file="`echo $configure_ac_in_file | sed -e 's:\.in$::'`"
187
223
 
188
224
  # first generate a revision id
189
225
  if test -d .git/svn; then
194
230
  elif test -d .git; then
195
231
    revision=`git rev-parse --short HEAD`
196
232
  elif test -d .svn; then
197
 
    revision=`LC_ALL=C svn info $0 | awk '/^Revision: / {printf "%05d\n", $2}'`
 
233
    revision=`LC_ALL=C svn info $0 | $AWK '/^Revision: / {printf "%05d\n", $2}'`
198
234
  fi
199
235
 
200
236
  if test "x$revision" = "x"; then
202
238
  fi
203
239
 
204
240
  # find out what languages we support
205
 
  conf_dir=`dirname $conf_ac`
206
 
  linguas=`cd "$conf_dir/po" 2>/dev/null && ls *.po 2>/dev/null | awk 'BEGIN { FS="."; ORS=" " } { print $1 }'`
 
241
  conf_dir=`dirname $configure_ac_file`
 
242
  linguas=`cd "$conf_dir/po" 2>/dev/null && ls *.po 2>/dev/null | $AWK 'BEGIN { FS="."; ORS=" " } { print $1 }'`
207
243
 
208
244
  # and do the substitution
 
245
  tmp=`basename ${configure_ac_in_file}`
 
246
  cat >"$configure_ac_file" <<EOF
 
247
dnl
 
248
dnl This file was autogenerated from "${tmp}".
 
249
dnl Edit that file instead!
 
250
dnl
 
251
 
 
252
EOF
209
253
  sed -e "s/@REVISION@/${revision}/g" \
210
254
      -e "s/@LINGUAS@/${linguas}/g" \
211
 
      < "$conf_ac_in" > "$conf_ac"
 
255
      < "$configure_ac_in_file" >> "$configure_ac_file"
212
256
 
213
257
done
214
258
 
216
260
##
217
261
## Search for the configure.{ac,in} files
218
262
##
219
 
CONFIGURE_FILES=""
220
 
lookup_configure_files "$MASTER_DIR"
 
263
CONFIGURE_AC_FILES=`lookup_configure_ac_files "$MASTER_DIR"`
221
264
 
222
265
 
223
266
##
242
285
## cleanup autogenerated files
243
286
##
244
287
if test x"$1" = x"clean"; then
245
 
  for configure_file in $CONFIGURE_FILES; do
246
 
    directory=`dirname ${configure_file}`
 
288
  for configure_ac_file in $CONFIGURE_AC_FILES; do
 
289
    directory=`dirname ${configure_ac_file}`
247
290
    
248
291
    echo "Running ${MAKE} distclean in ${directory}..."
249
292
    (cd ${directory} ; ${MAKE} distclean) >/dev/null 2>&1
250
293
 
251
294
    echo "Cleaning generated files in ${directory}..."
252
295
 
 
296
    # determine the output files used in this package directory
 
297
    output_files=`tr '\\n\\t\\\\' '   ' < ${configure_ac_file} | sed -ne 's|.*AC_OUTPUT(\[\{0,1\}\([[:alnum:]_@/\. -]\{1,\}\).*|\1|p'`;
 
298
    for output_file in $output_files; do
 
299
      if test x`basename $output_file` = x"Makefile"; then
 
300
        rm -f "${directory}/${output_file}.in";
 
301
        rm -f "${directory}/${output_file}.in.in";
 
302
      fi
 
303
      rm -f "${directory}/${output_file}";
 
304
    done
 
305
 
253
306
    (cd ${directory} ;
254
307
     rm -f config.* configure configure.lineno aclocal.m4 ;
255
308
     rm -f compile depcomp ltmain.sh missing install-sh ;
257
310
     rm -f stamp-h1 *.spec ;
258
311
     rm -f mkinstalldirs libtool ;
259
312
     rm -rf autom4te.cache ;
260
 
     rm -f intltool-* gtk-doc.make)
261
 
 
262
 
    # determine the output files used in this package directory
263
 
    output_files=`tr '\\n\\t\\\\' '   ' < ${configure_file} | sed -ne 's|.*AC_OUTPUT(\[\{0,1\}\([[:alnum:]_@/\. -]\{1,\}\).*|\1|p'`;
264
 
    for output_file in $output_files; do
265
 
      if test x`basename $output_file` = x"Makefile"; then
266
 
        rm -f "${directory}/${output_file}.in";
267
 
        rm -f "${directory}/${output_file}.in.in";
268
 
      fi
269
 
      rm -f "${directory}/${output_file}";
270
 
    done
 
313
     rm -f intltool-* gtk-doc.make ;
 
314
     if test -f configure.ac.in -a -f configure.ac; then
 
315
       rm -f configure.ac
 
316
     elif test -f configure.in.in -a -f configure.in; then
 
317
       rm -f configure.in
 
318
     fi)
271
319
 
272
320
    # determine translations used in this package directory
273
 
#    translations=`tr '\\n\\\\' '  ' < ${configure_file} | sed -ne 's/.*XDT_I18N(\[\{0,1\}\([a-zA-Z_@ ]\{1,\}\).*/\1/p'`;
 
321
#    translations=`tr '\\n\\\\' '  ' < ${configure_ac_file} | sed -ne 's/.*XDT_I18N(\[\{0,1\}\([a-zA-Z_@ ]\{1,\}\).*/\1/p'`;
274
322
#    for translation in $translations; do
275
323
#      rm -f "${directory}/po/${translation}.gmo";
276
324
#    done
305
353
## Check for intltoolize
306
354
##
307
355
test -z "${XDT_PROG_INTLTOOLIZE}" && XDT_PROG_INTLTOOLIZE="intltoolize"
308
 
for configure_file in $CONFIGURE_FILES; do
309
 
  if grep -E "^(AC|IT)_PROG_INTLTOOL" "${configure_file}" >/dev/null 2>&1; then
 
356
for configure_ac_file in $CONFIGURE_AC_FILES; do
 
357
  if $EGREP -q "^(AC|IT)_PROG_INTLTOOL" "${configure_ac_file}"; then
310
358
    (${XDT_PROG_INTLTOOLIZE} --version) </dev/null >/dev/null 2>&1 || {
311
359
      cat >&2 <<EOF
312
360
xdt-autogen: You must have "intltool" installed on your system.
324
372
## Check for libtoolize
325
373
##
326
374
test -z "${XDT_PROG_LIBTOOLIZE}" && XDT_PROG_LIBTOOLIZE="libtoolize"
327
 
for configure_file in $CONFIGURE_FILES; do
328
 
  if grep "^AC_PROG_LIBTOOL" "${configure_file}" >/dev/null 2>&1; then
 
375
for configure_ac_file in $CONFIGURE_AC_FILES; do
 
376
  if grep -q "^AC_PROG_LIBTOOL" "${configure_ac_file}"; then
329
377
    (${XDT_PROG_LIBTOOLIZE} --version) </dev/null >/dev/null 2>&0 || {
330
378
      cat >&2 <<EOF
331
379
xdt-autogen: You must have "libtool" installed on your system.
343
391
## Check for glib-gettextize
344
392
##
345
393
test -z "${XDT_PROG_GLIB_GETTEXTIZE}" && XDT_PROG_GLIB_GETTEXTIZE="glib-gettextize"
346
 
for configure_file in $CONFIGURE_FILES; do
347
 
  directory=`dirname ${configure_file}`
 
394
for configure_ac_file in $CONFIGURE_AC_FILES; do
 
395
  directory=`dirname ${configure_ac_file}`
348
396
  if test -d "${directory}/po"; then
349
397
    (${XDT_PROG_GLIB_GETTEXTIZE} --version) </dev/null >/dev/null 2>&1 || {
350
398
      cat >&2 <<EOF
362
410
## Check for gtkdocize
363
411
##
364
412
test -z "${XDT_PROG_GTKDOCIZE}" && XDT_PROG_GTKDOCIZE="gtkdocize"
365
 
for configure_file in $CONFIGURE_FILES; do
366
 
  if grep "^GTK_DOC_CHECK" "${configure_file}" >/dev/null 2>&1; then
 
413
for configure_ac_file in $CONFIGURE_AC_FILES; do
 
414
  if grep -q "^GTK_DOC_CHECK" "${configure_ac_file}"; then
367
415
    (${XDT_PROG_GTKDOCIZE} --version) </dev/null >/dev/null 2>&1 || {
368
416
      cat >&2 <<EOF
369
417
xdt-autogen: You must have "gtk-doc" installed. You can get if from
401
449
## then autoheader-2.57, then autoheader-2.53, and finally simply autoheader.
402
450
##
403
451
test -z "${XDT_PROG_AUTOHEADER}" &&
404
 
for configure_file in $CONFIGURE_FILES; do
405
 
  if grep "^AM_CONFIG_HEADER" "${configure_file}" >/dev/null 2>&1; then
 
452
for configure_ac_file in $CONFIGURE_AC_FILES; do
 
453
  if $EGREP -q "^A(M|C)_CONFIG_HEADER" "${configure_ac_file}"; then
406
454
    for i in autoheader-2.61 autoheader-2.60 autoheader-2.59 autoheader-2.58 autoheader-2.57 autoheader-2.53 autoheader; do
407
455
      (${i} --version) </dev/null >/dev/null 2>&1 &&
408
456
      XDT_PROG_AUTOHEADER=${i} && break
463
511
##
464
512
## Do the real work(TM)
465
513
##
466
 
for configure_file in ${CONFIGURE_FILES}; do
 
514
for configure_ac_file in ${CONFIGURE_AC_FILES}; do
467
515
  # figure out the package dir path
468
 
  source_dir=`dirname ${configure_file}`
 
516
  source_dir=`dirname ${configure_ac_file}`
469
517
  echo "Preparing package directory ${source_dir}..."
470
518
 
471
519
  # set aclocal flags
490
538
    fi
491
539
  fi
492
540
 
493
 
  if grep -E "^(AC|IT)_PROG_INTLTOOL" "${configure_file}" >/dev/null 2>&1; then
 
541
  if $EGREP -q "^(AC|IT)_PROG_INTLTOOL" "${configure_ac_file}"; then
494
542
    (echo "Running ${XDT_PROG_INTLTOOLIZE} --automake --copy --force" &&
495
543
     cd "${source_dir}" &&
496
544
     ${XDT_PROG_INTLTOOLIZE} --automake --copy --force) || exit 1
518
566
    fi
519
567
  fi
520
568
 
521
 
  if grep "^AC_PROG_LIBTOOL" "${configure_file}" >/dev/null 2>&1; then
 
569
  if grep -q "^AC_PROG_LIBTOOL" "${configure_ac_file}"; then
522
570
    (echo "Running ${XDT_PROG_LIBTOOLIZE} --force --copy..." &&
523
571
     cd "${source_dir}" &&
524
572
     ${XDT_PROG_LIBTOOLIZE} --force --copy) || exit 1
525
573
  fi
526
574
 
527
 
  if grep "^GTK_DOC_CHECK" "${configure_file}" >/dev/null 2>&1; then
 
575
  if grep -q "^GTK_DOC_CHECK" "${configure_ac_file}"; then
528
576
    (echo "Running ${XDT_PROG_GTKDOCIZE} --copy..." &&
529
577
     cd ${source_dir} &&
530
578
     ${XDT_PROG_GTKDOCIZE} --copy) || exit 1
534
582
   cd ${source_dir} &&
535
583
   ${XDT_PROG_ACLOCAL} ${ACLOCAL_FLAGS}) || exit 1
536
584
 
537
 
  if grep "^AM_CONFIG_HEADER" "${configure_file}" >/dev/null 2>&1; then
 
585
  if $EGREP -q "^A(M|C)_CONFIG_HEADER" "${configure_ac_file}"; then
538
586
    (echo "Running ${XDT_PROG_AUTOHEADER}..." &&
539
587
     cd ${source_dir} &&
540
588
     ${XDT_PROG_AUTOHEADER}) || exit 1