]> granicus.if.org Git - strace/commitdiff
Macroize -m32/-mx32 configure checks
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 23 Jul 2015 11:19:47 +0000 (11:19 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 23 Jul 2015 11:39:32 +0000 (11:39 +0000)
Prepare for additional configure checks that would be needed
for new multiple personalities support.

* m4/mpers.m4: New file.
* configure.ac: Use it.

configure.ac
m4/mpers.m4 [new file with mode: 0644]

index 40cdc0cd23aff3d0c4bd5ab892ea7160f18f0cc3..85749399af7e3c31b18576ec059550eb9b36106e 100644 (file)
@@ -852,33 +852,8 @@ if test "$arch" = mips && test "$no_create" != yes; then
        fi
 fi
 
-have_m32=no
-case "$arch" in
-       aarch64|powerpc64|sparc64|tile|x32|x86_64)
-       AC_MSG_CHECKING([for -m32 runtime support])
-       saved_CFLAGS="$CFLAGS"
-       CFLAGS="$CFLAGS -m32"
-       AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(){return 0;}]])],
-               [have_m32=yes],[have_m32=no],[have_m32=no])
-       CFLAGS="$saved_CFLAGS"
-       AC_MSG_RESULT($have_m32)
-       ;;
-esac
-AM_CONDITIONAL([HAVE_M32_RUNTIME], [test "$have_m32" = yes])
-
-have_mx32=no
-case "$arch" in
-       x86_64)
-       AC_MSG_CHECKING([for -mx32 runtime support])
-       saved_CFLAGS="$CFLAGS"
-       CFLAGS="$CFLAGS -mx32"
-       AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(){return 0;}]])],
-               [have_mx32=yes],[have_mx32=no],[have_mx32=no])
-       CFLAGS="$saved_CFLAGS"
-       AC_MSG_RESULT($have_mx32)
-       ;;
-esac
-AM_CONDITIONAL([HAVE_MX32_RUNTIME], [test "$have_mx32" = yes])
+st_MPERS([m32], [aarch64|powerpc64|sparc64|tile|x32|x86_64])
+st_MPERS([mx32], [x86_64])
 
 AC_CONFIG_FILES([Makefile tests/Makefile tests-m32/Makefile tests-mx32/Makefile])
 AC_OUTPUT
diff --git a/m4/mpers.m4 b/m4/mpers.m4
new file mode 100644 (file)
index 0000000..6cb01de
--- /dev/null
@@ -0,0 +1,42 @@
+AC_DEFUN([st_MPERS],[
+
+pushdef([MPERS_NAME], translit([$1], [a-z], [A-Z]))
+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])
+
+case "$arch" in
+       [$2])
+       saved_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS CFLAG"
+       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])])
+       fi
+       CFLAGS="$saved_CFLAGS"
+       ;;
+
+       *)
+       st_cv_runtime=no
+       ;;
+esac
+
+AM_CONDITIONAL(HAVE_RUNTIME, [test "$st_cv_runtime" = yes])
+
+popdef([st_cv_runtime])
+popdef([st_cv_cc])
+popdef([CFLAG])
+popdef([HAVE_RUNTIME])
+popdef([MPERS_NAME])
+
+])