=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: build: Add VKD3D_CHECK_FUNC() macro.

Alexandre Julliard julliard at winehq.org
Thu Jan 11 15:34:06 CST 2018


Module: vkd3d
Branch: master
Commit: 54dd3217294c1a3836b7d52a1e7d8f66674772ed
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=54dd3217294c1a3836b7d52a1e7d8f66674772ed

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Thu Jan 11 17:03:45 2018 +0100

build: Add VKD3D_CHECK_FUNC() macro.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 configure.ac                  |  8 ++++----
 m4/check-builtin-functions.m4 | 39 ---------------------------------------
 m4/check-functions.m4         |  9 +++++++++
 3 files changed, 13 insertions(+), 43 deletions(-)

diff --git a/configure.ac b/configure.ac
index d13b440..5614f79 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,10 +79,10 @@ AS_IF([test "x$with_spirv_tools" = "xyes"],
 PKG_CHECK_MODULES([XCB], [xcb xcb-keysyms])
 
 dnl Check for functions
-VKD3D_CHECK_BUILTIN_CLZ
-VKD3D_CHECK_BUILTIN_POPCOUNT
-VKD3D_CHECK_SYNC_ADD_AND_FETCH_FUNC
-VKD3D_CHECK_SYNC_SUB_AND_FETCH_FUNC
+VKD3D_CHECK_FUNC([HAVE_BUILTIN_CLZ], [__builtin_clz], [__builtin_clz(0)])
+VKD3D_CHECK_FUNC([HAVE_BUILTIN_POPCOUNT], [__builtin_popcount], [__builtin_popcount(0)])
+VKD3D_CHECK_FUNC([HAVE_SYNC_ADD_AND_FETCH], [__sync_add_and_fetch], [__sync_add_and_fetch((int *)0, 0)])
+VKD3D_CHECK_FUNC([HAVE_SYNC_SUB_AND_FETCH], [__sync_sub_and_fetch], [__sync_sub_and_fetch((int *)0, 0)])
 
 AM_CONDITIONAL([HAS_CROSSTARGET32], [test "x$CROSSTARGET32" != "xno"])
 AM_CONDITIONAL([HAS_CROSSTARGET64], [test "x$CROSSTARGET64" != "xno"])
diff --git a/m4/check-builtin-functions.m4 b/m4/check-builtin-functions.m4
deleted file mode 100644
index 2b24a80..0000000
--- a/m4/check-builtin-functions.m4
+++ /dev/null
@@ -1,39 +0,0 @@
-dnl VKD3D_CHECK_SYNC_ADD_AND_FETCH_FUNC
-AC_DEFUN([VKD3D_CHECK_SYNC_ADD_AND_FETCH_FUNC],
-[AC_MSG_CHECKING([for __sync_add_and_fetch])
-AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __sync_add_and_fetch((int *)0, 0); }])],
-               [AC_MSG_RESULT([yes])
-               AC_DEFINE([HAVE_SYNC_ADD_AND_FETCH],
-                         [1],
-                         [Define to 1 if you have __sync_add_and_fetch.])],
-               [AC_MSG_RESULT([no])])])
-
-dnl VKD3D_CHECK_SYNC_SUB_AND_FETCH_FUNC
-AC_DEFUN([VKD3D_CHECK_SYNC_SUB_AND_FETCH_FUNC],
-[AC_MSG_CHECKING([for __sync_sub_and_fetch])
-AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __sync_sub_and_fetch((int *)0, 0); }])],
-               [AC_MSG_RESULT([yes])
-               AC_DEFINE([HAVE_SYNC_SUB_AND_FETCH],
-                         [1],
-                         [Define to 1 if you have __sync_sub_and_fetch.])],
-               [AC_MSG_RESULT([no])])])
-
-dnl VKD3D_CHECK_BUILTIN_CLZ
-AC_DEFUN([VKD3D_CHECK_BUILTIN_CLZ],
-[AC_MSG_CHECKING([for __builtin_clz])
-AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_clz(0); }])],
-               [AC_MSG_RESULT([yes])
-               AC_DEFINE([HAVE_BUILTIN_CLZ],
-                         [1],
-                         [Define to 1 if you have __builtin_clz.])],
-               [AC_MSG_RESULT([no])])])
-
-dnl VKD3D_CHECK_BUILTIN_POPCOUNT
-AC_DEFUN([VKD3D_CHECK_BUILTIN_POPCOUNT],
-[AC_MSG_CHECKING([for __builtin_popcount])
-AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_popcount(0); }])],
-               [AC_MSG_RESULT([yes])
-               AC_DEFINE([HAVE_BUILTIN_POPCOUNT],
-                         [1],
-                         [Define to 1 if you have __builtin_popcount.])],
-               [AC_MSG_RESULT([no])])])
diff --git a/m4/check-functions.m4 b/m4/check-functions.m4
new file mode 100644
index 0000000..8bb8213
--- /dev/null
+++ b/m4/check-functions.m4
@@ -0,0 +1,9 @@
+dnl VKD3D_CHECK_FUNC
+AC_DEFUN([VKD3D_CHECK_FUNC],
+[AC_MSG_CHECKING([for $2])
+AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return [$3]; }])],
+               [AC_MSG_RESULT([yes])
+               AC_DEFINE([$1],
+                         [1],
+                         [Define to 1 if you have $2.])],
+               [AC_MSG_RESULT([no])])])




More information about the wine-cvs mailing list