Mercurial > hg > octave-nkf
annotate src/mkoctfile.in.cc @ 19898:4197fc428c7d
maint: Update copyright notices for 2015.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 11 Feb 2015 14:19:08 -0500 |
parents | 9ef286208da1 |
children | b59aabc08e63 |
rev | line source |
---|---|
18428
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
1 // %NO_EDIT_WARNING% |
8920 | 2 /* |
3 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19572
diff
changeset
|
4 Copyright (C) 2008-2015 Michael Goffioul |
8920 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
10 Free Software Foundation; either version 3 of the License, or (at your | |
11 option) any later version. | |
12 | |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with Octave; see the file COPYING. If not, see | |
20 <http://www.gnu.org/licenses/>. | |
21 | |
22 */ | |
23 | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
24 #if defined (HAVE_CONFIG_H) |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
25 #include <config.h> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
26 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
27 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
28 #include <string> |
15299
8bd5c490b787
Fix mex compilation with subdirs on Windows platforms (bug #37122)
Rik <rik@octave.org>
parents:
15271
diff
changeset
|
29 #include <cstring> |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
30 #include <map> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
31 #include <list> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
32 #include <algorithm> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
33 #include <iostream> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
34 #include <fstream> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
35 #include <vector> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
36 #include <cstdlib> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
37 |
18410
ee7f66925267
Always build mkoctfile and octave-config as executables (bug #41296)
Mike Miller <mtmiller@ieee.org>
parents:
17898
diff
changeset
|
38 #include <unistd.h> |
ee7f66925267
Always build mkoctfile and octave-config as executables (bug #41296)
Mike Miller <mtmiller@ieee.org>
parents:
17898
diff
changeset
|
39 |
19106
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
40 // This mess suggested by the autoconf manual. |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
41 |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
42 #include <sys/types.h> |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
43 |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
44 #if defined HAVE_SYS_WAIT_H |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
45 #include <sys/wait.h> |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
46 #endif |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
47 |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
48 #ifndef WIFEXITED |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
49 #define WIFEXITED(stat_val) (((stat_val) & 255) == 0) |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
50 #endif |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
51 |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
52 #ifndef WEXITSTATUS |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
53 #define WEXITSTATUS(stat_val) (static_cast<unsigned> (stat_val) >> 8) |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
54 #endif |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
55 |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
56 static std::map<std::string, std::string> vars; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
57 |
18428
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
58 #ifndef OCTAVE_VERSION |
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
59 #define OCTAVE_VERSION %OCTAVE_CONF_VERSION% |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
60 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
61 |
18428
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
62 #ifndef OCTAVE_PREFIX |
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
63 #define OCTAVE_PREFIX %OCTAVE_CONF_PREFIX% |
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
64 #endif |
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
65 |
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
66 #include "shared-fcns.h" |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
67 |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
68 static std::string |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
69 get_line (FILE *fp) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
70 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
71 static std::vector<char> buf (100); |
15458
1cc42df8ede7
mkoctfile.in.cc: Change variable types to stop compilation warnings.
Rik <rik@octave.org>
parents:
15309
diff
changeset
|
72 unsigned int idx = 0; |
19568
7759e4d62f04
mkoctfile.in.cc: Fix infinite loop of mkoctfile -M (Bug #43640)
Edmund Grimley Evans <edmund.grimley.evans@gmail.com>
parents:
19106
diff
changeset
|
73 int c; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
74 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
75 while (true) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
76 { |
19568
7759e4d62f04
mkoctfile.in.cc: Fix infinite loop of mkoctfile -M (Bug #43640)
Edmund Grimley Evans <edmund.grimley.evans@gmail.com>
parents:
19106
diff
changeset
|
77 c = gnulib::fgetc (fp); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
78 if (c == '\n' || c == EOF) |
12174 | 79 break; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
80 if (buf.size () <= idx) |
12174 | 81 buf.resize (buf.size () + 100); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
82 buf[idx++] = c; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
83 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
84 if (idx == 0) |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
85 return std::string (""); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
86 else |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
87 return std::string (&buf[0], idx); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
88 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
89 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
90 |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
91 static std::string |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
92 get_variable (const char *name, const std::string& defval) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
93 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
94 const char *val = getenv (name); |
17898
8c33abdd2f9a
maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents:
17789
diff
changeset
|
95 if (val && *val) |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
96 return std::string (val); |
17898
8c33abdd2f9a
maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents:
17789
diff
changeset
|
97 else |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
98 return defval; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
99 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
100 |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
101 static std::string |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
102 quote_path (const std::string& s) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
103 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
104 if (s.find (' ') != std::string::npos && s[0] != '"') |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
105 return "\"" + s + "\""; |
8332 | 106 else |
107 return s; | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
108 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
109 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
110 static void |
8332 | 111 initialize (void) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
112 { |
18428
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
113 vars["OCTAVE_HOME"] = get_octave_home (); |
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
114 vars["OCTAVE_PREFIX"] = OCTAVE_PREFIX; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
115 |
8332 | 116 vars["SED"] = get_variable ("SED", %OCTAVE_CONF_SED%); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
117 |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
118 std::string DEFAULT_OCTINCLUDEDIR = %OCTAVE_CONF_OCTINCLUDEDIR%; |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
119 std::string DEFAULT_INCLUDEDIR = %OCTAVE_CONF_INCLUDEDIR%; |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
120 std::string DEFAULT_LIBDIR = %OCTAVE_CONF_LIBDIR%; |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
121 std::string DEFAULT_OCTLIBDIR = %OCTAVE_CONF_OCTLIBDIR%; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
122 |
18428
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
123 DEFAULT_OCTINCLUDEDIR = subst_octave_home (DEFAULT_OCTINCLUDEDIR); |
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
124 DEFAULT_INCLUDEDIR = subst_octave_home (DEFAULT_INCLUDEDIR); |
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
125 DEFAULT_LIBDIR = subst_octave_home (DEFAULT_LIBDIR); |
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
126 DEFAULT_OCTLIBDIR = subst_octave_home (DEFAULT_OCTLIBDIR); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
127 |
8332 | 128 vars["OCTINCLUDEDIR"] = get_variable ("OCTINCLUDEDIR", DEFAULT_OCTINCLUDEDIR); |
129 vars["INCLUDEDIR"] = get_variable ("INCLUDEDIR", DEFAULT_INCLUDEDIR); | |
130 vars["LIBDIR"] = get_variable ("LIBDIR", DEFAULT_LIBDIR); | |
131 vars["OCTLIBDIR"] = get_variable ("OCTLIBDIR", DEFAULT_OCTLIBDIR); | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
132 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
133 #if defined (__WIN32__) && ! defined (_POSIX_VERSION) |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
134 std::string DEFAULT_INCFLAGS |
9794
0d4613a736e9
convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents:
9565
diff
changeset
|
135 = "-I" + quote_path (vars["OCTINCLUDEDIR"] + "\\..") |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
136 + " -I" + quote_path (vars["OCTINCLUDEDIR"]); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
137 #else |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
138 std::string DEFAULT_INCFLAGS |
9794
0d4613a736e9
convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents:
9565
diff
changeset
|
139 = "-I" + quote_path (vars["OCTINCLUDEDIR"] + "/..") |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
140 + " -I" + quote_path (vars["OCTINCLUDEDIR"]); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
141 #endif |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
142 if (vars["INCLUDEDIR"] != "/usr/include") |
8332 | 143 DEFAULT_INCFLAGS += " -I" + quote_path (vars["INCLUDEDIR"]); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
144 |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
145 std::string DEFAULT_LFLAGS = "-L" + quote_path (vars["OCTLIBDIR"]); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
146 if (vars["LIBDIR"] != "/usr/lib") |
8332 | 147 DEFAULT_LFLAGS += " -L" + quote_path (vars["LIBDIR"]); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
148 |
8332 | 149 vars["CPPFLAGS"] = get_variable ("CPPFLAGS", %OCTAVE_CONF_CPPFLAGS%); |
150 vars["INCFLAGS"] = get_variable ("INCFLAGS", DEFAULT_INCFLAGS); | |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15458
diff
changeset
|
151 vars["F77"] = get_variable ("F77", %OCTAVE_CONF_MKOCTFILE_F77%); |
8332 | 152 vars["FFLAGS"] = get_variable ("FFLAGS", %OCTAVE_CONF_FFLAGS%); |
153 vars["FPICFLAG"] = get_variable ("FPICFLAG", %OCTAVE_CONF_FPICFLAG%); | |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15458
diff
changeset
|
154 vars["CC"] = get_variable ("CC", %OCTAVE_CONF_MKOCTFILE_CC%); |
8332 | 155 vars["CFLAGS"] = get_variable ("CFLAGS", %OCTAVE_CONF_CFLAGS%); |
156 vars["CPICFLAG"] = get_variable ("CPICFLAG", %OCTAVE_CONF_CPICFLAG%); | |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15458
diff
changeset
|
157 vars["CXX"] = get_variable ("CXX", %OCTAVE_CONF_MKOCTFILE_CXX%); |
8332 | 158 vars["CXXFLAGS"] = get_variable ("CXXFLAGS", %OCTAVE_CONF_CXXFLAGS%); |
159 vars["CXXPICFLAG"] = get_variable ("CXXPICFLAG", %OCTAVE_CONF_CXXPICFLAG%); | |
160 vars["XTRA_CFLAGS"] = get_variable ("XTRA_CFLAGS", %OCTAVE_CONF_XTRA_CFLAGS%); | |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
161 vars["XTRA_CXXFLAGS"] = get_variable ("XTRA_CXXFLAGS", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
162 %OCTAVE_CONF_XTRA_CXXFLAGS%); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
163 |
15944
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
164 vars["AR"] = get_variable ("AR", %OCTAVE_CONF_MKOCTFILE_AR%); |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
165 vars["RANLIB"] = get_variable ("RANLIB", %OCTAVE_CONF_MKOCTFILE_RANLIB%); |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
166 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
167 vars["DEPEND_FLAGS"] = get_variable ("DEPEND_FLAGS", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
168 %OCTAVE_CONF_DEPEND_FLAGS%); |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
169 vars["DEPEND_EXTRA_SED_PATTERN"] = get_variable ("DEPEND_EXTRA_SED_PATTERN", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
170 %OCTAVE_CONF_DEPEND_EXTRA_SED_PATTERN%); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
171 |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15458
diff
changeset
|
172 vars["DL_LD"] = get_variable ("DL_LD", %OCTAVE_CONF_MKOCTFILE_DL_LD%); |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
173 vars["DL_LDFLAGS"] = get_variable ("DL_LDFLAGS", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
174 %OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
175 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
176 vars["RDYNAMIC_FLAG"] = get_variable ("RDYNAMIC_FLAG", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
177 %OCTAVE_CONF_RDYNAMIC_FLAG%); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
178 vars["LIBOCTAVE"] = "-loctave"; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
179 vars["LIBOCTINTERP"] = "-loctinterp"; |
9515 | 180 vars["READLINE_LIBS"] = "-lreadline"; |
11450
5eb10763069f
substitute and use LAPACK_LIBS in mkoctfile script
John W. Eaton <jwe@octave.org>
parents:
11251
diff
changeset
|
181 vars["LAPACK_LIBS"] = get_variable ("LAPACK_LIBS", %OCTAVE_CONF_LAPACK_LIBS%); |
8332 | 182 vars["BLAS_LIBS"] = get_variable ("BLAS_LIBS", %OCTAVE_CONF_BLAS_LIBS%); |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
183 vars["FFTW3_LDFLAGS"] = get_variable ("FFTW3_LDFLAGS", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
184 %OCTAVE_CONF_FFTW3_LDFLAGS%); |
9538
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
185 vars["FFTW3_LIBS"] = get_variable ("FFTW3_LIBS", %OCTAVE_CONF_FFTW3_LIBS%); |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
186 vars["FFTW3F_LDFLAGS"] = get_variable ("FFTW3F_LDFLAGS", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
187 %OCTAVE_CONF_FFTW3F_LDFLAGS%); |
9538
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
188 vars["FFTW3F_LIBS"] = get_variable ("FFTW3F_LIBS", %OCTAVE_CONF_FFTW3F_LIBS%); |
8332 | 189 vars["LIBS"] = get_variable ("LIBS", %OCTAVE_CONF_LIBS%); |
190 vars["FLIBS"] = get_variable ("FLIBS", %OCTAVE_CONF_FLIBS%); | |
18417
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
191 vars["OCTAVE_LINK_DEPS"] = get_variable ("OCTAVE_LINK_DEPS", |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
192 %OCTAVE_CONF_OCTAVE_LINK_DEPS%); |
18417
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
193 vars["OCTAVE_LINK_OPTS"] = get_variable ("OCTAVE_LINK_OPTS", |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
194 %OCTAVE_CONF_OCTAVE_LINK_OPTS%); |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
195 vars["OCT_LINK_DEPS"] = get_variable ("OCT_LINK_DEPS", |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
196 %OCTAVE_CONF_OCT_LINK_DEPS%); |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
197 vars["OCT_LINK_OPTS"] = get_variable ("OCT_LINK_OPTS", |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
198 %OCTAVE_CONF_OCT_LINK_OPTS%); |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15458
diff
changeset
|
199 vars["LD_CXX"] = get_variable ("LD_CXX", %OCTAVE_CONF_MKOCTFILE_LD_CXX%); |
8332 | 200 vars["LDFLAGS"] = get_variable ("LDFLAGS", %OCTAVE_CONF_LDFLAGS%); |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
201 vars["LD_STATIC_FLAG"] = get_variable ("LD_STATIC_FLAG", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
202 %OCTAVE_CONF_LD_STATIC_FLAG%); |
8332 | 203 vars["LFLAGS"] = get_variable ("LFLAGS", DEFAULT_LFLAGS); |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
204 vars["F77_INTEGER8_FLAG"] = get_variable ("F77_INTEGER8_FLAG", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
205 %OCTAVE_CONF_F77_INTEGER_8_FLAG%); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
206 |
10721
4906ccf5d95e
use F77_INTEGER8_FLAG in BLAS checking as well as ALL_FFLAGS in mkoctfile
Jaroslav Hajek <highegg@gmail.com>
parents:
9957
diff
changeset
|
207 vars["ALL_FFLAGS"] = vars["FFLAGS"] + " " + vars["F77_INTEGER8_FLAG"]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
208 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
209 vars["ALL_CFLAGS"] = vars["INCFLAGS"] + " " + vars["XTRA_CFLAGS"] + " " |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
210 + vars["CFLAGS"]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
211 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
212 vars["ALL_CXXFLAGS"] = vars["INCFLAGS"] + " " + vars["XTRA_CXXFLAGS"] + " " |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
213 + vars["CXXFLAGS"]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
214 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
215 vars["ALL_LDFLAGS"] = vars["LD_STATIC_FLAG"] + " " + vars["CPICFLAG"] + " " |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
216 + vars["LDFLAGS"]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
217 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
218 vars["OCTAVE_LIBS"] = vars["LIBOCTINTERP"] + " " + vars["LIBOCTAVE"] + " " |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
219 + vars["SPECIAL_MATH_LIB"]; |
9538
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
220 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
221 vars["FFTW_LIBS"] = vars["FFTW3_LDFLAGS"] + " " + vars["FFTW3_LIBS"] + " " |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
222 + vars["FFTW3F_LDFLAGS"] + " " + vars["FFTW3F_LIBS"]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
223 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
224 |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
225 static std::string usage_msg = "usage: mkoctfile [options] file ..."; |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
226 static std::string version_msg = "mkoctfile, version " OCTAVE_VERSION; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
227 static bool debug = false; |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
228 static std::string help_msg = |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
229 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
230 "Options:\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
231 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
232 " -h, -?, --help Print this message.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
233 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
234 " -IDIR Add -IDIR to compile commands.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
235 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
236 " -idirafter DIR Add -idirafter DIR to compile commands.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
237 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
238 " -DDEF Add -DDEF to compile commands.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
239 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
240 " -lLIB Add library LIB to link command.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
241 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
242 " -LDIR Add -LDIR to link command.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
243 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
244 " -M, --depend Generate dependency files (.d) for C and C++\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
245 " source files.\n" |
18417
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
246 #if ! defined (__WIN32__) || defined (_POSIX_VERSION) |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
247 "\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
248 " -pthread Add -pthread to link command.\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
249 #endif |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
250 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
251 " -RDIR Add -RDIR to link command.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
252 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
253 " -Wl,... Pass flags though the linker like -Wl,-rpath=...\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
254 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
255 " -W... Pass flags though the compiler like -Wa,OPTION.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
256 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
257 " -c, --compile Compile, but do not link.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
258 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
259 " -o FILE, --output FILE Output file name. Default extension is .oct\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
260 " (or .mex if --mex is specified) unless linking\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
261 " a stand-alone executable.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
262 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
263 " -g Enable debugging options for compilers.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
264 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
265 " -p VAR, --print VAR Print configuration variable VAR. Recognized\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
266 " variables are:\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
267 "\n" |
18417
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
268 " ALL_CFLAGS INCFLAGS\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
269 " ALL_CXXFLAGS INCLUDEDIR\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
270 " ALL_FFLAGS LAPACK_LIBS\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
271 " ALL_LDFLAGS LD_CXX\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
272 " AR LDFLAGS\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
273 " BLAS_LIBS LD_STATIC_FLAG\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
274 " CC LFLAGS\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
275 " CFLAGS LIBDIR\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
276 " CPICFLAG LIBOCTAVE\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
277 " CPPFLAGS LIBOCTINTERP\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
278 " CXX LIBS\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
279 " CXXFLAGS OCTAVE_HOME\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
280 " CXXPICFLAG OCTAVE_LIBS\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
281 " DEPEND_EXTRA_SED_PATTERN OCTAVE_LINK_DEPS\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
282 " DEPEND_FLAGS OCTAVE_LINK_OPTS\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
283 " DL_LD OCTAVE_PREFIX\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
284 " DL_LDFLAGS OCTINCLUDEDIR\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
285 " F77 OCTLIBDIR\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
286 " F77_INTEGER8_FLAG OCT_LINK_DEPS\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
287 " FFLAGS OCT_LINK_OPTS\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
288 " FFTW3F_LDFLAGS RANLIB\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
289 " FFTW3F_LIBS RDYNAMIC_FLAG\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
290 " FFTW3_LDFLAGS READLINE_LIBS\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
291 " FFTW3_LIBS SED\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
292 " FFTW_LIBS SPECIAL_MATH_LIB\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
293 " FLIBS XTRA_CFLAGS\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
294 " FPICFLAG XTRA_CXXFLAGS\n" |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
295 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
296 " --link-stand-alone Link a stand-alone executable file.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
297 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
298 " --mex Assume we are creating a MEX file. Set the\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
299 " default output extension to \".mex\".\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
300 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
301 " -s, --strip Strip output file.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
302 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
303 " -v, --verbose Echo commands as they are executed.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
304 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
305 " FILE Compile or link FILE. Recognized file types are:\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
306 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
307 " .c C source\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
308 " .cc C++ source\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
309 " .C C++ source\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
310 " .cpp C++ source\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
311 " .f Fortran source (fixed form)\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
312 " .F Fortran source (fixed form)\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
313 " .f90 Fortran source (free form)\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
314 " .F90 Fortran source (free form)\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
315 " .o object file\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
316 " .a library file\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
317 #ifdef _MSC_VER |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
318 " .lib library file\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
319 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
320 "\n"; |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
321 |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
322 static std::string |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
323 basename (const std::string& s, bool strip_path = false) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
324 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
325 std::string retval; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
326 size_t pos = s.rfind ('.'); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
327 |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
328 if (pos == std::string::npos) |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
329 retval = s; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
330 else |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
331 retval = s.substr (0, pos); |
15299
8bd5c490b787
Fix mex compilation with subdirs on Windows platforms (bug #37122)
Rik <rik@octave.org>
parents:
15271
diff
changeset
|
332 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
333 if (strip_path) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
334 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
335 size_t p1 = retval.rfind ('/'), p2 = retval.rfind ('\\'); |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
336 pos = (p1 != std::string::npos && p2 != std::string::npos |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
337 ? std::max (p1, p2) : (p2 != std::string::npos ? p2 : p1)); |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
338 if (pos != std::string::npos) |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
339 retval = retval.substr (++pos, std::string::npos); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
340 } |
15299
8bd5c490b787
Fix mex compilation with subdirs on Windows platforms (bug #37122)
Rik <rik@octave.org>
parents:
15271
diff
changeset
|
341 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
342 return retval; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
343 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
344 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
345 inline bool |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
346 starts_with (const std::string& s, const std::string& prefix) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
347 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
348 return (s.length () >= prefix.length () && s.find (prefix) == 0); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
349 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
350 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
351 inline bool |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
352 ends_with (const std::string& s, const std::string& suffix) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
353 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
354 return (s.length () >= suffix.length () |
12174 | 355 && s.rfind (suffix) == s.length () - suffix.length ()); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
356 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
357 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
358 static int |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
359 run_command (const std::string& cmd) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
360 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
361 if (debug) |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
362 std::cout << cmd << std::endl; |
19106
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
363 |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
364 int result = system (cmd.c_str ()); |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
365 |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
366 if (WIFEXITED (result)) |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
367 result = WEXITSTATUS (result); |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
368 |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
19105
diff
changeset
|
369 return result; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
370 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
371 |
16624
96d02808a881
Support "true" or "yes" for %NO_OCT_FILE_STRIP% in mkoctfile.in.cc.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15946
diff
changeset
|
372 bool |
96d02808a881
Support "true" or "yes" for %NO_OCT_FILE_STRIP% in mkoctfile.in.cc.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15946
diff
changeset
|
373 is_true (const std::string& s) |
96d02808a881
Support "true" or "yes" for %NO_OCT_FILE_STRIP% in mkoctfile.in.cc.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15946
diff
changeset
|
374 { |
18428
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18417
diff
changeset
|
375 return (s == "yes" || s == "true"); |
16624
96d02808a881
Support "true" or "yes" for %NO_OCT_FILE_STRIP% in mkoctfile.in.cc.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15946
diff
changeset
|
376 } |
96d02808a881
Support "true" or "yes" for %NO_OCT_FILE_STRIP% in mkoctfile.in.cc.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15946
diff
changeset
|
377 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
378 int |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
379 main (int argc, char **argv) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
380 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
381 initialize (); |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
382 |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
383 std::string file, output_option; |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
384 std::list<std::string> cfiles, ccfiles, f77files; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
385 int result = 0; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
386 |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
387 std::string objfiles = ""; |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
388 std::string libfiles = ""; |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
389 std::string octfile = ""; |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
390 std::string outputfile = ""; |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
391 std::string incflags = ""; |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
392 std::string defs = ""; |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
393 std::string ldflags = ""; |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
394 std::string pass_on_options = ""; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
395 bool strip = false; |
16624
96d02808a881
Support "true" or "yes" for %NO_OCT_FILE_STRIP% in mkoctfile.in.cc.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15946
diff
changeset
|
396 bool no_oct_file_strip_on_this_platform = is_true ("%NO_OCT_FILE_STRIP%"); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
397 bool link = true; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
398 bool link_stand_alone = false; |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
399 std::string output_ext = ".oct"; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
400 bool depend = false; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
401 |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
402 if (argc == 1) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
403 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
404 std::cout << usage_msg << std::endl; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
405 return 1; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
406 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
407 |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
408 if (argc == 2 && (!strcmp (argv[1], "-v") |
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
409 || !strcmp (argv[1], "-version") |
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
410 || !strcmp (argv[1], "--version"))) |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
411 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
412 std::cout << version_msg << std::endl; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
413 return 0; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
414 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
415 |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
416 for (int i = 1; i < argc; i++) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
417 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
418 std::string arg = argv[i]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
419 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
420 if (ends_with (arg, ".c")) |
12174 | 421 { |
422 file = arg; | |
423 cfiles.push_back (file); | |
424 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
425 else if (ends_with (arg, ".cc") || ends_with (arg, ".C") |
12174 | 426 || ends_with (arg, ".cpp")) |
427 { | |
428 file = arg; | |
429 ccfiles.push_back (file); | |
430 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
431 else if (ends_with (arg, ".f") || ends_with (arg, ".F") |
12174 | 432 || ends_with (arg, "f90") || ends_with (arg, ".F90")) |
433 { | |
434 file = arg; | |
435 f77files.push_back (file); | |
436 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
437 else if (ends_with (arg, ".o") || ends_with (arg, ".obj")) |
12174 | 438 { |
439 file = arg; | |
440 objfiles += (" " + quote_path (arg)); | |
441 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
442 else if (ends_with (arg, ".lib") || ends_with (arg, ".a")) |
12174 | 443 { |
444 file = arg; | |
445 libfiles += (" " + quote_path (arg)); | |
446 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
447 else if (arg == "-d" || arg == "-debug" || arg == "--debug" |
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
448 || arg == "-v" || arg == "-verbose" || arg == "--verbose") |
12174 | 449 { |
450 debug = true; | |
451 if (vars["CC"] == "cc-msvc") | |
452 vars["CC"] += " -d"; | |
453 if (vars["CXX"] == "cc-msvc") | |
454 vars["CXX"] += " -d"; | |
455 if (vars["DL_LD"] == "cc-msvc") | |
456 vars["DL_LD"] += " -d"; | |
457 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
458 else if (arg == "-h" || arg == "-?" || arg == "-help" || arg == "--help") |
12174 | 459 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
460 std::cout << usage_msg << std::endl; |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
461 std::cout << help_msg << std::endl; |
12174 | 462 return 0; |
463 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
464 else if (starts_with (arg, "-I")) |
12174 | 465 { |
466 incflags += (" " + quote_path (arg)); | |
467 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
468 else if (arg == "-idirafter") |
12174 | 469 { |
470 if (i < argc-1) | |
471 { | |
472 arg = argv[++i]; | |
473 incflags += (" -idirafter " + arg); | |
474 } | |
475 else | |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
476 std::cerr << "mkoctfile: include directory name missing" |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
477 << std::endl; |
12174 | 478 } |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
479 else if (starts_with (arg, "-D")) |
12174 | 480 { |
481 defs += (" " + arg); | |
482 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
483 else if (starts_with (arg, "-Wl,") || starts_with (arg, "-l") |
12174 | 484 || starts_with (arg, "-L") || starts_with (arg, "-R")) |
485 { | |
486 ldflags += (" " + arg); | |
487 } | |
18417
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
488 #if ! defined (__WIN32__) || defined (_POSIX_VERSION) |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
489 else if (arg == "-pthread") |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
490 { |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
491 ldflags += (" " + arg); |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
492 } |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18410
diff
changeset
|
493 #endif |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
494 else if (arg == "-M" || arg == "-depend" || arg == "--depend") |
12174 | 495 { |
496 depend = true; | |
497 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
498 else if (arg == "-o" || arg == "-output" || arg == "--output") |
12174 | 499 { |
500 if (i < argc-1) | |
501 { | |
502 arg = argv[++i]; | |
503 outputfile = arg; | |
504 } | |
505 else | |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
506 std::cerr << "mkoctfile: output file name missing" << std::endl; |
12174 | 507 } |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
508 else if (arg == "-p" || arg == "-print" || arg == "--print") |
12174 | 509 { |
510 if (i < argc-1) | |
511 { | |
512 arg = argv[++i]; | |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
513 std::cout << vars[arg] << std::endl; |
12174 | 514 return 0; |
515 } | |
516 else | |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
517 std::cerr << "mkoctfile: --print requires argument" << std::endl; |
12174 | 518 } |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
519 else if (arg == "-s" || arg == "-strip" || arg == "--strip") |
12174 | 520 { |
521 if (no_oct_file_strip_on_this_platform) | |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
522 std::cerr << "mkoctfile: stripping disabled on this platform" |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
523 << std::endl; |
12174 | 524 else |
525 strip = true; | |
526 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
527 else if (arg == "-c" || arg == "-compile" || arg == "--compile") |
12174 | 528 { |
529 link = false; | |
530 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
531 else if (arg == "-g") |
12174 | 532 { |
533 vars["ALL_CFLAGS"] += " -g"; | |
534 vars["ALL_CXXFLAGS"] += " -g"; | |
535 vars["ALL_FFLAGS"] += " -g"; | |
536 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
537 else if (arg == "-link-stand-alone" || arg == "--link-stand-alone") |
12174 | 538 { |
539 link_stand_alone = true; | |
540 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
541 else if (arg == "-mex" || arg == "--mex") |
12174 | 542 { |
543 incflags += " -I."; | |
9303
adf676387922
properly #ifdef MSVC linker specific flags
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents:
9245
diff
changeset
|
544 #ifdef _MSC_VER |
12174 | 545 ldflags += " -Wl,-export:mexFunction"; |
9303
adf676387922
properly #ifdef MSVC linker specific flags
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents:
9245
diff
changeset
|
546 #endif |
12174 | 547 output_ext = ".mex"; |
548 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
549 else if (starts_with (arg, "-W")) |
12174 | 550 { |
551 pass_on_options += (" " + arg); | |
552 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
553 else |
12174 | 554 { |
18984
dd57ca9ef7e4
Add missing newline to error message from mkoctfile.
Rik <rik@octave.org>
parents:
18432
diff
changeset
|
555 std::cerr << "mkoctfile: unrecognized argument " << arg << std::endl; |
12174 | 556 return 1; |
557 } | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
558 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
559 if (!file.empty () && octfile.empty ()) |
12174 | 560 octfile = file; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
561 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
562 |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
563 if (link_stand_alone) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
564 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
565 if (!outputfile.empty ()) |
12174 | 566 output_option = "-o " + outputfile; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
567 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
568 else |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
569 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
570 if (!outputfile.empty ()) |
9957
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
571 { |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
572 octfile = outputfile; |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
573 size_t len = octfile.length (); |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
574 size_t len_ext = output_ext.length (); |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
575 if (octfile.substr (len-len_ext) != output_ext) |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
576 octfile += output_ext; |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
577 } |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
578 else |
12174 | 579 octfile = basename (octfile, true) + output_ext; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
580 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
581 |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
582 std::list<std::string>::const_iterator it; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
583 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
584 if (depend) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
585 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
586 for (it = cfiles.begin (); it != cfiles.end (); ++it) |
12174 | 587 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
588 std::string f = *it, dfile = basename (f, true) + ".d", line; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
589 |
18431
7eb1bb820c84
* mkoctfile.in.cc: Use gnulib:: tag where appropriate.
John W. Eaton <jwe@octave.org>
parents:
18428
diff
changeset
|
590 gnulib::unlink (dfile.c_str ()); |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
591 std::string cmd = vars["CC"] + " " + vars["DEPEND_FLAGS"] + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
592 + vars["CPPFLAGS"] + " " + vars["ALL_CFLAGS"] + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
593 + incflags + " " + defs + " " + quote_path (f); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
594 |
12174 | 595 FILE *fd = popen (cmd.c_str (), "r"); |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
596 std::ofstream fo (dfile.c_str ()); |
15458
1cc42df8ede7
mkoctfile.in.cc: Change variable types to stop compilation warnings.
Rik <rik@octave.org>
parents:
15309
diff
changeset
|
597 size_t pos; |
12174 | 598 while (!feof (fd)) |
599 { | |
600 line = get_line (fd); | |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
601 if ((pos = line.rfind (".o:")) != std::string::npos) |
12174 | 602 { |
15458
1cc42df8ede7
mkoctfile.in.cc: Change variable types to stop compilation warnings.
Rik <rik@octave.org>
parents:
15309
diff
changeset
|
603 size_t spos = line.rfind ('/', pos); |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
604 std::string ofile = |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
605 (spos == std::string::npos ? line.substr (0, pos+2) |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
606 : line.substr (spos+1, pos-spos+1)); |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
607 fo << "pic/" << ofile << " " << ofile << " " |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
608 << dfile << line.substr (pos) << std::endl; |
12174 | 609 } |
610 else | |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
611 fo << line << std::endl; |
12174 | 612 } |
613 pclose (fd); | |
614 fo.close (); | |
615 } | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
616 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
617 for (it = ccfiles.begin (); it != ccfiles.end (); ++it) |
12174 | 618 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
619 std::string f = *it, dfile = basename (f, true) + ".d", line; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
620 |
18431
7eb1bb820c84
* mkoctfile.in.cc: Use gnulib:: tag where appropriate.
John W. Eaton <jwe@octave.org>
parents:
18428
diff
changeset
|
621 gnulib::unlink (dfile.c_str ()); |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
622 std::string cmd = vars["CC"] + " " + vars["DEPEND_FLAGS"] + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
623 + vars["CPPFLAGS"] + " " + vars["ALL_CXXFLAGS"] + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
624 + incflags + " " + defs + " " + quote_path (f); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
625 |
12174 | 626 FILE *fd = popen (cmd.c_str (), "r"); |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
627 std::ofstream fo (dfile.c_str ()); |
15458
1cc42df8ede7
mkoctfile.in.cc: Change variable types to stop compilation warnings.
Rik <rik@octave.org>
parents:
15309
diff
changeset
|
628 size_t pos; |
12174 | 629 while (!feof (fd)) |
630 { | |
631 line = get_line (fd); | |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
632 if ((pos = line.rfind (".o:")) != std::string::npos) |
12174 | 633 { |
15458
1cc42df8ede7
mkoctfile.in.cc: Change variable types to stop compilation warnings.
Rik <rik@octave.org>
parents:
15309
diff
changeset
|
634 size_t spos = line.rfind ('/', pos); |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
635 std::string ofile = |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
636 (spos == std::string::npos ? line.substr (0, pos+2) |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
637 : line.substr (spos+1, pos-spos+1)); |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
638 fo << "pic/" << ofile << " " << ofile << " " |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
639 << dfile << line.substr (pos+2) << std::endl; |
12174 | 640 } |
641 else | |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
642 fo << line << std::endl; |
12174 | 643 } |
644 pclose (fd); | |
645 fo.close (); | |
646 } | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
647 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
648 return 0; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
649 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
650 |
19105
3e4e2cfba186
Stop mkoctfile process if any part of compilation or linking fails (bug #42704).
Rik <rik@octave.org>
parents:
18432
diff
changeset
|
651 for (it = f77files.begin (); it != f77files.end () && !result; ++it) |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
652 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
653 std::string f = *it, b = basename (f, true); |
9187
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
654 if (!vars["F77"].empty ()) |
12174 | 655 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
656 std::string o; |
12174 | 657 if (!outputfile.empty ()) |
658 { | |
659 if (link) | |
660 o = b + ".o"; | |
661 else | |
662 o = outputfile; | |
663 } | |
664 else | |
665 o = b + ".o"; | |
666 objfiles += (" " + o); | |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
667 std::string cmd = vars["F77"] + " -c " + vars["FPICFLAG"] + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
668 + vars["ALL_FFLAGS"] + " " + incflags + " " + defs + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
669 + pass_on_options + " " + f + " -o " + o; |
12174 | 670 result = run_command (cmd); |
671 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
672 else |
12174 | 673 { |
18984
dd57ca9ef7e4
Add missing newline to error message from mkoctfile.
Rik <rik@octave.org>
parents:
18432
diff
changeset
|
674 std::cerr << "mkoctfile: no way to compile Fortran file " << f |
dd57ca9ef7e4
Add missing newline to error message from mkoctfile.
Rik <rik@octave.org>
parents:
18432
diff
changeset
|
675 << std::endl; |
12174 | 676 return 1; |
677 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
678 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
679 |
19105
3e4e2cfba186
Stop mkoctfile process if any part of compilation or linking fails (bug #42704).
Rik <rik@octave.org>
parents:
18432
diff
changeset
|
680 for (it = cfiles.begin (); it != cfiles.end () && !result; ++it) |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
681 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
682 std::string f = *it; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
683 if (!vars["CC"].empty ()) |
12174 | 684 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
685 std::string b = basename (f, true), o; |
12174 | 686 if (!outputfile.empty ()) |
687 { | |
688 if (link) | |
689 o = b + ".o"; | |
690 else | |
691 o = outputfile; | |
692 } | |
693 else | |
694 o = b + ".o"; | |
695 objfiles += (" " + o); | |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
696 std::string cmd = vars["CC"] + " -c " + vars["CPPFLAGS"] + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
697 + vars["CPICFLAG"] + " " + vars["ALL_CFLAGS"] + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
698 + pass_on_options + " " + incflags + " " + defs + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
699 + quote_path (f) + " -o " + quote_path (o); |
12174 | 700 result = run_command (cmd); |
701 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
702 else |
12174 | 703 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
704 std::cerr << "mkoctfile: no way to compile C file " << f |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
705 << std::endl; |
12174 | 706 return 1; |
707 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
708 } |
12174 | 709 |
19105
3e4e2cfba186
Stop mkoctfile process if any part of compilation or linking fails (bug #42704).
Rik <rik@octave.org>
parents:
18432
diff
changeset
|
710 for (it = ccfiles.begin (); it != ccfiles.end () && !result; ++it) |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
711 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
712 std::string f = *it; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
713 if (!vars["CXX"].empty ()) |
12174 | 714 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
715 std::string b = basename (f, true), o; |
12174 | 716 if (!outputfile.empty ()) |
717 { | |
718 if (link) | |
719 o = b + ".o"; | |
720 else | |
721 o = outputfile; | |
722 } | |
723 else | |
724 o = b + ".o"; | |
725 objfiles += (" " + o); | |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
726 std::string cmd = vars["CXX"] + " -c " + vars["CPPFLAGS"] + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
727 + vars["CXXPICFLAG"] + " " + vars["ALL_CXXFLAGS"] + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
728 + pass_on_options + " " + incflags + " " + defs + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
729 + quote_path (f) + " -o " + quote_path (o); |
12174 | 730 result = run_command (cmd); |
731 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
732 else |
12174 | 733 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
734 std::cerr << "mkoctfile: no way to compile C++ file " << f |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
735 << std::endl; |
12174 | 736 return 1; |
737 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
738 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
739 |
19105
3e4e2cfba186
Stop mkoctfile process if any part of compilation or linking fails (bug #42704).
Rik <rik@octave.org>
parents:
18432
diff
changeset
|
740 if (link && !objfiles.empty () && !result) |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
741 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
742 if (link_stand_alone) |
12174 | 743 { |
744 if (!vars["LD_CXX"].empty ()) | |
745 { | |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
746 std::string cmd = vars["LD_CXX"] + " " + vars["CPPFLAGS"] + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
747 + vars["ALL_CXXFLAGS"] + " " + vars["RDYNAMIC_FLAG"] |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
748 + " " + vars["ALL_LDFLAGS"] + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
749 + pass_on_options + " " + output_option + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
750 + objfiles + " " + libfiles + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
751 + ldflags + " " + vars["LFLAGS"] |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
752 + " -loctinterp -loctave " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
753 + " " + vars["OCTAVE_LINK_OPTS"] |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
754 + " " + vars["OCTAVE_LINK_DEPS"]; |
12174 | 755 result = run_command (cmd); |
756 } | |
757 else | |
758 { | |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
759 std::cerr |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
760 << "mkoctfile: no way to link stand-alone executable file" |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
761 << std::endl; |
12174 | 762 return 1; |
763 } | |
764 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
765 else |
12174 | 766 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
767 std::string cmd = vars["DL_LD"] + " " + vars["DL_LDFLAGS"] + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
768 + pass_on_options + " -o " + octfile + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
769 + objfiles + " " + libfiles + " " + ldflags + " " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
770 + vars["LFLAGS"] + " -loctinterp -loctave " |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
771 + vars["OCT_LINK_OPTS"] + " " + vars["OCT_LINK_DEPS"]; |
12174 | 772 result = run_command (cmd); |
773 } | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
774 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
775 if (strip) |
12174 | 776 { |
18432
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18431
diff
changeset
|
777 std::string cmd = "strip " + octfile; |
12174 | 778 result = run_command (cmd); |
779 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
780 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
781 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
782 return result; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
783 } |