@@ -204,6 +204,7 @@ fn test_apple(target: &str) {
204204 "iconv.h" ,
205205 "ifaddrs.h" ,
206206 "langinfo.h" ,
207+ "libgen.h" ,
207208 "libproc.h" ,
208209 "limits.h" ,
209210 "locale.h" ,
@@ -417,6 +418,7 @@ fn test_openbsd(target: &str) {
417418 "errno.h" ,
418419 "execinfo.h" ,
419420 "fcntl.h" ,
421+ "libgen.h" ,
420422 "limits.h" ,
421423 "link.h" ,
422424 "locale.h" ,
@@ -992,6 +994,7 @@ fn test_netbsd(target: &str) {
992994 "elf.h" ,
993995 "errno.h" ,
994996 "fcntl.h" ,
997+ "libgen.h" ,
995998 "limits.h" ,
996999 "link.h" ,
9971000 "locale.h" ,
@@ -1206,6 +1209,7 @@ fn test_dragonflybsd(target: &str) {
12061209 "ifaddrs.h" ,
12071210 "kvm.h" ,
12081211 "langinfo.h" ,
1212+ "libgen.h" ,
12091213 "limits.h" ,
12101214 "link.h" ,
12111215 "locale.h" ,
@@ -1505,6 +1509,7 @@ fn test_android(target: &str) {
15051509 "fcntl.h" ,
15061510 "grp.h" ,
15071511 "ifaddrs.h" ,
1512+ "libgen.h" ,
15081513 "limits.h" ,
15091514 "link.h" ,
15101515 "locale.h" ,
@@ -1866,6 +1871,7 @@ fn test_freebsd(target: &str) {
18661871 "iconv.h" ,
18671872 "ifaddrs.h" ,
18681873 "langinfo.h" ,
1874+ "libgen.h" ,
18691875 "libutil.h" ,
18701876 "limits.h" ,
18711877 "link.h" ,
@@ -2771,6 +2777,7 @@ fn test_linux(target: &str) {
27712777 "iconv.h" ,
27722778 "ifaddrs.h" ,
27732779 "langinfo.h" ,
2780+ "libgen.h" ,
27742781 "limits.h" ,
27752782 "link.h" ,
27762783 "locale.h" ,
@@ -3410,6 +3417,22 @@ fn test_linux(target: &str) {
34103417 // it can't be changed from struct.
34113418 "pthread_sigqueue" => true ,
34123419
3420+ // There are two versions of basename(3) on Linux with glibc, see
3421+ //
3422+ // https://man7.org/linux/man-pages/man3/basename.3.html
3423+ //
3424+ // If libgen.h is included, then the POSIX version will be available;
3425+ // If _GNU_SOURCE is defined and string.h is included, then the GNU one
3426+ // will be used.
3427+ //
3428+ // libc exposes both of them, providing a prefix to differentiate between
3429+ // them.
3430+ //
3431+ // Because the name with prefix is not a valid symbol in C, we have to
3432+ // skip the tests.
3433+ "posix_basename" if gnu => true ,
3434+ "gnu_basename" if gnu => true ,
3435+
34133436 _ => false ,
34143437 }
34153438 } ) ;
0 commit comments