annotate src/mkoctfile.in.cc @ 18915:3e4e2cfba186 stable

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