diff mbox

[2/2] package/fftw: Enable multiple precision installation

Message ID 1471588192-2273-1-git-send-email-flatmax@flatmax.org
State Changes Requested
Headers show

Commit Message

Matt Flax Aug. 19, 2016, 6:29 a.m. UTC
This commit enables fftw to be installed for multiple precisions on the
same system. For example if one package requires single precision and another
package requires double precision, then both fftw and fftwf can now be
slected and installed at the same time. Before this commit that wasn't
possible.

The fftw site (http://www.fftw.org/fftw2_doc/fftw_6.html) states that to
install multiple precisions the procedure is a full clean and rebuild for
each desired precision. This patch achieves that by doing complete
builds (as required) for each of the required precisions.

Signed-off-by: Matt Flax <flatmax@flatmax.org>
---
 package/fftw/Config.in            | 61 ++++-----------------------------------
 package/fftw/fftw.mk              |  6 +---
 package/fftw/fftw/Config.in       | 19 ++++++++++++
 package/fftw/{ => fftw}/fftw.hash |  0
 package/fftw/fftw/fftw.mk         |  9 ++++++
 package/fftw/fftwf/Config.in      | 22 ++++++++++++++
 package/fftw/fftwf/fftwf.hash     |  2 ++
 package/fftw/fftwf/fftwf.mk       | 23 +++++++++++++++
 package/fftw/fftwl/Config.in      | 22 ++++++++++++++
 package/fftw/fftwl/fftwl.hash     |  2 ++
 package/fftw/fftwl/fftwl.mk       | 23 +++++++++++++++
 package/fftw/fftwq/Config.in      | 21 ++++++++++++++
 package/fftw/fftwq/fftwq.hash     |  2 ++
 package/fftw/fftwq/fftwq.mk       | 23 +++++++++++++++
 14 files changed, 174 insertions(+), 61 deletions(-)
 create mode 100644 package/fftw/fftw/Config.in
 rename package/fftw/{ => fftw}/fftw.hash (100%)
 create mode 100644 package/fftw/fftw/fftw.mk
 create mode 100644 package/fftw/fftwf/Config.in
 create mode 100644 package/fftw/fftwf/fftwf.hash
 create mode 100644 package/fftw/fftwf/fftwf.mk
 create mode 100644 package/fftw/fftwl/Config.in
 create mode 100644 package/fftw/fftwl/fftwl.hash
 create mode 100644 package/fftw/fftwl/fftwl.mk
 create mode 100644 package/fftw/fftwq/Config.in
 create mode 100644 package/fftw/fftwq/fftwq.hash
 create mode 100644 package/fftw/fftwq/fftwq.mk

Comments

Thomas Petazzoni Aug. 19, 2016, 2:20 p.m. UTC | #1
Hello,

On Fri, 19 Aug 2016 16:29:52 +1000, Matt Flax wrote:
> This commit enables fftw to be installed for multiple precisions on the
> same system. For example if one package requires single precision and another
> package requires double precision, then both fftw and fftwf can now be
> slected and installed at the same time. Before this commit that wasn't
> possible.
> 
> The fftw site (http://www.fftw.org/fftw2_doc/fftw_6.html) states that to
> install multiple precisions the procedure is a full clean and rebuild for
> each desired precision. This patch achieves that by doing complete
> builds (as required) for each of the required precisions.
> 
> Signed-off-by: Matt Flax <flatmax@flatmax.org>

Thanks for this patch. However, I read on the fftw web site that
--enable-type-prefix should be used to have a library file and header
file with different name depending on the precision being used.

I don't see where you are passing this option, so from the look of it,
your four packages would install over each other. Or is
--enable-type-prefix the default ?

Another concern is that one --enable-type-prefix is used, then all
packages that use fftw will have to use the right library name and
header name depending on the precision they want to use. Are they all
ready for that?

Could you check the different Buildroot packages in the tree that use
FFTW, and see how they behave, and whether they need to be changed to
accommodate your patch?

There's at least alsa-lib, gnuradio, httping, imagemagick, libvips,
liquid-dsp and pulseaudio to look at.

> diff --git a/package/fftw/fftw/Config.in b/package/fftw/fftw/Config.in
> new file mode 100644
> index 0000000..51bd5eb
> --- /dev/null
> +++ b/package/fftw/fftw/Config.in
> @@ -0,0 +1,19 @@
> +config BR2_PACKAGE_FFTW
> +	bool "fftw"
> +	help
> +	  Library for computing Fast Fourier Transforms in double precision.
> +
> +	  This library computes Fast Fourier Transforms (FFT) in one
> +	  or more dimensions. It is extremely fast. This package
> +	  contains the shared library version of the fftw libraries in
> +	  double precision.
> +
> +	  http://www.fftw.org
> +
> +config BR2_PACKAGE_FFTW_PRECISION_DOUBLE
> +	bool "double"
> +	select BR2_PACKAGE_FFTW_USE_SSE2 if BR2_X86_CPU_HAS_SSE2
> +	help
> +	  Compile fftw in double precision (the default), i.e. use 'double'
> +	  for floating point type.

You have those two symbols for each package, why so? They don't have
any dependency between each other, which means that
BR2_PACKAGE_FFTW_PRECISION_DOUBLE can be enabled without
BR2_PACKAGE_FFTW, so BR2_PACKAGE_FFTW_PRECISION_DOUBLE can be enabled,
but the fftw package will not be built.

We should have a single option for each package.

> diff --git a/package/fftw/fftw.hash b/package/fftw/fftw/fftw.hash
> similarity index 100%
> rename from package/fftw/fftw.hash
> rename to package/fftw/fftw/fftw.hash
> diff --git a/package/fftw/fftw/fftw.mk b/package/fftw/fftw/fftw.mk
> new file mode 100644
> index 0000000..66a82ec
> --- /dev/null
> +++ b/package/fftw/fftw/fftw.mk
> @@ -0,0 +1,9 @@
> +################################################################################
> +#
> +# fftw
> +#
> +################################################################################

I'd prefer to have this package be similar to the other ones, so
package/fftw/fftw.mk be renamed to package/fftw/fftw-common.mk, and
then here a package that looks like the other fftw* packages.

> +$(eval $(autotools-package))
> +
> +

Useless empty lines.

> diff --git a/package/fftw/fftwf/Config.in b/package/fftw/fftwf/Config.in
> new file mode 100644
> index 0000000..7077086
> --- /dev/null
> +++ b/package/fftw/fftwf/Config.in
> @@ -0,0 +1,22 @@
> +config BR2_PACKAGE_FFTWF
> +	bool "fftwf"
> +	select BR2_PACKAGE_FFTW_PRECISION_SINGLE

Ah, here we have this select. But do we really need two options?

> diff --git a/package/fftw/fftwf/fftwf.hash b/package/fftw/fftwf/fftwf.hash
> new file mode 100644
> index 0000000..62b8f0f
> --- /dev/null
> +++ b/package/fftw/fftwf/fftwf.hash
> @@ -0,0 +1,2 @@
> +# From http://www.fftw.org/fftw-3.3.4.tar.gz.md5sum
> +md5	2edab8c06b24feeb3b82bbb3ebf3e7b3	fftw-3.3.4.tar.gz

For the hash file, you can use a symlink, like we're doing in
package/gcc/gcc-{initial,final}.

I must say I'm not really thrilled by the duplication of code for those
four packages, but I unfortunately don't have a better idea to propose.
Let's add Arnout in Cc, he sometimes have some very creative ideas :-)

Thanks!

Thomas
Matt Flax Aug. 20, 2016, 3:36 a.m. UTC | #2
On 20/08/16 00:20, Thomas Petazzoni wrote:
> Hello,
>
> On Fri, 19 Aug 2016 16:29:52 +1000, Matt Flax wrote:
>> This commit enables fftw to be installed for multiple precisions on the
>> same system. For example if one package requires single precision and another
>> package requires double precision, then both fftw and fftwf can now be
>> slected and installed at the same time. Before this commit that wasn't
>> possible.
>>
>> The fftw site (http://www.fftw.org/fftw2_doc/fftw_6.html) states that to
>> install multiple precisions the procedure is a full clean and rebuild for
>> each desired precision. This patch achieves that by doing complete
>> builds (as required) for each of the required precisions.
>>
>> Signed-off-by: Matt Flax <flatmax@flatmax.org>
> Thanks for this patch. However, I read on the fftw web site that
> --enable-type-prefix should be used to have a library file and header
> file with different name depending on the precision being used.
>
> I don't see where you are passing this option, so from the look of it,
> your four packages would install over each other. Or is
> --enable-type-prefix the default ?
There are now 4 mk files. Each builds in a separate directory (fftw, 
fftwf, fftwl, fftwq) and installs as per the recommendations from fftw. 
All fftw packages  inherit the version, source, site, license, env, 
conf_opts, cflags from fftw.mk. By inheriting from one single set of 
macros, we can bump versions very easily.
The different precisions are added like so :
fftwf.mk : FFTWF_CONF_OPTS += --enable-single
fftwl.mk : FFTL_CONF_OPTS += --enable-long-double
fftwq.mk : FFTQ_CONF_OPTS += --enable-quad-precision

Regarding dev files, the header files are all the same - in fact from 
the fftw site, http://www.fftw.org/fftw2_doc/fftw_6.html#SEC69 it is 
recommended that they all install ontop of each other :
./configure; make; make install; make clean
./configure --ebale-single; make; make install; make clean
and so on ...

> Another concern is that one --enable-type-prefix is used, then all
> packages that use fftw will have to use the right library name and
> header name depending on the precision they want to use. Are they all
> ready for that?
>
> Could you check the different Buildroot packages in the tree that use
> FFTW, and see how they behave, and whether they need to be changed to
> accommodate your patch?
>
> There's at least alsa-lib, gnuradio, httping, imagemagick, libvips,
> liquid-dsp and pulseaudio to look at.

Actually "type-prefixes" aren't used and no changes are made to the 
names.  Double precision remains libfftw3.so.3, single precision remains 
libfftw3f.so.3 .... and so on. There is one header file used by all and 
it is constant.

Literally, this patch simply allows side by side installation, as it is 
intended to be.

thanks
Matt


>> diff --git a/package/fftw/fftw/Config.in b/package/fftw/fftw/Config.in
>> new file mode 100644
>> index 0000000..51bd5eb
>> --- /dev/null
>> +++ b/package/fftw/fftw/Config.in
>> @@ -0,0 +1,19 @@
>> +config BR2_PACKAGE_FFTW
>> +	bool "fftw"
>> +	help
>> +	  Library for computing Fast Fourier Transforms in double precision.
>> +
>> +	  This library computes Fast Fourier Transforms (FFT) in one
>> +	  or more dimensions. It is extremely fast. This package
>> +	  contains the shared library version of the fftw libraries in
>> +	  double precision.
>> +
>> +	  http://www.fftw.org
>> +
>> +config BR2_PACKAGE_FFTW_PRECISION_DOUBLE
>> +	bool "double"
>> +	select BR2_PACKAGE_FFTW_USE_SSE2 if BR2_X86_CPU_HAS_SSE2
>> +	help
>> +	  Compile fftw in double precision (the default), i.e. use 'double'
>> +	  for floating point type.
> You have those two symbols for each package, why so? They don't have
> any dependency between each other, which means that
> BR2_PACKAGE_FFTW_PRECISION_DOUBLE can be enabled without
> BR2_PACKAGE_FFTW, so BR2_PACKAGE_FFTW_PRECISION_DOUBLE can be enabled,
> but the fftw package will not be built.
>
> We should have a single option for each package.

Yep - I will have to fix this and resubmit a patch.

>
>> diff --git a/package/fftw/fftw.hash b/package/fftw/fftw/fftw.hash
>> similarity index 100%
>> rename from package/fftw/fftw.hash
>> rename to package/fftw/fftw/fftw.hash
>> diff --git a/package/fftw/fftw/fftw.mk b/package/fftw/fftw/fftw.mk
>> new file mode 100644
>> index 0000000..66a82ec
>> --- /dev/null
>> +++ b/package/fftw/fftw/fftw.mk
>> @@ -0,0 +1,9 @@
>> +################################################################################
>> +#
>> +# fftw
>> +#
>> +################################################################################
> I'd prefer to have this package be similar to the other ones, so
> package/fftw/fftw.mk be renamed to package/fftw/fftw-common.mk, and
> then here a package that looks like the other fftw* packages.
OK. However what is the best way to do this ? I notice ibr and matchbox 
have common directories ... so should we clutter the package directory 
with 5 fftw related directories ?
>
>> +$(eval $(autotools-package))
>> +
>> +
> Useless empty lines.
>
>> diff --git a/package/fftw/fftwf/Config.in b/package/fftw/fftwf/Config.in
>> new file mode 100644
>> index 0000000..7077086
>> --- /dev/null
>> +++ b/package/fftw/fftwf/Config.in
>> @@ -0,0 +1,22 @@
>> +config BR2_PACKAGE_FFTWF
>> +	bool "fftwf"
>> +	select BR2_PACKAGE_FFTW_PRECISION_SINGLE
> Ah, here we have this select. But do we really need two options?
Yep - I don't understand what you mean here though ?
>
>> diff --git a/package/fftw/fftwf/fftwf.hash b/package/fftw/fftwf/fftwf.hash
>> new file mode 100644
>> index 0000000..62b8f0f
>> --- /dev/null
>> +++ b/package/fftw/fftwf/fftwf.hash
>> @@ -0,0 +1,2 @@
>> +# From http://www.fftw.org/fftw-3.3.4.tar.gz.md5sum
>> +md5	2edab8c06b24feeb3b82bbb3ebf3e7b3	fftw-3.3.4.tar.gz
> For the hash file, you can use a symlink, like we're doing in
> package/gcc/gcc-{initial,final}.
OK
>
> I must say I'm not really thrilled by the duplication of code for those
> four packages, but I unfortunately don't have a better idea to propose.
> Let's add Arnout in Cc, he sometimes have some very creative ideas :-)
>
> Thanks!
>
> Thomas
I agree, I wasn't thrilled about having different build code replication 
in output/build, however I think that is the trade-off for simplicity !

Matt
Thomas Petazzoni Aug. 20, 2016, 2:18 p.m. UTC | #3
Hello,

On Sat, 20 Aug 2016 13:36:41 +1000, Matt Flax wrote:

> > I don't see where you are passing this option, so from the look of it,
> > your four packages would install over each other. Or is
> > --enable-type-prefix the default ?  
> There are now 4 mk files. Each builds in a separate directory (fftw, 
> fftwf, fftwl, fftwq) and installs as per the recommendations from fftw. 
> All fftw packages  inherit the version, source, site, license, env, 
> conf_opts, cflags from fftw.mk. By inheriting from one single set of 
> macros, we can bump versions very easily.
> The different precisions are added like so :
> fftwf.mk : FFTWF_CONF_OPTS += --enable-single
> fftwl.mk : FFTL_CONF_OPTS += --enable-long-double
> fftwq.mk : FFTQ_CONF_OPTS += --enable-quad-precision

I'm not talking about the Buildroot code, but what each fftw package
will be installing. My understanding is that if you don't pass
--enable-type-prefix, each fftw package will install exactly the same
files, overwriting the ones written by the other fftw packages, making
the all adventure useless.

> Regarding dev files, the header files are all the same - in fact from 
> the fftw site, http://www.fftw.org/fftw2_doc/fftw_6.html#SEC69 it is 
> recommended that they all install ontop of each other :
> ./configure; make; make install; make clean
> ./configure --ebale-single; make; make install; make clean
> and so on ...

Read again this very same section, they tell you to do:

./configure --enable-type-prefix [ other options ]
make
make install
make clean
./configure --enable-float --enable-type-prefix [ other options ]
make
make install

See that they are using the --enable-type-prefix option I'm referring
to?

> > Another concern is that one --enable-type-prefix is used, then all
> > packages that use fftw will have to use the right library name and
> > header name depending on the precision they want to use. Are they all
> > ready for that?
> >
> > Could you check the different Buildroot packages in the tree that use
> > FFTW, and see how they behave, and whether they need to be changed to
> > accommodate your patch?
> >
> > There's at least alsa-lib, gnuradio, httping, imagemagick, libvips,
> > liquid-dsp and pulseaudio to look at.  
> 
> Actually "type-prefixes" aren't used and no changes are made to the 
> names.  Double precision remains libfftw3.so.3, single precision remains 
> libfftw3f.so.3 .... and so on. There is one header file used by all and 
> it is constant.

See above.

> Literally, this patch simply allows side by side installation, as it is 
> intended to be.

I don't see how side by side installation is possible if all four
variants of the library install to the same libfftw3.so.3 file. Could
you expand a bit on this?

Thanks!

Thomas
Matt Flax Aug. 21, 2016, 1:06 a.m. UTC | #4
On 21/08/16 00:18, Thomas Petazzoni wrote:
> Hello,
>
> On Sat, 20 Aug 2016 13:36:41 +1000, Matt Flax wrote:
>
>>> I don't see where you are passing this option, so from the look of it,
>>> your four packages would install over each other. Or is
>>> --enable-type-prefix the default ?
>> There are now 4 mk files. Each builds in a separate directory (fftw,
>> fftwf, fftwl, fftwq) and installs as per the recommendations from fftw.
>> All fftw packages  inherit the version, source, site, license, env,
>> conf_opts, cflags from fftw.mk. By inheriting from one single set of
>> macros, we can bump versions very easily.
>> The different precisions are added like so :
>> fftwf.mk : FFTWF_CONF_OPTS += --enable-single
>> fftwl.mk : FFTL_CONF_OPTS += --enable-long-double
>> fftwq.mk : FFTQ_CONF_OPTS += --enable-quad-precision
> I'm not talking about the Buildroot code, but what each fftw package
> will be installing. My understanding is that if you don't pass
> --enable-type-prefix, each fftw package will install exactly the same
> files, overwriting the ones written by the other fftw packages, making
> the all adventure useless.
>
>> Regarding dev files, the header files are all the same - in fact from
>> the fftw site, http://www.fftw.org/fftw2_doc/fftw_6.html#SEC69 it is
>> recommended that they all install ontop of each other :
>> ./configure; make; make install; make clean
>> ./configure --ebale-single; make; make install; make clean
>> and so on ...
> Read again this very same section, they tell you to do:
>
> ./configure --enable-type-prefix [ other options ]
> make
> make install
> make clean
> ./configure --enable-float --enable-type-prefix [ other options ]
> make
> make install
>
> See that they are using the --enable-type-prefix option I'm referring
> to?
>

Type prefix was removed in version 3 of fftw. Here for example is an 
attempt to configure with type-prefix enabled :
configure: WARNING: unrecognized options: --enable-type-prefix

type-prefix is not a problem, as it isn't used any more ... I Think the 
fftw website is a little out of date ... the point however I was trying 
to show is that they recommend installing everything on the same system 
by building and rebuilding ...

In my opinion, the bottom line is that the package fftw in buildroot is 
inadequate. For example when alsa bat selects fftw, it is implicitly 
selecting the double version of fftw because it is the first choice, 
this isn't very robust. But this is not a huge problem ... however there 
are bigger issues...

There are situations when some packages want double precision, some 
packages want single precision ... and so on ... for example, gnuradio 
has had to force no installation of SINGLE precision :
package/gnuradio/Config.in:    depends on !BR2_PACKAGE_FFTW_PRECISION_SINGLE
I asssume this is because they have to choose between double or single 
precision, merely because the current status of the buildroot package 
fftw is inadequately cobbled together.

You see, the problem arises if someone needs to link against libfftwf 
... the single version and also is using other programs which require 
the double precision version.

Fftw the package is designed to be installed on the same system with all 
precisions that are required.

My proposal is to fix this inherent problem. I will submit a new patch 
which includes all of the feedback I have been given ... such as using a 
common mk file and symbolic linking against the one hash file.
I will address the packages in the buildroot repo which depend/select fftw.

Do you think this is a good approach or is there a better way to go 
about this ?

> Another concern is that one --enable-type-prefix is used, then all
> packages that use fftw will have to use the right library name and
> header name depending on the precision they want to use. Are they all
> ready for that?
>
> Could you check the different Buildroot packages in the tree that use
> FFTW, and see how they behave, and whether they need to be changed to
> accommodate your patch?
>
> There's at least alsa-lib, gnuradio, httping, imagemagick, libvips,
> liquid-dsp and pulseaudio to look at.
>> Actually "type-prefixes" aren't used and no changes are made to the
>> names.  Double precision remains libfftw3.so.3, single precision remains
>> libfftw3f.so.3 .... and so on. There is one header file used by all and
>> it is constant.
> See above.
>
>> Literally, this patch simply allows side by side installation, as it is
>> intended to be.
> I don't see how side by side installation is possible if all four
> variants of the library install to the same libfftw3.so.3 file. Could
> you expand a bit on this?
>
> Thanks!
>
> Thomas
diff mbox

Patch

diff --git a/package/fftw/Config.in b/package/fftw/Config.in
index ef11384..be8f6cd 100644
--- a/package/fftw/Config.in
+++ b/package/fftw/Config.in
@@ -1,17 +1,3 @@ 
-config BR2_PACKAGE_FFTW
-	bool "fftw"
-	help
-	  Library for computing Fast Fourier Transforms.
-
-	  This library computes Fast Fourier Transforms (FFT) in one
-	  or more dimensions. It is extremely fast. This package
-	  contains the shared library version of the fftw libraries in
-	  double precision.
-
-	  http://www.fftw.org
-
-if BR2_PACKAGE_FFTW
-
 config BR2_PACKAGE_FFTW_USE_SSE
 	bool
 
@@ -21,47 +7,6 @@  config BR2_PACKAGE_FFTW_USE_SSE2
 config BR2_PACKAGE_FFTW_USE_NEON
 	bool
 
-choice
-	prompt "fftw precision"
-	default BR2_PACKAGE_FFTW_PRECISION_DOUBLE
-	help
-	  Selects fftw precision
-
-config BR2_PACKAGE_FFTW_PRECISION_SINGLE
-	bool "single"
-	select BR2_PACKAGE_FFTW_USE_SSE if BR2_X86_CPU_HAS_SSE
-	select BR2_PACKAGE_FFTW_USE_SSE2 if BR2_X86_CPU_HAS_SSE2
-	select BR2_PACKAGE_FFTW_USE_NEON if BR2_ARM_CPU_HAS_NEON && !BR2_ARM_SOFT_FLOAT
-	help
-	  Compile fftw in single precision, i.e. use 'float' for floating
-	  point type.
-
-config BR2_PACKAGE_FFTW_PRECISION_DOUBLE
-	bool "double"
-	select BR2_PACKAGE_FFTW_USE_SSE2 if BR2_X86_CPU_HAS_SSE2
-	help
-	  Compile fftw in double precision (the default), i.e. use 'double'
-	  for floating point type.
-
-config BR2_PACKAGE_FFTW_PRECISION_LONG_DOUBLE
-	bool "long double"
-	# long-double precision require long-double trigonometric routines
-	depends on !(BR2_TOOLCHAIN_BUILDROOT_UCLIBC && \
-		(BR2_arm || BR2_mips || BR2_mipsel))
-	help
-	  Compile fftw in long double precision, i.e. use 'long double'
-	  for floating point type.
-
-config BR2_PACKAGE_FFTW_PRECISION_QUAD
-	bool "quad"
-	# quad-precision needs to have a gcc with libquadmath
-	depends on (BR2_i386 || BR2_x86_64) && BR2_USE_WCHAR
-	help
-	  Compile fftw in quadruple precision, i.e. use '__float128' for
-	  floating point type.
-
-endchoice
-
 config BR2_PACKAGE_FFTW_FAST
 	bool "optimise for speed over accuracy"
 	help
@@ -75,4 +20,8 @@  config BR2_PACKAGE_FFTW_FAST
 	  turn is basically using gcc's -ffast-math. See the gcc manual
 	  for what this means.
 
-endif
+source "package/fftw/fftw/Config.in"
+source "package/fftw/fftwf/Config.in"
+source "package/fftw/fftwl/Config.in"
+source "package/fftw/fftwq/Config.in"
+
diff --git a/package/fftw/fftw.mk b/package/fftw/fftw.mk
index 5bd39a8..216838a 100644
--- a/package/fftw/fftw.mk
+++ b/package/fftw/fftw.mk
@@ -18,10 +18,6 @@  else
 FFTW_CONF_OPTS += --disable-fortran
 endif
 
-FFTW_CONF_OPTS += $(if $(BR2_PACKAGE_FFTW_PRECISION_SINGLE),--enable,--disable)-single
-FFTW_CONF_OPTS += $(if $(BR2_PACKAGE_FFTW_PRECISION_LONG_DOUBLE),--enable,--disable)-long-double
-FFTW_CONF_OPTS += $(if $(BR2_PACKAGE_FFTW_PRECISION_QUAD),--enable,--disable)-quad-precision
-
 FFTW_CFLAGS = $(TARGET_CFLAGS)
 ifeq ($(BR2_PACKAGE_FFTW_FAST),y)
 FFTW_CFLAGS += -O3 -ffast-math
@@ -46,4 +42,4 @@  FFTW_CONF_OPTS += $(if $(BR2_GCC_ENABLE_OPENMP),--enable,--disable)-openmp
 
 FFTW_CONF_OPTS += CFLAGS="$(FFTW_CFLAGS)"
 
-$(eval $(autotools-package))
+include package/fftw/*/*.mk
diff --git a/package/fftw/fftw/Config.in b/package/fftw/fftw/Config.in
new file mode 100644
index 0000000..51bd5eb
--- /dev/null
+++ b/package/fftw/fftw/Config.in
@@ -0,0 +1,19 @@ 
+config BR2_PACKAGE_FFTW
+	bool "fftw"
+	help
+	  Library for computing Fast Fourier Transforms in double precision.
+
+	  This library computes Fast Fourier Transforms (FFT) in one
+	  or more dimensions. It is extremely fast. This package
+	  contains the shared library version of the fftw libraries in
+	  double precision.
+
+	  http://www.fftw.org
+
+config BR2_PACKAGE_FFTW_PRECISION_DOUBLE
+	bool "double"
+	select BR2_PACKAGE_FFTW_USE_SSE2 if BR2_X86_CPU_HAS_SSE2
+	help
+	  Compile fftw in double precision (the default), i.e. use 'double'
+	  for floating point type.
+
diff --git a/package/fftw/fftw.hash b/package/fftw/fftw/fftw.hash
similarity index 100%
rename from package/fftw/fftw.hash
rename to package/fftw/fftw/fftw.hash
diff --git a/package/fftw/fftw/fftw.mk b/package/fftw/fftw/fftw.mk
new file mode 100644
index 0000000..66a82ec
--- /dev/null
+++ b/package/fftw/fftw/fftw.mk
@@ -0,0 +1,9 @@ 
+################################################################################
+#
+# fftw
+#
+################################################################################
+
+$(eval $(autotools-package))
+
+
diff --git a/package/fftw/fftwf/Config.in b/package/fftw/fftwf/Config.in
new file mode 100644
index 0000000..7077086
--- /dev/null
+++ b/package/fftw/fftwf/Config.in
@@ -0,0 +1,22 @@ 
+config BR2_PACKAGE_FFTWF
+	bool "fftwf"
+	select BR2_PACKAGE_FFTW_PRECISION_SINGLE
+	help
+	  Library for computing Fast Fourier Transforms in single precision.
+
+	  This library computes Fast Fourier Transforms (FFT) in one
+	  or more dimensions. It is extremely fast. This package
+	  contains the shared library version of the fftw libraries in
+	  double precision.
+
+	  http://www.fftw.org
+
+config BR2_PACKAGE_FFTW_PRECISION_SINGLE
+	bool "single"
+	select BR2_PACKAGE_FFTW_USE_SSE if BR2_X86_CPU_HAS_SSE
+	select BR2_PACKAGE_FFTW_USE_SSE2 if BR2_X86_CPU_HAS_SSE2
+	select BR2_PACKAGE_FFTW_USE_NEON if BR2_ARM_CPU_HAS_NEON && !BR2_ARM_SOFT_FLOAT
+	help
+	  Compile fftw in single precision, i.e. use 'float' for floating
+	  point type.
+
diff --git a/package/fftw/fftwf/fftwf.hash b/package/fftw/fftwf/fftwf.hash
new file mode 100644
index 0000000..62b8f0f
--- /dev/null
+++ b/package/fftw/fftwf/fftwf.hash
@@ -0,0 +1,2 @@ 
+# From http://www.fftw.org/fftw-3.3.4.tar.gz.md5sum
+md5	2edab8c06b24feeb3b82bbb3ebf3e7b3	fftw-3.3.4.tar.gz
diff --git a/package/fftw/fftwf/fftwf.mk b/package/fftw/fftwf/fftwf.mk
new file mode 100644
index 0000000..a4184b5
--- /dev/null
+++ b/package/fftw/fftwf/fftwf.mk
@@ -0,0 +1,23 @@ 
+################################################################################
+#
+# fftwf
+#
+################################################################################
+
+FFTWF_VERSION = $(FFTW_VERSION)
+FFTWF_SOURCE = fftw-$(FFTWF_VERSION).tar.gz
+FFTWF_SITE = $(FFTW_SITE)
+FFTWF_INSTALL_STAGING = $(FFTW_INSTALL_STAGING)
+FFTWF_LICENSE = $(FFTW_LICENSE)
+FFTWF_LICENSE_FILES = $(FFTW_LICENSE_FILES)
+
+FFTWF_CONF_ENV = $(FFTW_CONF_ENV)
+
+FFTWF_CONF_OPTS = $(FFTW_CONF_OPTS)
+FFTWF_CONF_OPTS += --enable-single
+
+FFTWF_CFLAGS = $(FFTW_CFLAGS)
+
+$(eval $(autotools-package))
+
+
diff --git a/package/fftw/fftwl/Config.in b/package/fftw/fftwl/Config.in
new file mode 100644
index 0000000..466a11e
--- /dev/null
+++ b/package/fftw/fftwl/Config.in
@@ -0,0 +1,22 @@ 
+config BR2_PACKAGE_FFTWL
+	bool "fftwl"
+	select BR2_PACKAGE_FFTW_PRECISION_LONG_DOUBLE
+	help
+	  Library for computing Fast Fourier Transforms in long double precision.
+
+	  This library computes Fast Fourier Transforms (FFT) in one
+	  or more dimensions. It is extremely fast. This package
+	  contains the shared library version of the fftw libraries in
+	  double precision.
+
+	  http://www.fftw.org
+
+config BR2_PACKAGE_FFTW_PRECISION_LONG_DOUBLE
+	bool "long double"
+	# long-double precision require long-double trigonometric routines
+	depends on !(BR2_TOOLCHAIN_BUILDROOT_UCLIBC && \
+		(BR2_arm || BR2_mips || BR2_mipsel))
+	help
+	  Compile fftw in long double precision, i.e. use 'long double'
+	  for floating point type.
+
diff --git a/package/fftw/fftwl/fftwl.hash b/package/fftw/fftwl/fftwl.hash
new file mode 100644
index 0000000..62b8f0f
--- /dev/null
+++ b/package/fftw/fftwl/fftwl.hash
@@ -0,0 +1,2 @@ 
+# From http://www.fftw.org/fftw-3.3.4.tar.gz.md5sum
+md5	2edab8c06b24feeb3b82bbb3ebf3e7b3	fftw-3.3.4.tar.gz
diff --git a/package/fftw/fftwl/fftwl.mk b/package/fftw/fftwl/fftwl.mk
new file mode 100644
index 0000000..2412590
--- /dev/null
+++ b/package/fftw/fftwl/fftwl.mk
@@ -0,0 +1,23 @@ 
+################################################################################
+#
+# fftwl
+#
+################################################################################
+
+FFTL_VERSION = $(FFTW_VERSION)
+FFTL_SOURCE = fftw-$(FFTWL_VERSION).tar.gz
+FFTL_SITE = $(FFTW_SITE)
+FFTL_INSTALL_STAGING = $(FFTW_INSTALL_STAGING)
+FFTL_LICENSE = $(FFTW_LICENSE)
+FFTL_LICENSE_FILES = $(FFTW_LICENSE_FILES)
+
+FFTL_CONF_ENV = $(FFTW_CONF_ENV)
+
+FFTL_CONF_OPTS = $(FFTW_CONF_OPTS)
+FFTL_CONF_OPTS += --enable-long-double
+
+FFTL_CFLAGS = $(FFTW_CFLAGS)
+
+$(eval $(autotools-package))
+
+
diff --git a/package/fftw/fftwq/Config.in b/package/fftw/fftwq/Config.in
new file mode 100644
index 0000000..fc6f427
--- /dev/null
+++ b/package/fftw/fftwq/Config.in
@@ -0,0 +1,21 @@ 
+config BR2_PACKAGE_FFTWQ
+	bool "fftwq"
+	select BR2_PACKAGE_FFTW_PRECISION_QUAD
+	help
+	  Library for computing Fast Fourier Transforms in quad precision.
+
+	  This library computes Fast Fourier Transforms (FFT) in one
+	  or more dimensions. It is extremely fast. This package
+	  contains the shared library version of the fftw libraries in
+	  double precision.
+
+	  http://www.fftw.org
+
+config BR2_PACKAGE_FFTW_PRECISION_QUAD
+	bool "quad"
+	# quad-precision needs to have a gcc with libquadmath
+	depends on (BR2_i386 || BR2_x86_64) && BR2_USE_WCHAR
+	help
+	  Compile fftw in quadruple precision, i.e. use '__float128' for
+	  floating point type.
+
diff --git a/package/fftw/fftwq/fftwq.hash b/package/fftw/fftwq/fftwq.hash
new file mode 100644
index 0000000..62b8f0f
--- /dev/null
+++ b/package/fftw/fftwq/fftwq.hash
@@ -0,0 +1,2 @@ 
+# From http://www.fftw.org/fftw-3.3.4.tar.gz.md5sum
+md5	2edab8c06b24feeb3b82bbb3ebf3e7b3	fftw-3.3.4.tar.gz
diff --git a/package/fftw/fftwq/fftwq.mk b/package/fftw/fftwq/fftwq.mk
new file mode 100644
index 0000000..6130538
--- /dev/null
+++ b/package/fftw/fftwq/fftwq.mk
@@ -0,0 +1,23 @@ 
+################################################################################
+#
+# fftwq
+#
+################################################################################
+
+FFTQ_VERSION = $(FFTW_VERSION)
+FFTQ_SOURCE = fftw-$(FFTWQ_VERSION).tar.gz
+FFTQ_SITE = $(FFTW_SITE)
+FFTQ_INSTALL_STAGING = $(FFTW_INSTALL_STAGING)
+FFTQ_LICENSE = $(FFTW_LICENSE)
+FFTQ_LICENSE_FILES = $(FFTW_LICENSE_FILES)
+
+FFTQ_CONF_ENV = $(FFTW_CONF_ENV)
+
+FFTQ_CONF_OPTS = $(FFTW_CONF_OPTS)
+FFTQ_CONF_OPTS += --enable-quad-precision
+
+FFTQ_CFLAGS = $(FFTW_CFLAGS)
+
+$(eval $(autotools-package))
+
+