strace/m4/mpers.m4
Dmitry V. Levin e2a3370f67 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.
2015-08-28 08:46:24 +00:00

71 lines
1.9 KiB
Plaintext

AC_DEFUN([st_MPERS],[
pushdef([MPERS_NAME], translit([$1], [a-z], [A-Z]))
pushdef([HAVE_MPERS], [HAVE_]MPERS_NAME[_MPERS])
pushdef([HAVE_RUNTIME], [HAVE_]MPERS_NAME[_RUNTIME])
pushdef([CFLAG], [-$1])
pushdef([st_cv_cc], [st_cv_$1_cc])
pushdef([st_cv_runtime], [st_cv_$1_runtime])
pushdef([st_cv_mpers], [st_cv_$1_mpers])
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 $IFLAG"
AC_CACHE_CHECK([for CFLAG compile support], [st_cv_cc],
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdint.h>
int main(){return 0;}]])],
[st_cv_cc=yes],
[st_cv_cc=no])])
if test $st_cv_cc = yes; then
AC_CACHE_CHECK([for CFLAG runtime support], [st_cv_runtime],
[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdint.h>
int main(){return 0;}]])],
[st_cv_runtime=yes],
[st_cv_runtime=no],
[st_cv_runtime=no])])
AC_CACHE_CHECK([whether mpers.sh CFLAG works], [st_cv_mpers],
[if CC="$CC" CPP="$CPP" CPPFLAGS="$CPPFLAGS" \
$srcdir/mpers_test.sh [$1]; then
st_cv_mpers=yes
else
st_cv_mpers=no
fi])
if test $st_cv_mpers = yes; then
AC_DEFINE(HAVE_MPERS, [1],
[Define to 1 if you have CFLAG mpers support])
fi
fi
CFLAGS="$saved_CFLAGS"
;;
*)
st_cv_runtime=no
st_cv_mpers=no
;;
esac
AM_CONDITIONAL(HAVE_RUNTIME, [test "$st_cv_runtime" = yes])
AM_CONDITIONAL(HAVE_MPERS, [test "$st_cv_mpers" = yes])
popdef([st_cv_mpers])
popdef([st_cv_runtime])
popdef([st_cv_cc])
popdef([CFLAG])
popdef([HAVE_RUNTIME])
popdef([HAVE_MPERS])
popdef([MPERS_NAME])
])