Index: Source/GNUmakefile
===================================================================
--- Source/GNUmakefile	(revision 36751)
+++ Source/GNUmakefile	(working copy)
@@ -283,6 +283,7 @@
 NSURLProtocol.m \
 NSURLRequest.m \
 NSURLResponse.m \
+NSUUID.m \
 NSTextCheckingResult.m\
 NSURLHandle.m \
 NSUserDefaults.m \
@@ -445,6 +446,7 @@
 NSURLResponse.h \
 NSUserDefaults.h \
 NSUtilities.h \
+NSUUID.h \
 NSValue.h \
 NSValueTransformer.h \
 NSXMLDocument.h \
Index: Source/NSUUID.m
===================================================================
--- Source/NSUUID.m	(revision 0)
+++ Source/NSUUID.m	(revision 0)
@@ -0,0 +1,181 @@
+/* Implementation for NSUUID for GNUStep                                                            
+   Copyright (C) 2013 Free Software Foundation, Inc.                                           
+                                                                                               
+   Written by:  Eric Wasylishen <ewasylishen@gmail.com>                                        
+   Created: June 2013                                                                          
+                                                                                               
+   This file is part of the GNUstep Base Library.                                              
+                                                                                               
+   This library is free software; you can redistribute it and/or                               
+   modify it under the terms of the GNU Lesser General Public                                  
+   License as published by the Free Software Foundation; either                                
+   version 3 of the License, or (at your option) any later version.                            
+                                                                                               
+   This library is distributed in the hope that it will be useful,                             
+   but WITHOUT ANY WARRANTY; without even the implied warranty of                              
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                           
+   Library General Public License for more details.                                            
+                                                                                               
+   You should have received a copy of the GNU Lesser General Public                            
+   License along with this library; if not, write to the Free                                  
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,                                 
+   Boston, MA 02111 USA.                                                                       
+*/
+
+#import <Foundation/NSUUID.h>
+
+#if GS_USE_UUID == 1
+
+@implementation NSUUID
+
+static Class NSUUIDClass;
+
++ (void) initialize
+{
+  if (self == [NSUUID class])
+    {
+      NSUUIDClass = self;
+    }
+}
+
++ (NSUUID *) UUID
+{
+  return [[[NSUUID alloc] init] autorelease];
+}
+
+- (id) init
+{
+  if (nil == (self = [super init]))
+    {
+      return nil;
+    }
+
+  uuid_generate_random(_uuid);
+
+  return self;
+}
+
+- (id) initWithUUIDBytes: (const uuid_t)aUUID
+{
+  if (nil == (self = [super init]))
+    {
+      return nil;
+    }
+
+  uuid_copy(_uuid, aUUID);
+  
+  return self;
+}
+- (id) initWithUUIDString: (NSString *)aString
+{
+  if (nil == (self = [super init]))
+    {
+      return nil;
+    }
+
+  if (nil == aString)
+    {
+      return self;
+    }
+
+  if (0 != uuid_parse([aString UTF8String], _uuid))
+    {
+      [self release];
+      return nil;
+    }
+
+  return self;
+}
+
+- (void) getUUIDBytes: (uuid_t)bytesOut
+{
+  uuid_copy(bytesOut, _uuid);
+}
+
+- (NSString *) UUIDString
+{
+  char cstring[37];
+  uuid_unparse_upper(_uuid, cstring);
+  return [NSString stringWithUTF8String: cstring];
+}
+
+- (id) copyWithZone: (NSZone *)zone
+{
+  return [self retain];
+}
+
+- (NSUInteger) hash
+{
+  NSUInteger result = 0;
+  memcpy(&result, _uuid, MIN(sizeof(uuid_t), sizeof(NSUInteger)));
+  return result;
+}
+
+- (BOOL) isEqual: (id)anObject
+{
+  if (anObject == self)
+    {
+      return YES;
+    }
+  else if (object_getClass(anObject) == NSUUIDClass)
+    {
+      return (0 == uuid_compare(_uuid, ((NSUUID *)anObject)->_uuid));
+    }
+  else if ([anObject isKindOfClass: NSUUIDClass])
+    {
+      uuid_t temp;
+      [anObject getUUIDBytes: temp];
+      return (0 == uuid_compare(_uuid, temp)); 
+    }
+  return NO;
+}
+
+- (NSString *) description
+{
+  return [self UUIDString];
+}
+
+/* NSCoding Protocol */
+
+- (void) encodeWithCoder: (NSCoder*)aCoder
+{
+  if ([aCoder allowsKeyedCoding])
+    {
+      [aCoder encodeBytes: _uuid length: 16 forKey: @"NS.uuidbytes"];
+    }
+  else
+    {
+      [aCoder encodeBytes: _uuid length: 16];
+    }
+}
+
+- (id) initWithCoder: (NSCoder*)aCoder
+{
+  if ([aCoder allowsKeyedCoding])
+    {
+      if ([aCoder containsValueForKey: @"NS.uuidbytes"])
+        {
+	  NSUInteger length = 0;
+	  const uint8_t *bytes = [aCoder decodeBytesForKey: @"NS.uuidbytes" returnedLength: &length];
+	  if (length == 16)
+	    {
+	      self = [self initWithUUIDBytes: bytes];
+	    }
+	}
+    }
+  else
+    {
+      NSUInteger length = 0;
+      const uint8_t *bytes = [aCoder decodeBytesWithReturnedLength: &length];
+      if (length == 16)
+	{
+	  self = [self initWithUUIDBytes: bytes];
+	}
+    }
+  return self;
+}
+
+@end
+
+#endif /* GS_USE_UUID == 1 */
+
Index: configure.ac
===================================================================
--- configure.ac	(revision 36751)
+++ configure.ac	(working copy)
@@ -3122,7 +3122,37 @@
 fi
 AC_SUBST(HAVE_GNUTLS)
 
+#--------------------------------------------------------------------
+# Check libuuid.
 #--------------------------------------------------------------------
+AC_ARG_ENABLE(uuid,
+  [  --disable-uuid			Disable use of libuuid],,
+  enable_uuid=yes)
+
+if test $enable_uuid = yes; then
+  HAVE_UUID=0
+
+  if test $PKGCONFIG = yes; then
+    if pkg-config --exists uuid; then
+      HAVE_UUID=1
+      UUID_CFLAGS=`pkg-config --cflags uuid`
+      UUID_LIBS=`pkg-config --libs uuid`
+ 
+      CPPFLAGS="$CPPFLAGS $UUID_CFLAGS"
+      INCLUDE_FLAGS="$INCLUDE_FLAGS $UUID_CFLAGS"
+      LIBS="$UUID_LIBS $LIBS"
+      LDFLAGS="$LDFLAGS $UUID_LIBS"
+      LDIR_FLAGS="$LDIR_FLAGS $UUID_LIBS"
+    fi
+  fi
+else
+  AC_MSG_WARN([Disabled support for NSUUID.])
+  HAVE_UUID=0
+fi
+AC_SUBST(HAVE_UUID)
+
+
+#--------------------------------------------------------------------
 # Check for NSNetServices
 # See DEPENDENCIES POLICY at the start of this file.
 #--------------------------------------------------------------------
Index: Headers/GNUstepBase/GSConfig.h.in
===================================================================
--- Headers/GNUstepBase/GSConfig.h.in	(revision 36751)
+++ Headers/GNUstepBase/GSConfig.h.in	(working copy)
@@ -234,6 +234,7 @@
 #define GS_USE_AVAHI @HAVE_AVAHI@
 #define GS_USE_MDNS @HAVE_MDNS@
 #define GS_USE_ICU @HAVE_ICU@
+#define GS_USE_UUID @HAVE_UUID@
 #define GS_USE_LIBDISPATCH @HAVE_LIBDISPATCH@
 #define GS_HAVE_OBJC_ROOT_CLASS_ATTR @GS_HAVE_OBJC_ROOT_CLASS_ATTR@
 
Index: Headers/Foundation/NSUUID.h
===================================================================
--- Headers/Foundation/NSUUID.h	(revision 0)
+++ Headers/Foundation/NSUUID.h	(revision 0)
@@ -0,0 +1,67 @@
+/* Interface for NSUUID for GNUStep
+   Copyright (C) 2013 Free Software Foundation, Inc.
+
+   Written by:  Eric Wasylishen <ewasylishen@gmail.com>
+   Created: June 2013
+
+   This file is part of the GNUstep Base Library.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02111 USA.
+*/
+
+#ifndef __NSUUID_h_GNUSTEP_BASE_INCLUDE
+#define __NSUUID_h_GNUSTEP_BASE_INCLUDE
+
+#import  <GNUstepBase/GSConfig.h>
+
+#if GS_USE_UUID == 1
+
+#import <Foundation/NSObject.h>
+#import <Foundation/NSCoder.h>
+
+#include <uuid/uuid.h>
+
+#if     defined(__cplusplus)
+extern "C" {
+#endif
+
+#if OS_API_VERSION(100800, GS_API_LATEST)
+
+@interface NSUUID : NSObject <NSCopying, NSCoding>
+{
+  uuid_t _uuid;
+}
+
++ (NSUUID *) UUID;
+
+- (id) init;
+- (id) initWithUUIDBytes: (const uuid_t)aUUID;
+- (id) initWithUUIDString: (NSString *)aString;
+
+- (void) getUUIDBytes: (uuid_t)bytesOut;
+- (NSString *) UUIDString;
+
+@end
+
+#endif /* OS_API_VERSION(100800, GS_API_LATEST) */
+
+#if     defined(__cplusplus)
+}
+#endif
+
+#endif /* GS_USE_UUID == 1 */
+
+#endif /*__NSUUID_h_GNUSTEP_BASE_INCLUDE */
Index: Headers/Foundation/Foundation.h
===================================================================
--- Headers/Foundation/Foundation.h	(revision 36751)
+++ Headers/Foundation/Foundation.h	(working copy)
@@ -131,6 +131,7 @@
 #import	<Foundation/NSURLRequest.h>
 #import	<Foundation/NSURLResponse.h>
 #import	<Foundation/NSUserDefaults.h>
+#import <Foundation/NSUUID.h>
 #import	<Foundation/NSValue.h>
 #import	<Foundation/NSValueTransformer.h>
 #import <Foundation/NSXMLDocument.h>
Index: Tests/base/NSUUID/testUUID.plist
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: Tests/base/NSUUID/testUUID.plist
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: Tests/base/NSUUID/TestInfo
===================================================================
Index: Tests/base/NSUUID/basic.m
===================================================================
--- Tests/base/NSUUID/basic.m	(revision 0)
+++ Tests/base/NSUUID/basic.m	(revision 0)
@@ -0,0 +1,76 @@
+#import "ObjectTesting.h"
+#import <Foundation/Foundation.h>
+
+int main()
+{
+  START_SET("NSUUID")
+
+#if GS_USE_UUID == 1
+  NSAutoreleasePool   *arp = [NSAutoreleasePool new];
+
+  NSUUID *randomUUID = [NSUUID UUID];
+  uuid_t fixedUUIDBytes = {220,166,55,145,158,164,79,6,131,53,141,85,167,251,179,42};
+  NSUUID *fixedUUID = [[[NSUUID alloc] initWithUUIDBytes: fixedUUIDBytes] autorelease];
+    
+  // Very easy check that we can create 1,000,000 UUIDs with no duplicates.
+  // Also, try storing them in NSMutableSet.
+  {
+    NSMutableSet *set = [NSMutableSet set];
+    int i;
+    for (i=0; i<1000000; i++) {
+      [set addObject: [NSUUID UUID]];
+    }
+    PASS([set count] == 1000000, "test UUIDs don't collide in set");
+  }
+    
+  // Test copying
+    
+  PASS([randomUUID isEqual: [[randomUUID copy] autorelease]], "test copy is equal to original");
+    
+  // Test -initWithUUIDBytes:
+  {
+    uuid_t raw;
+    [randomUUID getUUIDBytes: raw];
+        
+    NSUUID *uuid2 = [[NSUUID alloc] initWithUUIDBytes: raw];
+    PASS([randomUUID isEqual: uuid2], "test getUUIDBytes: round trip");
+    [uuid2 release];
+  }
+
+  // Test string IO    
+  {
+    PASS([@"DCA63791-9EA4-4F06-8335-8D55A7FBB32A" isEqual: [fixedUUID UUIDString]], "test UUIDString");
+        
+    NSUUID *fixedUUID2 = [[[NSUUID alloc] initWithUUIDString: @"DCA63791-9EA4-4F06-8335-8D55A7FBB32A"] autorelease];
+    PASS([fixedUUID isEqual: fixedUUID2], "test UUIDString round trip");
+        
+    PASS(nil == [[[NSUUID alloc] initWithUUIDString: @""] autorelease], "test empty string init");
+    PASS(nil == [[[NSUUID alloc] initWithUUIDString: @"abc"] autorelease], "test garbage string init");
+  }
+    
+  // Test null UUID    
+  {
+    uuid_t nullUUIDBytes;
+    memset(nullUUIDBytes, 0, 16);
+    NSUUID *nullUUID = [[[NSUUID alloc] initWithUUIDBytes: nullUUIDBytes] autorelease];
+    PASS([nullUUID isEqual: [[[NSUUID alloc] initWithUUIDString: nil] autorelease]], "test init with null");
+  }
+    
+  // Test NSCoding
+  {
+    NSData *arData = [NSKeyedArchiver archivedDataWithRootObject: fixedUUID];
+    NSUUID *unarchived = [NSKeyedUnarchiver unarchiveObjectWithData: arData];
+    PASS([fixedUUID isEqual: unarchived], "test NSCoding");
+        
+    NSUUID *unarchived2 = [NSKeyedUnarchiver unarchiveObjectWithFile: @"testUUID.plist"];
+    PASS([fixedUUID isEqual: unarchived2], "test NSCoding from file");
+  }
+
+  [arp release]; arp = nil;
+#else
+  SKIP("gnustep-base was not built with libuuid, so NSUUID is not available.")
+#endif
+  END_SET("NSUUID")
+
+  return 0;
+}
