~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- autoconf -*-
2
2
# Process this file with autoconf to produce a configure script.
3
3
 
4
 
# Copyright (C) 1991, 1993-2011 Free Software Foundation, Inc.
 
4
# Copyright (C) 1991-2012 Free Software Foundation, Inc.
5
5
 
6
6
# This program is free software: you can redistribute it and/or modify
7
7
# it under the terms of the GNU General Public License as published by
32
32
AC_CONFIG_AUX_DIR([build-aux])
33
33
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
34
34
 
35
 
AM_INIT_AUTOMAKE([1.11.1 dist-xz color-tests parallel-tests])
 
35
AM_INIT_AUTOMAKE([1.11.2 no-dist-gzip dist-xz color-tests parallel-tests
 
36
                  subdir-objects])
36
37
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
37
38
 
 
39
dnl POSIXCHECK is worthwhile for maintainers, but adds several seconds
 
40
dnl (more than 10% execution time) to ./configure, with no benefit for
 
41
dnl most users.  Using it to look for bugs requires:
 
42
dnl   GNULIB_POSIXCHECK=1 autoreconf -f
 
43
dnl   ./configure
 
44
dnl   make
 
45
dnl   make -C src clean
 
46
dnl   make CFLAGS=-DGNULIB_POSIXCHECK=1
 
47
dnl FIXME: Once we figure out how to avoid false positives, we should
 
48
dnl have 'make my-distcheck' in dist-check.mk exercise this.
 
49
m4_syscmd([test "${GNULIB_POSIXCHECK+set}" = set])
 
50
m4_if(m4_sysval, [0], [], [dnl
 
51
gl_ASSERT_NO_GNULIB_POSIXCHECK])
 
52
 
38
53
AC_PROG_CC_STDC
39
54
AM_PROG_CC_C_O
40
55
AC_PROG_CPP
45
60
gl_INIT
46
61
coreutils_MACROS
47
62
 
 
63
# The test suite needs to know if we have a working perl.
 
64
# FIXME: this is suboptimal.  Ideally, we would be able to call gl_PERL
 
65
# with an ACTION-IF-NOT-FOUND argument ...
 
66
cu_have_perl=yes
 
67
case $PERL in *"/missing "*) cu_have_perl=no;; esac
 
68
AM_CONDITIONAL([HAVE_PERL], [test $cu_have_perl = yes])
 
69
 
48
70
AC_ARG_ENABLE([gcc-warnings],
49
71
  [AS_HELP_STRING([--enable-gcc-warnings],
50
 
                  [turn on lots of GCC warnings (for developers)])],
 
72
     [turn on many GCC warnings (for developers; best with GNU make)])],
51
73
  [case $enableval in
52
74
     yes|no) ;;
53
75
     *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
54
76
   esac
55
77
   gl_gcc_warnings=$enableval],
56
 
  [gl_gcc_warnings=no]
 
78
  [if test -d "$srcdir"/.git; then
 
79
     gl_gcc_warnings=yes
 
80
   else
 
81
     gl_gcc_warnings=no
 
82
   fi]
 
83
)
 
84
 
 
85
# gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
 
86
# ------------------------------------------------
 
87
# If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
 
88
# Otherwise, run RUN-IF-NOT-FOUND.
 
89
AC_DEFUN([gl_GCC_VERSION_IFELSE],
 
90
  [AC_PREPROC_IFELSE(
 
91
    [AC_LANG_PROGRAM(
 
92
      [[
 
93
#if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
 
94
/* ok */
 
95
#else
 
96
# error "your version of gcc is older than $1.$2"
 
97
#endif
 
98
      ]]),
 
99
    ], [$3], [$4])
 
100
  ]
57
101
)
58
102
 
59
103
if test "$gl_gcc_warnings" = yes; then
88
132
  nw="$nw -Wmissing-format-attribute" # copy.c
89
133
  nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
90
134
  nw="$nw -Winline"                 # system.h's readdir_ignoring_dot_and_dotdot
 
135
  nw="$nw -Wsuggest-attribute=format" # warns about copy.c and factor.c
91
136
 
92
137
  # Using -Wstrict-overflow is a pain, but the alternative is worse.
93
138
  # For an example, see the code that provoked this report:
102
147
  gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
103
148
  gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
104
149
  gl_WARN_ADD([-Wsuggest-attribute=const])
105
 
  gl_WARN_ADD([-Wsuggest-attribute=pure])
106
150
  gl_WARN_ADD([-Wsuggest-attribute=noreturn])
 
151
  gl_WARN_ADD([-Wno-format-nonliteral])
 
152
 
 
153
  # Enable this warning only with gcc-4.7 and newer.  With 4.6.2 20111027,
 
154
  # it suggests test.c's advance function may be pure, even though it
 
155
  # increments a global variable.  Oops.
 
156
  # Normally we'd write code to test for the precise failure, but that
 
157
  # requires a relatively large input to make gcc exhibit the failure.
 
158
  gl_GCC_VERSION_IFELSE([4], [7], [gl_WARN_ADD([-Wsuggest-attribute=pure])])
107
159
 
108
160
  # In spite of excluding -Wlogical-op above, it is enabled, as of
109
161
  # gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
115
167
  AC_SUBST([WARN_CFLAGS])
116
168
 
117
169
  AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
118
 
  AC_DEFINE([_FORTIFY_SOURCE], [2],
119
 
    [enable compile-time and run-time bounds-checking, and some warnings])
 
170
  AH_VERBATIM([FORTIFY_SOURCE],
 
171
  [/* Enable compile-time and run-time bounds-checking, and some warnings,
 
172
      without upsetting glibc 2.15+. */
 
173
   #if defined __OPTIMIZE__ && __OPTIMIZE__
 
174
   # define _FORTIFY_SOURCE 2
 
175
   #endif
 
176
  ])
120
177
  AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
121
178
 
122
179
  # We use a slightly smaller set of warning options for lib/.
127
184
  nw="$nw -Wunused-macros"
128
185
  nw="$nw -Wmissing-prototypes"
129
186
  nw="$nw -Wold-style-definition"
130
 
  # FIXME: remove/reenable the following two, once gnulib is adjusted.
131
 
  nw="$nw -Wsuggest-attribute=const"
132
 
  nw="$nw -Wsuggest-attribute=pure"
 
187
  # FIXME: it may be easy to remove this, since it affects only one file:
 
188
  # the snprintf call at ftoastr.c:132.
 
189
  nw="$nw -Wdouble-promotion"
133
190
  gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
134
191
  AC_SUBST([GNULIB_WARN_CFLAGS])
135
192
 
136
193
  # For gnulib-tests, the set is slightly smaller still.
137
194
  nw=
138
195
  nw="$nw -Wstrict-prototypes"
 
196
  # It's not worth being this picky about test programs.
 
197
  nw="$nw -Wsuggest-attribute=const"
 
198
  nw="$nw -Wsuggest-attribute=pure"
139
199
  gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
140
200
                         [$GNULIB_WARN_CFLAGS], [$nw])
141
201
  AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
338
398
  [AC_INCLUDES_DEFAULT
339
399
#include <signal.h>])
340
400
 
341
 
cu_LIB_CHECK
342
401
cu_GMP
343
402
 
344
403
# Build df only if there's a point to it.
358
417
fi
359
418
 
360
419
############################################################################
361
 
mk="$srcdir/src/Makefile.am"
362
 
# Extract all literal names from the definition of $(EXTRA_PROGRAMS)
363
 
# in $mk but don't expand the variable references.
364
 
# Append each literal name to $optional_bin_progs.
365
 
v=EXTRA_PROGRAMS
366
 
for gl_i in `sed -n '/^'$v' =/,/[[^\]]$/p' $mk \
367
 
    | sed 's/^  *//;/^\$.*/d;/^'$v' =/d' \
368
 
    | tr -s '\\015\\012\\\\' '   '`; do
369
 
  gl_ADD_PROG([optional_bin_progs], $gl_i)
370
 
done
371
 
 
372
 
# As above, extract literal names from the definition of $(no_install__progs)
373
 
# in $mk but don't expand the variable references.
374
 
v=no_install__progs
375
 
t=`sed -n '/^'$v' =/,/[[^\]]$/p' $mk \
376
 
    | sed 's/^  *//;/^\$.*/d;/^'$v' =/d' \
377
 
    | tr -s '\\015\\012\\\\' '   '`
378
 
# Remove any trailing space.
379
 
no_install_progs_default=`echo "$t"|sed 's/ $//'`
380
 
 
381
 
# Unfortunately, due to the way autoconf's AS_HELP_STRING works, the list
382
 
# of default-not-installed programs, "arch hostname su", must appear in two
383
 
# places: in this file below, and in $mk.  Using "$no_install_progs_default"
384
 
# below cannot work.  And we can't substitute the names into $mk because
385
 
# automake needs the literals, too.
386
 
# The compromise is to ensure that the space-separated list extracted
387
 
# above matches the literal 2nd argument below.
388
 
c="$srcdir/configure.ac"
389
 
re='^g''l_INCLUDE_EXCLUDE_PROG(.* [\[\(.*\)\]])'
390
 
t=`sed -n '/'"$re"'/{s/'"$re"'/\1/;s/,/ /gp
391
 
}' $c`
392
 
case $t in
393
 
  $no_install_progs_default) ;;
394
 
  *) AC_MSG_ERROR([[internal error: g'l_INCLUDE_EXCLUDE_PROG's 2nd arg, $t,
395
 
                   does not match the list of default-not-installed programs
396
 
                   ($no_install_progs_default) also recorded in $mk]],
397
 
                   1) ;;
398
 
esac
399
 
 
400
 
# Given the name of a variable containing a space-separated list of
401
 
# install-by-default programs and the actual list do-not-install-by-default
402
 
# programs, modify the former variable to reflect any "do-install" and
403
 
# "don't-install" requests.
404
 
# I.e., add any program name specified via --enable-install-program=..., and
405
 
# remove any program name specified via --enable-no-install-program=...
406
 
# Note how the second argument below is a literal, with "," separators.
407
 
# That is required due to the way the macro works, and since the
408
 
# corresponding ./configure option argument is comma-separated on input.
409
 
gl_INCLUDE_EXCLUDE_PROG([optional_bin_progs], [arch,hostname,su])
410
 
 
411
 
# Now that we know which programs will actually be built up, figure out
 
420
 
 
421
dnl Autogenerated by the 'gen-lists-of-programs.sh' auxiliary script.
 
422
dnl Issue proper calls to the macros gl_INCLUDE_EXCLUDE_PROG and
 
423
dnl gl_ADD_PROG (updating $optional_bin_progs), and generate the list
 
424
dnl of coreutils programs to be built only upon explicit user request,
 
425
dnl saving that list in the $no_install_progs_default shell variable.
 
426
m4_include([m4/cu-progs.m4])
 
427
 
 
428
# Now that we know which programs will actually be built, determine
412
429
# which optional helper progs should be compiled.
413
 
optional_pkglib_progs=
414
 
case " $optional_bin_progs " in
415
 
  *' stdbuf '*) gl_ADD_PROG([optional_pkglib_progs], [libstdbuf.so]) ;;
416
 
esac
417
 
 
418
 
# Set INSTALL_SU if su installation has been requested via
419
 
# --enable-install-program=su.
420
 
AC_SUBST([INSTALL_SU])
421
 
case " $optional_bin_progs " in
422
 
  *' su '*) INSTALL_SU=yes ;;
423
 
  *)        INSTALL_SU=no ;;
424
 
esac
425
 
 
426
 
MAN=`echo "$optional_bin_progs "|sed 's/ /.1 /g;s/ $//'|tr -d '\\015\\012'`
427
 
 
428
 
# Change "ginstall.1" to "install.1" in $MAN.
429
 
MAN=`for m in $MAN; do test $m = ginstall.1 && m=install.1; echo $m; done \
430
 
  | tr '\015\012' '  '; echo`
431
 
 
432
 
# Remove [.1, since writing a portable rule for it in man/Makefile.am
433
 
# is not practical.  The sed LHS below uses the autoconf quadrigraph
434
 
# representing '['.
435
 
MAN=`echo "$MAN"|sed 's/\@<:@\.1//'`
436
 
 
437
 
OPTIONAL_BIN_PROGS=`echo "$optional_bin_progs "|sed 's/ /\$(EXEEXT) /g;s/ $//'`
438
 
AC_SUBST([OPTIONAL_BIN_PROGS])
439
 
OPTIONAL_PKGLIB_PROGS=`echo "$optional_pkglib_progs " | sed 's/ $//'`
440
 
AC_SUBST([OPTIONAL_PKGLIB_PROGS])
441
 
NO_INSTALL_PROGS_DEFAULT=$no_install_progs_default
442
 
AC_SUBST([NO_INSTALL_PROGS_DEFAULT])
 
430
case " $optional_bin_progs " in
 
431
  *' stdbuf '*) pkglibexec_PROGRAMS='src/libstdbuf.so';;
 
432
  *) pkglibexec_PROGRAMS='';;
 
433
esac
 
434
 
 
435
man1_MANS=`
 
436
  for p in $optional_bin_progs; do
 
437
    # Change "ginstall.1" to "install.1".
 
438
    test $p = ginstall && p=install
 
439
    # Ignore the "[" program, since writing a portable make rule to
 
440
    # generate its manpage is not practical.
 
441
    dnl Use the autoconf-provided quadrigraph to represent "[",
 
442
    dnl otherwise we will incur in dreadful quoting issues.
 
443
    test x$p = x'@<:@' && continue
 
444
    echo "man/$p.1"
 
445
  done`
 
446
 
 
447
# Not installed by "make install", but must be built when creating
 
448
# a distribution tarball.
 
449
EXTRA_MANS=`for p in $no_install_progs_default; do echo man/$p.1; done`
 
450
 
 
451
# The programs built and installed by "make && make install".
 
452
# Since this is AC_SUBST'd, Automake won't be able to perform rewrite
 
453
# with $(EXEEXT) appending on it, so we have to do it ourselves -- in
 
454
# this case, only for $(bin_PROGRAMS).
 
455
bin_PROGRAMS=`
 
456
  for p in $optional_bin_progs; do echo src/"$p"'$(EXEEXT)'; done`
 
457
 
 
458
# Normalize whitespace.
 
459
man1_MANS=`echo $man1_MANS`
 
460
EXTRA_MANS=`echo $EXTRA_MANS`
 
461
bin_PROGRAMS=`echo $bin_PROGRAMS`
 
462
pkglibexec_PROGS=`echo $pkglibexec_PROGRAMS`
 
463
 
 
464
AC_SUBST([bin_PROGRAMS])        AM_SUBST_NOTMAKE([bin_PROGRAMS])
 
465
AC_SUBST([pkglibexec_PROGRAMS]) AM_SUBST_NOTMAKE([pkglibexec_PROGRAMS])
 
466
AC_SUBST([man1_MANS])           AM_SUBST_NOTMAKE([man1_MANS])
 
467
AC_SUBST([EXTRA_MANS])          AM_SUBST_NOTMAKE([EXTRA_MANS])
 
468
 
 
469
AC_SUBST([built_programs], [$optional_bin_progs])
443
470
 
444
471
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
445
472
 
446
 
# Arrange to rerun configure whenever the file, src/Makefile.am,
447
 
# containing the list of program names changes.
448
 
CONFIG_STATUS_DEPENDENCIES='$(top_srcdir)/src/Makefile.am'
449
 
AC_SUBST([CONFIG_STATUS_DEPENDENCIES])
450
473
############################################################################
451
474
 
452
475
# As long as "grep 'PRI[diouxX]' po/*.pot" reports matches in
459
482
 
460
483
AC_CONFIG_FILES(
461
484
  Makefile
462
 
  doc/Makefile
463
 
  lib/Makefile
464
 
  man/Makefile
465
485
  po/Makefile.in
466
 
  src/Makefile
467
 
  tests/Makefile
468
486
  gnulib-tests/Makefile
469
487
  )
470
488
AC_OUTPUT