annotate src/mkoctfile.cc.in @ 14204:704f7895eef0 stable release-3-6-0 release-3.6.0

Version 3.6.0 released. * configure.ac (AC_INIT): Version is now 3.6.0. (OCTAVE_API_VERSION_NUMBER): Now 48. (OCTAVE_RELEASE_DATE): Now 2012-01-15.
author John W. Eaton <jwe@octave.org>
date Sun, 15 Jan 2012 13:02:42 -0500
parents 72c96de7a403
children 747dd82082c8
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
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 13130
diff changeset
3 Copyright (C) 2008-2012 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,
12174
db1f49eaba6b 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)
12174
db1f49eaba6b 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)
12174
db1f49eaba6b 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)
12174
db1f49eaba6b 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)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
133 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
134 bin_dir.resize (status);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
135 break;
db1f49eaba6b 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
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
138 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
139 n *= 2;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
140 bin_dir.resize (n);
db1f49eaba6b 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)
12174
db1f49eaba6b 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
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
165 = substitute_prefix (DEFAULT_OCTINCLUDEDIR, vars["OCTAVE_PREFIX"],
db1f49eaba6b 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
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
169 = substitute_prefix (DEFAULT_INCLUDEDIR, vars["OCTAVE_PREFIX"],
db1f49eaba6b 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
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
173 = substitute_prefix (DEFAULT_LIBDIR, vars["OCTAVE_PREFIX"],
db1f49eaba6b 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
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
177 = substitute_prefix (DEFAULT_OCTLIBDIR, vars["OCTAVE_PREFIX"],
db1f49eaba6b 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["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
223 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
224 vars["LIBOCTINTERP"] = "-loctinterp";
9515
eee9b3150446 more configure tweaks
John W. Eaton <jwe@octave.org>
parents: 9303
diff changeset
225 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
226 vars["LIBCRUFT"] = "-lcruft";
11450
5eb10763069f substitute and use LAPACK_LIBS in mkoctfile script
John W. Eaton <jwe@octave.org>
parents: 11251
diff changeset
227 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
228 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
229 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
230 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
231 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
232 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
233 vars["LIBS"] = get_variable ("LIBS", %OCTAVE_CONF_LIBS%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
234 vars["FLIBS"] = get_variable ("FLIBS", %OCTAVE_CONF_FLIBS%);
13010
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
235 vars["OCTAVE_LINK_DEPS"] = get_variable ("FLIBS", %OCTAVE_CONF_OCTAVE_LINK_DEPS%);
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
236 vars["OCT_LINK_DEPS"] = get_variable ("FLIBS", %OCTAVE_CONF_OCT_LINK_DEPS%);
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
237 vars["FLIBS"] = get_variable ("FLIBS", %OCTAVE_CONF_FLIBS%);
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
238
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
239 vars["LD_CXX"] = get_variable ("LD_CXX", %OCTAVE_CONF_LD_CXX%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
240 vars["LDFLAGS"] = get_variable ("LDFLAGS", %OCTAVE_CONF_LDFLAGS%);
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
241 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
242 vars["LFLAGS"] = get_variable ("LFLAGS", DEFAULT_LFLAGS);
11251
77989197a3c7 [mq]: mkoctfile_variable
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10721
diff changeset
243 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
244
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
245 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
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_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
248 + " " + vars["CFLAGS"];
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_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
251 + " " + vars["CXXFLAGS"];
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["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
254 + " " + vars["LDFLAGS"];
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
255
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
256 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
257 + " " + 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
258
d0239bddf621 use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents: 9515
diff changeset
259 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
260 + " " + 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
261 }
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
262
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
263 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
264 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
265 static bool debug = false;
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
266 static string help_msg =
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
267 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
268 "Options:\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
269 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
270 " -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
271 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
272 " -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
273 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
274 " -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
275 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
276 " -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
277 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
278 " -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
279 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
280 " -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
281 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
282 " -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
283 " source files.\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
284 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
285 " -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
286 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
287 " -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
288 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
289 " -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
290 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
291 " -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
292 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
293 " -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
294 " (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
295 " a stand-alone executable.\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
296 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
297 " -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
298 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
299 " -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
300 " variables are:\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
301 "\n"
13010
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
302 " ALL_CFLAGS FLIBS\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
303 " ALL_CXXFLAGS FPICFLAG\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
304 " ALL_FFLAGS INCFLAGS\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
305 " ALL_LDFLAGS LAPACK_LIBS\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
306 " BLAS_LIBS LDFLAGS\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
307 " CC LD_CXX\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
308 " CFLAGS LD_STATIC_FLAG\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
309 " CPICFLAG LFLAGS\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
310 " CPPFLAGS LIBCRUFT\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
311 " CXX LIBOCTAVE\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
312 " CXXFLAGS LIBOCTINTERP\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
313 " CXXPICFLAG LIBS\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
314 " DEPEND_EXTRA_SED_PATTERN OCTAVE_LIBS\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
315 " DEPEND_FLAGS OCTAVE_LINK_DEPS\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
316 " DL_LD OCTAVE_LINK_OPTS\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
317 " DL_LDFLAGS OCT_LINK_DEPS\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
318 " EXEEXT OCT_LINK_OPTS\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
319 " F77 RDYNAMIC_FLAG\n"
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
320 " F77_INTEGER_8_FLAG READLINE_LIBS\n"
13025
4a86826dbb0e maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents: 13024
diff changeset
321 " FFLAGS SED\n"
4a86826dbb0e maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents: 13024
diff changeset
322 " FFTW3_LDFLAGS XTRA_CFLAGS\n"
4a86826dbb0e maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents: 13024
diff changeset
323 " FFTW3_LIBS XTRA_CXXFLAGS\n"
4a86826dbb0e maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents: 13024
diff changeset
324 " FFTW3F_LDFLAGS\n"
13010
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
325 " FFTW3F_LIBS\n"
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
326 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
327 " --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
328 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
329 " --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
330 " 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
331 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
332 " -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
333 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
334 " -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
335 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
336 " 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
337 "\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
338 " .c C source\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
339 " .cc C++ source\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
340 " .C C++ source\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
341 " .cpp C++ source\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
342 " .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
343 " .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
344 " .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
345 " .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
346 " .o object file\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
347 " .a library file\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
348 #ifdef _MSC_VER
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
349 " .lib library file\n"
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
350 #endif
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
351 "\n";
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
352
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
353 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
354 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
355 {
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
356 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
357 string retval;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
358
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
359 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
360 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
361 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
362 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
363 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
364 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
365 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
366 pos = (p1 != string::npos && p2 != string::npos
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
367 ? 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
368 if (pos != string::npos)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
369 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
370 }
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
371 return retval;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
372 }
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
373
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
374 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
375 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
376 {
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
377 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
378 }
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
379
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
380 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
381 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
382 {
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
383 return (s.length () >= suffix.length ()
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
384 && 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
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 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
388 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
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 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
391 cout << cmd << endl;
8332
34fde4755a0f style fixes
John W. Eaton <jwe@octave.org>
parents: 8092
diff changeset
392 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
393 }
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
394
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
395 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
396 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
397 {
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
398 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
399
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 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
401 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
402 int result = 0;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
403
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
404 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
405 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
406 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
407 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
408 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
409 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
410 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
411 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
412 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
413 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
414 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
415 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
416 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
417 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
418 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
419
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
420 if (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
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 << 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
423 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
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
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
426 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
427 || !strcmp (argv[1], "-version")
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
428 || !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
429 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
430 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
431 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
432 }
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
433
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
434 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
435 {
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 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
437 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
438
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
439 if (ends_with (arg, ".c"))
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
440 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
441 file = arg;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
442 cfiles.push_back (file);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
443 }
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
444 else if (ends_with (arg, ".cc") || ends_with (arg, ".C")
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
445 || ends_with (arg, ".cpp"))
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
446 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
447 file = arg;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
448 ccfiles.push_back (file);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
449 }
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
450 else if (ends_with (arg, ".f") || ends_with (arg, ".F")
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
451 || ends_with (arg, "f90") || ends_with (arg, ".F90"))
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
452 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
453 file = arg;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
454 f77files.push_back (file);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
455 }
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
456 else if (ends_with (arg, ".o") || ends_with (arg, ".obj"))
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
457 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
458 file = arg;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
459 objfiles += (" " + quote_path (arg));
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
460 }
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
461 else if (ends_with (arg, ".lib") || ends_with (arg, ".a"))
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
462 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
463 file = arg;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
464 libfiles += (" " + quote_path (arg));
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
465 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
466 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
467 || arg == "-v" || arg == "-verbose" || arg == "--verbose")
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
468 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
469 debug = true;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
470 if (vars["CC"] == "cc-msvc")
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
471 vars["CC"] += " -d";
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
472 if (vars["CXX"] == "cc-msvc")
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
473 vars["CXX"] += " -d";
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
474 if (vars["DL_LD"] == "cc-msvc")
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
475 vars["DL_LD"] += " -d";
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
476 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
477 else if (arg == "-h" || arg == "-?" || arg == "-help" || arg == "--help")
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
478 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
479 cout << usage_msg << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
480 cout << help_msg << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
481 return 0;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
482 }
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
483 else if (starts_with (arg, "-I"))
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
484 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
485 incflags += (" " + quote_path (arg));
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
486 }
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
487 else if (arg == "-idirafter")
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
488 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
489 if (i < argc-1)
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
490 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
491 arg = argv[++i];
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
492 incflags += (" -idirafter " + arg);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
493 }
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
494 else
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
495 cerr << "mkoctfile: include directory name missing" << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
496 }
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
497 else if (starts_with (arg, "-D"))
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
498 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
499 defs += (" " + arg);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
500 }
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
501 else if (starts_with (arg, "-Wl,") || starts_with (arg, "-l")
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
502 || starts_with (arg, "-L") || starts_with (arg, "-R"))
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
503 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
504 ldflags += (" " + arg);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
505 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
506 else if (arg == "-M" || arg == "-depend" || arg == "--depend")
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
507 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
508 depend = true;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
509 compile = false;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
510 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
511 else if (arg == "-o" || arg == "-output" || arg == "--output")
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
512 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
513 if (i < argc-1)
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
514 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
515 arg = argv[++i];
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
516 outputfile = arg;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
517 }
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
518 else
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
519 cerr << "mkoctfile: output file name missing" << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
520 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
521 else if (arg == "-p" || arg == "-print" || arg == "--print")
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
522 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
523 if (i < argc-1)
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
524 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
525 arg = argv[++i];
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
526 cout << vars[arg] << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
527 return 0;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
528 }
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
529 else
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
530 cerr << "mkoctfile: --print requires argument" << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
531 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
532 else if (arg == "-s" || arg == "-strip" || arg == "--strip")
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
533 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
534 if (no_oct_file_strip_on_this_platform)
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
535 cerr << "mkoctfile: stripping disabled on this platform" << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
536 else
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
537 strip = true;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
538 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
539 else if (arg == "-c" || arg == "-compile" || arg == "--compile")
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
540 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
541 link = false;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
542 }
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
543 else if (arg == "-g")
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
544 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
545 vars["ALL_CFLAGS"] += " -g";
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
546 vars["ALL_CXXFLAGS"] += " -g";
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
547 vars["ALL_FFLAGS"] += " -g";
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
548 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
549 else if (arg == "-link-stand-alone" || arg == "--link-stand-alone")
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
550 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
551 link_stand_alone = true;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
552 }
9955
33537a4d223f mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
553 else if (arg == "-mex" || arg == "--mex")
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
554 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
555 incflags += " -I.";
9303
adf676387922 properly #ifdef MSVC linker specific flags
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents: 9245
diff changeset
556 #ifdef _MSC_VER
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
557 ldflags += " -Wl,-export:mexFunction";
9303
adf676387922 properly #ifdef MSVC linker specific flags
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents: 9245
diff changeset
558 #endif
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
559 output_ext = ".mex";
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
560 }
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
561 else if (starts_with (arg, "-W"))
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
562 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
563 pass_on_options += (" " + arg);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
564 }
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 else
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
566 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
567 cerr << "mkoctfile: unrecognized argument " << arg;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
568 return 1;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
569 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
570
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 if (!file.empty () && octfile.empty ())
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
572 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
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
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
575 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
576 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
577 if (!outputfile.empty ())
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
578 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
579 }
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
580 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
581 {
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 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
583 {
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
584 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
585 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
586 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
587 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
588 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
589 }
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
590 else
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
591 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
592 }
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
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
594 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
595
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
596 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
597 {
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 for (it = cfiles.begin (); it != cfiles.end (); ++it)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
599 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
600 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
601
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
602 unlink (dfile.c_str ());
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
603 string cmd = vars["CC"] + " " + vars["DEPEND_FLAGS"] + " "
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
604 + vars["CPPFLAGS"] + " " + vars["ALL_CFLAGS"] + " "
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
605 + 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
606
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
607 FILE *fd = popen (cmd.c_str (), "r");
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
608 ofstream fo (dfile.c_str ());
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
609 int pos;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
610 while (!feof (fd))
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
611 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
612 line = get_line (fd);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
613 if ((pos = line.rfind (".o:")) != string::npos)
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
614 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
615 int spos = line.rfind ('/', pos);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
616 string ofile = (spos == string::npos ? line.substr (0, pos+2) : line.substr (spos+1, pos-spos+1));
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
617 fo << "pic/" << ofile << " " << ofile << " " << dfile << line.substr (pos) << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
618 }
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
619 else
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
620 fo << line << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
621 }
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
622 pclose (fd);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
623 fo.close ();
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
624 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
625
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
626 for (it = ccfiles.begin (); it != ccfiles.end (); ++it)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
627 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
628 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
629
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
630 unlink (dfile.c_str ());
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
631 string cmd = vars["CC"] + " " + vars["DEPEND_FLAGS"] + " "
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
632 + vars["CPPFLAGS"] + " " + vars["ALL_CXXFLAGS"] + " "
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
633 + 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
634
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
635 FILE *fd = popen (cmd.c_str (), "r");
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
636 ofstream fo (dfile.c_str ());
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
637 int pos;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
638 while (!feof (fd))
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
639 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
640 line = get_line (fd);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
641 if ((pos = line.rfind (".o:")) != string::npos)
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
642 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
643 int spos = line.rfind ('/', pos);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
644 string ofile = (spos == string::npos ? line.substr (0, pos+2) : line.substr (spos+1, pos-spos+1));
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
645 fo << "pic/" << ofile << " " << ofile << " " << dfile << line.substr (pos+2) << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
646 }
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
647 else
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
648 fo << line << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
649 }
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
650 pclose (fd);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
651 fo.close ();
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
652 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
653
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
654 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
655 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
656
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
657 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
658 {
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
659 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
660 if (!vars["F77"].empty ())
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
661 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
662 string o;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
663 if (!outputfile.empty ())
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
664 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
665 if (link)
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
666 o = b + ".o";
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
667 else
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
668 o = outputfile;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
669 }
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
670 else
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
671 o = b + ".o";
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
672 objfiles += (" " + o);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
673 string cmd = vars["F77"] + " -c " + vars["FPICFLAG"] + " "
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
674 + vars["ALL_FFLAGS"] + " " + incflags + " " + defs + " "
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
675 + pass_on_options + " " + f + " -o " + o;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
676 result = run_command (cmd);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
677 }
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
678 else
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
679 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
680 cerr << "mkoctfile: no way to compile Fortran file " << f << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
681 return 1;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
682 }
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
683 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
684
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
685 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
686 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
687 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
688 if (!vars["CC"].empty ())
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
689 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
690 string b = basename (f, true), o;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
691 if (!outputfile.empty ())
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
692 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
693 if (link)
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
694 o = b + ".o";
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
695 else
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
696 o = outputfile;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
697 }
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
698 else
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
699 o = b + ".o";
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
700 objfiles += (" " + o);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
701 string cmd = vars["CC"] + " -c " + vars["CPPFLAGS"] + " "
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
702 + vars["CPICFLAG"] + " " + vars["ALL_CFLAGS"] + " "
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
703 + pass_on_options + " " + incflags + " " + defs + " "
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
704 + quote_path (f) + " -o " + quote_path (o);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
705 result = run_command (cmd);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
706 }
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
707 else
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
708 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
709 cerr << "mkoctfile: no way to compile C file " << f << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
710 return 1;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
711 }
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
712 }
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
713
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
714 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
715 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
716 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
717 if (!vars["CXX"].empty ())
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
718 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
719 string b = basename (f, true), o;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
720 if (!outputfile.empty ())
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
721 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
722 if (link)
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
723 o = b + ".o";
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
724 else
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
725 o = outputfile;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
726 }
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
727 else
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
728 o = b + ".o";
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
729 objfiles += (" " + o);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
730 string cmd = vars["CXX"] + " -c " + vars["CPPFLAGS"] + " "
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
731 + vars["CXXPICFLAG"] + " " + vars["ALL_CXXFLAGS"] + " "
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
732 + pass_on_options + " " + incflags + " " + defs + " "
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
733 + quote_path (f) + " -o " + quote_path (o);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
734 result = run_command (cmd);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
735 }
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
736 else
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
737 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
738 cerr << "mkoctfile: no way to compile C++ file " << f << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
739 return 1;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
740 }
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
741 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
742
8092
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
743 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
744 {
6a292b0fa88c mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents: 8091
diff changeset
745 if (link_stand_alone)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
746 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
747 if (!vars["LD_CXX"].empty ())
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
748 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
749 string cmd = vars["LD_CXX"] + " " + vars["CPPFLAGS"] + " "
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
750 + vars["ALL_CXXFLAGS"] + " " + vars["RDYNAMIC_FLAG"]
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
751 + " " + vars["ALL_LDFLAGS"] + " " + pass_on_options
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
752 + " " + output_option + " " + objfiles + " " + libfiles
13024
f3c53fea9fb5 maint: more linking tweaks
John W. Eaton <jwe@octave.org>
parents: 13010
diff changeset
753 + " " + ldflags + " " + vars["LFLAGS"]
f3c53fea9fb5 maint: more linking tweaks
John W. Eaton <jwe@octave.org>
parents: 13010
diff changeset
754 + " -loctinterp -loctave -lcruft "
13010
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
755 + " " + vars["OCT_LINK_OPTS"]
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
756 + " " + vars["OCTAVE_LINK_DEPS"];
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
757 result = run_command (cmd);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
758 }
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
759 else
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
760 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
761 cerr << "mkoctfile: no way to link stand-alone executable file"
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
762 << endl;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
763 return 1;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
764 }
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
765 }
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
766 else
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
767 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
768 string cmd = vars["DL_LD"] + " " + vars["DL_LDFLAGS"] + " "
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
769 + pass_on_options + " -o " + octfile + " " + objfiles + " "
13024
f3c53fea9fb5 maint: more linking tweaks
John W. Eaton <jwe@octave.org>
parents: 13010
diff changeset
770 + libfiles + " " + ldflags + " " + vars["LFLAGS"]
f3c53fea9fb5 maint: more linking tweaks
John W. Eaton <jwe@octave.org>
parents: 13010
diff changeset
771 + " -loctinterp -loctave -lcruft "
13010
edc5ec6e949b maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents: 12733
diff changeset
772 + vars["OCT_LINK_OPTS"] + " " + vars["OCT_LINK_DEPS"];
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
773 result = run_command (cmd);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
774 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
775
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
776 if (strip)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
777 {
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
778 string cmd = "strip " + octfile;
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
779 result = run_command (cmd);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11561
diff changeset
780 }
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
781 }
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
782
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
783 return result;
8091
4e7527a7b3f9 mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff changeset
784 }