| 1 | # Copyright (c) 2005-2008 David Carter <dcarter@arm4.org> and others. |
|---|
| 2 | # All rights reserved. This program and the accompanying materials |
|---|
| 3 | # are made available under the terms of the Eclipse Public License v1.0 |
|---|
| 4 | # which accompanies this distribution, and is available at |
|---|
| 5 | # http://www.eclipse.org/legal/epl-v10.html |
|---|
| 6 | |
|---|
| 7 | # Check for the uuid headers, and wether -luuid is required |
|---|
| 8 | |
|---|
| 9 | AC_DEFUN([__ARM4_UUID_H_CHECKLINK], |
|---|
| 10 | [ |
|---|
| 11 | UUID_LIBS="$1" |
|---|
| 12 | ac_save_LIBS="$LIBS" |
|---|
| 13 | LIBS="$LIBS $UUID_LIBS" |
|---|
| 14 | __arm4_uuid_linked="no" |
|---|
| 15 | AC_LINK_IFELSE([ |
|---|
| 16 | #include <uuid.h> |
|---|
| 17 | |
|---|
| 18 | main () |
|---|
| 19 | { |
|---|
| 20 | uuid_t uuid; |
|---|
| 21 | |
|---|
| 22 | uuid_generate (uuid); |
|---|
| 23 | } |
|---|
| 24 | ],[__arm4_uuid_linked="yes"],[UUID_LIBS=""]) |
|---|
| 25 | LIBS="$ac_save_libs" |
|---|
| 26 | AC_SUBST(UUID_LIBS) |
|---|
| 27 | ]) |
|---|
| 28 | |
|---|
| 29 | AC_DEFUN([__ARM4_UUID_UUID_H_CHECKLINK], |
|---|
| 30 | [ |
|---|
| 31 | UUID_LIBS="$1" |
|---|
| 32 | ac_save_LIBS="$LIBS" |
|---|
| 33 | LIBS="$LIBS $UUID_LIBS" |
|---|
| 34 | __arm4_uuid_linked="no" |
|---|
| 35 | AC_LINK_IFELSE([ |
|---|
| 36 | #include <uuid/uuid.h> |
|---|
| 37 | |
|---|
| 38 | main () |
|---|
| 39 | { |
|---|
| 40 | uuid_t uuid; |
|---|
| 41 | |
|---|
| 42 | uuid_generate (uuid); |
|---|
| 43 | } |
|---|
| 44 | ],[__arm4_uuid_linked="yes"],[UUID_LIBS=""]) |
|---|
| 45 | LIBS="$ac_save_libs" |
|---|
| 46 | AC_SUBST(UUID_LIBS) |
|---|
| 47 | ]) |
|---|
| 48 | |
|---|
| 49 | AC_DEFUN([ARM4_CHECK_UUID], |
|---|
| 50 | [ |
|---|
| 51 | arm4_uuid_h=no |
|---|
| 52 | arm4_uuid_uuid_h=no |
|---|
| 53 | __arm4_uuid_linked="no" |
|---|
| 54 | AC_CHECK_HEADER([uuid.h],[arm4_uuid_h=yes],,) |
|---|
| 55 | AC_CHECK_HEADER([uuid/uuid.h],[arm4_uuid_uuid_h=yes],,) |
|---|
| 56 | if test "$arm4_uuid_h" = "yes" ; then |
|---|
| 57 | __ARM4_UUID_H_CHECKLINK([-luuid]) |
|---|
| 58 | if test "$__arm4_uuid_linked" = "no" ; then |
|---|
| 59 | __ARM4_UUID_H_CHECKLINK([]) |
|---|
| 60 | fi |
|---|
| 61 | fi |
|---|
| 62 | if test "$__arm4_uuid_linked" = "no" ; then |
|---|
| 63 | arm4_uuid_h=no |
|---|
| 64 | if test "$arm4_uuid_uuid_h" = "yes" ; then |
|---|
| 65 | __ARM4_UUID_UUID_H_CHECKLINK([-luuid]) |
|---|
| 66 | if test "$__arm4_uuid_linked" = "no" ; then |
|---|
| 67 | __ARM4_UUID_UUID_H_CHECKLINK([]) |
|---|
| 68 | fi |
|---|
| 69 | if test "$__arm4_uuid_linked" = "no" ; then |
|---|
| 70 | arm4_uuid_uuid_h=no |
|---|
| 71 | fi |
|---|
| 72 | fi |
|---|
| 73 | fi |
|---|
| 74 | if test "$__arm4_uuid_linked" = "no" ; then |
|---|
| 75 | AC_MSG_ERROR([this platform doesn't support uuid generation]) |
|---|
| 76 | fi |
|---|
| 77 | if test "$arm4_uuid_h" = "yes" ; then |
|---|
| 78 | AC_DEFINE(HAVE_UUID_H, 1, |
|---|
| 79 | [Define to 1 if you have the <uuid.h> header file.]) |
|---|
| 80 | fi |
|---|
| 81 | if test "$arm4_uuid_uuid_h" = "yes" ; then |
|---|
| 82 | AC_DEFINE(HAVE_UUID_UUID_H, 1, |
|---|
| 83 | [Define to 1 if you have the <uuid/uuid.h> header file.]) |
|---|
| 84 | fi |
|---|
| 85 | ]) |
|---|