annotate mkoctfile.cc.in @ 12312:b10ea6efdc58 release-3-4-x ss-3-3-91

version is now 3.3.91
author John W. Eaton <jwe@octave.org>
date Mon, 31 Jan 2011 08:36:58 -0500
parents 23385f2c90b7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8920
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8332
diff changeset
1 /*
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8332
diff changeset
2
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 11450
diff changeset
3 Copyright (C) 2008-2011 Michael Goffioul
8920
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8332
diff changeset
4
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8332
diff changeset
5 This file is part of Octave.
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8332
diff changeset
6
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8332
diff changeset
7 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
8 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
9 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
10 option) any later version.
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8332
diff changeset
11
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8332
diff changeset
12 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
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8332
diff changeset
14 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
15 for more details.
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8332
diff changeset
16
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8332
diff changeset
17 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
18 along with Octave; see the file COPYING. If not, see
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8332
diff changeset
19 <http://www.gnu.org/licenses/>.
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8332
diff changeset
20
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
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
23 #if defined (HAVE_CONFIG_H)
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
24 #include <config.h>
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
25 #endif
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
26
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
27 #include <string>
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
28 #include <map>
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
29 #include <list>
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
30 #include <algorithm>
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
31 #include <iostream>
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
32 #include <fstream>
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
33 #include <vector>
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
34 #include <cstdlib>
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
35
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
36 #if defined (__WIN32__) && ! defined (_POSIX_VERSION)
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
37 #include <windows.h>
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
38 #ifdef _MSC_VER
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
39 #define popen _popen
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
40 #define pclose _pclose
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
41 #endif
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
42 #endif
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
43
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
44 using namespace std;
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
45
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
46 static bool initialized = false;
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
47 static map<string,string> vars;
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
48
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
49 static string OCTAVE_VERSION = %OCTAVE_CONF_VERSION%;
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
50
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
51 static std::string
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
52 substitute_prefix (const std::string& s, const std::string& prefix,
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
53 const std::string& new_prefix)
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
54 {
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
55 std::string retval = s;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
56
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 if (!prefix.empty () && new_prefix != prefix)
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
58 {
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 int len = prefix.length ();
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 if (retval.find (prefix) == 0)
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
61 retval.replace (0, len, new_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
62 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
63
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
64 #if defined (__WIN32__) && ! defined (_POSIX_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
65 std::replace (retval.begin (), retval.end (), '/', '\\');
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
66 #endif
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
67
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
68 return retval;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
69 }
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
70
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
71 static string
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
72 get_line (FILE *fp)
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
73 {
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
74 static vector<char> buf (100);
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
75 int idx = 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
76 char c;
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 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
79 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
80 c = static_cast<char> (fgetc (fp));
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
81 if (c == '\n' || c == EOF)
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
82 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
83 if (buf.size () <= idx)
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
84 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
85 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
86 }
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
87 if (idx == 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
88 return string ("");
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 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
90 return string (&buf[0], idx);
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
91 }
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 string
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
95 get_variable (const char *name, const string& defval)
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
96 {
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
97 const char *val = getenv (name);
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
98 if (val == NULL || val[0] == '\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
99 return defval;
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
100 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
101 return string (val);
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
102 }
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
103
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
104 static string
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
105 quote_path (const string& s)
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
106 {
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
107 if (s.find (' ') != string::npos && s[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
108 return "\"" + s + "\"";
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
109 else
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
110 return s;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
111 }
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
112
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
113 static void
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
114 initialize (void)
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
115 {
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
116 if (initialized)
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
117 return;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
118
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
119 initialized = true;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
120
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
121 vars["OCTAVE_HOME"] = get_variable ("OCTAVE_HOME", "");
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
122
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
123 #if defined (__WIN32__) && ! defined (_POSIX_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
124 int n = 1024;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
125
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 std::string bin_dir (n, '\0');
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
127
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
128 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
129 {
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 int status = GetModuleFileName (0, &bin_dir[0], n);
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
131
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
132 if (status < n)
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
133 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
134 bin_dir.resize (status);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
135 break;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
136 }
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
137 else
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
138 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
139 n *= 2;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
140 bin_dir.resize (n);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
141 }
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
142 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
143
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
144 if (! bin_dir.empty ())
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
145 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
146 size_t pos = bin_dir.rfind ("\\bin\\");
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
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
148 if (pos != string::npos)
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
149 vars["OCTAVE_HOME"] = bin_dir.substr (0, pos);
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
150 }
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
151 #endif
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
152
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
153 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
154
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
155 vars["OCTAVE_PREFIX"] = %OCTAVE_CONF_PREFIX%;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
156
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
157 std::string DEFAULT_OCTINCLUDEDIR = %OCTAVE_CONF_OCTINCLUDEDIR%;
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
158 std::string DEFAULT_INCLUDEDIR = %OCTAVE_CONF_INCLUDEDIR%;
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
159 std::string DEFAULT_LIBDIR = %OCTAVE_CONF_LIBDIR%;
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
160 std::string DEFAULT_OCTLIBDIR = %OCTAVE_CONF_OCTLIBDIR%;
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
161
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
162 if (! vars["OCTAVE_HOME"].empty ())
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
163 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
164 DEFAULT_OCTINCLUDEDIR
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
165 = substitute_prefix (DEFAULT_OCTINCLUDEDIR, vars["OCTAVE_PREFIX"],
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
166 vars["OCTAVE_HOME"]);
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
167
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
168 DEFAULT_INCLUDEDIR
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
169 = substitute_prefix (DEFAULT_INCLUDEDIR, vars["OCTAVE_PREFIX"],
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
170 vars["OCTAVE_HOME"]);
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
171
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
172 DEFAULT_LIBDIR
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
173 = substitute_prefix (DEFAULT_LIBDIR, vars["OCTAVE_PREFIX"],
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
174 vars["OCTAVE_HOME"]);
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
175
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
176 DEFAULT_OCTLIBDIR
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
177 = substitute_prefix (DEFAULT_OCTLIBDIR, vars["OCTAVE_PREFIX"],
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
178 vars["OCTAVE_HOME"]);
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
179 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
180
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
181 vars["OCTINCLUDEDIR"] = get_variable ("OCTINCLUDEDIR", DEFAULT_OCTINCLUDEDIR);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
182 vars["INCLUDEDIR"] = get_variable ("INCLUDEDIR", DEFAULT_INCLUDEDIR);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
183 vars["LIBDIR"] = get_variable ("LIBDIR", DEFAULT_LIBDIR);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
184 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
185
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
186 #if defined (__WIN32__) && ! defined (_POSIX_VERSION)
9794
0d4613a736e9 convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents: 9565
diff changeset
187 std::string DEFAULT_INCFLAGS
0d4613a736e9 convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents: 9565
diff changeset
188 = "-I" + quote_path (vars["OCTINCLUDEDIR"] + "\\..")
0d4613a736e9 convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents: 9565
diff changeset
189 + " -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
190 #else
9794
0d4613a736e9 convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents: 9565
diff changeset
191 std::string DEFAULT_INCFLAGS
0d4613a736e9 convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents: 9565
diff changeset
192 = "-I" + quote_path (vars["OCTINCLUDEDIR"] + "/..")
0d4613a736e9 convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents: 9565
diff changeset
193 + " -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
194 #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
195 if (vars["INCLUDEDIR"] != "/usr/include")
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
196 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
197
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
198 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
199 if (vars["LIBDIR"] != "/usr/lib")
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
200 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
201
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
202 vars["CPPFLAGS"] = get_variable ("CPPFLAGS", %OCTAVE_CONF_CPPFLAGS%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
203 vars["INCFLAGS"] = get_variable ("INCFLAGS", DEFAULT_INCFLAGS);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
204 vars["F77"] = get_variable ("F77", %OCTAVE_CONF_F77%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
205 vars["FFLAGS"] = get_variable ("FFLAGS", %OCTAVE_CONF_FFLAGS%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
206 vars["FPICFLAG"] = get_variable ("FPICFLAG", %OCTAVE_CONF_FPICFLAG%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
207 vars["CC"] = get_variable ("CC", %OCTAVE_CONF_CC%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
208 vars["CFLAGS"] = get_variable ("CFLAGS", %OCTAVE_CONF_CFLAGS%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
209 vars["CPICFLAG"] = get_variable ("CPICFLAG", %OCTAVE_CONF_CPICFLAG%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
210 vars["CXX"] = get_variable ("CXX", %OCTAVE_CONF_CXX%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
211 vars["CXXFLAGS"] = get_variable ("CXXFLAGS", %OCTAVE_CONF_CXXFLAGS%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
212 vars["CXXPICFLAG"] = get_variable ("CXXPICFLAG", %OCTAVE_CONF_CXXPICFLAG%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
213 vars["XTRA_CFLAGS"] = get_variable ("XTRA_CFLAGS", %OCTAVE_CONF_XTRA_CFLAGS%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
214 vars["XTRA_CXXFLAGS"] = get_variable ("XTRA_CXXFLAGS", %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
215
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
216 vars["DEPEND_FLAGS"] = get_variable ("DEPEND_FLAGS", %OCTAVE_CONF_DEPEND_FLAGS%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
217 vars["DEPEND_EXTRA_SED_PATTERN"] = get_variable ("DEPEND_EXTRA_SED_PATTERN", %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
218
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
219 vars["DL_LD"] = get_variable ("DL_LD", %OCTAVE_CONF_DL_LD%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
220 vars["DL_LDFLAGS"] = get_variable ("DL_LDFLAGS", %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
221
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
222 vars["RLD_FLAG"] = get_variable ("RLD_FLAG", %OCTAVE_CONF_RLD_FLAG%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
223 vars["RDYNAMIC_FLAG"] = get_variable ("RDYNAMIC_FLAG", %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
224 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
225 vars["LIBOCTINTERP"] = "-loctinterp";
9515
eee9b3150446 more configure tweaks
John W. Eaton <jwe@octave.org>
parents: 9303
diff changeset
226 vars["READLINE_LIBS"] = "-lreadline";
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
227 vars["LIBCRUFT"] = "-lcruft";
11450
5eb10763069f substitute and use LAPACK_LIBS in mkoctfile script
John W. Eaton <jwe@octave.org>
parents: 11251
diff changeset
228 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
229 vars["BLAS_LIBS"] = get_variable ("BLAS_LIBS", %OCTAVE_CONF_BLAS_LIBS%);
9538
d0239bddf621 use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents: 9515
diff changeset
230 vars["FFTW3_LDFLAGS"] = get_variable ("FFTW3_LDFLAGS", %OCTAVE_CONF_FFTW3_LDFLAGS%);
d0239bddf621 use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents: 9515
diff changeset
231 vars["FFTW3_LIBS"] = get_variable ("FFTW3_LIBS", %OCTAVE_CONF_FFTW3_LIBS%);
d0239bddf621 use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents: 9515
diff changeset
232 vars["FFTW3F_LDFLAGS"] = get_variable ("FFTW3F_LDFLAGS", %OCTAVE_CONF_FFTW3F_LDFLAGS%);
d0239bddf621 use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents: 9515
diff changeset
233 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
234 vars["LIBS"] = get_variable ("LIBS", %OCTAVE_CONF_LIBS%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
235 vars["FLIBS"] = get_variable ("FLIBS", %OCTAVE_CONF_FLIBS%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
236 vars["LD_CXX"] = get_variable ("LD_CXX", %OCTAVE_CONF_LD_CXX%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
237 vars["LDFLAGS"] = get_variable ("LDFLAGS", %OCTAVE_CONF_LDFLAGS%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
238 vars["LD_STATIC_FLAG"] = get_variable ("LD_STATIC_FLAG", %OCTAVE_CONF_LD_STATIC_FLAG%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
239 vars["LFLAGS"] = get_variable ("LFLAGS", DEFAULT_LFLAGS);
11251
77989197a3c7 [mq]: mkoctfile_variable
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10721
diff changeset
240 vars["F77_INTEGER8_FLAG"] = get_variable ("F77_INTEGER8_FLAG", %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
241
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
242 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
243
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
244 vars["ALL_CFLAGS"] = vars["INCFLAGS"] + " " + vars["XTRA_CFLAGS"]
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
245 + " " + vars["CFLAGS"];
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
246
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
247 vars["ALL_CXXFLAGS"] = vars["INCFLAGS"] + " " + vars["XTRA_CXXFLAGS"]
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
248 + " " + vars["CXXFLAGS"];
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
249
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
250 vars["ALL_LDFLAGS"] = vars["LD_STATIC_FLAG"] + " " + vars["CPICFLAG"]
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
251 + " " + vars["LDFLAGS"];
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
252
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
253 vars["OCTAVE_LIBS"] = vars["LIBOCTINTERP"] + " " + vars["LIBOCTAVE"]
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
254 + " " + vars["SPECIAL_MATH_LIB"] + " " + vars["LIBCRUFT"];
9538
d0239bddf621 use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents: 9515
diff changeset
255
d0239bddf621 use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents: 9515
diff changeset
256 vars["FFTW_LIBS"] = vars["FFTW3_LDFLAGS"] + " " + vars["FFTW3_LIBS"]
9565
fe57b638e48c adapt octave-bug.cc.in and mkoctfile.cc.in to recent configure changes
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents: 9538
diff changeset
257 + " " + 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
258 }
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
259
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
260 static string usage_msg = "usage: mkoctfile [options] file ...";
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
261 static string version_msg = "mkoctfile, version " + OCTAVE_VERSION;
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
262 static bool debug = false;
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
263 static string help_msg =
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
264 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
265 "Options:\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
266 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
267 " -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
268 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
269 " -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
270 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
271 " -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
272 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
273 " -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
274 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
275 " -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
276 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
277 " -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
278 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
279 " -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
280 " source files.\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 " -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
283 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
284 " -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
285 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
286 " -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
287 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
288 " -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
289 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
290 " -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
291 " (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
292 " a stand-alone executable.\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
293 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
294 " -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
295 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
296 " -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
297 " variables are:\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
298 "\n"
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
299 " ALL_CFLAGS FLIBS\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
300 " ALL_CXXFLAGS FPICFLAG\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
301 " ALL_FFLAGS INCFLAGS\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
302 " ALL_LDFLAGS LAPACK_LIBS\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
303 " BLAS_LIBS LDFLAGS\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
304 " CC LD_CXX\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
305 " CFLAGS LD_STATIC_FLAG\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
306 " CPICFLAG LFLAGS\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
307 " CPPFLAGS LIBCRUFT\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
308 " CXX LIBOCTAVE\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
309 " CXXFLAGS LIBOCTINTERP\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
310 " CXXPICFLAG LIBS\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
311 " DEPEND_EXTRA_SED_PATTERN OCTAVE_LIBS\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
312 " DEPEND_FLAGS RDYNAMIC_FLAG\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
313 " DL_LD READLINE_LIBS\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
314 " DL_LDFLAGS RLD_FLAG\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
315 " F77 SED\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
316 " FFLAGS XTRA_CFLAGS\n"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
317 " FFTW_LIBS XTRA_CXXFLAGS\n"
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
318 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
319 " --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
320 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
321 " --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
322 " 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
323 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
324 " -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
325 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
326 " -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
327 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
328 " 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
329 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
330 " .c C source\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
331 " .cc C++ source\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
332 " .C C++ source\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
333 " .cpp C++ source\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
334 " .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
335 " .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
336 " .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
337 " .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
338 " .o object file\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
339 " .a library file\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
340 #ifdef _MSC_VER
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
341 " .lib library file\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
342 #endif
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
343 "\n";
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 static string
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
346 basename (const 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
347 {
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
348 size_t pos = s.rfind ('.');
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
349 string retval;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
350
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
351 if (pos == string::npos)
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
352 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
353 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
354 retval = s.substr (0, pos);
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
355 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
356 {
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 size_t p1 = retval.rfind ('/'), p2 = retval.rfind ('\\');
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
358 pos = (p1 != string::npos && p2 != string::npos
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
359 ? max (p1, p2) : (p2 != string::npos ? p2 : p1));
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
360 if (pos != string::npos)
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
361 retval = retval.substr (0, pos);
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
362 }
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 return retval;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
364 }
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
365
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
366 inline bool
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
367 starts_with (const string& s, const string& prefix)
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
368 {
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
369 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
370 }
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
371
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
372 inline bool
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 ends_with (const string& s, const string& suffix)
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
374 {
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 return (s.length () >= suffix.length ()
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
376 && 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
377 }
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
378
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
379 static 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
380 run_command (const string& cmd)
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
381 {
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
382 if (debug)
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 cout << cmd << endl;
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
384 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
385 }
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
386
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
387 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
388 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
389 {
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
390 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
391
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 string file, output_option;
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 list<string> cfiles, ccfiles, f77files;
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 int result = 0;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
395
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
396 string objfiles = "";
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
397 string libfiles = "";
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 string octfile = "";
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
399 string outputfile = "";
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
400 string incflags = "";
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
401 string defs = "";
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
402 string ldflags = "";
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 string pass_on_options = "";
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
404 bool strip = 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
405 bool no_oct_file_strip_on_this_platform = %NO_OCT_FILE_STRIP%;
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
406 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
407 bool link_stand_alone = 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
408 string output_ext = ".oct";
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 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
410 bool compile = 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
411
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
412 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
413 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
414 cout << usage_msg << endl;
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 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
416 }
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
417
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
418 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
419 || !strcmp (argv[1], "-version")
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
420 || !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
421 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
422 cout << version_msg << endl;
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
423 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
424 }
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
425
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
426 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
427 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
428 string arg = argv[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
429 size_t len = arg.length ();
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
430
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
431 if (ends_with (arg, ".c"))
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
432 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
433 file = arg;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
434 cfiles.push_back (file);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
435 }
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
436 else if (ends_with (arg, ".cc") || ends_with (arg, ".C")
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
437 || ends_with (arg, ".cpp"))
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
438 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
439 file = arg;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
440 ccfiles.push_back (file);
23385f2c90b7 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 (ends_with (arg, ".f") || ends_with (arg, ".F")
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
443 || ends_with (arg, "f90") || ends_with (arg, ".F90"))
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
444 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
445 file = arg;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
446 f77files.push_back (file);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
447 }
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
448 else if (ends_with (arg, ".o") || ends_with (arg, ".obj"))
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
449 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
450 file = arg;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
451 objfiles += (" " + quote_path (arg));
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
452 }
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
453 else if (ends_with (arg, ".lib") || ends_with (arg, ".a"))
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
454 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
455 file = arg;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
456 libfiles += (" " + quote_path (arg));
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
457 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
458 else if (arg == "-d" || arg == "-debug" || arg == "--debug"
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
459 || arg == "-v" || arg == "-verbose" || arg == "--verbose")
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
460 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
461 debug = true;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
462 if (vars["CC"] == "cc-msvc")
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
463 vars["CC"] += " -d";
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
464 if (vars["CXX"] == "cc-msvc")
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
465 vars["CXX"] += " -d";
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
466 if (vars["DL_LD"] == "cc-msvc")
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
467 vars["DL_LD"] += " -d";
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
468 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
469 else if (arg == "-h" || arg == "-?" || arg == "-help" || arg == "--help")
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
470 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
471 cout << usage_msg << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
472 cout << help_msg << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
473 return 0;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
474 }
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
475 else if (starts_with (arg, "-I"))
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
476 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
477 incflags += (" " + quote_path (arg));
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
478 }
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
479 else if (arg == "-idirafter")
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
480 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
481 if (i < argc-1)
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
482 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
483 arg = argv[++i];
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
484 incflags += (" -idirafter " + arg);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
485 }
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
486 else
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
487 cerr << "mkoctfile: include directory name missing" << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
488 }
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
489 else if (starts_with (arg, "-D"))
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
490 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
491 defs += (" " + arg);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
492 }
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
493 else if (starts_with (arg, "-Wl,") || starts_with (arg, "-l")
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
494 || starts_with (arg, "-L") || starts_with (arg, "-R"))
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
495 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
496 ldflags += (" " + arg);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
497 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
498 else if (arg == "-M" || arg == "-depend" || arg == "--depend")
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
499 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
500 depend = true;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
501 compile = false;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
502 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
503 else if (arg == "-o" || arg == "-output" || arg == "--output")
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
504 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
505 if (i < argc-1)
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
506 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
507 arg = argv[++i];
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
508 outputfile = arg;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
509 }
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
510 else
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
511 cerr << "mkoctfile: output file name missing" << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
512 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
513 else if (arg == "-p" || arg == "-print" || arg == "--print")
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
514 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
515 if (i < argc-1)
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
516 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
517 arg = argv[++i];
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
518 cout << vars[arg] << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
519 return 0;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
520 }
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
521 else
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
522 cerr << "mkoctfile: --print requires argument" << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
523 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
524 else if (arg == "-s" || arg == "-strip" || arg == "--strip")
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
525 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
526 if (no_oct_file_strip_on_this_platform)
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
527 cerr << "mkoctfile: stripping disabled on this platform" << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
528 else
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
529 strip = true;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
530 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
531 else if (arg == "-c" || arg == "-compile" || arg == "--compile")
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
532 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
533 link = false;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
534 }
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
535 else if (arg == "-g")
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
536 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
537 vars["ALL_CFLAGS"] += " -g";
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
538 vars["ALL_CXXFLAGS"] += " -g";
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
539 vars["ALL_FFLAGS"] += " -g";
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
540 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
541 else if (arg == "-link-stand-alone" || arg == "--link-stand-alone")
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
542 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
543 link_stand_alone = true;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
544 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
545 else if (arg == "-mex" || arg == "--mex")
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
546 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
547 incflags += " -I.";
9303
adf676387922 properly #ifdef MSVC linker specific flags
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents: 9245
diff changeset
548 #ifdef _MSC_VER
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
549 ldflags += " -Wl,-export:mexFunction";
9303
adf676387922 properly #ifdef MSVC linker specific flags
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents: 9245
diff changeset
550 #endif
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
551 output_ext = ".mex";
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
552 }
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
553 else if (starts_with (arg, "-W"))
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
554 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
555 pass_on_options += (" " + arg);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
556 }
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
557 else
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
558 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
559 cerr << "mkoctfile: unrecognized argument " << arg;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
560 return 1;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
561 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
562
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
563 if (!file.empty () && octfile.empty ())
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
564 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
565 }
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
566
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 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
568 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
569 if (!outputfile.empty ())
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
570 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
571 }
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 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
573 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
574 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
575 {
59ed11557715 mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents: 9956
diff changeset
576 octfile = 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
577 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
578 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
579 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
580 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
581 }
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
582 else
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
583 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
584 }
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
585
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
586 list<string>::const_iterator it;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
587
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
588 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
589 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
590 for (it = cfiles.begin (); it != cfiles.end (); ++it)
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
591 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
592 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
593
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
594 unlink (dfile.c_str ());
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
595 string cmd = vars["CC"] + " " + vars["DEPEND_FLAGS"] + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
596 + vars["CPPFLAGS"] + " " + vars["ALL_CFLAGS"] + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
597 + 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
598
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
599 FILE *fd = popen (cmd.c_str (), "r");
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
600 ofstream fo (dfile.c_str ());
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
601 int pos;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
602 while (!feof (fd))
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
603 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
604 line = get_line (fd);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
605 if ((pos = line.rfind (".o:")) != string::npos)
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
606 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
607 int spos = line.rfind ('/', pos);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
608 string ofile = (spos == string::npos ? line.substr (0, pos+2) : line.substr (spos+1, pos-spos+1));
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
609 fo << "pic/" << ofile << " " << ofile << " " << dfile << line.substr (pos) << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
610 }
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
611 else
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
612 fo << line << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
613 }
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
614 pclose (fd);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
615 fo.close ();
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
616 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
617
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
618 for (it = ccfiles.begin (); it != ccfiles.end (); ++it)
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
619 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
620 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
621
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
622 unlink (dfile.c_str ());
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
623 string cmd = vars["CC"] + " " + vars["DEPEND_FLAGS"] + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
624 + vars["CPPFLAGS"] + " " + vars["ALL_CXXFLAGS"] + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
625 + 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
626
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
627 FILE *fd = popen (cmd.c_str (), "r");
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
628 ofstream fo (dfile.c_str ());
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
629 int pos;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
630 while (!feof (fd))
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
631 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
632 line = get_line (fd);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
633 if ((pos = line.rfind (".o:")) != string::npos)
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
634 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
635 int spos = line.rfind ('/', pos);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
636 string ofile = (spos == string::npos ? line.substr (0, pos+2) : line.substr (spos+1, pos-spos+1));
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
637 fo << "pic/" << ofile << " " << ofile << " " << dfile << line.substr (pos+2) << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
638 }
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
639 else
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
640 fo << line << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
641 }
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
642 pclose (fd);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
643 fo.close ();
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
644 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
645
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
646 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
647 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
648
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
649 for (it = f77files.begin (); it != f77files.end (); ++it)
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 {
9956
f26a33e21db9 mkoctfile: when compiling files in subdirectories, place object files in current directory by default
John W. Eaton <jwe@octave.org>
parents: 9955
diff changeset
651 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
652 if (!vars["F77"].empty ())
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
653 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
654 string o;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
655 if (!outputfile.empty ())
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
656 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
657 if (link)
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
658 o = b + ".o";
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
659 else
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
660 o = outputfile;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
661 }
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
662 else
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
663 o = b + ".o";
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
664 objfiles += (" " + o);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
665 string cmd = vars["F77"] + " -c " + vars["FPICFLAG"] + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
666 + vars["ALL_FFLAGS"] + " " + incflags + " " + defs + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
667 + pass_on_options + " " + f + " -o " + o;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
668 result = run_command (cmd);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
669 }
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
670 else
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
671 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
672 cerr << "mkoctfile: no way to compile Fortran file " << f << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
673 return 1;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
674 }
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
675 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
676
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
677 for (it = cfiles.begin (); it != cfiles.end (); ++it)
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
678 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
679 string f = *it;
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 if (!vars["CC"].empty ())
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
681 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
682 string b = basename (f, true), o;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
683 if (!outputfile.empty ())
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
684 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
685 if (link)
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
686 o = b + ".o";
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
687 else
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
688 o = outputfile;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
689 }
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
690 else
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
691 o = b + ".o";
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
692 objfiles += (" " + o);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
693 string cmd = vars["CC"] + " -c " + vars["CPPFLAGS"] + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
694 + vars["CPICFLAG"] + " " + vars["ALL_CFLAGS"] + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
695 + pass_on_options + " " + incflags + " " + defs + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
696 + quote_path (f) + " -o " + quote_path (o);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
697 result = run_command (cmd);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
698 }
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
699 else
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
700 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
701 cerr << "mkoctfile: no way to compile C file " << f << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
702 return 1;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
703 }
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
704 }
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
705
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
706 for (it = ccfiles.begin (); it != ccfiles.end (); ++it)
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
707 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
708 string f = *it;
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
709 if (!vars["CXX"].empty ())
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
710 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
711 string b = basename (f, true), o;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
712 if (!outputfile.empty ())
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
713 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
714 if (link)
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
715 o = b + ".o";
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
716 else
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
717 o = outputfile;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
718 }
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
719 else
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
720 o = b + ".o";
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
721 objfiles += (" " + o);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
722 string cmd = vars["CXX"] + " -c " + vars["CPPFLAGS"] + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
723 + vars["CXXPICFLAG"] + " " + vars["ALL_CXXFLAGS"] + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
724 + pass_on_options + " " + incflags + " " + defs + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
725 + quote_path (f) + " -o " + quote_path (o);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
726 result = run_command (cmd);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
727 }
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
728 else
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
729 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
730 cerr << "mkoctfile: no way to compile C++ file " << f << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
731 return 1;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
732 }
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
733 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
734
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
735 if (link && !objfiles.empty ())
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
736 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
737 if (link_stand_alone)
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
738 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
739 if (!vars["LD_CXX"].empty ())
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
740 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
741 string cmd = vars["LD_CXX"] + " " + vars["CPPFLAGS"] + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
742 + vars["ALL_CXXFLAGS"] + " " + vars["RDYNAMIC_FLAG"]
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
743 + " " + vars["ALL_LDFLAGS"] + " " + pass_on_options
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
744 + " " + output_option + " " + objfiles + " " + libfiles
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
745 + " " + ldflags + " " + vars["LFLAGS"] + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
746 + vars["RLD_FLAG"] + " " + vars["OCTAVE_LIBS"] + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
747 + vars["LAPACK_LIBS"] + " " + vars["BLAS_LIBS"] + " "
11450
5eb10763069f substitute and use LAPACK_LIBS in mkoctfile script
John W. Eaton <jwe@octave.org>
parents: 11251
diff changeset
748 + vars["FFTW_LIBS"] + " " + vars["READLINE_LIBS"] + " "
5eb10763069f substitute and use LAPACK_LIBS in mkoctfile script
John W. Eaton <jwe@octave.org>
parents: 11251
diff changeset
749 + vars["LIBS"] + " " + vars["FLIBS"];
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
750 result = run_command (cmd);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
751 }
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
752 else
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
753 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
754 cerr << "mkoctfile: no way to link stand-alone executable file"
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
755 << endl;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
756 return 1;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
757 }
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
758 }
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
759 else
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
760 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
761 string LINK_DEPS = vars["LFLAGS"] + " " + vars["OCTAVE_LIBS"]
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
762 + " " + vars["LDFLAGS"] + " " + vars["BLAS_LIBS"] + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
763 + vars["FFTW_LIBS"] + " " + vars["LIBS"] + " " + vars["FLIBS"];
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
764 string cmd = vars["DL_LD"] + " " + vars["DL_LDFLAGS"] + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
765 + pass_on_options + " -o " + octfile + " " + objfiles + " "
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
766 + libfiles + " " + ldflags + " " + LINK_DEPS;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
767 result = run_command (cmd);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
768 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
769
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
770 if (strip)
12254
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
771 {
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
772 string cmd = "strip " + octfile;
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
773 result = run_command (cmd);
23385f2c90b7 whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
774 }
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
775 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
776
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
777 return result;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
778 }