aboutsummaryrefslogtreecommitdiffstats
path: root/configure.in
blob: 2a42477723aea42509547b9465bb9cff0ac63b4f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
dnl Process this file with autoconf to produce a configure script.

dnl %CopyrightBegin%
dnl
dnl Copyright Ericsson AB 1998-2016. All Rights Reserved.
dnl
dnl Licensed under the Apache License, Version 2.0 (the "License");
dnl you may not use this file except in compliance with the License.
dnl You may obtain a copy of the License at
dnl
dnl     http://www.apache.org/licenses/LICENSE-2.0
dnl
dnl Unless required by applicable law or agreed to in writing, software
dnl distributed under the License is distributed on an "AS IS" BASIS,
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
dnl See the License for the specific language governing permissions and
dnl limitations under the License.
dnl
dnl %CopyrightEnd%

AC_PREREQ(2.8)dnl

AC_INIT()

LM_PRECIOUS_VARS

default_cache_file=./config.cache

if test "x$no_recursion" != "xyes" -a "x$OVERRIDE_CONFIG_CACHE" = "x"; then
    # The no_recursion variable is not documented, but the only
    # action we take on it is disabling caching which is safe!
    if test "x$cache_file" != "x$default_cache_file"; then
	echo "Ignoring the --cache-file argument since it can cause the system to be erroneously configured"
    fi
    echo "Disabling caching"
    if test -f $cache_file; then
	echo "Removing cache file $cache_file"
	rm -f $cache_file
    fi
    cache_file=/dev/null
fi

case "X$ERL_TOP" in
    X)
	;;
    X/*)
	test -f $ERL_TOP/erts/emulator/beam/beam_emu.c || {
	     AC_MSG_ERROR([Invalid \$ERL_TOP])
	}
	srcdir="$ERL_TOP";;
    *)
	AC_MSG_ERROR([\$ERL_TOP needs to be absolute]);;
esac

dnl How to set srcdir absolute is taken from the GNU Emacs distribution
#### Make srcdir absolute, if it isn't already.  It's important to
#### avoid running the path through pwd unnecessary, since pwd can
#### give you automounter prefixes, which can go away.
case "${srcdir}" in
  /* ) ;;
  . )
    ## We may be able to use the $PWD environment variable to make this
    ## absolute.  But sometimes PWD is inaccurate.
    ## Make sure CDPATH doesn't affect cd (in case PWD is relative).
    CDPATH=
    if test "${PWD}" != "" && test "`(cd ${PWD} ; sh -c pwd)`" = "`pwd`"  ;
    then
      srcdir="$PWD"
    else
      srcdir="`(cd ${srcdir}; pwd)`"
    fi
  ;;
  *  ) srcdir="`(cd ${srcdir}; pwd)`" ;;
esac

#
# Now srcdir is absolute and also the top of Erlang distribution, ERL_TOP.
#
test "X$ERL_TOP" != "X" || ERL_TOP="$srcdir"
AC_SUBST(ERL_TOP)

dnl
dnl Aux programs are found in erts/autoconf
dnl
AC_CONFIG_AUX_DIR(${srcdir}/erts/autoconf)

dnl
dnl Figure out what we are running on. And in violation of autoconf
dnl style assume that $host is also what we are building for. I would
dnl like to get cross compiling working, since we actually have
dnl systems we cross compile for!
dnl

if test "X$host" != "Xfree_source" -a "X$host" != "Xwin32"; then
    AC_CANONICAL_HOST
fi

TARGET=$host
AC_SUBST(TARGET)

if test "$cross_compiling" = "yes"; then
    CROSS_COMPILING=yes
else
    CROSS_COMPILING=no
fi
AC_SUBST(CROSS_COMPILING)

AC_ARG_ENABLE(bootstrap-only,
AS_HELP_STRING([--enable-bootstrap-only],
               [enable bootstrap only configuration]),
[ if test "X$enableval" = "Xyes"; then
     BOOTSTRAP_ONLY=yes
  else
     BOOTSTRAP_ONLY=no  
  fi	
],
BOOTSTRAP_ONLY=no)

AC_SUBST(BOOTSTRAP_ONLY)

if test $CROSS_COMPILING = yes -a $BOOTSTRAP_ONLY = yes; then
    AC_MSG_ERROR([Cannot both cross compile and build a bootstrap system])
fi

dnl Checks for programs.

AC_PROG_CC
AC_PROG_CXX
AC_CHECK_TOOL(LD, [ld])

_search_path=/bin:/usr/bin:/usr/local/bin:$PATH

AC_PATH_PROG(ENV, [env], false, $_search_path)
if test "$ac_cv_path_ENV" = false; then
  AC_MSG_ERROR([No 'env' command found])
fi

#
# We need GNU make, complain if we can't find it
#
AC_MSG_CHECKING(for GNU make)
# If there is a Makefile created we don't want make to start making, run
# in a subdirectory and -f /dev/null
MAKE_PROG=x
if test X"$CLEARCASE_MAKE_COMPAT" = X"gnu" -a X"$CLEARCASE_ROOT" != X"" ; then
  eval clearmake -version 2>&1 | grep clearmake > /dev/null 2>&1
  case $? in
	0) MAKE_PROG="clearmake -V";;
	*);;
  esac
fi
if test X"$MAKE_PROG" = X"x"; then
  mkdir conftestmake
  if test -d conftestmake; then
    cd conftestmake
    for m in make gmake ggmake; do
      eval $m --version -f /dev/null 2>&1 | grep GNU > /dev/null 2>&1
      case $? in
        0) MAKE_PROG=$m ; break ;;
        *) ;;
      esac
    done
    cd ..
  else
    AC_MSG_ERROR(could not create subdirectory)
  fi
fi
rm -rf conftestmake
case $MAKE_PROG in
    x) AC_MSG_RESULT(no)
       AC_MSG_ERROR(GNU make is required!)
       ;;
    *) AC_MSG_RESULT(yes ($MAKE_PROG))
       AC_SUBST(MAKE_PROG)
       ;;
esac

AC_PROG_INSTALL
if test X"${INSTALL}" = "X${ac_aux_dir}/install-sh -c" && test -f /usr/ucb/install ; then
   case $host_os in
      osf*) ;;
      *) INSTALL="/usr/ucb/install -c" ;;
   esac
fi

AC_PROG_LN_S
AC_PROG_RANLIB
LM_PROG_PERL5
if test "$ac_cv_path_PERL" = false; then
  AC_MSG_ERROR([Perl version 5 is required!])
fi

#
# Get erts version from erts/vsn.mk
#
AC_MSG_CHECKING([ERTS version])
[ERTS_VSN=`sed -n "s/^VSN[	 ]*=[	 ]*\(.*\)/\1/p" < $ERL_TOP/erts/vsn.mk`]
AC_MSG_RESULT([$ERTS_VSN])
AC_SUBST(ERTS_VSN)

#
# Get OTP release and OTP version from $ERL_TOP/OTP_VERSION
#
AC_MSG_CHECKING([OTP release])
[OTP_REL=`cat $ERL_TOP/OTP_VERSION | sed "s|\([0-9]*\).*|\1|"`]
AC_MSG_RESULT([$OTP_REL])
AC_SUBST(OTP_REL)

AC_MSG_CHECKING([OTP version])
[OTP_VSN=`cat $ERL_TOP/OTP_VERSION`]
AC_MSG_RESULT([$OTP_VSN])
AC_SUBST(OTP_VSN)

AC_ARG_ENABLE(dirty-schedulers,
AS_HELP_STRING([--enable-dirty-schedulers], [enable dirty scheduler support]))

AC_ARG_ENABLE(plain-emulator,
AS_HELP_STRING([--enable-plain-emulator], [enable threaded non-smp emulator])
AS_HELP_STRING([--disable-plain-emulator], [disable threaded non-smp emulator]))

AC_ARG_WITH(termcap,
AS_HELP_STRING([--with-termcap], [use termcap (default)])
AS_HELP_STRING([--without-termcap],
               [do not use any termcap libraries (ncurses,curses,termcap,termlib)]))

AC_ARG_ENABLE(kernel-poll,
AS_HELP_STRING([--enable-kernel-poll], [enable kernel poll support])
AS_HELP_STRING([--disable-kernel-poll], [disable kernel poll support]))

AC_ARG_ENABLE(sctp,
AS_HELP_STRING([--enable-sctp], [enable sctp support (default)
to on demand load the SCTP library in runtime])
AS_HELP_STRING([--enable-sctp=lib], [enable sctp support
to link against the SCTP library])
AS_HELP_STRING([--disable-sctp], [disable sctp support]))

AC_ARG_ENABLE(hipe,
AS_HELP_STRING([--enable-hipe], [enable hipe support])
AS_HELP_STRING([--disable-hipe], [disable hipe support]))

AC_ARG_ENABLE(native-libs,
AS_HELP_STRING([--enable-native-libs],
               [compile Erlang libraries to native code]))

AC_ARG_WITH(dynamic-trace,
AS_HELP_STRING([--with-dynamic-trace={dtrace|lttng|systemtap}],
	       [specify use of dynamic trace framework, dtrace, lttng or systemtap])
AS_HELP_STRING([--without-dynamic-trace], 
               [don't enable any dynamic tracing (default)]))
AC_ARG_ENABLE(vm-probes,
AS_HELP_STRING([--enable-vm-probes],
               [add dynamic trace probes to the Beam VM (only possible if --with-dynamic-trace is enabled, and then default)]))
AC_ARG_WITH(javac,
AS_HELP_STRING([--with-javac=JAVAC], [specify Java compiler to use])
AS_HELP_STRING([--with-javac], [use a Java compiler if found (default)])
AS_HELP_STRING([--without-javac], [don't use any Java compiler]))

AC_ARG_ENABLE(megaco_flex_scanner_lineno,
AS_HELP_STRING([--disable-megaco-flex-scanner-lineno],
               [disable megaco flex scanner lineno]))

AC_ARG_ENABLE(megaco_reentrant_flex_scanner,
AS_HELP_STRING([--disable-megaco-reentrant-flex-scanner],
               [disable reentrant megaco flex scanner]))

AC_ARG_WITH(ssl,
AS_HELP_STRING([--with-ssl=PATH], [specify location of OpenSSL include and lib])
AS_HELP_STRING([--with-ssl], [use SSL (default)])
AS_HELP_STRING([--without-ssl], [don't use SSL]))

AC_ARG_WITH(ssl-incl,
AS_HELP_STRING([--with-ssl-incl=PATH],
               [location of OpenSSL include dir, if different than specified by --with-ssl=PATH]))

AC_ARG_WITH(ssl-rpath,
AS_HELP_STRING([--with-ssl-rpath=yes|no|PATHS],
               [runtime library path for OpenSSL. Default is 'yes', which equates to a
	       number of standard locations. If 'no', then no runtime
	       library paths will be used. Anything else should be a
	       comma separated list of paths.]))

AC_ARG_ENABLE(dynamic-ssl-lib,
AS_HELP_STRING([--disable-dynamic-ssl-lib],
               [disable using dynamic openssl libraries]))

AC_ARG_ENABLE(fips,
AS_HELP_STRING([--enable-fips], [enable OpenSSL FIPS mode support])
AS_HELP_STRING([--disable-fips], [disable OpenSSL FIPS mode support (default)]))

AC_ARG_ENABLE(builtin-zlib,
AS_HELP_STRING([--enable-builtin-zlib],
               [force use of our own built-in zlib]))

AC_ARG_ENABLE(sharing-preserving,
AS_HELP_STRING([--enable-sharing-preserving],
               [enable copying of terms without destroying sharing]))

dnl This functionality has been lost along the way... :(
dnl It could perhaps be nice to reintroduce some day; therefore,
dnl it is not removed just commented out.
dnl
dnl #
dnl # Set Erlang man page directory
dnl #
dnl AC_ARG_ENABLE(erlang-mandir,
dnl [  --disable-erlang-mandir do not install Erlang man pages in a private directory],
dnl [ case "$enableval" in
dnl     no) erl_mandir=$mandir ;;
dnl     *)  erl_mandir='$(erlang_libdir)/man' ;;
dnl   esac ], erl_mandir='$(erlang_libdir)/man')
dnl AC_SUBST(erl_mandir)

AC_ARG_ENABLE(m64-build,
AS_HELP_STRING([--enable-m64-build],
               [build 64bit binaries using the -m64 flag to (g)cc]),
[ case "$enableval" in
    no) enable_m64_build=no ;;
    *)  enable_m64_build=yes ;;
  esac
],enable_m64_build=no)

AC_ARG_ENABLE(m32-build,
AS_HELP_STRING([--enable-m32-build],
               [build 32bit binaries using the -m32 flag to (g)cc]),
[ case "$enableval" in
    no) enable_m32_build=no ;;
    *)	enable_m32_build=yes ;;
  esac
],enable_m32_build=no)

AC_ARG_WITH(libatomic_ops,
	    AS_HELP_STRING([--with-libatomic_ops=PATH],
			   [specify and prefer usage of libatomic_ops in the ethread library]))

m4_define(DEFAULT_SANITIZERS, [address,undefined])
AC_ARG_ENABLE(sanitizers,
    AS_HELP_STRING(
        [--enable-sanitizers@<:@=comma-separated list of sanitizers@:>@],
	    [Default=DEFAULT_SANITIZERS]))

AC_ARG_ENABLE([silent-rules], [dnl
AS_HELP_STRING(
  [--enable-silent-rules],
  [less verbose build output (undo: "make V=1")])
AS_HELP_STRING(
  [--disable-silent-rules],
  [verbose build output (undo: "make V=0")])dnl
])

DEFAULT_VERBOSITY=0
if test X${enable_silent_rules} = Xno; then
  DEFAULT_VERBOSITY=1
fi
AC_SUBST(DEFAULT_VERBOSITY)

if test X${enable_m64_build} = Xyes; then
	CFLAGS="-m64 $CFLAGS"
	export CFLAGS
	LDFLAGS="-m64 $LDFLAGS"
	export LDFLAGS
fi
if test X${enable_m32_build} = Xyes; then
	CFLAGS="-m32 $CFLAGS"
	export CFLAGS
	LDFLAGS="-m32 $LDFLAGS"
	export LDFLAGS
fi

NATIVE_LIBS_ENABLED=
if test X${enable_native_libs} = Xyes -a X${enable_hipe} != Xno; then
  NATIVE_LIBS_ENABLED=yes
fi
AC_SUBST(NATIVE_LIBS_ENABLED)

if test $CROSS_COMPILING = no; then
   case $host_os in
   	darwin*)
	   macosx_version=`sw_vers -productVersion`
	   test $? -eq 0 || {
	   	AC_MSG_ERROR([Failed to execute 'sw_vers'; please provide it in PATH])
	   }
	   [case "$macosx_version" in
	       [1-9][0-9].[0-9])
	          int_macosx_version=`echo $macosx_version | sed 's|\([^\.]*\)\.\([^\.]*\)|\1\2|'`;;
	       [1-9][0-9].[0-9].[0-9])
	          int_macosx_version=`echo $macosx_version | sed 's|\([^\.]*\)\.\([^\.]*\)\.\([^\.]*\)|\1\2\3|'`;;
	       [1-9][0-9].[1-9][0-9])
	          int_macosx_version=`echo $macosx_version | sed 's|\([^\.]*\)\.\([^\.]*\)|\1\200|'`;;
	       [1-9][0-9].[1-9][0-9].[0-9])
	          int_macosx_version=`echo $macosx_version | sed 's|\([^\.]*\)\.\([^\.]*\)\.\([^\.]*\)|\1\20\3|'`;;
	       [1-9][0-9].[1-9][0-9].[1-9][0-9])
	          int_macosx_version=`echo $macosx_version | sed 's|\([^\.]*\)\.\([^\.]*\)\.\([^\.]*\)|\1\2\3|'`;;
	       *)
		  int_macosx_version=unexpected;;
	   esac]
	   test $int_macosx_version != unexpected || {
	   	AC_MSG_ERROR([Unexpected MacOSX version ($macosx_version) returned by 'sw_vers -productVersion'; this configure script probably needs to be updated])
	   }
	   AC_TRY_COMPILE([
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > $int_macosx_version
#error Compiling for a newer MacOSX version...
#endif
		], [;],
		[],
		[AC_MSG_ERROR([

  You are natively building Erlang/OTP for a later version of MacOSX
  than current version ($macosx_version). You either need to
  cross-build Erlang/OTP, or set the environment variable
  MACOSX_DEPLOYMENT_TARGET to $macosx_version (or a lower version).

])])
	   ;;
	*)
	   ;;
   esac
fi

rm -f $ERL_TOP/lib/SKIP-APPLICATIONS
for app in `cd lib && ls -d *`; do
    var=`eval echo \\$with_$app`
    if test X${var} = Xno; then
       echo "$app" >> $ERL_TOP/lib/SKIP-APPLICATIONS
     fi
done

export ERL_TOP
AC_CONFIG_SUBDIRS(lib erts)

AC_CONFIG_FILES([Makefile make/output.mk])
AC_CONFIG_FILES([make/emd2exml], [chmod +x make/emd2exml])

AC_OUTPUT

pattern="lib/*/SKIP"
files=`echo $pattern`
if test "$files" != "$pattern" || test -f $ERL_TOP/lib/SKIP-APPLICATIONS; then
  echo '*********************************************************************'
  echo '**********************  APPLICATIONS DISABLED  **********************'
  echo '*********************************************************************'
  echo
  if test "$files" != "$pattern"; then
    for skipfile in $files; do
      app=`dirname $skipfile`; app=`basename $app`
      printf "%-15s: " $app; cat $skipfile
    done
  fi
  if test -f $ERL_TOP/lib/SKIP-APPLICATIONS; then
    for skipapp in `cat $ERL_TOP/lib/SKIP-APPLICATIONS`; do
      printf "%-15s: User gave --without-%s option\n" $skipapp $skipapp
    done
  fi
  echo
  echo '*********************************************************************'
fi
pattern="lib/*/CONF_INFO"
files=`echo $pattern`
if test "$files" != "$pattern" || test -f erts/CONF_INFO; then
  echo '*********************************************************************'
  echo '**********************  APPLICATIONS INFORMATION  *******************'
  echo '*********************************************************************'
  echo
  test "$files" != "$pattern" || files=""
  test ! -f erts/CONF_INFO || files="$files erts/CONF_INFO"
  for infofile in $files; do
    app=`dirname $infofile`; app=`basename $app`
    printf "%-15s: " $app; cat $infofile
  done
  echo
  echo '*********************************************************************'
fi
if test -f "erts/doc/CONF_INFO"; then
  echo '*********************************************************************'
  echo '**********************  DOCUMENTATION INFORMATION  ******************'
  echo '*********************************************************************'
  echo
  printf "%-15s: \n" documentation; 
  havexsltproc="yes"
  for cmd in `cat erts/doc/CONF_INFO`; do
	echo "                 $cmd is missing." 
  if test $cmd = "xsltproc"; then
    havexsltproc="no"
  fi
  done  
  if test $havexsltproc = "no"; then
    echo '                 The documentation can not be built.'
  else
    echo '                 Using fakefop to generate placeholder PDF files.'
  fi
  echo
  echo '*********************************************************************'
fi