Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v4 1/1] fftw: add compile precision option
@ 2015-03-15 16:15 Gwenhael Goavec-Merou
  2015-03-15 19:26 ` Yann E. MORIN
  0 siblings, 1 reply; 3+ messages in thread
From: Gwenhael Goavec-Merou @ 2015-03-15 16:15 UTC (permalink / raw)
  To: buildroot

From: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>

fftw has options to select compile precision between single, long-double and
quad. These options are exclusives. This patch adds choice to select precision
option.

Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
---
Changes v3 -> v4:
 * add depends instruction for long-double procession. This option needs to
   have a toolchain with long-double trigonometric routines.
Changes v2 -> v3:
 * add depends instruction for quad-precision. This option needs to have a
   toolchain with libquadmath enabled (only x86, x86_64 and Itanium).
Changes v1 -> v2:
 * FFTW_CONFIGURE_OPTS -> FFTW_CONF_OPTS
---
 package/fftw/Config.in | 38 ++++++++++++++++++++++++++++++++++++++
 package/fftw/fftw.mk   |  9 +++++++++
 2 files changed, 47 insertions(+)

diff --git a/package/fftw/Config.in b/package/fftw/Config.in
index 36f849f..7fa2c4c 100644
--- a/package/fftw/Config.in
+++ b/package/fftw/Config.in
@@ -9,3 +9,41 @@ config BR2_PACKAGE_FFTW
 	  double precision.
 
 	  http://www.fftw.org
+
+if BR2_PACKAGE_FFTW
+
+choice
+	prompt "fftw precision"
+	default BR2_PACKAGE_FFTW_PRECISION_NONE
+	help
+	  Selects fftw precision
+
+config BR2_PACKAGE_FFTW_PRECISION_NONE
+	bool "none"
+	help
+	  no compile precision selected
+
+config BR2_PACKAGE_FFTW_PRECISION_SINGLE
+	bool "single precision"
+	help
+	  compile fftw in single precision
+
+config BR2_PACKAGE_FFTW_PRECISION_LONG_DOUBLE
+	bool "long double precision"
+	# 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
+
+config BR2_PACKAGE_FFTW_PRECISION_QUAD
+	bool "quad precision"
+	# 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 if available
+
+endchoice
+
+endif
diff --git a/package/fftw/fftw.mk b/package/fftw/fftw.mk
index 3b302df..80cc0dc 100644
--- a/package/fftw/fftw.mk
+++ b/package/fftw/fftw.mk
@@ -10,4 +10,13 @@ FFTW_INSTALL_STAGING = YES
 FFTW_LICENSE = GPLv2+
 FFTW_LICENSE_FILES = COPYING
 
+ifeq ($(BR2_PACKAGE_FFTW_PRECISION_SINGLE),y)
+FFTW_CONF_OPTS = --enable-single
+endif
+ifeq ($(BR2_PACKAGE_FFTW_PRECISION_LONG_DOUBLE),y)
+FFTW_CONF_OPTS = --enable-long-double
+endif
+ifeq ($(BR2_PACKAGE_FFTW_PRECISION_QUAD),y)
+FFTW_CONF_OPTS = --enable-quad-precision
+endif
 $(eval $(autotools-package))
-- 
2.0.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH v4 1/1] fftw: add compile precision option
  2015-03-15 16:15 [Buildroot] [PATCH v4 1/1] fftw: add compile precision option Gwenhael Goavec-Merou
@ 2015-03-15 19:26 ` Yann E. MORIN
  2015-03-15 20:00   ` gwenhael.goavec
  0 siblings, 1 reply; 3+ messages in thread
From: Yann E. MORIN @ 2015-03-15 19:26 UTC (permalink / raw)
  To: buildroot

Gwenhael, All,

On 2015-03-15 17:15 +0100, Gwenhael Goavec-Merou spake thusly:
> fftw has options to select compile precision between single, long-double and
> quad. These options are exclusives. This patch adds choice to select precision
> option.
> 
> Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>

So, I have tested this patch in different configurations:
  - x86, all of none, single, double and quad
  - arm, all of none single, and double

All did build successfuly.

However, I am a bit worried that we do not have a disbling condition for
'none'...

[--SNIP--]
> diff --git a/package/fftw/fftw.mk b/package/fftw/fftw.mk
> index 3b302df..80cc0dc 100644
> --- a/package/fftw/fftw.mk
> +++ b/package/fftw/fftw.mk
> @@ -10,4 +10,13 @@ FFTW_INSTALL_STAGING = YES
>  FFTW_LICENSE = GPLv2+
>  FFTW_LICENSE_FILES = COPYING
>  

Maybe we could have something like:

    # Disable everything, and then selectively enable what we want
    FFTW_CONF_OPTS = --disable-single --disable-long-double --disable-quad-precision

    ifeq ($(BR2_PACKAGE_FFTW_PRECISION_SINGLE),y)
    FFTW_CONF_OPTS = --enable-single
    endif

    ifeq ($(BR2_PACKAGE_FFTW_PRECISION_LONG_DOUBLE),y)
    FFTW_CONF_OPTS = --enable-long-double
    endif

    ifeq ($(BR2_PACKAGE_FFTW_PRECISION_QUAD),y)
    FFTW_CONF_OPTS = --enable-quad-precision
    endif

When we have both --disabe/--enable, the latter wins. So we can simply
disable everything, and then enable only the one we need.

I got it that they are mutually exclusive, but if the user selects
'none', we do not have any '--enable-XXX' so what happens?

Alternatively, you could do:

    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

Not sure which I prefer...

Regards,
Yann E. MORIN.

> +ifeq ($(BR2_PACKAGE_FFTW_PRECISION_SINGLE),y)
> +FFTW_CONF_OPTS = --enable-single
> +endif
> +ifeq ($(BR2_PACKAGE_FFTW_PRECISION_LONG_DOUBLE),y)
> +FFTW_CONF_OPTS = --enable-long-double
> +endif
> +ifeq ($(BR2_PACKAGE_FFTW_PRECISION_QUAD),y)
> +FFTW_CONF_OPTS = --enable-quad-precision
> +endif
>  $(eval $(autotools-package))
> -- 
> 2.0.5
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH v4 1/1] fftw: add compile precision option
  2015-03-15 19:26 ` Yann E. MORIN
@ 2015-03-15 20:00   ` gwenhael.goavec
  0 siblings, 0 replies; 3+ messages in thread
From: gwenhael.goavec @ 2015-03-15 20:00 UTC (permalink / raw)
  To: buildroot

On Sun, 15 Mar 2015 20:26:10 +0100
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> Gwenhael, All,
> 
> On 2015-03-15 17:15 +0100, Gwenhael Goavec-Merou spake thusly:
> > fftw has options to select compile precision between single, long-double and
> > quad. These options are exclusives. This patch adds choice to select precision
> > option.
> > 
> > Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
> 
> So, I have tested this patch in different configurations:
>   - x86, all of none, single, double and quad
>   - arm, all of none single, and double
> 
> All did build successfuly.
> 
> However, I am a bit worried that we do not have a disbling condition for
> 'none'...
>
The none have no existence because fftw by default has no options enabled.
This choice is only present to reflect the default behaviour. 
>
> [--SNIP--]
> > diff --git a/package/fftw/fftw.mk b/package/fftw/fftw.mk
> > index 3b302df..80cc0dc 100644
> > --- a/package/fftw/fftw.mk
> > +++ b/package/fftw/fftw.mk
> > @@ -10,4 +10,13 @@ FFTW_INSTALL_STAGING = YES
> >  FFTW_LICENSE = GPLv2+
> >  FFTW_LICENSE_FILES = COPYING
> >  
> 
> Maybe we could have something like:
> 
>     # Disable everything, and then selectively enable what we want
>     FFTW_CONF_OPTS = --disable-single --disable-long-double --disable-quad-precision
> 
>     ifeq ($(BR2_PACKAGE_FFTW_PRECISION_SINGLE),y)
>     FFTW_CONF_OPTS = --enable-single
>     endif
> 
>     ifeq ($(BR2_PACKAGE_FFTW_PRECISION_LONG_DOUBLE),y)
>     FFTW_CONF_OPTS = --enable-long-double
>     endif
> 
>     ifeq ($(BR2_PACKAGE_FFTW_PRECISION_QUAD),y)
>     FFTW_CONF_OPTS = --enable-quad-precision
>     endif
> 
> When we have both --disabe/--enable, the latter wins. So we can simply
> disable everything, and then enable only the one we need.
> 
> I got it that they are mutually exclusive, but if the user selects
> 'none', we do not have any '--enable-XXX' so what happens?
>
Nothing this is the default situation ;-) In fact fftw configure don't care
about disable-{single,quad,...}. Only enable-xxx is taken into account. This is
why I do nothing if none is selected.
>
> Alternatively, you could do:
> 
>     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
> 
> Not sure which I prefer...
> 
> Regards,
> Yann E. MORIN.
> 
Regards,
Gwen

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-15 20:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-15 16:15 [Buildroot] [PATCH v4 1/1] fftw: add compile precision option Gwenhael Goavec-Merou
2015-03-15 19:26 ` Yann E. MORIN
2015-03-15 20:00   ` gwenhael.goavec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox