changeset 21600:184b85b31e03

more updates for version function * toplev.cc (F__octave_config_info__): New fields, build_time, fftw_version. * oct-fftw.cc, oct-fftw.h (octave_fftw_version): New function. * version.m: New option "-fftw". Fix release_date in tests * module.mk (libinterp/build-info.cc): Update rule. * build-info.h, build-info.in.cc (octave_build_date): Delete. (octave_build_time): Return Unix time instead of local clock time.
author mmuetzel <markus.muetzel@gmx.de>
date Sun, 10 Apr 2016 15:33:43 -0400
parents f29d68e24c5a
children 25fd18a15a6c
files libinterp/build-info.h libinterp/build-info.in.cc libinterp/corefcn/toplev.cc libinterp/module.mk liboctave/numeric/oct-fftw.cc liboctave/numeric/oct-fftw.h scripts/miscellaneous/version.m
diffstat 7 files changed, 31 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/build-info.h	Sun Apr 10 09:49:12 2016 -0700
+++ b/libinterp/build-info.h	Sun Apr 10 15:33:43 2016 -0400
@@ -1,4 +1,3 @@
-// %NO_EDIT_WARNING%
 /*
 
 Copyright (C) 2016 M. Muetzel
@@ -21,10 +20,10 @@
 
 */
 
+#include <ctime>
+
 #include <string>
 
 extern OCTAVE_API std::string octave_hg_id (void);
 
-extern OCTAVE_API std::string octave_build_date (void);
-
-extern OCTAVE_API std::string octave_build_time (void);
+extern OCTAVE_API time_t octave_build_time (void);
--- a/libinterp/build-info.in.cc	Sun Apr 10 09:49:12 2016 -0700
+++ b/libinterp/build-info.in.cc	Sun Apr 10 15:33:43 2016 -0400
@@ -33,14 +33,8 @@
   return "%OCTAVE_HG_ID%";
 }
 
-std::string
-octave_build_date (void)
-{
-  return __DATE__;
-}
-
-std::string
+time_t
 octave_build_time (void)
 {
-  return __TIME__;
+  return %OCTAVE_BUILD_TIME%;
 }
--- a/libinterp/corefcn/toplev.cc	Sun Apr 10 09:49:12 2016 -0700
+++ b/libinterp/corefcn/toplev.cc	Sun Apr 10 15:33:43 2016 -0400
@@ -45,6 +45,7 @@
 #include "lo-error.h"
 #include "lo-mappers.h"
 #include "oct-env.h"
+#include "oct-fftw.h"
 #include "oct-locbuf.h"
 #include "quit.h"
 #include "singleton-cleanup.h"
@@ -1423,13 +1424,13 @@
       { "api_version", OCTAVE_API_VERSION },
       { "archlibdir", subst_octave_home (OCTAVE_ARCHLIBDIR) },
       { "bindir", subst_octave_home (OCTAVE_BINDIR) },
-      { "build_date", octave_build_date () },
       { "build_time", octave_build_time () },
       { "canonical_host_type", OCTAVE_CANONICAL_HOST_TYPE },
       { "datadir", subst_octave_home (OCTAVE_DATADIR) },
       { "datarootdir", subst_octave_home (OCTAVE_DATAROOTDIR) },
       { "exec_prefix", subst_octave_home (OCTAVE_EXEC_PREFIX) },
       { "fcnfiledir", subst_octave_home (OCTAVE_FCNFILEDIR) },
+      { "fftw_version", octave_fftw_version () },
       { "hg_id", octave_hg_id () },
       { "imagedir", subst_octave_home (OCTAVE_IMAGEDIR) },
       { "includedir", subst_octave_home (OCTAVE_INCLUDEDIR) },
--- a/libinterp/module.mk	Sun Apr 10 09:49:12 2016 -0700
+++ b/libinterp/module.mk	Sun Apr 10 15:33:43 2016 -0400
@@ -267,7 +267,8 @@
 	$(AM_V_GEN)rm -f $@-t && \
 	$(SED) \
 	  -e "s|%NO_EDIT_WARNING%|DO NOT EDIT!  Generated automatically by Makefile|" \
-	  -e "s|%OCTAVE_HG_ID%|`cat $(builddir)/HG-ID`|" $< > $@-t && \
+	  -e "s|%OCTAVE_HG_ID%|`cat $(builddir)/HG-ID`|" \
+	  -e "s|%OCTAVE_BUILD_TIME%|`date +%s`|" $< > $@-t && \
 	$(simple_move_if_change_rule)
 
 libinterp/builtins.cc: $(DEF_FILES) libinterp/mkbuiltins | libinterp/$(octave-dirstamp)
--- a/liboctave/numeric/oct-fftw.cc	Sun Apr 10 09:49:12 2016 -0700
+++ b/liboctave/numeric/oct-fftw.cc	Sun Apr 10 15:33:43 2016 -0400
@@ -38,6 +38,7 @@
 #include "quit.h"
 #include "oct-locbuf.h"
 #include "singleton-cleanup.h"
+#include "libinterp/build-info.h"
 
 #if defined (HAVE_FFTW3_THREADS) || defined (HAVE_FFTW3F_THREADS)
 #  include "nproc.h"
@@ -1132,3 +1133,13 @@
 }
 
 #endif
+
+std::string
+octave_fftw_version (void)
+{
+#if defined (HAVE_FFTW)
+  return fftw_version;
+#else
+  return "none";
+#endif
+}
--- a/liboctave/numeric/oct-fftw.h	Sun Apr 10 09:49:12 2016 -0700
+++ b/liboctave/numeric/oct-fftw.h	Sun Apr 10 15:33:43 2016 -0400
@@ -364,4 +364,6 @@
   octave_fftw& operator = (const octave_fftw&);
 };
 
+extern OCTAVE_API std::string octave_fftw_version (void);
+
 #endif
--- a/scripts/miscellaneous/version.m	Sun Apr 10 09:49:12 2016 -0700
+++ b/scripts/miscellaneous/version.m	Sun Apr 10 15:33:43 2016 -0400
@@ -40,6 +40,9 @@
 ## @item @qcode{"-java"}
 ## for version information of the Java VM,
 ##
+## @item @qcode{"-fftw"}
+## for version information for the linked FFTW,
+##
 ## @item @qcode{"-blas"}
 ## for version information for the linked BLAS (not implemented),
 ##
@@ -64,12 +67,12 @@
     vs = OCTAVE_VERSION;
 
     if (nargout > 1)
-      d = __octave_config_info__.releasedate;
+      d = __octave_config_info__ ("release_date");
     end
   else
     switch (feature)
       case "-date"
-        vs = __octave_config_info__.releasedate;
+        vs = __octave_config_info__ ("release_date");
       case "-description"
         vs = "";
       case "-release"
@@ -88,6 +91,8 @@
         catch
           vs = "no java available";
         end_try_catch
+      case "-fftw"
+        vs = __octave_config_info__ ("fftw_version");
       case "-blas"
         vs = "";
         warning(["version: option '" feature "' not implemented"])
@@ -99,18 +104,15 @@
     endswitch
   endif
 
-
 endfunction
 
-
 %!assert (ischar (version ()))
 
 %!test
 %! [v, d] = version ();
 %! assert (v, OCTAVE_VERSION)
-%! assert (d, __octave_config_info__.releasedate)
+%! assert (d, __octave_config_info__ ("release_date"))
 
-%!assert (version ("-date"), __octave_config_info__.releasedate)
+%!assert (version ("-date"), __octave_config_info__ ("release_date"))
 
 %!error version (1);
-