@@ -143,7 +143,24 @@ public void reportJdkHome() {
143
143
out .println (jdkDir .getAbsolutePath ());
144
144
}
145
145
146
- public void reportCFlags () {
146
+ public boolean isOSX () {
147
+ return "Mac OS X" .equals (System .getProperty ("os.name" ));
148
+ }
149
+
150
+ public void reportCFlags () throws IOException {
151
+ if (isOSX ()) {
152
+ // OSX is special, as always
153
+ // Up one level from the java.home is a Headers directory
154
+ File jreHome =new File (System .getProperty ("java.home" , "" ));
155
+ File headersDir =new File (jreHome .getParentFile (), "Headers" );
156
+ if (headersDir .isDirectory ()) {
157
+ out .println ("-I" + headersDir .getCanonicalPath ());
158
+ return ;
159
+ }
160
+
161
+ // Otherwise, fall through to standard JDK directory structure detect
162
+ }
163
+
147
164
File jdkDir =getJdkHome ();
148
165
if (jdkDir ==null ) error ("Could not determine JDK location" );
149
166
@@ -164,6 +181,18 @@ public void reportCFlags() {
164
181
}
165
182
166
183
public void reportLDFlags () throws IOException {
184
+ if (isOSX ()) {
185
+ // OSX is special, as always
186
+ // Up one level from the java.home is a Headers directory
187
+ File jreHome =new File (System .getProperty ("java.home" , "" ));
188
+ File libDir =new File (jreHome .getParentFile (), "Libraries" );
189
+ if (libDir .isDirectory ()) {
190
+ out .println ("-L" + libDir .getCanonicalPath ());
191
+ return ;
192
+ }
193
+ // Otherwise, fall through to standard directory layout detect
194
+ }
195
+
167
196
String prop =System .getProperty ("java.library.path" );
168
197
if (prop ==null ) error ("Could not find java.library.path" );
169
198
String [] paths =prop .split (Pattern .quote (String .valueOf (File .pathSeparatorChar )));
0 commit comments