mpers.m4: workaround missing gnu/stubs-*.h files
On some systems missing gnu/stubs-*.h files make -m32/-mx32 compilation
checks fail. As we want to support multiple personalities despite of
this limitation, workaround the check by creating empty gnu stub files
if necessary.
* m4/mpers.m4 (st_MPERS): Check for the gnu stub file. Create an empty
gnu stub file if the system one is missing.
* Makefile.am (DISTCLEANFILES): Add gnu/stubs-32.h and gnu/stubs-x32.h.
diff --git a/m4/mpers.m4 b/m4/mpers.m4
index 3d17300..70933ff 100644
--- a/m4/mpers.m4
+++ b/m4/mpers.m4
@@ -10,8 +10,19 @@
case "$arch" in
[$2])
+ AH_TEMPLATE([HAVE_GNU_STUBS_32_H],
+ [Define to 1 if you have the <gnu/stubs-32.h> header file.])
+ AH_TEMPLATE([HAVE_GNU_STUBS_X32_H],
+ [Define to 1 if you have the <gnu/stubs-x32.h> header file.])
+ pushdef([gnu_stubs], [gnu/stubs-][m4_substr([$1], 1)][.h])
+ AC_CHECK_HEADERS([gnu_stubs], [IFLAG=],
+ [mkdir -p gnu
+ : > gnu_stubs
+ AC_MSG_NOTICE([Created empty gnu_stubs])
+ IFLAG=-I.])
+ popdef([gnu_stubs])
saved_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS CFLAG"
+ CFLAGS="$CFLAGS CFLAG $IFLAG"
AC_CACHE_CHECK([for CFLAG compile support], [st_cv_cc],
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdint.h>
int main(){return 0;}]])],