-AC_DEFUN([AX_UUID_GENERATE_TIME_SAFE], [
- AC_CACHE_CHECK([check for uuid_generate_time_safe], [ax_cv_uuid_generate_time_safe], [
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="-luuid"
- AC_LANG_PUSH([C])
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([
-#include <uuid/uuid.h>
- ], [
- uuid_t out;
- uuid_generate_time_safe(out);
- ]), [ax_cv_uuid_generate_time_safe=yes ], [ax_cv_uuid_generate_time_safe=no ]
+AC_DEFUN([AX_UUID], [
+ AC_CHECK_HEADER([uuid/uuid.h], [
+ AC_CACHE_CHECK([check to see if we need -luuid], [ax_cv_libuuid_is_required], [
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="-luuid"
+ AC_LANG_PUSH([C])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
+ uuid_t out;
+ uuid_generate(out);
+ ])],
+ [ax_cv_libuuid_is_required=yes],
+ [])
+ AC_LANG_POP
+ LDFLAGS="$save_LDFLAGS"
+ ])
+ AS_IF([test x"ax_cv_libuuid_is_required" = xyes], [
+ LIBUUID_LDFLAGS="-luuid"
+ UUID_UUID_H=yes
+ ],[
+ AC_CACHE_CHECK([check to see if -luuid is not needed], [ax_cv_libuuid_is_not_required], [
+ AC_LANG_PUSH([C])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
+ uuid_t out;
+ uuid_generate(out);
+ ])],
+ [ax_cv_libuuid_is_not_required=yes],
+ [ax_cv_libuuid_is_not_required=no])
+ AC_LANG_POP
+ ])
+ AS_IF([test x"ax_cv_libuuid_is_not_required" = xyes], [UUID_UUID_H=yes], [UUID_UUID_H=])
+ ])
+ ], [UUID_UUID_H=])
+
+AS_IF([test x"$UUID_UUID_H" = xyes], [
+ AC_DEFINE([HAVE_UUID_UUID_H], [ 1 ], [Have uuid/uuid.h])
+ ],[
+ AC_DEFINE([HAVE_UUID_UUID_H], [ 0 ], [Have uuid/uuid.h])