Skip to content

Commit a1e3b66

Browse files
jrngitster
authored andcommitted
autoconf: don't use platform regex if it lacks REG_STARTEND
If the platform regex cannot match null bytes, we might as well use the glibc version instead. Cc: Ævar Arnfjörð Bjarmason <[email protected]> Cc: René Scharfe <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Tested-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7e36de5 commit a1e3b66

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

config.mak.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ NO_INET_NTOP=@NO_INET_NTOP@
5858
NO_INET_PTON=@NO_INET_PTON@
5959
NO_ICONV=@NO_ICONV@
6060
OLD_ICONV=@OLD_ICONV@
61+
NO_REGEX=@NO_REGEX@
6162
NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
6263
INLINE=@INLINE@
6364
SOCKLEN_T=@SOCKLEN_T@

configure.ac

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,27 @@ else
706706
fi
707707
AC_SUBST(NO_C99_FORMAT)
708708
#
709+
# Define NO_REGEX if you have no or inferior regex support in your C library.
710+
AC_CACHE_CHECK([whether the platform regex can handle null bytes],
711+
[ac_cv_c_excellent_regex], [
712+
AC_EGREP_CPP(yippeeyeswehaveit,
713+
AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
714+
#include <regex.h>
715+
],
716+
[#ifdef REG_STARTEND
717+
yippeeyeswehaveit
718+
#endif
719+
]),
720+
[ac_cv_c_excellent_regex=yes],
721+
[ac_cv_c_excellent_regex=yes])
722+
])
723+
if test $ac_cv_c_excellent_regex = yes; then
724+
NO_REGEX=
725+
else
726+
NO_REGEX=YesPlease
727+
fi
728+
AC_SUBST(NO_REGEX)
729+
#
709730
# Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
710731
# when attempting to read from an fopen'ed directory.
711732
AC_CACHE_CHECK([whether system succeeds to read fopen'ed directory],

0 commit comments

Comments
 (0)