Imported Upstream version 1.3.14
[debian/gzip] / configure.ac
1 # Configure template for gzip.
2
3 # Copyright (C) 1999-2002, 2006-2007, 2009 Free Software Foundation, Inc.
4
5 # Copyright (C) 1992-1993 Jean-loup Gailly
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3, or (at your option)
10 # any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 # 02111-1307, USA.
21
22 AC_PREREQ([2.60])
23 AC_INIT([gzip],
24         m4_esyscmd([build-aux/git-version-gen .tarball-version]),
25         [bug-gzip@gnu.org])
26
27 AC_CONFIG_SRCDIR(gzip.c)
28 AC_CONFIG_AUX_DIR(build-aux)
29 AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
30 AM_INIT_AUTOMAKE([1.11 dist-xz color-tests parallel-tests])
31 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
32
33 AC_PROG_CC_STDC
34 AM_PROG_CC_C_O
35 AC_PROG_CPP
36 AC_CHECK_TOOL([NM], [nm], [nm])
37 AC_PROG_LN_S
38 AC_PROG_RANLIB
39 AC_PROG_SHELL
40
41 gl_EARLY
42 AC_SYS_LARGEFILE
43
44 gl_INIT
45
46 # cc -E produces incorrect asm files on SVR4, so postprocess it.
47 ASCPPPOST="sed '/^ *#/d; s,//.*,,; s/% /%/g; s/\\. /./g'"
48 AC_SUBST([ASCPPPOST])
49
50 AC_CACHE_CHECK([for underline in external names], [gzip_cv_underline],
51   [gzip_cv_underline=yes
52    AC_TRY_COMPILE([int foo() {return 0;}], [],
53      [$NM conftest.$OBJEXT | grep _foo >/dev/null 2>&1 ||
54         gzip_cv_underline=no])])
55 ASCPPFLAGS=
56 if test $gzip_cv_underline = no; then
57   ASCPPFLAGS='-DNO_UNDERLINE'
58 fi
59 AC_SUBST([ASCPPFLAGS])
60 AC_OBJEXT
61
62 # Try to assemble match.S.
63 # "gcc -E match.s" ignores -E, so we must use _match.S.
64 AC_CACHE_CHECK([for an assembler syntax supported by this package],
65   [gzip_cv_assembler],
66   [gzip_cv_assembler=no
67    case " $DEFS " in
68    *' NO_ASM '*) ;;
69    *)
70      if cp $srcdir/lib/match.c _match.S &&
71         eval "$CPP $CPPFLAGS $ASCPPFLAGS _match.S > _match.i" 2>/dev/null &&
72         eval "$ASCPPPOST < _match.i > match_.s" 2>/dev/null; then
73        if test ! -s match_.s || grep error < match_.s > /dev/null; then
74          :
75        elif eval "$CC $CPPFLAGS $CFLAGS -c match_.s >/dev/null 2>&1" &&
76             test -f match_.$OBJEXT; then
77          rm -f match_.$OBJEXT
78          gzip_cv_assembler=yes
79          if echo 'void foo (void) {}' > conftest.c &&
80             eval "$CC $CPPFLAGS $CFLAGS -S conftest.c >/dev/null 2>&1" &&
81             grep '\.note\.GNU-stack' conftest.s >/dev/null 2>&1 &&
82             eval "$CC $CPPFLAGS $CFLAGS -c -Wa,--noexecstack match_.s >/dev/null 2>&1" &&
83             test -f match_.$OBJEXT; then
84            gzip_cv_assembler='yes, with -Wa,--noexecstack'
85          fi
86        fi
87      fi
88      rm -f conftest* _match.i _match.S match_.s match_.$OBJEXT;;
89    esac])
90 if test "$gzip_cv_assembler" != no; then
91   AC_DEFINE(ASMV, ,
92     [Define if an assembler version of longest_match is available.])
93   AC_LIBOBJ(match)
94 fi
95 if test "$gzip_cv_assembler" = 'yes, with -Wa,--noexecstack'; then
96   ASFLAGS_config='-Wa,--noexecstack'
97 else
98   ASFLAGS_config=
99 fi
100 AC_SUBST([ASFLAGS_config])
101
102 AC_ISC_POSIX
103 AC_C_CONST
104 AC_HEADER_STDC
105 AC_CHECK_HEADERS_ONCE(fcntl.h limits.h memory.h time.h)
106 AC_CHECK_FUNCS_ONCE([chown fchmod fchown fdopendir lstat siginterrupt])
107 AC_HEADER_DIRENT
108 AC_TYPE_SIGNAL
109 AC_TYPE_SIZE_T
110 AC_TYPE_OFF_T
111
112 AC_CONFIG_FILES([Makefile doc/Makefile lib/Makefile])
113 AC_OUTPUT