[Mesa-dev] [PATCH] build: fixup pthread_setaffinity_np checking

Emil Velikov emil.l.velikov at gmail.com
Thu Sep 20 16:35:11 UTC 2018


On 20 September 2018 at 15:19, Eric Engestrom <eric.engestrom at intel.com> wrote:
> On Thursday, 2018-09-20 14:56:03 +0100, Emil Velikov wrote:
>> From: Emil Velikov <emil.velikov at collabora.com>
>>
>> Use the correct guard name (was missing the _NP) and use the
>> AC_CHECK_FUNCS helper instead of opencoding it.
>>
>> Fixes: 3acc18fcf7c ("move pthread_setaffinity_np check to the build system")
>> Cc: Dylan Baker <dylan at pnwbakers.com>
>> Cc: Eric Engestrom <eric.engestrom at intel.com>
>> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
>> ---
>>  configure.ac                           | 13 +------------
>>  meson.build                            |  2 +-
>>  src/gallium/auxiliary/util/u_helpers.c |  4 ++--
>>  src/util/u_thread.h                    |  4 ++--
>>  4 files changed, 6 insertions(+), 17 deletions(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index 7583a375ad7..c2fd762bbf5 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -970,18 +970,7 @@ fi
>>
>>  save_LIBS="$LIBS"
>>  LIBS="$PTHREAD_LIBS"
>> -AC_MSG_CHECKING(whether pthread_setaffinity_np is supported)
>> -AC_LINK_IFELSE([AC_LANG_SOURCE([[
>> -    #define _GNU_SOURCE
>> -    #include <pthread.h>
>> -    int main() {
>> -       void *a = (void*) &pthread_setaffinity_np;
>> -       long b = (long) a;
>> -       return (int) b;
>> -    }]])],
>> -  [DEFINES="$DEFINES -DHAVE_PTHREAD_SETAFFINITY"];
>> -   AC_MSG_RESULT([yes]),
>> -   AC_MSG_RESULT([no]))
>> +AC_CHECK_FUNCS([pthread_setaffinity_np])
>
> How does autoconf know to #define _GNU_SOURCE and #include <pthread.h> ?
> Are you sure your check is working as previously?
>
AC_CHECK_FUNCS is a dead trivial link-time check.
"Details" such as header (for function signature) and specific guards
are not needed.

I haven't done a full test - will do so next week. I'll be enjoying my
holidays until the end of the week ;-)

-Emil


More information about the mesa-dev mailing list