Name: fping
Version: 3.4
Release: 1
Summary: Scriptable, parallelized ping-like utility
Group: Applications/Internet
License: BSD with advertising
URL: http://www.fping.com/
Source0: %{name}-%{version}.tar.gz
Patch0: %{name}-%{version}-aix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: patch

%ifos aix5.3 || %ifos aix6.1 || %ifos aix7.1
Requires: AIX-rpm >= 5.3.0.0
%endif

%description
fping is a ping-like program which can determine the accessibility of
multiple hosts using ICMP echo requests. fping is designed for parallelized
monitoring of large numbers of systems, and is developed with ease of
use in scripting in mind.


%prep
%setup -q
export PATH=/opt/freeware/bin:$PATH
%patch0


%build
export CC="xlc"
./configure \
    --prefix=%{_prefix} \
    --mandir=%{_mandir}

%ifos aix5.3 || %ifos aix6.1 || %ifos aix7.1
# build IPV6 version
make CFLAGS="-DIPV6 -O"
mv src/fping src/fping6
make clean
%endif

# build IPV4 version
make CFLAGS="-O"


%install
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
make DESTDIR=${RPM_BUILD_ROOT} install

%ifos aix5.3 || %ifos aix6.1 || %ifos aix7.1
cp src/fping6 ${RPM_BUILD_ROOT}%{_sbindir}
chmod 4755 ${RPM_BUILD_ROOT}%{_sbindir}/fping6
%endif

/usr/bin/strip ${RPM_BUILD_ROOT}%{_sbindir}/* || :

cd ${RPM_BUILD_ROOT}
mkdir -p usr/sbin
cd usr/sbin
ln -sf ../..%{_sbindir}/* .


%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}


%files
%defattr(-,root,system,-)
%doc ChangeLog COPYING README
%attr(4755,root,system) %{_sbindir}/fping
/usr/sbin/fping
%ifos aix5.3 || %ifos aix6.1
%attr(4755,root,system) %{_sbindir}/fping6
/usr/sbin/fping6
%endif
%{_mandir}/man8/*


%changelog
* Wed Sep 05 2012 Michael Perzl <michael@perzl.org> - 3.4-1
- updated to version 3.4

* Mon Aug 20 2012 Michael Perzl <michael@perzl.org> - 3.3-1
- updated to version 3.3

* Tue May 29 2012 Michael Perzl <michael@perzl.org> - 3.2-1
- updated to version 3.2

* Fri Apr 27 2012 Michael Perzl <michael@perzl.org> - 3.1-1
- updated to version 3.1

* Wed Jan 04 2012 Michael Perzl <michael@perzl.org> - 3.0-1
- updated to version 3.0

* Tue Sep 29 2009 Michael Perzl <michael@perzl.org> - 2.4b2-1
- first version for AIX V5.1 and higher
