* configure.ac: New switch for disabling -O2 (--disable-optimizations).
[cacao.git] / m4 / intrp.m4
1 dnl m4/intrp.m4
2 dnl
3 dnl Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
4 dnl C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 dnl E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 dnl J. Wenninger, Institut f. Computersprachen - TU Wien
7 dnl 
8 dnl This file is part of CACAO.
9 dnl 
10 dnl This program is free software; you can redistribute it and/or
11 dnl modify it under the terms of the GNU General Public License as
12 dnl published by the Free Software Foundation; either version 2, or (at
13 dnl your option) any later version.
14 dnl 
15 dnl This program is distributed in the hope that it will be useful, but
16 dnl WITHOUT ANY WARRANTY; without even the implied warranty of
17 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 dnl General Public License for more details.
19 dnl 
20 dnl You should have received a copy of the GNU General Public License
21 dnl along with this program; if not, write to the Free Software
22 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 dnl 02110-1301, USA.
24
25
26 dnl check for interpreter
27
28 AC_DEFUN([AC_CHECK_ENABLE_INTRP],[
29 AC_ARG_ENABLE([intrp], [AS_HELP_STRING(--enable-intrp,enable interpreter [[default=no]])])
30
31 AC_MSG_CHECKING(whether interpreter should be compiled)
32 if test x"$enable_intrp" = "xyes"; then
33     AC_MSG_RESULT(yes)
34     AC_DEFINE([ENABLE_INTRP], 1, [enable interpreter])
35     AM_CONDITIONAL([ENABLE_INTRP], [true])
36     ENABLE_INTRP=yes
37
38     AC_ASM_SKIP16
39
40     dnl check for libffi
41     AC_ARG_WITH([ffi],
42                 [AS_HELP_STRING(--with-ffi,use libffi to call native functions)],
43                 [WITH_FFI=yes
44                  AC_CHECK_HEADERS([ffi.h],, [AC_MSG_ERROR(cannot find ffi.h)])
45                  AC_CHECK_LIB(ffi, ffi_call,, [AC_MSG_ERROR(cannot find libffi)])
46                  AC_DEFINE([WITH_FFI], 1, [use libffi])],
47                 [WITH_FFI=no])
48
49     dnl check for libffcall
50     AC_ARG_WITH([ffcall],
51                 [AS_HELP_STRING(--with-ffcall,use libffcall to call native functions)],
52                 [WITH_FFCALL=yes
53                  AC_CHECK_HEADERS([avcall.h],, [AC_MSG_ERROR(cannot find avcall.h)])
54                  AC_CHECK_LIB(avcall, __builtin_avcall,, [AC_MSG_ERROR(cannot find libavcall (from libffcall))])
55                  AC_DEFINE([WITH_FFCALL], 1, [use libffcall])],
56                 [WITH_FFCALL=no])
57
58     dnl check for libffi or libffcall
59     if test x"${WITH_FFI}" = "xyes" -a x"${WITH_FFCALL}" = "xyes"; then
60         AC_ERROR(Enable only libffi or libffcall.)
61     fi
62     if test x"${WITH_FFI}" = "xno" -a x"${WITH_FFCALL}" = "xno"; then
63         AC_ERROR(Enable one of libffi or libffcall.)
64     fi
65
66 else
67     AC_MSG_RESULT(no)
68     AM_CONDITIONAL([ENABLE_INTRP], [false])
69     ENABLE_INTRP="no"
70 fi
71 ])