Mercurial > octave
annotate libinterp/config-features.sh @ 21182:82a44483dbff
move octave_config_features function out of header file
* oct-conf-features.h: New file.
* module.mk: Generate octave-conf-features.cc instead of
oct-conf-features.h.
* toplev.cc (Foctave_config_info): Call octave::config::features.
* config-features.sh: Adapt to use of namespace. Make internal data
static and initialized only once.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 03 Feb 2016 15:10:15 -0500 |
parents | a65b906e25bc |
children |
rev | line source |
---|---|
16170
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 #! /bin/sh |
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 |
21182
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
3 ## Attempt to get traditional sort behavior based on byte values. |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
4 LC_ALL="C" |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
5 export LC_ALL |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
6 |
16170
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 set -e |
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 AWK=${AWK:-awk} |
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 |
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 conffile=$1 |
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 |
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 cat << EOF |
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 // DO NOT EDIT! Generated automatically from $conffile by Make." |
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 |
21182
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
15 #ifdef HAVE_CONFIG_H |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
16 #include <config.h> |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
17 #endif |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
18 |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
19 #include "oct-conf-features.h" |
16170
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 #include "ov.h" |
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 |
21182
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
22 namespace octave |
16170
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 { |
21182
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
24 namespace config |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
25 { |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
26 octave_scalar_map |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
27 features (void) |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
28 { |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
29 static bool initialized = false; |
16170
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 |
21182
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
31 static octave_scalar_map m; |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
32 |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
33 if (! initialized) |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
34 { |
16170
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 EOF |
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 |
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 $AWK \ |
21181 | 38 '/#define (HAVE|ENABLE)_/ { |
21182
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
39 sub (/HAVE_/, "", $2); |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
40 printf (" m.assign (\"%s\", octave_value (true));\n", $2); |
16170
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 } |
21181 | 42 /\/\* #undef (HAVE|ENABLE)_/ { |
21182
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
43 sub (/HAVE_/, "", $3); |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
44 printf (" m.assign (\"%s\", octave_value (false));\n", $3); |
16170
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 } { |
21182
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
46 }' $conffile | sort |
16170
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 |
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 cat << EOF |
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 |
21182
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
50 initialized = true; |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
51 } |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
52 |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
53 return m; |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
54 } |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
55 }; |
82a44483dbff
move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents:
21181
diff
changeset
|
56 }; |
16170
2a4f83826024
new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
57 EOF |