# Enable Emacs support
%bcond_without autoconf_enables_emacs
# Run extended test
%bcond_without autoconf_enables_optional_test

Summary:    A GNU tool for automatically configuring source code
Name:       autoconf2.7x
Version:    2.72
Release:    1%{?dist}
License:    GPLv2+ and GFDL
Source0:    https://ftp.gnu.org/gnu/autoconf/autoconf-%{version}.tar.xz
Source1:    config.site
Source2:    autoconf-init.el
URL:        https://www.gnu.org/software/autoconf/
Patch0:     autoconf27.patch
BuildArch:  noarch


# run "make check" by default
%bcond_without check

# m4 >= 1.4.6 is required, >= 1.4.14 is recommended:
BuildRequires:      perl
Requires:           perl(File::Compare)
Requires:           perl-interpreter
BuildRequires:      m4 >= 1.4.14
Requires:           m4 >= 1.4.14
%if %{with autoconf_enables_emacs}
Requires:           emacs-filesystem
BuildRequires:      emacs
%endif
# the filtering macros are currently in /etc/rpm/macros.perl:
BuildRequires:      perl-generators
BuildRequires:      perl-macros
BuildRequires:      perl(Data::Dumper)
# from f19, Text::ParseWords is not the part of 'perl' package
BuildRequires:      perl(Text::ParseWords)

# %%configure replaces config.guess/config.sub for us, which confuses autoconf
# build system and it produces empty man pages for those scripts if help2man is
# not installed
BuildRequires:      help2man
BuildRequires:      make, texinfo

%if %{with check}
%if %{with autoconf_enables_optional_test}
# For extended testsuite coverage
BuildRequires:      gcc-gfortran
%if 0%{?fedora} >= 15
BuildRequires:      erlang
%endif
%endif
%endif

# filter out bogus perl(Autom4te*) dependencies
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(Autom4te::
%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\(Autom4te::

%description
GNU's Autoconf is a tool for configuring source code and Makefiles.
Using Autoconf, programmers can create portable and configurable
packages, since the person building the package is allowed to
specify various configuration options.

You should install Autoconf if you are developing software and
would like to create shell scripts that configure your source code
packages. If you are installing Autoconf, you will also need to
install the GNU m4 package.

Note that the Autoconf package is not required for the end-user who
may be configuring software with an Autoconf-generated script;
Autoconf is only required for the generation of the scripts, not
their use.


%prep
%setup -n autoconf-%{version}
%patch0 -p1
mv doc/autoconf.info doc/autoconf27.info
mv doc/autoconf.texi doc/autoconf27.texi

%build
%configure --program-suffix=27 --with-lispdir=%{_emacs_sitelispdir}/autoconf27
make

%check
%if %{with check}
make check %{?_smp_mflags}
%endif


%install
%make_install
mkdir -p %{buildroot}/share
install -m 0644 %{SOURCE1} %{buildroot}%{_datadir}
##%%mv %{buildroot}/usr/share/autoconf %{buildroot}/usr/share/autoconf_27

%files
%license COPYING*
%{_bindir}/*
%{_infodir}/autoconf27.info*
# don't include standards.info, because it comes from binutils...
%exclude %{_infodir}/standards*
# don't include info's TOP directory
%exclude %{_infodir}/dir
%{_datadir}/emacs/site-lisp/*
%{_datadir}/autoconf27/
%{_datadir}/config.site
%{_mandir}/man1/*
%doc AUTHORS ChangeLog NEWS README THANKS TODO
