1 # vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
2 # ===========================================================================
3 # https://github.com/BrianAker/ddm4
4 # ===========================================================================
9 # AX_UUID_GENERATE_TIME_SAFE()
13 # Check for uuid, and uuid_generate_time_safe support.
17 # Copyright (c) 2012 Brian Aker <brian@tangent.org>
19 # Copying and distribution of this file, with or without modification, are
20 # permitted in any medium without royalty provided the copyright notice
21 # and this notice are preserved. This file is offered as-is, without any
28 AC_CHECK_HEADER([uuid/uuid.h],[
30 AC_CACHE_CHECK([check to see if -luuid is needed], [ax_cv_libuuid_is_required],
33 [AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
37 [ax_cv_libuuid_is_required=no],
38 [ax_cv_libuuid_is_required=yes],
39 [AC_MSG_WARN([test program execution failed])])
43 AS_IF([test "$ax_cv_libuuid_is_required" = yes],
44 [AC_CACHE_CHECK([check to see if -luuid is needed], [ax_cv_libuuid_works],
49 [AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
53 [ax_cv_libuuid_works=yes],
54 [ax_cv_libuuid_works=no],
55 [AC_MSG_WARN([test program execution failed])])
60 AS_IF([test "$ax_cv_libuuid_is_required" = yes],
61 [AS_IF([test "$ax_cv_libuuid_works" = yes],[ax_libuuid=yes])],
65 AS_IF([test "x$ax_libuuid" = xyes],
66 [AC_DEFINE([HAVE_UUID_UUID_H],[1],[Have uuid/uuid.h])
67 AS_IF([test "x$ax_cv_libuuid_is_required" = xyes],[ LIBUUID_LIB='-luuid' ])],
68 [AC_DEFINE([HAVE_UUID_UUID_H],[0],[Have uuid/uuid.h])
71 AC_SUBST([LIBUUID_LIB])
72 AM_CONDITIONAL([HAVE_LIBUUID],[test "x$ax_libuuid" = xyes])
75 AC_DEFUN([AX_UUID_GENERATE_TIME_SAFE],
77 AC_REQUIRE([AX_UUID])dnl
78 AC_CACHE_CHECK([for uuid_generate_time_safe],
79 [ax_cv_uuid_generate_time_safe],
81 LIBS="$LIBUUID_LIB $LIBS"
84 AC_LANG_PROGRAM([#include <uuid/uuid.h>],[
86 uuid_generate_time_safe(out);
88 [ax_cv_uuid_generate_time_safe=yes],
89 [ax_cv_uuid_generate_time_safe=no],
90 [AC_MSG_WARN([test program execution failed])])
95 AS_IF([test "$ax_cv_uuid_generate_time_safe" = yes],
96 [AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE],[1],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])],
97 [AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE],[0],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])])