[svn:parrot] r49378 - in trunk: . config/auto config/auto/timespec include/parrot lib/Parrot/Configure/Step
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Wed Sep 29 05:00:06 UTC 2010
Author: plobsing
Date: Wed Sep 29 05:00:01 2010
New Revision: 49378
URL: https://trac.parrot.org/parrot/changeset/49378
Log:
test for timespec directly in stead of guessing at internal details of system headers
Added:
trunk/config/auto/timespec/
trunk/config/auto/timespec.pm
trunk/config/auto/timespec/test_c.in
Modified:
trunk/MANIFEST
trunk/include/parrot/thr_windows.h
trunk/include/parrot/thread.h
trunk/lib/Parrot/Configure/Step/List.pm
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST Wed Sep 29 04:45:39 2010 (r49377)
+++ trunk/MANIFEST Wed Sep 29 05:00:01 2010 (r49378)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Wed Sep 29 02:26:09 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Wed Sep 29 04:41:54 2010 UT
#
# See below for documentation on the format of this file.
#
@@ -248,6 +248,8 @@
config/auto/snprintf/test_c.in []
config/auto/socklen_t.pm []
config/auto/thread.pm []
+config/auto/timespec.pm []
+config/auto/timespec/test_c.in []
config/auto/va_ptr.pm []
config/auto/va_ptr/test_c.in []
config/auto/warnings.pm []
Added: trunk/config/auto/timespec.pm
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/config/auto/timespec.pm Wed Sep 29 05:00:01 2010 (r49378)
@@ -0,0 +1,57 @@
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+config/auto/timespec.pm - Timespec detection
+
+=head1 DESCRIPTION
+
+Determining if the system has C<struct timespec> defined.
+
+=cut
+
+package auto::timespec;
+
+use strict;
+use warnings;
+
+use base qw(Parrot::Configure::Step);
+
+use Parrot::Configure::Utils ':auto';
+
+sub _init {
+ my $self = shift;
+ my %data;
+ $data{description} = q{Does your system has timespec};
+ $data{result} = q{};
+ return \%data;
+}
+
+sub runstep {
+ my ( $self, $conf ) = @_;
+
+ $conf->cc_gen('config/auto/timespec/test_c.in');
+ eval { $conf->cc_build(); };
+ if ($@) {
+ $conf->data->set( HAS_TIMESPEC => 0 );
+ $self->set_result('no');
+ }
+ else {
+ $conf->data->set( HAS_TIMESPEC => 1 );
+ $self->set_result('yes');
+ }
+ $conf->cc_clean();
+
+ return 1;
+}
+
+1;
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
+
Added: trunk/config/auto/timespec/test_c.in
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/config/auto/timespec/test_c.in Wed Sep 29 05:00:01 2010 (r49378)
@@ -0,0 +1,26 @@
+/*
+Copyright (C) 2008-2009, Parrot Foundation.
+$Id$
+
+seeing if struct timespec exists
+
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+int
+main()
+{
+ struct timespec ts;
+ printf("OK: %d", sizeof ts);
+ return EXIT_SUCCESS;
+}
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: trunk/include/parrot/thr_windows.h
==============================================================================
--- trunk/include/parrot/thr_windows.h Wed Sep 29 04:45:39 2010 (r49377)
+++ trunk/include/parrot/thr_windows.h Wed Sep 29 05:00:01 2010 (r49378)
@@ -119,13 +119,12 @@
typedef void (*Cleanup_Handler)(void *);
-#ifndef _TIMESPEC_DEFINED
-# define _TIMESPEC_DEFINED
+#if ! PARROT_HAS_TIMESPEC
struct timespec {
time_t tv_sec;
long tv_nsec;
};
-#endif /* _TIMESPEC_DEFINED */
+#endif /* PARROT_HAS_TIMESPEC */
#endif /* PARROT_THR_WINDOWS_H_GUARD */
Modified: trunk/include/parrot/thread.h
==============================================================================
--- trunk/include/parrot/thread.h Wed Sep 29 04:45:39 2010 (r49377)
+++ trunk/include/parrot/thread.h Wed Sep 29 05:00:01 2010 (r49378)
@@ -46,13 +46,12 @@
typedef void (*Cleanup_Handler)(void *);
-# ifndef __timespec_defined
-# define __timespec_defined
+# if ! PARROT_HAS_TIMESPEC
struct timespec {
time_t tv_sec;
long tv_nsec;
};
-# endif /* __timespec_defined */
+# endif /* PARROT_HAS_TIMESPEC */
#endif /* PARROT_HAS_THREADS */
Modified: trunk/lib/Parrot/Configure/Step/List.pm
==============================================================================
--- trunk/lib/Parrot/Configure/Step/List.pm Wed Sep 29 04:45:39 2010 (r49377)
+++ trunk/lib/Parrot/Configure/Step/List.pm Wed Sep 29 05:00:01 2010 (r49378)
@@ -47,6 +47,7 @@
auto::socklen_t
auto::neg_0
auto::env
+ auto::timespec
auto::thread
auto::gmp
auto::readline
More information about the parrot-commits
mailing list