annotate libinterp/mk-build-env-features.sh @ 33603:ea261407cb9f bytecode-interpreter tip

maint: Merge default to bytecode-interpreter
author Arun Giridhar <arungiridhar@gmail.com>
date Sat, 18 May 2024 17:42:42 -0400
parents 2e484f9f1f18
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
3 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 ##
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
5 ## Copyright (C) 2013-2024 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
6 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 ## distribution or <https://octave.org/copyright/>.
22799
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 22516
diff changeset
9 ##
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 22516
diff changeset
10 ## This file is part of Octave.
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 22516
diff changeset
11 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23710
diff changeset
12 ## Octave is free software: you can redistribute it and/or modify it
22799
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 22516
diff changeset
13 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23710
diff changeset
14 ## the Free Software Foundation, either version 3 of the License, or
22799
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 22516
diff changeset
15 ## (at your option) any later version.
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 22516
diff changeset
16 ##
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 22516
diff changeset
17 ## Octave is distributed in the hope that it will be useful, but
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 22516
diff changeset
18 ## WITHOUT ANY WARRANTY; without even the implied warranty of
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 22516
diff changeset
19 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 22516
diff changeset
20 ## GNU General Public License for more details.
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 22516
diff changeset
21 ##
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 22516
diff changeset
22 ## You should have received a copy of the GNU General Public License
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 22516
diff changeset
23 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23710
diff changeset
24 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
25 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
26 ########################################################################
22799
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 22516
diff changeset
27
21182
82a44483dbff move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents: 21181
diff changeset
28 ## Attempt to get traditional sort behavior based on byte values.
21277
1bca6c72d2b1 maint: Use consistent coding style for build helper shell scripts
Mike Miller <mtmiller@octave.org>
parents: 21226
diff changeset
29 LC_ALL=C
21182
82a44483dbff move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents: 21181
diff changeset
30 export LC_ALL
82a44483dbff move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents: 21181
diff changeset
31
16170
2a4f83826024 new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 set -e
21277
1bca6c72d2b1 maint: Use consistent coding style for build helper shell scripts
Mike Miller <mtmiller@octave.org>
parents: 21226
diff changeset
33
16170
2a4f83826024 new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 AWK=${AWK:-awk}
2a4f83826024 new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35
2a4f83826024 new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 cat << EOF
2a4f83826024 new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 // 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
38
21302
8376de2eaf00 define OCTAVE_HAVE_FAST_INT_OPS in octave-config.h
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
39 #if defined (HAVE_CONFIG_H)
8376de2eaf00 define OCTAVE_HAVE_FAST_INT_OPS in octave-config.h
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
40 # include "config.h"
21182
82a44483dbff move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents: 21181
diff changeset
41 #endif
82a44483dbff move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents: 21181
diff changeset
42
21220
d78e45987d6a rename octave::build_env namespace from octave::config
John W. Eaton <jwe@octave.org>
parents: 21182
diff changeset
43 #include "build-env.h"
16170
2a4f83826024 new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 #include "ov.h"
2a4f83826024 new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
46 OCTAVE_BEGIN_NAMESPACE(octave)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
47
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
48 OCTAVE_BEGIN_NAMESPACE(build_env)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
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 octave_scalar_map
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
51 features ()
21182
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 static bool initialized = false;
16170
2a4f83826024 new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54
21182
82a44483dbff move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents: 21181
diff changeset
55 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
56
82a44483dbff move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents: 21181
diff changeset
57 if (! initialized)
82a44483dbff move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents: 21181
diff changeset
58 {
21665
7b48be706e28 * build-env-features.sh: Emit code to use static variables instead of repeatedly creating new octave_value objects for true and false.
John W. Eaton <jwe@octave.org>
parents: 21305
diff changeset
59 static octave_value ov_true = (true);
7b48be706e28 * build-env-features.sh: Emit code to use static variables instead of repeatedly creating new octave_value objects for true and false.
John W. Eaton <jwe@octave.org>
parents: 21305
diff changeset
60 static octave_value ov_false = (false);
7b48be706e28 * build-env-features.sh: Emit code to use static variables instead of repeatedly creating new octave_value objects for true and false.
John W. Eaton <jwe@octave.org>
parents: 21305
diff changeset
61
16170
2a4f83826024 new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 EOF
2a4f83826024 new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63
23020
1dfbdd593c5b also read oct-conf-post.h for build environment info
John W. Eaton <jwe@octave.org>
parents: 22799
diff changeset
64 for conffile in "$@"; do
1dfbdd593c5b also read oct-conf-post.h for build environment info
John W. Eaton <jwe@octave.org>
parents: 22799
diff changeset
65 $AWK \
1dfbdd593c5b also read oct-conf-post.h for build environment info
John W. Eaton <jwe@octave.org>
parents: 22799
diff changeset
66 '/# *define *(OCTAVE_HAVE|HAVE)_/ {
1dfbdd593c5b also read oct-conf-post.h for build environment info
John W. Eaton <jwe@octave.org>
parents: 22799
diff changeset
67 sub (/# *define */, "", $0);
1dfbdd593c5b also read oct-conf-post.h for build environment info
John W. Eaton <jwe@octave.org>
parents: 22799
diff changeset
68 sub (/(OCTAVE_HAVE|HAVE)_/, "", $1)
1dfbdd593c5b also read oct-conf-post.h for build environment info
John W. Eaton <jwe@octave.org>
parents: 22799
diff changeset
69 printf (" m.assign (\"%s\", ov_true);\n", $1);
1dfbdd593c5b also read oct-conf-post.h for build environment info
John W. Eaton <jwe@octave.org>
parents: 22799
diff changeset
70 }
1dfbdd593c5b also read oct-conf-post.h for build environment info
John W. Eaton <jwe@octave.org>
parents: 22799
diff changeset
71 /\/\* #undef (OCTAVE_HAVE|HAVE)_/ {
1dfbdd593c5b also read oct-conf-post.h for build environment info
John W. Eaton <jwe@octave.org>
parents: 22799
diff changeset
72 sub (/(OCTAVE_HAVE|HAVE)_/, "", $3);
1dfbdd593c5b also read oct-conf-post.h for build environment info
John W. Eaton <jwe@octave.org>
parents: 22799
diff changeset
73 printf (" m.assign (\"%s\", ov_false);\n", $3);
1dfbdd593c5b also read oct-conf-post.h for build environment info
John W. Eaton <jwe@octave.org>
parents: 22799
diff changeset
74 } {
1dfbdd593c5b also read oct-conf-post.h for build environment info
John W. Eaton <jwe@octave.org>
parents: 22799
diff changeset
75 }' $conffile
1dfbdd593c5b also read oct-conf-post.h for build environment info
John W. Eaton <jwe@octave.org>
parents: 22799
diff changeset
76 done | sort
16170
2a4f83826024 new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77
2a4f83826024 new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 cat << EOF
2a4f83826024 new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79
21182
82a44483dbff move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents: 21181
diff changeset
80 initialized = true;
82a44483dbff move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents: 21181
diff changeset
81 }
82a44483dbff move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents: 21181
diff changeset
82
82a44483dbff move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents: 21181
diff changeset
83 return m;
82a44483dbff move octave_config_features function out of header file
John W. Eaton <jwe@octave.org>
parents: 21181
diff changeset
84 }
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
85
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
86 OCTAVE_END_NAMESPACE(build_env)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
87 OCTAVE_END_NAMESPACE(octave)
16170
2a4f83826024 new way to test for features in Octave scripts
John W. Eaton <jwe@octave.org>
parents:
diff changeset
88 EOF