1dnl Process this file with autoconf to produce a configure script.
2
3dnl %CopyrightBegin%
4dnl
5dnl Copyright Ericsson AB 1998-2019. All Rights Reserved.
6dnl
7dnl Licensed under the Apache License, Version 2.0 (the "License");
8dnl you may not use this file except in compliance with the License.
9dnl You may obtain a copy of the License at
10dnl
11dnl     http://www.apache.org/licenses/LICENSE-2.0
12dnl
13dnl Unless required by applicable law or agreed to in writing, software
14dnl distributed under the License is distributed on an "AS IS" BASIS,
15dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16dnl See the License for the specific language governing permissions and
17dnl limitations under the License.
18dnl
19dnl %CopyrightEnd%
20
21AC_PREREQ(2.8)dnl
22
23AC_INIT()
24
25LM_PRECIOUS_VARS
26
27default_cache_file=./config.cache
28
29if test "x$no_recursion" != "xyes" -a "x$OVERRIDE_CONFIG_CACHE" = "x"; then
30    # The no_recursion variable is not documented, but the only
31    # action we take on it is disabling caching which is safe!
32    if test "x$cache_file" != "x$default_cache_file"; then
33	echo "Ignoring the --cache-file argument since it can cause the system to be erroneously configured"
34    fi
35    echo "Disabling caching"
36    if test -f $cache_file; then
37	echo "Removing cache file $cache_file"
38	rm -f $cache_file
39    fi
40    cache_file=/dev/null
41fi
42
43case "X$ERL_TOP" in
44    X)
45	;;
46    X/*)
47	test -f "$ERL_TOP/erts/emulator/beam/beam_emu.c" || {
48	     AC_MSG_ERROR([Invalid \$ERL_TOP])
49	}
50	srcdir="$ERL_TOP";;
51    *)
52	AC_MSG_ERROR([\$ERL_TOP needs to be absolute]);;
53esac
54
55dnl How to set srcdir absolute is taken from the GNU Emacs distribution
56#### Make srcdir absolute, if it isn't already.  It's important to
57#### avoid running the path through pwd unnecessary, since pwd can
58#### give you automounter prefixes, which can go away.
59case "${srcdir}" in
60  /* ) ;;
61  . )
62    ## We may be able to use the $PWD environment variable to make this
63    ## absolute.  But sometimes PWD is inaccurate.
64    ## Make sure CDPATH doesn't affect cd (in case PWD is relative).
65    CDPATH=
66    if test "${PWD}" != "" && test "`(cd ${PWD} ; sh -c pwd)`" = "`pwd`"  ;
67    then
68      srcdir="$PWD"
69    else
70      srcdir="`(cd ${srcdir}; pwd)`"
71    fi
72  ;;
73  *  ) srcdir="`(cd ${srcdir}; pwd)`" ;;
74esac
75
76#
77# Now srcdir is absolute and also the top of Erlang distribution, ERL_TOP.
78#
79test "X$ERL_TOP" != "X" || ERL_TOP="$srcdir"
80AC_SUBST(ERL_TOP)
81
82dnl
83dnl Aux programs are found in erts/autoconf
84dnl
85AC_CONFIG_AUX_DIR(${srcdir}/erts/autoconf)
86
87dnl
88dnl Figure out what we are running on. And in violation of autoconf
89dnl style assume that $host is also what we are building for. I would
90dnl like to get cross compiling working, since we actually have
91dnl systems we cross compile for!
92dnl
93
94if test "X$host" != "Xfree_source" -a "X$host" != "Xwin32"; then
95    AC_CANONICAL_HOST
96else
97    host_os=$host
98fi
99
100TARGET=$host
101AC_SUBST(TARGET)
102
103if test "$cross_compiling" = "yes"; then
104    CROSS_COMPILING=yes
105else
106    CROSS_COMPILING=no
107fi
108AC_SUBST(CROSS_COMPILING)
109
110AC_ARG_ENABLE(bootstrap-only,
111AS_HELP_STRING([--enable-bootstrap-only],
112               [enable bootstrap only configuration]),
113[ if test "X$enableval" = "Xyes"; then
114     BOOTSTRAP_ONLY=yes
115  else
116     BOOTSTRAP_ONLY=no
117  fi
118],
119BOOTSTRAP_ONLY=no)
120
121AC_SUBST(BOOTSTRAP_ONLY)
122
123if test $CROSS_COMPILING = yes -a $BOOTSTRAP_ONLY = yes; then
124    AC_MSG_ERROR([Cannot both cross compile and build a bootstrap system])
125fi
126
127dnl Checks for programs.
128
129AC_PROG_CC
130AC_PROG_CXX
131AC_CHECK_TOOL(LD, [ld])
132
133LM_WINDOWS_ENVIRONMENT
134
135_search_path=/bin:/usr/bin:/usr/local/bin:$PATH
136
137AC_PATH_PROG(ENV, [env], false, $_search_path)
138if test "$ac_cv_path_ENV" = false; then
139  AC_MSG_ERROR([No 'env' command found])
140fi
141
142#
143# We need GNU make, complain if we can't find it
144#
145AC_MSG_CHECKING(for GNU make)
146# If there is a Makefile created we don't want make to start making, run
147# in a subdirectory and -f /dev/null
148MAKE_PROG=x
149if test X"$CLEARCASE_MAKE_COMPAT" = X"gnu" -a X"$CLEARCASE_ROOT" != X"" ; then
150  eval clearmake -version 2>&1 | grep clearmake > /dev/null 2>&1
151  case $? in
152	0) MAKE_PROG="clearmake -V";;
153	*);;
154  esac
155fi
156if test X"$MAKE_PROG" = X"x"; then
157  mkdir conftestmake
158  if test -d conftestmake; then
159    cd conftestmake
160    for m in make gmake ggmake; do
161      eval $m --version -f /dev/null 2>&1 | grep GNU > /dev/null 2>&1
162      case $? in
163        0) MAKE_PROG=$m ; break ;;
164        *) ;;
165      esac
166    done
167    cd ..
168  else
169    AC_MSG_ERROR(could not create subdirectory)
170  fi
171fi
172rm -rf conftestmake
173case $MAKE_PROG in
174    x) AC_MSG_RESULT(no)
175       AC_MSG_ERROR(GNU make is required!)
176       ;;
177    *) AC_MSG_RESULT(yes ($MAKE_PROG))
178       AC_SUBST(MAKE_PROG)
179       ;;
180esac
181
182AC_PROG_INSTALL
183if test X"${INSTALL}" = "X${ac_aux_dir}/install-sh -c" && test -f /usr/ucb/install ; then
184   case $host_os in
185      osf*) ;;
186      *) INSTALL="/usr/ucb/install -c" ;;
187   esac
188fi
189
190AC_PROG_LN_S
191AC_PROG_RANLIB
192LM_PROG_PERL5
193if test "$ac_cv_path_PERL" = false; then
194  AC_MSG_ERROR([Perl version 5 is required!])
195fi
196
197#
198# Get erts version from erts/vsn.mk
199#
200AC_MSG_CHECKING([ERTS version])
201[ERTS_VSN=`sed -n "s/^VSN[	 ]*=[	 ]*\(.*\)/\1/p" < $ERL_TOP/erts/vsn.mk`]
202AC_MSG_RESULT([$ERTS_VSN])
203AC_SUBST(ERTS_VSN)
204
205#
206# Get OTP release and OTP version from $ERL_TOP/OTP_VERSION
207#
208AC_MSG_CHECKING([OTP release])
209[OTP_REL=`cat $ERL_TOP/OTP_VERSION | sed "s|\([0-9]*\).*|\1|"`]
210AC_MSG_RESULT([$OTP_REL])
211AC_SUBST(OTP_REL)
212
213AC_MSG_CHECKING([OTP version])
214[OTP_VSN=`cat $ERL_TOP/OTP_VERSION`]
215AC_MSG_RESULT([$OTP_VSN])
216AC_SUBST(OTP_VSN)
217
218AC_ARG_ENABLE(parallel-configure,
219AS_HELP_STRING([--disable-parallel-configure], [disable parallel execution of configure scripts]))
220
221AC_ARG_ENABLE(dirty-schedulers,
222AS_HELP_STRING([--enable-dirty-schedulers], [enable dirty scheduler support]))
223
224AC_ARG_ENABLE(plain-emulator,
225AS_HELP_STRING([--enable-plain-emulator], [enable threaded non-smp emulator])
226AS_HELP_STRING([--disable-plain-emulator], [disable threaded non-smp emulator]))
227
228AC_ARG_WITH(termcap,
229AS_HELP_STRING([--with-termcap], [use termcap (default)])
230AS_HELP_STRING([--without-termcap],
231               [do not use any termcap libraries (ncurses,curses,termcap,termlib)]))
232
233AC_ARG_ENABLE(kernel-poll,
234AS_HELP_STRING([--enable-kernel-poll], [enable kernel poll support])
235AS_HELP_STRING([--disable-kernel-poll], [disable kernel poll support]))
236
237AC_ARG_ENABLE(sctp,
238AS_HELP_STRING([--enable-sctp], [enable sctp support (default)
239to on demand load the SCTP library in runtime])
240AS_HELP_STRING([--enable-sctp=lib], [enable sctp support
241to link against the SCTP library])
242AS_HELP_STRING([--disable-sctp], [disable sctp support]))
243
244AC_ARG_ENABLE(hipe,
245AS_HELP_STRING([--enable-hipe], [enable hipe support])
246AS_HELP_STRING([--disable-hipe], [disable hipe support]))
247
248AC_ARG_ENABLE(native-libs,
249AS_HELP_STRING([--enable-native-libs],
250               [compile Erlang libraries to native code]))
251
252AC_ARG_WITH(dynamic-trace,
253AS_HELP_STRING([--with-dynamic-trace={dtrace|lttng|systemtap}],
254	       [specify use of dynamic trace framework, dtrace, lttng or systemtap])
255AS_HELP_STRING([--without-dynamic-trace],
256               [don't enable any dynamic tracing (default)]))
257AC_ARG_ENABLE(vm-probes,
258AS_HELP_STRING([--enable-vm-probes],
259               [add dynamic trace probes to the Beam VM (only possible if --with-dynamic-trace is enabled, and then default)]))
260AC_ARG_WITH(javac,
261AS_HELP_STRING([--with-javac=JAVAC], [specify Java compiler to use])
262AS_HELP_STRING([--with-javac], [use a Java compiler if found (default)])
263AS_HELP_STRING([--without-javac], [don't use any Java compiler]))
264
265AC_ARG_ENABLE(megaco_flex_scanner_lineno,
266AS_HELP_STRING([--disable-megaco-flex-scanner-lineno],
267               [disable megaco flex scanner lineno]))
268
269AC_ARG_ENABLE(megaco_reentrant_flex_scanner,
270AS_HELP_STRING([--disable-megaco-reentrant-flex-scanner],
271               [disable reentrant megaco flex scanner]))
272
273AC_ARG_WITH(ssl,
274AS_HELP_STRING([--with-ssl=PATH], [specify location of OpenSSL include and lib])
275AS_HELP_STRING([--with-ssl], [use SSL (default)])
276AS_HELP_STRING([--without-ssl], [don't use SSL]))
277
278AC_ARG_WITH(ssl-incl,
279AS_HELP_STRING([--with-ssl-incl=PATH],
280               [location of OpenSSL include dir, if different than specified by --with-ssl=PATH]))
281
282AC_ARG_WITH(ssl-rpath,
283AS_HELP_STRING([--with-ssl-rpath=yes|no|PATHS],
284               [runtime library path for OpenSSL. Default is 'yes', which equates to a
285	       number of standard locations. If 'no', then no runtime
286	       library paths will be used. Anything else should be a
287	       comma separated list of paths.]))
288
289AC_ARG_ENABLE(dynamic-ssl-lib,
290AS_HELP_STRING([--disable-dynamic-ssl-lib],
291               [disable using dynamic openssl libraries]))
292
293AC_ARG_ENABLE(fips,
294AS_HELP_STRING([--enable-fips], [enable OpenSSL FIPS mode support])
295AS_HELP_STRING([--disable-fips], [disable OpenSSL FIPS mode support (default)]))
296
297AC_ARG_ENABLE(builtin-zlib,
298AS_HELP_STRING([--enable-builtin-zlib],
299               [force use of our own built-in zlib]))
300
301AC_ARG_ENABLE(esock,
302AS_HELP_STRING([--enable-esock], [enable builtin experimental socket (as a nif) support (default)])
303AS_HELP_STRING([--disable-esock], [disable builtin experimental socket (as a nif) support]))
304
305AC_ARG_ENABLE(sharing-preserving,
306AS_HELP_STRING([--enable-sharing-preserving],
307               [enable copying of terms without destroying sharing]))
308
309dnl This functionality has been lost along the way... :(
310dnl It could perhaps be nice to reintroduce some day; therefore,
311dnl it is not removed just commented out.
312dnl
313dnl #
314dnl # Set Erlang man page directory
315dnl #
316dnl AC_ARG_ENABLE(erlang-mandir,
317dnl [  --disable-erlang-mandir do not install Erlang man pages in a private directory],
318dnl [ case "$enableval" in
319dnl     no) erl_mandir=$mandir ;;
320dnl     *)  erl_mandir='$(erlang_libdir)/man' ;;
321dnl   esac ], erl_mandir='$(erlang_libdir)/man')
322dnl AC_SUBST(erl_mandir)
323
324AC_ARG_ENABLE(m64-build,
325AS_HELP_STRING([--enable-m64-build],
326               [build 64bit binaries using the -m64 flag to (g)cc]),
327[ case "$enableval" in
328    no) enable_m64_build=no ;;
329    *)  enable_m64_build=yes ;;
330  esac
331],enable_m64_build=no)
332
333AC_ARG_ENABLE(m32-build,
334AS_HELP_STRING([--enable-m32-build],
335               [build 32bit binaries using the -m32 flag to (g)cc]),
336[ case "$enableval" in
337    no) enable_m32_build=no ;;
338    *)	enable_m32_build=yes ;;
339  esac
340],enable_m32_build=no)
341
342AC_ARG_WITH(libatomic_ops,
343	    AS_HELP_STRING([--with-libatomic_ops=PATH],
344			   [specify and prefer usage of libatomic_ops in the ethread library]))
345
346m4_define(DEFAULT_SANITIZERS, [address,undefined])
347AC_ARG_ENABLE(sanitizers,
348    AS_HELP_STRING(
349        [--enable-sanitizers@<:@=comma-separated list of sanitizers@:>@],
350	    [Default=DEFAULT_SANITIZERS]))
351
352AC_ARG_ENABLE([silent-rules], [dnl
353AS_HELP_STRING(
354  [--enable-silent-rules],
355  [less verbose build output (undo: "make V=1")])
356AS_HELP_STRING(
357  [--disable-silent-rules],
358  [verbose build output (undo: "make V=0")])dnl
359])
360
361DEFAULT_VERBOSITY=0
362if test X${enable_silent_rules} = Xno; then
363  DEFAULT_VERBOSITY=1
364fi
365AC_SUBST(DEFAULT_VERBOSITY)
366
367if test X${enable_m64_build} = Xyes; then
368	CFLAGS="-m64 $CFLAGS"
369	export CFLAGS
370	LDFLAGS="-m64 $LDFLAGS"
371	export LDFLAGS
372fi
373if test X${enable_m32_build} = Xyes; then
374	CFLAGS="-m32 $CFLAGS"
375	export CFLAGS
376	LDFLAGS="-m32 $LDFLAGS"
377	export LDFLAGS
378fi
379
380NATIVE_LIBS_ENABLED=
381if test X${enable_native_libs} = Xyes -a X${enable_hipe} != Xno; then
382  NATIVE_LIBS_ENABLED=yes
383fi
384AC_SUBST(NATIVE_LIBS_ENABLED)
385
386ERL_DED
387
388AC_CONFIG_FILES([../Makefile output.mk ../make/$host/otp_ded.mk:../make/otp_ded.mk.in])
389AC_CONFIG_FILES([emd2exml], [chmod +x emd2exml])
390
391AC_OUTPUT
392