1 # ===========================================================================
3 # ===========================================================================
8 # AX_UUID_GENERATE_TIME_SAFE
12 # Check for uuid, and uuid_generate_time_safe support.
16 # Copyright (c) 2012 Brian Aker <brian@tangent.org>
18 # Copying and distribution of this file, with or without modification, are
19 # permitted in any medium without royalty provided the copyright notice
20 # and this notice are preserved. This file is offered as-is, without any
26 AC_CHECK_HEADER([uuid/uuid.h], [
27 AC_CACHE_CHECK([check to see if -luuid is not needed], [ax_cv_libuuid_is_required], [
30 AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
34 [ax_cv_libuuid_is_required=no],
35 [ax_cv_libuuid_is_required=maybe],
36 [AC_MSG_WARN([test program execution failed])])
40 AS_IF([test "$ax_cv_libuuid_is_required" = maybe], [
41 AC_CACHE_CHECK([check to see if -luuid is needed], [ax_cv_libuuid_works], [
46 AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
50 [ax_cv_libuuid_works=yes],
51 [ax_cv_libuuid_works=no],
52 [AC_MSG_WARN([test program execution failed])])
56 AS_IF([test "$ax_cv_libuuid_works" = yes], [
57 AC_SUBST([LIBUUID_LDFLAGS],[-luuid])])
60 AS_IF([test "$ax_cv_libuuid_is_required" = no], [UUID_UUID_H=yes])
61 AS_IF([test "$ax_cv_libuuid_works" = yes], [UUID_UUID_H=yes])
64 AS_IF([test "$UUID_UUID_H" = yes], [
65 AC_DEFINE([HAVE_UUID_UUID_H], [1], [Have uuid/uuid.h])
67 AC_DEFINE([HAVE_UUID_UUID_H], [0], [Have uuid/uuid.h])
71 AC_DEFUN([AX_UUID_GENERATE_TIME_SAFE], [
73 AC_CACHE_CHECK([for uuid_generate_time_safe], [ax_cv_uuid_generate_time_safe], [
75 LIBS="$LIBUUID_LDFLAGS $LIBS"
78 AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
80 uuid_generate_time_safe(out);
82 [ax_cv_uuid_generate_time_safe=yes],
83 [ax_cv_uuid_generate_time_safe=no],
84 [AC_MSG_WARN([test program execution failed])])
89 AS_IF([test "$ax_cv_uuid_generate_time_safe" = yes],[
90 AC_DEFINE(HAVE_UUID_GENERATE_TIME_SAFE,[1],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])],[
91 AC_DEFINE(HAVE_UUID_GENERATE_TIME_SAFE,[0],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])