diff --git a/fftw.spec b/fftw.spec index 622a700..444c954 100644 --- a/fftw.spec +++ b/fftw.spec @@ -1,6 +1,6 @@ Name: fftw Version: 3.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A Fast Fourier Transform library Group: System Environment/Libraries License: GPLv2+ @@ -8,7 +8,22 @@ URL: http://www.fftw.org Source0: http://www.fftw.org/fftw-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# OpenMP support not available on RHEL 4 +%if 0%{?rhel} == 4 +BuildRequires: gcc-g77 +%global openmp 0 +%else BuildRequires: gcc-gfortran +%global openmp 1 +%endif + +# Quad precision support only available with gcc >= 4.6 +%if 0%{?fedora} >= 15 +%global quad 1 +%else +%global quad 0 +%endif + # For check phase BuildRequires: time BuildRequires: perl @@ -39,9 +54,10 @@ Group: Development/Libraries Requires: pkgconfig Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}-libs%{?_isa} = %{version}-%{release} -Requires: %{name}-libs-openmp%{?_isa} = %{version}-%{release} Requires: %{name}-libs-threads%{?_isa} = %{version}-%{release} - +%if %{openmp} +Requires: %{name}-libs-openmp%{?_isa} = %{version}-%{release} +%endif Provides: fftw3-devel%{?_isa} = %{version}-%{release} Obsoletes: fftw3-devel%{?_isa} < 3.3 @@ -60,12 +76,14 @@ Group: Development/Libraries %description libs-threads This package contains the FFTW library compiled with threading support. +%if %{openmp} %package libs-openmp Summary: FFTW library with OpenMP support Group: Development/Libraries %description libs-openmp This package contains the FFTW library compiled with OpenMP support. +%endif %package static Summary: Static versions of the FFTW libraries @@ -81,7 +99,9 @@ the FFTW fast Fourier transform library. %package doc Summary: FFTW library manual Group: Documentation +%if 0%{?rhel} > 5 || 0%{?fedora} > 12 BuildArch: noarch +%endif %description doc This package contains the manual for the FFTW fast Fourier transform @@ -91,9 +111,18 @@ library. %setup -q %build +%if 0%{?rhel} == 4 +# System fortran compiler is g77 +export F77=g77 +%else # Configure uses g77 by default, if present on system export F77=gfortran -BASEFLAGS="--enable-shared --disable-dependency-tracking --enable-threads --enable-openmp" +%endif + +BASEFLAGS="--enable-shared --disable-dependency-tracking --enable-threads" +%if %{openmp} +BASEFLAGS="$BASEFLAGS --enable-openmp" +%endif # Precisions to build prec_name[0]=single @@ -108,7 +137,12 @@ prec_flags[2]=--enable-long-double prec_flags[3]=--enable-quad-precision # Loop over precisions -for((iprec=0;iprec<4;iprec++)); do +%if %{quad} +for((iprec=0;iprec<4;iprec++)) +%else +for((iprec=0;iprec<3;iprec++)) +%endif +do mkdir ${prec_name[iprec]}${ver_name[iver]} cd ${prec_name[iprec]}${ver_name[iver]} ln -s ../configure . @@ -121,7 +155,12 @@ done %install rm -rf %{buildroot} -for ver in single double long quad; do +%if %{quad} +for ver in single double long quad +%else +for ver in single double long +%endif +do make -C $ver install DESTDIR=%{buildroot} done rm -f %{buildroot}%{_infodir}/dir @@ -129,7 +168,12 @@ rm -f %{buildroot}%{_libdir}/*.la %check bdir=`pwd` -for ver in single double long quad; do +%if %{quad} +for ver in single double long quad +%else +for ver in single double long +%endif +do export LD_LIBRARY_PATH=$bdir/$ver/.libs:$bdir/$ver/threads/.libs make -C $ver check done @@ -139,10 +183,12 @@ rm -rf %{buildroot} %post libs -p /sbin/ldconfig %postun libs -p /sbin/ldconfig -%post libs-openmp -p /sbin/ldconfig -%postun libs-openmp -p /sbin/ldconfig %post libs-threads -p /sbin/ldconfig %postun libs-threads -p /sbin/ldconfig +%if %{openmp} +%post libs-openmp -p /sbin/ldconfig +%postun libs-openmp -p /sbin/ldconfig +%endif %post devel /sbin/install-info --section="Math" %{_infodir}/%{name}.info.gz %{_infodir}/dir 2>/dev/null || : @@ -163,21 +209,29 @@ fi %{_libdir}/libfftw3.so.* %{_libdir}/libfftw3f.so.* %{_libdir}/libfftw3l.so.* +%if %{quad} %{_libdir}/libfftw3q.so.* +%endif +%if %{openmp} %files libs-openmp %defattr(-,root,root,-) %{_libdir}/libfftw3_omp.so.* %{_libdir}/libfftw3f_omp.so.* %{_libdir}/libfftw3l_omp.so.* +%if %{quad} %{_libdir}/libfftw3q_omp.so.* +%endif +%endif %files libs-threads %defattr(-,root,root,-) %{_libdir}/libfftw3_threads.so.* %{_libdir}/libfftw3f_threads.so.* %{_libdir}/libfftw3l_threads.so.* +%if %{quad} %{_libdir}/libfftw3q_threads.so.* +%endif %files devel %defattr(-,root,root,-) @@ -196,6 +250,10 @@ fi %{_libdir}/libfftw3*.a %changelog +* Sat Jul 30 2011 Jussi Lehtola - 3.3-2 +- Conditionalize OpenMP and quadruple precision support based on capabilities + of system compiler. + * Thu Jul 28 2011 Jussi Lehtola - 3.3-1 - Update to 3.3.