autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should I define _GNU_SOURCE?


From: Mathieu Lirzin
Subject: Re: Should I define _GNU_SOURCE?
Date: Mon, 22 Jan 2018 17:42:31 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Victor Porton <address@hidden> writes:

> I am writing a software for Linux/Unix which could benefit from
> execvpe() C function.
>
> But this function is defined only when -D_GNU_SOURCE.
>
> Question 1: Should I ALWAYS use -D_GNU_SOURCE for compiler options no
> matter what are user options?
>
> Question 2: Should I check existence of execvpe() by checking
> #if _GNU_SOURCE
> or with AC_CHECK_FUNC(execvpe)?
>
> Question 3: Other advice?

It depends what kind of portability you aim.

* If you don't care about portability just ‘AC_CHECK_FUNC(execvpe)’, and
  bail out if not found.

* If you care about portability and you have some courage
  ‘AC_CHECK_FUNC(execvpe)’ and use ‘AC_LIBOBJ’ to provide a replacement
  implementation.  If you have extra bravery send a patch to
  <address@hidden> which is a repository for such replacement.

* If you care about portability but you don't have such courage, just
  don't use ‘execvpe’.  :-)

HTH

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37



reply via email to

[Prev in Thread] Current Thread [Next in Thread]