All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaroslav Kysela <perex@perex.cz>
To: makepost@firemail.cc
Cc: ALSA development <alsa-devel@alsa-project.org>
Subject: Re: [PATCH] alsamixer: define _GNU_SOURCE to get exp10
Date: Fri, 18 Jan 2019 09:42:17 +0100	[thread overview]
Message-ID: <6b160f04-3f6a-ad3c-23b6-ad79f5b1466d@perex.cz> (raw)
In-Reply-To: <1c7a2099a382ae15570aa6cdc0b6a666@firemail.cc>

Dne 17.1.2019 v 01:16 makepost@firemail.cc napsal(a):
> These flags vary between systems, on the Gentoo where I have access the 
> Makefile generated from e1aa6d4 contains:
> 
> $ ack '^(AM|CURSES|NCURSESW)_CFLAGS' alsamixer/Makefile
> CURSES_CFLAGS = -I/usr/include/ncursesw
> NCURSESW_CFLAGS = -I/usr/include/ncursesw
> AM_CFLAGS = -I/usr/include/ncursesw  -DCURSESINC="<ncurses.h>"
> 
> Files in /usr/include/ncursesw don't mention _GNU_SOURCE so I'm baffled 
> where GCC gets it from.
> 
> Indeed the local alsamixer/Makefile.am is a more suitable place to put 
> the flag. A newbie question follows, should I somehow update the patch 
> with your edit and reply to this message, or did you generate the diff 
> from an already edited version?

Applied to the repository:

http://git.alsa-project.org/?p=alsa-utils.git;a=commitdiff;h=116488e5f2f1b897084bd151381ee254e1cc177d

				Thanks,
					Jaroslav

> 
> On 2019-01-16 14:22, Jaroslav Kysela wrote:
>> Dne 16.1.2019 v 02:35 makepost@firemail.cc napsal(a):
>>> Fixes Master, Headphones and Speaker stuck at -8 percentage after
>>> building with Clang 7.0.1 and getting warned about implicit 
>>> declaration
>>> of exp10, which is behind _GNU_SOURCE as a non-standard feature. 
>>> Thanks
>>> Takashi Iwai for the CFLAGS suggestion on the mailing list. GCC build 
>>> is
>>> not affected, so not adding a compiler check to the configure script.
>>>
>>> uClibc-ng has got exp10 since 1.0.12, so the fallback macro is no 
>>> longer
>>> needed. However, alsa-utils relies on gettext so might need further
>>> patches to actually work on uClibc systems.
>>>
>>> Signed-off-by: makepost <makepost@firemail.cc>
>>>
>>> diff --git a/alsamixer/volume_mapping.c b/alsamixer/volume_mapping.c
>>> index 94bd0fe..48cfbe2 100644
>>> --- a/alsamixer/volume_mapping.c
>>> +++ b/alsamixer/volume_mapping.c
>>> @@ -36,11 +36,6 @@
>>>   #include <stdbool.h>
>>>   #include "volume_mapping.h"
>>>
>>> -#ifdef __UCLIBC__
>>> -/* 10^x = 10^(log e^x) = (e^x)^log10 = e^(x * log 10) */
>>> -#define exp10(x) (exp((x) * log(10)))
>>> -#endif /* __UCLIBC__ */
>>> -
>>>   #define MAX_LINEAR_DB_SCALE    24
>>>
>>>   static inline bool use_linear_dB_scale(long dBmin, long dBmax)
>>> diff --git a/configure.ac b/configure.ac
>>> index 7938996..0d54942 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -350,6 +350,8 @@ if test x$alsamixer = xtrue; then
>>>
>>>
>>>     AC_MSG_RESULT([$CURSESLIB])
>>> +
>>> +  CFLAGS="$CFLAGS -D_GNU_SOURCE"
>>
>> It would be propably better to put this to the local makefile for 
>> alsamixer:
>>
>> diff --git a/alsamixer/Makefile.am b/alsamixer/Makefile.am
>> index 259b29e..249e8f8 100644
>> --- a/alsamixer/Makefile.am
>> +++ b/alsamixer/Makefile.am
>> @@ -1,4 +1,4 @@
>> -AM_CFLAGS = @CURSES_CFLAGS@ -DCURSESINC="@CURSESINC@"
>> +AM_CFLAGS = -D_GNU_SOURCE @CURSES_CFLAGS@ -DCURSESINC="@CURSESINC@"
>>  LDADD = @CURSESLIB@
>>
>>  bin_PROGRAMS = alsamixer
>>
>> The reason, why the problem is not visible with the standard
>> gcc/glibc/ncurses is that this definition is activated by ncurses:
>>
>> $ find alsamixer -type f -exec grep -H GNU_SOURCE {} \;
>> alsamixer/Makefile:CURSES_CFLAGS = -D_GNU_SOURCE -D_DEFAULT_SOURCE
>> alsamixer/Makefile:NCURSESW_CFLAGS = -D_GNU_SOURCE -D_DEFAULT_SOURCE
>> alsamixer/Makefile:AM_CFLAGS = -D_GNU_SOURCE -D_DEFAULT_SOURCE
>> -DCURSESINC="<ncurses.h>"
>>
>> 					Jaroslav


-- 
Jaroslav Kysela <perex@perex.cz>

      reply	other threads:[~2019-01-18  8:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16  1:35 [PATCH] alsamixer: define _GNU_SOURCE to get exp10 makepost
2019-01-16 12:22 ` Jaroslav Kysela
2019-01-17  0:16   ` makepost
2019-01-18  8:42     ` Jaroslav Kysela [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b160f04-3f6a-ad3c-23b6-ad79f5b1466d@perex.cz \
    --to=perex@perex.cz \
    --cc=alsa-devel@alsa-project.org \
    --cc=makepost@firemail.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.