https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119250
--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> --- it seems a bit more complicated because the gcc configure is: AC_CHECK_DECLS([basename(const char*), strstr(const char*,const char*)], , ,[ #undef HAVE_DECL_BASENAME #define HAVE_DECL_BASENAME 1 #include "ansidecl.h" #include "system.h"]) i.e. It is looking for a declaration like 'basename(const char*)' which is a GNU extension. It is pulling in 'system.h' which includes libiberty.h which would provide a declaration of 'basename(const char*)' if the host has no 'basename (char*)' On Darwin (and probably Solaris) libiberty.h should not provide the declaration. However gcc/configure does not then consider that there could be a 'basename (char*)'. So maybe we need a fallback if this configure fails, looking for the posix basename.