@@ -33,6 +33,10 @@ AC_DEFUN([ORTE_SETUP_JAVA_BANNER],[
33
33
AC_DEFUN([ORTE_SETUP_JAVA],[
34
34
AC_REQUIRE([ORTE_SETUP_JAVA_BANNER])
35
35
36
+ AC_ARG_ENABLE(java,
37
+ AC_HELP_STRING([--enable-java],
38
+ [Enable Java-based support in the system - use this option to disable all Java-based compiler tests (default: enabled)]))
39
+
36
40
AC_ARG_WITH(jdk-dir,
37
41
AC_HELP_STRING([--with-jdk-dir(=DIR)],
38
42
[Location of the JDK header directory. If you use this option, do not specify --with-jdk-bindir or --with-jdk-headers.]))
@@ -43,140 +47,147 @@ AC_DEFUN([ORTE_SETUP_JAVA],[
43
47
AC_HELP_STRING([--with-jdk-headers(=DIR)],
44
48
[Location of the JDK header directory. If you use this option, you must also use --with-jdk-bindir (and you must NOT use --with-jdk-dir)]))
45
49
46
- # Check for bozo case: ensure a directory was specified
47
- AS_IF([test " $with_jdk_dir " = " yes" -o " $with_jdk_dir " = " no" ],
48
- [AC_MSG_WARN([Must specify a directory name for --with-jdk-dir])
49
- AC_MSG_ERROR([Cannot continue])])
50
- AS_IF([test " $with_jdk_bindir " = " yes" -o " $with_jdk_bindir " = " no" ],
51
- [AC_MSG_WARN([Must specify a directory name for --with-jdk-bindir])
52
- AC_MSG_ERROR([Cannot continue])])
53
- AS_IF([test " $with_jdk_headers " = " yes" -o " $with_jdk_headers " = " no" ],
54
- [AC_MSG_WARN([Must specify a directory name for --with-jdk-headers])
55
- AC_MSG_ERROR([Cannot continue])])
56
-
57
- # Check for bozo case: either specify --with-jdk-dir or
58
- # (--with-jdk-bindir, --with-jdk-headers) -- not both.
59
- bad= 0
60
- AS_IF([test -n " $with_jdk_dir " -a -n " $with_jdk_bindir " -o \
61
- -n " $with_jdk_dir " -a -n " $with_jdk_headers " ],[bad= 1])
62
- AS_IF([test -z " $with_jdk_bindir " -a -n " $with_jdk_headers " -o \
63
- -n " $with_jdk_bindir " -a -z " $with_jdk_headers " ],[bad= 1])
64
- AS_IF([test " $bad " = " 1" ],
65
- [AC_MSG_WARN([Either specify --with-jdk-dir or both of (--with-jdk_bindir, --with-jdk-headers) -- not both.])
66
- AC_MSG_ERROR([Cannot continue])])
67
-
68
- AS_IF([test -n " $with_jdk_dir " ],
69
- [with_jdk_bindir= $with_jdk_dir /bin
70
- with_jdk_headers= $with_jdk_dir /include])
71
-
72
- # #################################################################
73
- # with_jdk_dir can now be ignored; with_jdk_bindir and
74
- # with_jdk_headers will be either empty or have valid values.
75
- # #################################################################
76
-
77
- # Some java installations are in obscure places. So let's
78
- # hard-code a few of the common ones so that users don't have to
79
- # specify --with-java-<foo>=LONG_ANNOYING_DIRECTORY.
80
- AS_IF([test -z " $with_jdk_bindir " ],
81
- [ # OS X Snow Leopard and Lion (10.6 and 10.7 -- did not
82
- # check prior versions)
83
- found= 0
84
- dir= /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers
85
- AC_MSG_CHECKING([OSX locations])
86
- AS_IF([test -d $dir ],
87
- [AC_MSG_RESULT([found])
88
- found= 1
89
- with_jdk_headers= $dir
90
- with_jdk_bindir= /usr/bin],
91
- [AC_MSG_RESULT([not found])])
92
-
93
- if test " $found " = " 0" ; then
94
- # Various Linux
95
- dir=' /usr/lib/jvm/java-*-openjdk-*/include/'
96
- jnih=` ls $dir /jni.h 2> /dev/null | head -n 1`
97
- AC_MSG_CHECKING([Linux locations])
98
- AS_IF([test -r " $jnih " ],
99
- [with_jdk_headers= ` dirname $jnih `
100
- OPAL_WHICH([javac], [with_jdk_bindir])
101
- AS_IF([test -n " $with_jdk_bindir " ],
102
- [AC_MSG_RESULT([found])
103
- found= 1
104
- with_jdk_bindir= ` dirname $with_jdk_bindir ` ],
105
- [with_jdk_headers= ])],
106
- [dir= ' /usr/lib/jvm/default-java/include/'
107
- jnih= ` ls $dir /jni.h 2> /dev/null | head -n 1`
108
- AS_IF([test -r " $jnih " ],
109
- [with_jdk_headers= ` dirname $jnih `
110
- OPAL_WHICH([javac], [with_jdk_bindir])
111
- AS_IF([test -n " $with_jdk_bindir " ],
112
- [AC_MSG_RESULT([found])
113
- found= 1
114
- with_jdk_bindir= ` dirname $with_jdk_bindir ` ],
115
- [with_jdk_headers= ])],
116
- [AC_MSG_RESULT([not found])])])
117
- fi
118
-
119
- if test " $found " = " 0" ; then
120
- # Solaris
121
- dir=/usr/java
122
- AC_MSG_CHECKING([Solaris locations])
123
- AS_IF([test -d $dir -a -r " $dir /include/jni.h" ],
50
+ if test " $enable_java " = " no" ; then
51
+ HAVE_JAVA_SUPPORT=0
52
+ orte_java_happy=no
53
+ else
54
+ # Check for bozo case: ensure a directory was specified
55
+ AS_IF([test " $with_jdk_dir " = " yes" -o " $with_jdk_dir " = " no" ],
56
+ [AC_MSG_WARN([Must specify a directory name for --with-jdk-dir])
57
+ AC_MSG_ERROR([Cannot continue])])
58
+ AS_IF([test " $with_jdk_bindir " = " yes" -o " $with_jdk_bindir " = " no" ],
59
+ [AC_MSG_WARN([Must specify a directory name for --with-jdk-bindir])
60
+ AC_MSG_ERROR([Cannot continue])])
61
+ AS_IF([test " $with_jdk_headers " = " yes" -o " $with_jdk_headers " = " no" ],
62
+ [AC_MSG_WARN([Must specify a directory name for --with-jdk-headers])
63
+ AC_MSG_ERROR([Cannot continue])])
64
+
65
+ # Check for bozo case: either specify --with-jdk-dir or
66
+ # (--with-jdk-bindir, --with-jdk-headers) -- not both.
67
+ bad=0
68
+ AS_IF([test -n " $with_jdk_dir " -a -n " $with_jdk_bindir " -o \
69
+ -n " $with_jdk_dir " -a -n " $with_jdk_headers " ],[bad= 1])
70
+ AS_IF([test -z " $with_jdk_bindir " -a -n " $with_jdk_headers " -o \
71
+ -n " $with_jdk_bindir " -a -z " $with_jdk_headers " ],[bad= 1])
72
+ AS_IF([test " $bad " = " 1" ],
73
+ [AC_MSG_WARN([Either specify --with-jdk-dir or both of (--with-jdk_bindir, --with-jdk-headers) -- not both.])
74
+ AC_MSG_ERROR([Cannot continue])])
75
+
76
+ AS_IF([test -n " $with_jdk_dir " ],
77
+ [with_jdk_bindir= $with_jdk_dir /bin
78
+ with_jdk_headers= $with_jdk_dir /include])
79
+
80
+ # #################################################################
81
+ # with_jdk_dir can now be ignored; with_jdk_bindir and
82
+ # with_jdk_headers will be either empty or have valid values.
83
+ # #################################################################
84
+
85
+ # Some java installations are in obscure places. So let's
86
+ # hard-code a few of the common ones so that users don't have to
87
+ # specify --with-java-<foo>=LONG_ANNOYING_DIRECTORY.
88
+ AS_IF([test -z " $with_jdk_bindir " ],
89
+ [ # OS X Snow Leopard and Lion (10.6 and 10.7 -- did not
90
+ # check prior versions)
91
+ found= 0
92
+ dir= /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers
93
+ AC_MSG_CHECKING([OSX locations])
94
+ AS_IF([test -d $dir ],
124
95
[AC_MSG_RESULT([found])
125
- with_jdk_headers = $dir /include
126
- with_jdk_bindir = $dir /bin
127
- found = 1 ],
96
+ found = 1
97
+ with_jdk_headers = $dir
98
+ with_jdk_bindir = /usr/bin ],
128
99
[AC_MSG_RESULT([not found])])
129
- fi
130
- ],
131
- [found= 1])
132
100
133
- if test " $found " = " 1" ; then
134
- OMPI_CHECK_WITHDIR([jdk-bindir], [$with_jdk_bindir ], [javac])
135
- OMPI_CHECK_WITHDIR([jdk-headers], [$with_jdk_headers ], [jni.h])
136
-
137
- # Look for various Java-related programs
138
- orte_java_happy=no
139
- PATH_save=$PATH
140
- AS_IF([test -n " $with_jdk_bindir " -a " $with_jdk_bindir " != " yes" -a " $with_jdk_bindir " != " no" ],
141
- [PATH= " $PATH :$with_jdk_bindir " ])
142
- AC_PATH_PROG(JAVAC, javac)
143
- AC_PATH_PROG(JAVAH, javah)
144
- AC_PATH_PROG(JAR, jar)
145
- PATH=$PATH_save
146
-
147
- # Check to see if we have all 3 programs.
148
- AS_IF([test -z " $JAVAC " -o -z " $JAVAH " -o -z " $JAR " ],
149
- [orte_java_happy= no
150
- HAVE_JAVA_SUPPORT= 0],
151
- [orte_java_happy= yes
152
- HAVE_JAVA_SUPPORT= 1])
153
-
154
- # Look for jni.h
155
- AS_IF([test " $orte_java_happy " = " yes" ],
156
- [CPPFLAGS_save= $CPPFLAGS
157
- AS_IF([test -n " $with_jdk_headers " -a " $with_jdk_headers " != " yes" -a " $with_jdk_headers " != " no" ],
158
- [ORTE_JDK_CPPFLAGS= " -I$with_jdk_headers "
159
- # Some flavors of JDK also require -I<blah>/linux.
160
- # See if that's there, and if so, add a -I for that,
161
- # too. Ugh.
162
- AS_IF([test -d " $with_jdk_headers /linux" ],
163
- [ORTE_JDK_CPPFLAGS= " $ORTE_JDK_CPPFLAGS -I$with_jdk_headers /linux" ])
164
- # Solaris JDK also require -I<blah>/solaris.
165
- # See if that's there, and if so, add a -I for that,
166
- # too. Ugh.
167
- AS_IF([test -d " $with_jdk_headers /solaris" ],
168
- [ORTE_JDK_CPPFLAGS= " $ORTE_JDK_CPPFLAGS -I$with_jdk_headers /solaris" ])
169
-
170
- CPPFLAGS= " $CPPFLAGS $ORTE_JDK_CPPFLAGS " ])
171
- AC_CHECK_HEADER([jni.h], [],
172
- [orte_java_happy= no])
173
- CPPFLAGS= $CPPFLAGS_save
174
- ])
175
- else
176
- orte_java_happy=no;
177
- HAVE_JAVA_SUPPORT=no;
101
+ if test " $found " = " 0" ; then
102
+ # Various Linux
103
+ dir=' /usr/lib/jvm/java-*-openjdk-*/include/'
104
+ jnih=` ls $dir /jni.h 2> /dev/null | head -n 1`
105
+ AC_MSG_CHECKING([Linux locations])
106
+ AS_IF([test -r " $jnih " ],
107
+ [with_jdk_headers= ` dirname $jnih `
108
+ OPAL_WHICH([javac], [with_jdk_bindir])
109
+ AS_IF([test -n " $with_jdk_bindir " ],
110
+ [AC_MSG_RESULT([found])
111
+ found= 1
112
+ with_jdk_bindir= ` dirname $with_jdk_bindir ` ],
113
+ [with_jdk_headers= ])],
114
+ [dir= ' /usr/lib/jvm/default-java/include/'
115
+ jnih= ` ls $dir /jni.h 2> /dev/null | head -n 1`
116
+ AS_IF([test -r " $jnih " ],
117
+ [with_jdk_headers= ` dirname $jnih `
118
+ OPAL_WHICH([javac], [with_jdk_bindir])
119
+ AS_IF([test -n " $with_jdk_bindir " ],
120
+ [AC_MSG_RESULT([found])
121
+ found= 1
122
+ with_jdk_bindir= ` dirname $with_jdk_bindir ` ],
123
+ [with_jdk_headers= ])],
124
+ [AC_MSG_RESULT([not found])])])
125
+ fi
126
+
127
+ if test " $found " = " 0" ; then
128
+ # Solaris
129
+ dir=/usr/java
130
+ AC_MSG_CHECKING([Solaris locations])
131
+ AS_IF([test -d $dir -a -r " $dir /include/jni.h" ],
132
+ [AC_MSG_RESULT([found])
133
+ with_jdk_headers= $dir /include
134
+ with_jdk_bindir= $dir /bin
135
+ found= 1],
136
+ [AC_MSG_RESULT([not found])])
137
+ fi
138
+ ],
139
+ [found= 1])
140
+
141
+ if test " $found " = " 1" ; then
142
+ OMPI_CHECK_WITHDIR([jdk-bindir], [$with_jdk_bindir ], [javac])
143
+ OMPI_CHECK_WITHDIR([jdk-headers], [$with_jdk_headers ], [jni.h])
144
+
145
+ # Look for various Java-related programs
146
+ orte_java_happy=no
147
+ PATH_save=$PATH
148
+ AS_IF([test -n " $with_jdk_bindir " -a " $with_jdk_bindir " != " yes" -a " $with_jdk_bindir " != " no" ],
149
+ [PATH= " $PATH :$with_jdk_bindir " ])
150
+ AC_PATH_PROG(JAVAC, javac)
151
+ AC_PATH_PROG(JAVAH, javah)
152
+ AC_PATH_PROG(JAR, jar)
153
+ PATH=$PATH_save
154
+
155
+ # Check to see if we have all 3 programs.
156
+ AS_IF([test -z " $JAVAC " -o -z " $JAVAH " -o -z " $JAR " ],
157
+ [orte_java_happy= no
158
+ HAVE_JAVA_SUPPORT= 0],
159
+ [orte_java_happy= yes
160
+ HAVE_JAVA_SUPPORT= 1])
161
+
162
+ # Look for jni.h
163
+ AS_IF([test " $orte_java_happy " = " yes" ],
164
+ [CPPFLAGS_save= $CPPFLAGS
165
+ # silence a stupid Mac warning
166
+ CPPFLAGS= " $CPPFLAGS -DTARGET_RT_MAC_CFM=0"
167
+ AS_IF([test -n " $with_jdk_headers " -a " $with_jdk_headers " != " yes" -a " $with_jdk_headers " != " no" ],
168
+ [ORTE_JDK_CPPFLAGS= " -I$with_jdk_headers "
169
+ # Some flavors of JDK also require -I<blah>/linux.
170
+ # See if that's there, and if so, add a -I for that,
171
+ # too. Ugh.
172
+ AS_IF([test -d " $with_jdk_headers /linux" ],
173
+ [ORTE_JDK_CPPFLAGS= " $ORTE_JDK_CPPFLAGS -I$with_jdk_headers /linux" ])
174
+ # Solaris JDK also require -I<blah>/solaris.
175
+ # See if that's there, and if so, add a -I for that,
176
+ # too. Ugh.
177
+ AS_IF([test -d " $with_jdk_headers /solaris" ],
178
+ [ORTE_JDK_CPPFLAGS= " $ORTE_JDK_CPPFLAGS -I$with_jdk_headers /solaris" ])
179
+
180
+ CPPFLAGS= " $CPPFLAGS $ORTE_JDK_CPPFLAGS " ])
181
+ AC_CHECK_HEADER([jni.h], [],
182
+ [orte_java_happy= no])
183
+ CPPFLAGS= $CPPFLAGS_save
184
+ ])
185
+ else
186
+ orte_java_happy=no;
187
+ HAVE_JAVA_SUPPORT=no;
188
+ fi
189
+ AC_SUBST(ORTE_JDK_CPPFLAGS)
178
190
fi
179
- AC_SUBST(ORTE_JDK_CPPFLAGS)
180
191
181
192
# Are we happy?
182
193
AC_MSG_CHECKING([Java support available])
0 commit comments