On Thursday, 2017-12-21 04:05:59 +0000, co...@sdf.org wrote: > On Wed, Dec 20, 2017 at 09:54:09AM -0600, Rob Herring wrote: > > Android could be added here. Android has had getprogname since > > Lollipop and we don't support versions older than that. It could be a > > follow-on patch too. > > Attached is a modified patch for this.
Instead of trying to maintain an exhaustive list, shouldn't we replace this with a simple build-time detection? For instance, in meson this would be: if cc.has_function('getprogname', prefix : '#include <stdlib.h>') pre_args += '-DHAVE_GETPROGNAME' endif > > I've switched the macro to use __ANDROID__ which was recommended > upstream/GCC docs clarify it is defined. > (There's a lot of other instances of #ifdef ANDROID in the tree, > though). > > I've tested and uclibc built with buildroot's config does define > program_invocation_short_name like glibc, but apparently it is optional > (and not default yes). I'm assuming we want to keep the fallback for it. > From 64142efdd55c090078ee0da1131ba06fb5b60418 Mon Sep 17 00:00:00 2001 > From: Maya Rashish <co...@sdf.org> > Date: Sun, 17 Dec 2017 21:48:01 +0200 > Subject: [PATCH 1/1] Use getprogname on all BSDs, APPLE, ANDROID > > Remove EOL NetBSD < 1.x (this macro never worked, since we don't > include sys/param.h). > Remove EOL FreeBSD < 4.4 > > Use __ANDROID__ to macro check android, as recommended upstream. > > Functional change for OpenBSD and ANDROID. > --- > src/util/xmlconfig.c | 17 +++-------------- > 1 file changed, 3 insertions(+), 14 deletions(-) > > diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c > index 60a6331..7c3582e 100644 > --- a/src/util/xmlconfig.c > +++ b/src/util/xmlconfig.c > @@ -48,19 +48,8 @@ extern char *program_invocation_name, > *program_invocation_short_name; > # define GET_PROGRAM_NAME() program_invocation_short_name > #elif defined(__CYGWIN__) > # define GET_PROGRAM_NAME() program_invocation_short_name > -#elif defined(__FreeBSD__) && (__FreeBSD__ >= 2) > -# include <osreldate.h> > -# if (__FreeBSD_version >= 440000) > -# include <stdlib.h> > -# define GET_PROGRAM_NAME() getprogname() > -# endif > -#elif defined(__NetBSD__) && defined(__NetBSD_Version__) && > (__NetBSD_Version__ >= 106000100) > -# include <stdlib.h> > -# define GET_PROGRAM_NAME() getprogname() > -#elif defined(__DragonFly__) > -# include <stdlib.h> > -# define GET_PROGRAM_NAME() getprogname() > -#elif defined(__APPLE__) > +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || > \ > + defined(__DragonFly__) || defined(__APPLE__) || defined(__ANDROID__) > # include <stdlib.h> > # define GET_PROGRAM_NAME() getprogname() > #elif defined(__sun) > @@ -92,7 +81,7 @@ __getProgramName() > #endif > > #if !defined(GET_PROGRAM_NAME) > -# if defined(__OpenBSD__) || defined(NetBSD) || defined(__UCLIBC__) || > defined(ANDROID) > +# if defined(__UCLIBC__) > /* This is a hack. It's said to work on OpenBSD, NetBSD and GNU. > * Rogelio M.Serrano Jr. reported it's also working with UCLIBC. It's > * used as a last resort, if there is no documented facility available. */ > -- > 2.15.1 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev