1 |
dnl ## |
2 |
dnl ## OSSP js - JavaScript Engine |
3 |
dnl ## Copyright (c) 1998-2006 Mozilla <http://www.mozilla.org/> |
4 |
dnl ## |
5 |
dnl ## This file is part of OSSP js, a distribution of the Mozilla JavaScript |
6 |
dnl ## reference implementation, which can found at http://www.ossp.org/pkg/lib/js/ |
7 |
dnl ## |
8 |
dnl ## Permission to use, copy, modify, and distribute this software for |
9 |
dnl ## any purpose with or without fee is hereby granted, provided that |
10 |
dnl ## the above copyright notice and this permission notice appear in all |
11 |
dnl ## copies. |
12 |
dnl ## |
13 |
dnl ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
14 |
dnl ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
15 |
dnl ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
16 |
dnl ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
17 |
dnl ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
18 |
dnl ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
19 |
dnl ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
20 |
dnl ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
21 |
dnl ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
22 |
dnl ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
23 |
dnl ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
24 |
dnl ## SUCH DAMAGE. |
25 |
dnl ## |
26 |
dnl ## configure.ac: GNU Autoconf source script |
27 |
dnl ## |
28 |
|
29 |
AC_PREREQ(2.60) |
30 |
AC_INIT |
31 |
JS_VERSION=`./shtool version -l txt -d short VERSION` |
32 |
$ac_confdir/shtool echo -e \ |
33 |
"Configuring %BOSSP js%b (Mozilla JavaScript Engine), version %B${JS_VERSION}%b" |
34 |
AC_SUBST(JS_VERSION) |
35 |
|
36 |
AC_CANONICAL_BUILD |
37 |
AC_CANONICAL_HOST |
38 |
|
39 |
AC_PROG_MAKE_SET |
40 |
AC_PROG_CC |
41 |
AC_CHECK_DEBUGGING |
42 |
AC_CHECK_VA_COPY |
43 |
|
44 |
AC_CHECK_LIB(nsl, gethostname) |
45 |
if test ".`echo $LIBS | grep nsl`" = .; then |
46 |
AC_CHECK_LIB(nsl, gethostbyname) |
47 |
fi |
48 |
AC_CHECK_LIB(socket, accept) |
49 |
AC_CHECK_LIB(m, floor) |
50 |
|
51 |
AC_CHECK_MEMBERS([struct stat.st_birthtime, struct stat.st_birthtimensec],,, [#include <sys/stat.h>]) |
52 |
|
53 |
CPPFLAGS="$CPPFLAGS -DOSSP" |
54 |
case "${host}" in |
55 |
*mingw* | *windows* | *winnt* ) CPPFLAGS="$CPPFLAGS -DXP_WIN" ;; |
56 |
* ) CPPFLAGS="$CPPFLAGS -DXP_UNIX" ;; |
57 |
esac |
58 |
CPPFLAGS="$CPPFLAGS -DEXPORT_JS_API" |
59 |
|
60 |
dnl # configure option --with-version |
61 |
AC_ARG_WITH([version], |
62 |
AC_HELP_STRING([--with-version], [build the run-time engine with JavaScript features only. Available versions are: ECMA-3, JS-1.5, JS-1.6 (default)]), |
63 |
[ac_cv_with_version=$withval], [ac_cv_with_version=no]) |
64 |
AC_CACHE_CHECK([whether to build the run-time engine with JavaScript features only], |
65 |
[ac_cv_with_version], [ac_cv_with_version=no]) |
66 |
case "$ac_cv_with_version" in |
67 |
dnl JS-1.0 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=100" ;; |
68 |
dnl JS-1.1 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=110" ;; |
69 |
dnl JS-1.2 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=120" ;; |
70 |
dnl JS-1.3 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=130" ;; |
71 |
dnl JS-1.4 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=140" ;; |
72 |
ECMA-3 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=148" ;; |
73 |
JS-1.5 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=150" ;; |
74 |
JS-1.6 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=160" ;; |
75 |
esac |
76 |
|
77 |
CLI_CPPFLAGS="" |
78 |
CLI_CFLAGS="" |
79 |
CLI_LDFLAGS="" |
80 |
CLI_LIBS="" |
81 |
CLI_OBJS="" |
82 |
|
83 |
dnl # configure option --with-editline[=path] |
84 |
AC_ARG_WITH([editline], |
85 |
AC_HELP_STRING([--with-editline], [build command line interface with line editing support via editline, libedit or GNU readline]), |
86 |
[ac_cv_with_editline=$withval], [ac_cv_with_editline=no]) |
87 |
AC_CACHE_CHECK([whether to build command line interface with line editing support], |
88 |
[ac_cv_with_editline], [ac_cv_with_editline=no]) |
89 |
if test ".$ac_cv_with_editline" != ".no"; then |
90 |
CLI_CPPFLAGS="$CLI_CPPFLAGS -DEDITLINE" |
91 |
case "$ac_cv_with_editline" in |
92 |
/* ) CLI_LDFLAGS="-L$ac_cv_with_editline" ;; |
93 |
esac |
94 |
OLD_LDFLAGS="$LDFLAGS"; |
95 |
OLD_LIBS="$LIBS"; |
96 |
LDFLAGS="$LDFLAGS $CLI_LDFLAGS" |
97 |
LIBS="" |
98 |
AC_SEARCH_LIBS(tcgetattr, termcap termlib curses ncurses) |
99 |
AC_SEARCH_LIBS(tputs, termcap termlib curses ncurses) |
100 |
TERM_LIBS="$LIBS" |
101 |
AC_SEARCH_LIBS(readline, editline edit readline,,, [$TERM_LIBS]) |
102 |
CLI_LIBS="$LIBS" |
103 |
LDFLAGS="$OLD_LDFLAGS" |
104 |
LIBS="$OLD_LIBS" |
105 |
fi |
106 |
|
107 |
dnl # configure option --with-perl |
108 |
AC_ARG_WITH([perl], |
109 |
AS_HELP_STRING([--with-perl], [build Perl-to-JS and JS-to-Perl bindings]), |
110 |
[ac_cv_with_perl=$withval], [ac_cv_with_perl=no]) |
111 |
AC_CACHE_CHECK([whether to build Perl-to-JS and JS-to-Perl bindings], [ac_cv_with_perl], [ac_cv_with_perl=no]) |
112 |
if test ".$ac_cv_with_perl" != ".no"; then |
113 |
WITH_PERL="yes" |
114 |
CLI_OBJS="$CLI_OBJS src/perlconnect/jsperl.o" |
115 |
CLI_CPPFLAGS="$CLI_CPPFLAGS -DPERLCONNECT" |
116 |
else |
117 |
WITH_PERL="no" |
118 |
fi |
119 |
AC_SUBST(WITH_PERL) |
120 |
case "$ac_cv_with_perl" in |
121 |
/* ) PERL="$ac_cv_with_perl" ;; |
122 |
esac |
123 |
AC_PATH_PROG(PERL, perl, NA) |
124 |
if test ".$ac_cv_with_perl" = ".yes" -a ".$PERL" = ".NA"; then |
125 |
AC_ERROR([required Perl interpreter not found in \$PATH]) |
126 |
fi |
127 |
if test ".$ac_cv_with_perl" != ".no"; then |
128 |
CLI_CFLAGS="$CLI_CFLAGS `$PERL -MExtUtils::Embed -e ccopts`" |
129 |
CLI_LIBS="$CLI_LIBS `$PERL -MExtUtils::Embed -e ldopts`" |
130 |
fi |
131 |
|
132 |
dnl # configure option --without-file |
133 |
AC_ARG_WITH([file], |
134 |
AS_HELP_STRING([--without-file], [build without File object (grants access to the filesystem)]), |
135 |
[ac_cv_with_file=$withval], [ac_cv_with_file=yes]) |
136 |
AC_CACHE_CHECK([whether to build with the File object], [ac_cv_with_file], [ac_cv_with_file=yes]) |
137 |
if test ".$ac_cv_with_file" = ".yes"; then |
138 |
CPPFLAGS="$CPPFLAGS -DJS_HAS_FILE_OBJECT" |
139 |
fi |
140 |
|
141 |
dnl # configure option --with-dso |
142 |
AC_ARG_WITH([dso], |
143 |
AS_HELP_STRING([--with-dso], [build without DSO object (allows run-time process extending)]), |
144 |
[ac_cv_with_dso=$withval], [ac_cv_with_dso=no]) |
145 |
AC_CACHE_CHECK([whether to build with the DSO object], [ac_cv_with_dso], [ac_cv_with_dso=no]) |
146 |
if test ".$ac_cv_with_dso" = ".yes"; then |
147 |
AC_CHECK_LIB(dl, dlopen) |
148 |
AC_CHECK_HEADER(dlfcn.h, , AC_ERROR([dlopen(3) header <dlfcn.h> required])) |
149 |
AC_CHECK_FUNCS(dlopen dlclose dlerror, , AC_ERROR([dlopen(3) API functions dlopen/dlclose/dlerror required])) |
150 |
CPPFLAGS="$CPPFLAGS -DJS_HAS_DSO_OBJECT" |
151 |
CLI_LDFLAGS="$CLI_LDFLAGS -export-dynamic" |
152 |
fi |
153 |
|
154 |
dnl # configure option --with-utf8 |
155 |
AC_ARG_WITH([utf8], |
156 |
AS_HELP_STRING([--with-utf8], [build with exclusive UTF-8 C strings (uses Unicode UTF-8 encoded C strings only)]), |
157 |
[ac_cv_with_utf8=$withval], [ac_cv_with_utf8=no]) |
158 |
AC_CACHE_CHECK([whether to build with exclusive UTF-8 C string], [ac_cv_with_utf8], [ac_cv_with_utf8=no]) |
159 |
if test ".$ac_cv_with_utf8" = ".yes"; then |
160 |
CPPFLAGS="$CPPFLAGS -DJS_C_STRINGS_ARE_UTF8" |
161 |
fi |
162 |
|
163 |
AC_SUBST(CLI_CFLAGS) |
164 |
AC_SUBST(CLI_CPPFLAGS) |
165 |
AC_SUBST(CLI_LDFLAGS) |
166 |
AC_SUBST(CLI_LIBS) |
167 |
AC_SUBST(CLI_OBJS) |
168 |
|
169 |
with_tags="" |
170 |
sinclude(libtool.m4) |
171 |
AC_PROG_LIBTOOL |
172 |
|
173 |
AC_CONFIG_HEADERS(config.h) |
174 |
AC_CONFIG_FILES([Makefile js.pc js-config.sh src/perlconnect/Makefile.PL]) |
175 |
AC_OUTPUT |
176 |
|