make __stl_prime_list in comdat
[official-gcc.git] / libjava / classpath / m4 / acinclude.m4
blob65cb8fc4769f84fbb85c86d50a5f04da0225c409
1 dnl Used by aclocal to generate configure
3 dnl -----------------------------------------------------------
4 AC_DEFUN([CLASSPATH_WITH_JAVAH],
6   AC_ARG_WITH([javah],
7               [AS_HELP_STRING(--with-javah,specify path or name of a javah-like program)],
8   [
9     if test "x${withval}" != x && test "x${withval}" != xyes && test "x${withval}" != xno; then
10       CLASSPATH_CHECK_JAVAH(${withval})
11     else
12       CLASSPATH_CHECK_JAVAH
13     fi
14   ],
15   [ 
16     CLASSPATH_CHECK_JAVAH
17   ])
18   AC_SUBST(USER_JAVAH)
21 dnl -----------------------------------------------------------
22 dnl Checking for a javah like program 
23 dnl -----------------------------------------------------------
24 AC_DEFUN([CLASSPATH_CHECK_JAVAH],
26   if test "x$1" != x; then
27     if test -f "$1"; then
28       USER_JAVAH="$1"
29     else
30       AC_PATH_PROG(USER_JAVAH, "$1")
31     fi
32   else
33     AC_PATH_PROGS([USER_JAVAH],[gjavah gjavah-4.3 gjavah-4.2 gjavah-4.1 gcjh-wrapper-4.1 gcjh-4.1 javah])
34   fi
35   
36   if test "x${USER_JAVAH}" = x; then
37     AC_MSG_ERROR([can not find javah])
38   fi
41 dnl -----------------------------------------------------------
42 dnl CLASSPATH_WITH_CLASSLIB - checks for user specified classpath additions
43 dnl -----------------------------------------------------------
44 AC_DEFUN([CLASSPATH_WITH_CLASSLIB],
46   AC_ARG_WITH([vm-classes],
47               [AS_HELP_STRING(--with-vm-classes,specify path to VM override source files)], [vm_classes="$with_vm_classes"],
48               [vm_classes='${top_srcdir}/vm/reference'])
49   AC_SUBST(vm_classes)
52 dnl -----------------------------------------------------------
53 dnl CLASSPATH_WITH_GLIBJ - specify what to install
54 dnl -----------------------------------------------------------
55 AC_DEFUN([CLASSPATH_WITH_GLIBJ],
57   AC_PATH_PROG(ZIP, zip)
59   AC_MSG_CHECKING(for a jar-like tool)
60   AC_ARG_WITH([jar],
61               [AS_HELP_STRING([--with-jar=PATH], [define to use a jar style tool])],
62               [
63                 case "${withval}" in
64                   yes)
65                     JAR=yes
66                     ;;
67                   no)
68                     JAR=no
69                     AC_MSG_RESULT(${JAR})
70                     ;;
71                   *)
72                     if test -f "${withval}"; then
73                       JAR="${withval}"
74                       AC_MSG_RESULT(${JAR})
75                     else
76                       AC_MSG_RESULT([not found])
77                       AC_MSG_ERROR([The jar tool ${withval} was not found.])
78                     fi
79                     ;;
80                 esac
81               ],
82               [
83                 JAR=yes
84               ])
85   if test x"${JAR}" = "xyes"; then
86     AC_MSG_RESULT([trying fastjar, gjar and jar])
87     AC_PATH_PROGS([JAR], [fastjar gjar jar])
88     if test x"${RHINO_JAR}" = "xyes"; then
89       AC_MSG_RESULT([not found])
90     fi
91   fi
92   if test x"${JAR}" = "xno" && test x"${ZIP}" = ""; then
93     AC_MSG_ERROR([No zip or jar tool found.])
94   fi
95   AM_CONDITIONAL(WITH_JAR, test x"${JAR}" != "xno" && test x"${JAR}" != "xyes")
96   AC_SUBST(JAR)
97   
98   AC_ARG_WITH([glibj],
99               [AS_HELP_STRING([--with-glibj],[define what to install (zip|flat|both|none|build) [default=zip]])],
100               [
101                 if test "x${withval}" = xyes || test "x${withval}" = xzip; then
102                   install_class_files=no
103                   build_class_files=yes
104                   use_zip=yes
105                 elif test "x${withval}" = xboth; then
106                   install_class_files=yes
107                   build_class_files=yes
108                   use_zip=yes
109                 elif test "x${withval}" = xflat; then
110                   install_class_files=yes
111                   build_class_files=yes
112                   use_zip=no
113                 elif test "x${withval}" = xno || test "x${withval}" = xnone; then
114                   install_class_files=no
115                   build_class_files=no
116                   use_zip=no
117                 elif test "x${withval}" = xbuild; then
118                   install_class_files=no
119                   build_class_files=yes
120                   use_zip=no
121                 else
122                   AC_MSG_ERROR([unknown value given to --with-glibj])
123                 fi
124               ],
125               [
126                 install_class_files=no
127                 use_zip=yes
128               ])
129   AM_CONDITIONAL(INSTALL_GLIBJ_ZIP, test "x${use_zip}" = xyes)
130   AM_CONDITIONAL(INSTALL_CLASS_FILES, test "x${install_class_files}" = xyes)
131   AM_CONDITIONAL(BUILD_CLASS_FILES, test "x${build_class_files}" = xyes)
133   AC_ARG_ENABLE([examples],
134                 [AS_HELP_STRING(--enable-examples,enable build of the examples [default=yes])],
135                 [case "${enableval}" in
136                   yes) EXAMPLESDIR="examples" ;;
137                   no) EXAMPLESDIR="" ;;
138                   *) AC_MSG_ERROR(bad value ${enableval} for --enable-examples) ;;
139                 esac],
140                 [EXAMPLESDIR="examples"])
141   if test "x${build_class_files}" = xno; then
142     EXAMPLESDIR=""
143   fi
144   AC_SUBST(EXAMPLESDIR)
146   AC_ARG_ENABLE([tools],
147                 [AS_HELP_STRING(--enable-tools,enable build of the tools [default=yes])],
148                 [case "${enableval}" in
149                   yes) TOOLSDIR="tools" ;;
150                   no) TOOLSDIR="" ;;
151                   *) AC_MSG_ERROR(bad value ${enableval} for --enable-tools) ;;
152                 esac],
153                 [TOOLSDIR="tools"])
154   if test "x${build_class_files}" = xno; then
155     TOOLSDIR=""
156   fi
157   AC_SUBST(TOOLSDIR)
160 dnl -----------------------------------------------------------
161 dnl Enable generation of API documentation, with gjdoc if it
162 dnl has been compiled to an executable (or a suitable script
163 dnl is in your PATH) or using the argument as gjdoc executable.
164 dnl -----------------------------------------------------------
165 AC_DEFUN([CLASSPATH_WITH_GJDOC],
167   AC_ARG_WITH([gjdoc],
168               AS_HELP_STRING([--with-gjdoc],
169                              [generate documentation using gjdoc (default is NO)]),
170               [if test "x${withval}" = xno; then
171                  WITH_GJDOC=no;
172                elif test "x${withval}" = xyes -o "x{withval}" = x; then
173                  WITH_GJDOC=yes;
174                  AC_PATH_PROG(GJDOC, gjdoc, "no")
175                  if test "x${GJDOC}" = xno; then
176                    AC_MSG_ERROR("gjdoc executable not found");
177                  fi
178                else
179                  WITH_GJDOC=yes
180                  GJDOC="${withval}"
181                  AC_CHECK_FILE(${GJDOC}, AC_SUBST(GJDOC),
182                                AC_MSG_ERROR("Cannot use ${withval} as gjdoc executable since it doesn't exist"))
183                fi],
184               [WITH_GJDOC=no])
185   AM_CONDITIONAL(CREATE_API_DOCS, test "x${WITH_GJDOC}" = xyes)
186   if test "x${WITH_GJDOC}" = xyes; then
187     AC_MSG_CHECKING([version of GJDoc])
188     gjdoc_version=$(${GJDOC} --version|cut -d ' ' -f2)
189     AC_MSG_RESULT(${gjdoc_version})
190     case ${gjdoc_version} in
191       0.7.9) ;;
192       0.8*) ;;
193       *) AC_MSG_ERROR([Building documentation requires GJDoc >= 0.7.9, ${gjdoc_version} found.]) ;;
194     esac
195   fi
198 dnl -----------------------------------------------------------
199 dnl Enable regeneration of parsers using jay
200 dnl http://www.informatik.uni-osnabrueck.de/alumni/bernd/jay/
201 dnl -----------------------------------------------------------
202 AC_DEFUN([REGEN_WITH_JAY],
204   AC_ARG_WITH([jay],
205               [AS_HELP_STRING(--with-jay[=DIR|PATH],Regenerate the parsers with jay)],
206   [
207     AC_MSG_CHECKING([whether to regenerate parsers with jay])
208     JAY_FOUND=no
209     JAY_DIR_PATH=
210     if test "x${withval}" = xno; then
211       AC_MSG_RESULT(no)
212     elif test "x${withval}" = xyes; then
213       AC_MSG_RESULT(yes)
214       JAY_DIR_PATH="/usr/share/jay"
215     elif test -d "${withval}"; then
216       AC_MSG_RESULT(yes)
217       JAY_DIR_PATH="${withval}"
218     elif test -f "${withval}"; then
219       AC_MSG_RESULT(yes)
220       JAY_DIR_PATH=`dirname "${withval}"`
221       JAY="${withval}"
222     else
223         AC_MSG_ERROR(jay not found at ${withval})
224     fi
226     if test "x${JAY_DIR_PATH}" != x; then
227       AC_PATH_PROG(JAY, jay, "no", ${JAY_DIR_PATH}:${PATH})
228       if test "x${JAY}" = xno; then
229         AC_MSG_ERROR(jay executable not found);
230       fi
231       JAY_SKELETON="${JAY_DIR_PATH}/skeleton"
232       AC_CHECK_FILE(${JAY_SKELETON}, AC_SUBST(JAY_SKELETON),
233           AC_MSG_ERROR(Expected skeleton file in ${JAY_DIR_PATH}))
234       JAY_FOUND=yes
235     fi
236   ],
237   [
238     AC_MSG_CHECKING([whether to regenerate parsers with jay])
239     AC_MSG_RESULT(no)
240     JAY_FOUND=no
241   ])
242   AM_CONDITIONAL(REGEN_PARSERS, test "x${JAY_FOUND}" = xyes)
245 dnl -----------------------------------------------------------
246 dnl GCJ LOCAL: Calculate toolexeclibdir
247 dnl -----------------------------------------------------------
248 AC_DEFUN([CLASSPATH_TOOLEXECLIBDIR],
250   multi_os_directory=`$CC -print-multi-os-directory`
251   case $multi_os_directory in
252     .) toolexeclibdir=${libdir} ;; # Avoid trailing /.
253     *) toolexeclibdir=${libdir}/${multi_os_directory} ;;
254   esac
255   AC_SUBST(toolexeclibdir)
258 dnl -----------------------------------------------------------
259 AC_DEFUN([CLASSPATH_JAVAC_MEM_CHECK],
261   JAVA_TEST=Test.java
262   CLASS_TEST=Test.class
263   cat << \EOF > $JAVA_TEST
264   /* [#]line __oline__ "configure" */
265   public class Test 
266   {
267     public static void main(String[] args)
268     {
269       System.out.println("Hello World");
270     }
271   }
273   if test x$JAVAC_IS_GCJ != xyes; then
274     AC_MSG_CHECKING([whether javac supports -J])
275     $JAVAC $JAVACFLAGS -J-Xmx768M -sourcepath '' $JAVA_TEST
276     javac_result=$?
277     if test "x$javac_result" = "x0"; then
278       AC_MSG_RESULT([yes])
279       JAVAC_MEM_OPT="-J-Xmx768M"
280     else
281       AC_MSG_RESULT([no])
282     fi
283   fi
284   rm -f $JAVA_TEST $CLASS_TEST
285   AC_SUBST(JAVAC_MEM_OPT)
288 dnl ---------------------------------------------------------------
289 dnl CLASSPATH_COND_IF(COND, SHELL-CONDITION, [IF-TRUE], [IF-FALSE])
290 dnl ---------------------------------------------------------------
291 dnl Automake 1.11 can emit conditional rules for AC_CONFIG_FILES,
292 dnl using AM_COND_IF.  This wrapper uses it if it is available,
293 dnl otherwise falls back to code compatible with Automake 1.9.6.
294 AC_DEFUN([CLASSPATH_COND_IF],
295 [m4_ifdef([AM_COND_IF],
296   [AM_COND_IF([$1], [$3], [$4])],
297   [if $2; then
298      m4_default([$3], [:])
299    else
300      m4_default([$4], [:])
301    fi
302 ])])