aboutsummaryrefslogtreecommitdiffstats
path: root/build/autoconf
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2011-12-20 22:47:56 +0000
committerMartin Matuska <mm@FreeBSD.org>2011-12-20 22:47:56 +0000
commit35fa5e2f58abd428bff0de1238364880447ef095 (patch)
tree07565a115ca59ea7230cd38e88901b0290750cde /build/autoconf
downloadsrc-35fa5e2f58abd428bff0de1238364880447ef095.tar.gz
src-35fa5e2f58abd428bff0de1238364880447ef095.zip
Vendor import of libarchive (release/2.8, r3824)
Notes
Notes: svn path=/vendor/libarchive/dist/; revision=228753
Diffstat (limited to 'build/autoconf')
-rw-r--r--build/autoconf/check_stdcall_func.m451
-rw-r--r--build/autoconf/la_uid_t.m420
2 files changed, 71 insertions, 0 deletions
diff --git a/build/autoconf/check_stdcall_func.m4 b/build/autoconf/check_stdcall_func.m4
new file mode 100644
index 000000000000..926b046c5330
--- /dev/null
+++ b/build/autoconf/check_stdcall_func.m4
@@ -0,0 +1,51 @@
+# AC_LANG_STDCALL_FUNC_LINK_TRY(FUNCTION, SIGNATURE)
+# -------------------------------
+# Produce a source which links correctly iff the FUNCTION exists.
+AC_DEFUN([AC_LANG_STDCALL_FUNC_LINK_TRY],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+# AC_CHECK_STDCALL_FUNC(FUNCTION, SIGNATURE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# -----------------------------------------------------------------
+AC_DEFUN([AC_CHECK_STDCALL_FUNC],
+[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl
+AC_CACHE_CHECK([for $1], ac_var,
+[AC_LINK_IFELSE([AC_LANG_STDCALL_FUNC_LINK_TRY([$1],[$2])],
+ [AS_VAR_SET(ac_var, yes)],
+ [AS_VAR_SET(ac_var, no)])])
+AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl
+AS_VAR_POPDEF([ac_var])dnl
+])# AC_CHECK_FUNC
+
+# AC_LANG_STDCALL_FUNC_LINK_TRY(C)(FUNCTION, SIGNATURE)
+# ----------------------------------
+# Don't include <ctype.h> because on OSF/1 3.0 it includes
+# <sys/types.h> which includes <sys/select.h> which contains a
+# prototype for select. Similarly for bzero.
+m4_define([AC_LANG_STDCALL_FUNC_LINK_TRY(C)],
+[AC_LANG_PROGRAM(
+[/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char __stdcall $1 ( $2 ) below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char __stdcall $1 ( $2 );
+char (*f) ( $2 );
+],
+[/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$1) || defined (__stub___$1)
+choke me
+#else
+f = $1;
+#endif
+])])
+
+# AC_LANG_STDCALL_FUNC_LINK_TRY(C++)(FUNCTION)
+# ------------------------------------
+m4_copy([AC_LANG_STDCALL_FUNC_LINK_TRY(C)], [AC_LANG_STDCALL_FUNC_LINK_TRY(C++)])
+
diff --git a/build/autoconf/la_uid_t.m4 b/build/autoconf/la_uid_t.m4
new file mode 100644
index 000000000000..31eef5e96fcb
--- /dev/null
+++ b/build/autoconf/la_uid_t.m4
@@ -0,0 +1,20 @@
+# la_TYPE_UID_T
+# -------------
+AC_DEFUN([la_TYPE_UID_T],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_CACHE_CHECK(for uid_t in sys/types.h, la_cv_type_uid_t,
+[AC_EGREP_HEADER(uid_t, sys/types.h,
+ la_cv_type_uid_t=yes, la_cv_type_uid_t=no)])
+if test $la_cv_type_uid_t = no; then
+ case $host in
+ *mingw*) def_uid_t=short ;;
+ *) def_uid_t=int ;;
+ esac
+ AC_DEFINE_UNQUOTED(uid_t, [$def_uid_t],
+ [Define to match typeof st_uid field of struct stat if <sys/types.h> doesn't define.])
+ AC_DEFINE_UNQUOTED(gid_t, [$def_uid_t],
+ [Define to match typeof st_gid field of struct stat if <sys/types.h> doesn't define.])
+fi
+])
+AU_ALIAS([AC_TYPE_UID_T], [la_TYPE_UID_T])
+