~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to erts/configure.in

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
dnl Process this file with autoconf to produce a configure script. -*-m4-*-
2
2
 
3
3
dnl %CopyrightBegin%
4
 
dnl 
5
 
dnl Copyright Ericsson AB 1997-2009. All Rights Reserved.
6
 
dnl 
 
4
dnl
 
5
dnl Copyright Ericsson AB 1997-2010. All Rights Reserved.
 
6
dnl
7
7
dnl The contents of this file are subject to the Erlang Public License,
8
8
dnl Version 1.1, (the "License"); you may not use this file except in
9
9
dnl compliance with the License. You should have received a copy of the
10
10
dnl Erlang Public License along with this software. If not, it can be
11
11
dnl retrieved online at http://www.erlang.org/.
12
 
dnl 
 
12
dnl
13
13
dnl Software distributed under the License is distributed on an "AS IS"
14
14
dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15
15
dnl the License for the specific language governing rights and limitations
16
16
dnl under the License.
17
 
dnl 
 
17
dnl
18
18
dnl %CopyrightEnd%
19
19
 
20
20
dnl The string "FIXME convbreak" means that there is a break of
23
23
AC_INIT(vsn.mk)
24
24
AC_PREREQ(2.59)
25
25
 
 
26
LM_PRECIOUS_VARS
 
27
 
26
28
if test "x$no_recursion" != "xyes" -a "x$OVERRIDE_CONFIG_CACHE" = "x"; then
27
29
    # We do not want to use a common cache!
28
30
    cache_file=/dev/null
59
61
fi
60
62
erl_top=${ERL_TOP}
61
63
 
 
64
# Remove old configuration information
 
65
/bin/rm -f "$ERL_TOP/erts/CONF_INFO"
 
66
 
62
67
# echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
63
68
# echo X
64
69
# echo "X srcdir  = $srcdir"
84
89
else
85
90
    host_os=$host
86
91
fi
 
92
 
 
93
if test "$cross_compiling" = "yes"; then
 
94
    CROSS_COMPILING=yes
 
95
else
 
96
    CROSS_COMPILING=no
 
97
fi
 
98
AC_SUBST(CROSS_COMPILING)
 
99
 
 
100
ERL_XCOMP_SYSROOT_INIT
 
101
 
87
102
AC_ISC_POSIX
88
103
 
89
104
AC_CONFIG_HEADER($host/config.h:config.h.in include/internal/$host/ethread_header_config.h:include/internal/ethread_header_config.h.in include/$host/erl_int_sizes_config.h:include/erl_int_sizes_config.h.in)
94
109
ENABLE_ALLOC_TYPE_VARS=
95
110
AC_SUBST(ENABLE_ALLOC_TYPE_VARS)
96
111
 
97
 
AC_ARG_WITH(xcomp-conf,
98
 
[  --with-xcompconf=PATH     path to cross compilation configuration])
99
 
if test "x$with_xcompconf" != "xno" -a "x$with_xcompconf" != "x" ; then
100
 
    . $with_xcompconf
101
 
fi
102
 
 
 
112
AC_ARG_ENABLE(bootstrap-only,
 
113
AS_HELP_STRING([--enable-bootstrap-only],
 
114
               [enable bootstrap only configuration]),
 
115
[ if test "X$enableval" = "Xyes"; then
 
116
        # Disable stuff not necessary in a bootstrap only system in order
 
117
        # to speed up things by reducing the amount of stuff needing to be
 
118
        # built...
 
119
        enable_threads=no
 
120
        enable_smp_support=no
 
121
        with_termcap=no
 
122
        with_ssl=no
 
123
        with_ssl_zlib=no
 
124
        enable_hipe=no
 
125
        enable_sctp=no
 
126
  fi    
 
127
])
103
128
 
104
129
AC_ARG_ENABLE(threads,
105
 
[  --enable-threads        enable async thread support
106
 
  --disable-threads       disable async thread support],
 
130
AS_HELP_STRING([--enable-threads], [enable async thread support])
 
131
AS_HELP_STRING([--disable-threads], [disable async thread support]),
107
132
[ case "$enableval" in
108
133
    no) enable_threads=no ;;
109
134
    *)  enable_threads=yes ;;
110
135
  esac ], enable_threads=unknown)
111
136
 
 
137
AC_ARG_ENABLE(halfword-emulator,
 
138
AS_HELP_STRING([--enable-halfword-emulator],
 
139
               [enable halfword emulator (only for 64bit builds)]),
 
140
[ case "$enableval" in
 
141
    no) enable_halfword_emualtor=no ;;
 
142
    *)  enable_halfword_emulator=yes ;;
 
143
  esac ], enable_halfword_emulator=unknown)
 
144
 
112
145
AC_ARG_ENABLE(smp-support,
113
 
[  --enable-smp-support    enable smp support
114
 
  --disable-smp-support   disable smp support],
 
146
AS_HELP_STRING([--enable-smp-support], [enable smp support])
 
147
AS_HELP_STRING([--disable-smp-support], [disable smp support]),
115
148
[ case "$enableval" in
116
149
    no) enable_smp_support=no ;;
117
150
    *)  enable_smp_support=yes ;;
118
151
  esac ], enable_smp_support=unknown)
119
152
 
120
153
AC_ARG_WITH(termcap,
121
 
[  --with-termcap          use termcap (default)
122
 
  --without-termcap       do not use any termcap libraries (ncurses,curses,termcap,termlib)],
 
154
AS_HELP_STRING([--with-termcap], [use termcap (default)])
 
155
AS_HELP_STRING([--without-termcap],
 
156
               [do not use any termcap libraries (ncurses,curses,termcap,termlib)]),
123
157
[],
124
158
[with_termcap=yes])
125
159
 
126
160
 
127
161
AC_ARG_ENABLE(hybrid-heap,
128
 
[  --enable-hybrid-heap    enable hybrid heap
129
 
  --disable-hybrid-heap   disable hybrid heap],
 
162
AS_HELP_STRING([--enable-hybrid-heap], [enable hybrid heap]),
130
163
[ case "$enableval" in
131
164
    no) enable_hybrid_heap=no ;;
132
165
    *)  enable_hybrid_heap=yes ;;
133
166
  esac ], enable_hybrid_heap=unknown)
134
167
 
135
168
AC_ARG_ENABLE(lock-checking,
136
 
[  --enable-lock-checking  enable lock checking],
 
169
AS_HELP_STRING([--enable-lock-checking], [enable lock checking]),
137
170
[ case "$enableval" in
138
171
    no) enable_lock_check=no ;;
139
172
    *)  enable_lock_check=yes ;;
142
175
  enable_lock_check=no)
143
176
 
144
177
AC_ARG_ENABLE(lock-counter,
145
 
[  --enable-lock-counter    enable lock counters
146
 
  --disable-lock-counter   disable lock counters],
 
178
AS_HELP_STRING([--enable-lock-counter], [enable lock counters]),
147
179
[ case "$enableval" in
148
180
    no) enable_lock_count=no ;;
149
181
    *)  enable_lock_count=yes ;;
150
182
  esac ], enable_lock_count=no)
151
183
 
152
184
AC_ARG_ENABLE(kernel-poll,
153
 
[  --enable-kernel-poll    enable kernel poll support
154
 
  --disable-kernel-poll   disable kernel poll support],
 
185
AS_HELP_STRING([--enable-kernel-poll], [enable kernel poll support])
 
186
AS_HELP_STRING([--disable-kernel-poll], [disable kernel poll support]),
155
187
[ case "$enableval" in
156
188
    no) enable_kernel_poll=no ;;
157
189
    *)  enable_kernel_poll=yes ;;
159
191
 
160
192
 
161
193
AC_ARG_ENABLE(sctp,
162
 
[  --enable-sctp           enable sctp support
163
 
  --disable-sctp          disable sctp support],
 
194
AS_HELP_STRING([--enable-sctp], [enable sctp support])
 
195
AS_HELP_STRING([--disable-sctp], [disable sctp support]),
164
196
[ case "$enableval" in
165
197
    no) enable_sctp=no ;;
166
198
    *)  enable_sctp=yes ;;
167
199
  esac ], enable_sctp=unknown)
168
200
 
169
201
AC_ARG_ENABLE(hipe,
170
 
[  --enable-hipe           enable hipe support
171
 
  --disable-hipe          disable hipe support])
 
202
AS_HELP_STRING([--enable-hipe], [enable hipe support])
 
203
AS_HELP_STRING([--disable-hipe], [disable hipe support]))
172
204
 
173
205
AC_ARG_ENABLE(native-libs,
174
 
[  --enable-native-libs    compile Erlang libraries to native code])
 
206
AS_HELP_STRING([--enable-native-libs],
 
207
               [compile Erlang libraries to native code]))
175
208
 
176
209
AC_ARG_ENABLE(tsp,
177
 
[  --enable-tsp            compile tsp app])
178
 
 
179
 
AC_ARG_ENABLE(elib-malloc,
180
 
[  --enable-elib-malloc    use elib_malloc instead of normal malloc])
 
210
AS_HELP_STRING([--enable-tsp], [compile tsp app]))
181
211
 
182
212
AC_ARG_ENABLE(fp-exceptions,
183
 
[  --enable-fp-exceptions    Use hardware floating point exceptions (default if hipe enabled)],
 
213
AS_HELP_STRING([--enable-fp-exceptions],
 
214
               [use hardware floating point exceptions (default if hipe enabled)]),
184
215
[ case "$enableval" in
185
216
    no) enable_fp_exceptions=no ;;
186
217
    *)  enable_fp_exceptions=yes ;;
188
219
],enable_fp_exceptions=auto)
189
220
 
190
221
AC_ARG_ENABLE(darwin-universal,
191
 
[  --enable-darwin-universal    build universal binaries on darwin i386],
 
222
AS_HELP_STRING([--enable-darwin-universal],
 
223
               [build universal binaries on darwin i386]),
192
224
[ case "$enableval" in
193
225
    no) enable_darwin_universal=no ;;
194
226
    *)  enable_darwin_univeral=yes ;;
197
229
 
198
230
 
199
231
AC_ARG_ENABLE(darwin-64bit,
200
 
[  --enable-darwin-64bit    build 64bit binaries on darwin],
 
232
AS_HELP_STRING([--enable-darwin-64bit], [build 64bit binaries on darwin]),
201
233
[ case "$enableval" in
202
234
    no) enable_darwin_64bit=no ;;
203
235
    *)  enable_darwin_64bit=yes ;;
205
237
],enable_darwin_64bit=no)
206
238
 
207
239
AC_ARG_ENABLE(m64-build,
208
 
[  --enable-m64-build    build 64bit binaries using the -m64 flag to (g)cc],
 
240
AS_HELP_STRING([--enable-m64-build],
 
241
               [build 64bit binaries using the -m64 flag to (g)cc]),
209
242
[ case "$enableval" in
210
243
    no) enable_m64_build=no ;;
211
244
    *)  enable_m64_build=yes ;;
212
245
  esac
213
246
],enable_m64_build=no)
214
247
 
 
248
AC_ARG_ENABLE(m32-build,
 
249
AS_HELP_STRING([--enable-m32-build],
 
250
               [build 32bit binaries using the -m32 flag to (g)cc]),
 
251
[ case "$enableval" in
 
252
    no) enable_m32_build=no ;;
 
253
    *)
 
254
        if test X${enable_darwin_64bit} = Xyes -o  X${enable_m64_build} = Xyes;
 
255
        then
 
256
                AC_MSG_ERROR([(--enable-darwin-64bit or --enable-m64-build) and --enable-m32-build are mutually exclusive]) ;
 
257
        fi ;
 
258
        enable_m32_build=yes ;;
 
259
  esac
 
260
],enable_m32_build=no)
 
261
 
215
262
AC_ARG_ENABLE(fixalloc,
216
 
[  --disable-fixalloc      disable the use of fix_alloc])
 
263
AS_HELP_STRING([--disable-fixalloc], [disable the use of fix_alloc]))
217
264
if test x${enable_fixalloc} = xno ; then
218
265
  AC_DEFINE(NO_FIX_ALLOC,[],
219
266
            [Define if you don't want the fix allocator in Erlang])
221
268
 
222
269
AC_SUBST(PERFCTR_PATH)
223
270
AC_ARG_WITH(perfctr,
224
 
[  --with-perfctr=PATH     specify location of perfctr include and lib
225
 
  --without-perfctr       don't use perfctr (default)])
 
271
AS_HELP_STRING([--with-perfctr=PATH],
 
272
               [specify location of perfctr include and lib])
 
273
AS_HELP_STRING([--without-perfctr], [don't use perfctr (default)]))
226
274
 
227
275
if test "x$with_perfctr" = "xno" -o "x$with_perfctr" = "x" ; then
228
276
    PERFCTR_PATH=
236
284
fi
237
285
 
238
286
AC_ARG_ENABLE(clock-gettime,
239
 
[  --enable-clock-gettime  Use clock-gettime for time correction],
 
287
AS_HELP_STRING([--enable-clock-gettime],
 
288
               [use clock-gettime for time correction]),
240
289
[ case "$enableval" in
241
290
    no) clock_gettime_correction=no ;;
242
291
    *) clock_gettime_correction=yes ;;
243
292
  esac ], clock_gettime_correction=unknown)
244
293
 
245
 
AC_ARG_ENABLE(native-ethr-impls,
246
 
[  --enable-native-ethr-impls enable native ethread implementations
247
 
  --disable-native-ethr-impls disable native ethread implementations],
248
 
[ case "$enableval" in
249
 
    no) disable_native_ethr_impls=yes ;;
250
 
    *)  disable_native_ethr_impls=no ;;
251
 
  esac ], disable_native_ethr_impls=no)
252
 
 
253
 
dnl Defined in libraries/megaco/configure.in but we need it here
254
 
dnl also in order to show it to the "top user"
255
 
 
256
 
AC_ARG_ENABLE(megaco_flex_scanner_lineno,
257
 
[  --disable-megaco-flex-scanner-lineno disable megaco flex scanner lineno])
258
 
 
259
294
dnl Magic test for clearcase.
260
295
OTP_RELEASE=
261
296
if test "${ERLANG_COMMERCIAL_BUILD}" != ""; then
302
337
        esac
303
338
fi
304
339
if test X${enable_darwin_64bit} = Xyes -o X${enable_m64_build} = Xyes; then
305
 
        enable_hipe=no
306
340
        case $CFLAGS in
307
341
                *-m64*)
308
342
                        ;;
322
356
                        esac
323
357
                        ;;
324
358
                *)
 
359
                        if test X${enable_m32_build} = Xyes;
 
360
                        then
 
361
                                enable_hipe=no;
 
362
                                case $CFLAGS in
 
363
                                *-m32*)
 
364
                                        ;;
 
365
                                *)
 
366
                                        CFLAGS="-m32 $CFLAGS"
 
367
                                ;;
 
368
                                esac ;
 
369
                        fi
325
370
                        ;;
326
371
        esac
327
372
fi
332
377
dnl ----------------------------------------------------------------------
333
378
 
334
379
AC_PROG_CC
 
380
AC_SUBST(GCC)
335
381
 
336
382
dnl ---------------------------------------------------------------------
337
383
dnl Special stuff regarding CFLAGS and details in the environment...
351
397
        AC_MSG_WARN([Reverting to 32-bit time_t])
352
398
        CPPFLAGS="$CPPFLAGS -D_USE_32BIT_TIME_T"
353
399
        ;;
 
400
    darwin*)
 
401
        CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE"
 
402
        ;;
354
403
    *)
355
404
        ;;
356
405
esac
415
464
DEBUG_CFLAGS="-g $CPPFLAGS $extra_flags"
416
465
DEBUG_FLAGS=-g
417
466
 
 
467
dnl
 
468
dnl Adjust DEBUG_CFLAGS to match CFLAGS in terms of -m
 
469
dnl
 
470
 
 
471
case $CFLAGS in
 
472
        *-m64*)
 
473
                case $DEBUG_CFLAGS in
 
474
                        *-m64*)
 
475
                                ;;
 
476
                        *)
 
477
                                DEBUG_CFLAGS="-m64 $DEBUG_CFLAGS"
 
478
                                ;;
 
479
                esac
 
480
                ;;
 
481
        *-m32*)
 
482
                case $DEBUG_CFLAGS in
 
483
                        *-m32*)
 
484
                                ;;
 
485
                        *)
 
486
                                DEBUG_CFLAGS="-m32 $DEBUG_CFLAGS"
 
487
                                ;;
 
488
                esac
 
489
                ;;
 
490
        *)
 
491
                ;;
 
492
esac
 
493
 
 
494
 
 
495
 
418
496
CFLAG_RUNTIME_LIBRARY_PATH="-Wl,-R"
419
497
case $host_os in
420
498
  darwin*)
431
509
        ;;
432
510
esac
433
511
 
 
512
lfs_conf=ok
 
513
lfs_source=none
 
514
if test "${LFS_CFLAGS+set}" = "set" || \
 
515
   test "${LFS_LDFLAGS+set}" = "set" || \
 
516
   test "${LFS_LIBS+set}" = "set"; then
 
517
    lfs_source=user
 
518
else
 
519
   LM_CHECK_GETCONF
 
520
   test "$GETCONF" = "false" || lfs_source=getconf
 
521
fi
434
522
 
435
 
dnl
436
 
dnl Use the getconf utility if it exists
437
 
dnl to find large file support flags.
438
 
dnl
439
 
if type getconf >/dev/null 2>&1; then
440
 
        CFLAGS="$CFLAGS `getconf LFS_CFLAGS 2>/dev/null`"
441
 
        DEBUG_CFLAGS="$DEBUG_CFLAGS `getconf LFS_CFLAGS 2>/dev/null`"
442
 
        LDFLAGS="$LDFLAGS `getconf LFS_LDFLAGS 2>/dev/null`"
443
 
        LIBS="$LIBS `getconf LFS_LIBS 2>/dev/null`"
 
523
if test "$lfs_source" = "none"; then
 
524
    AC_MSG_WARN([Do not know how to check for large file support flags; no getconf is available])
 
525
else
 
526
    for var in CFLAGS LDFLAGS LIBS; do
 
527
        AC_MSG_CHECKING([for large file support $var])
 
528
        if test $lfs_source = user; then
 
529
            eval "lfs_val=\"\$LFS_$var\""
 
530
        else
 
531
            eval "lfs_var=LFS_$var"
 
532
            lfs_val=`$GETCONF $lfs_var 2>/dev/null` || lfs_conf=failed
 
533
            if test $lfs_conf = failed; then
 
534
                AC_MSG_RESULT([failed])
 
535
                break
 
536
            fi
 
537
            eval "$lfs_var=\"$lfs_val\""
 
538
        fi
 
539
        test "$lfs_val" != "" || lfs_val=none
 
540
        AC_MSG_RESULT([$lfs_val])
 
541
    done
 
542
    if test $lfs_conf = failed; then
 
543
        AC_MSG_WARN([Check for large file support flags failed; $GETCONF failed])
 
544
    else
 
545
        CFLAGS="$CFLAGS $LFS_CFLAGS"
 
546
        DEBUG_CFLAGS="$DEBUG_CFLAGS $LFS_CFLAGS"
 
547
        LDFLAGS="$LDFLAGS $LFS_LDFLAGS"
 
548
        LIBS="$LIBS $LFS_LIBS"
 
549
    fi
444
550
fi
445
551
 
446
552
if test "x$GCC" = xyes; then
447
553
  # until the emulator can handle this, I suggest we turn it off!
448
554
  #WFLAGS="-Wall -Wshadow -Wcast-qual -Wmissing-declarations"
449
 
  WFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes"
 
555
  WFLAGS="-Wall -Wstrict-prototypes"
 
556
 
 
557
  case "$host_cpu" in
 
558
    tile*)
 
559
      # tile-gcc is a bit stricter with -Wmissing-prototypes than other gccs,
 
560
      # and too strict for our taste.
 
561
      ;;
 
562
    *)
 
563
      WFLAGS="$WFLAGS -Wmissing-prototypes";;
 
564
  esac
450
565
 
451
566
  saved_CFLAGS=$CFLAGS
452
567
  CFLAGS="$CFLAGS -Wdeclaration-after-statement"
464
579
AC_SUBST(WFLAGS)
465
580
AC_SUBST(CFLAG_RUNTIME_LIBRARY_PATH)
466
581
 
467
 
AC_CHECK_SIZEOF(void *, $erl_xcomp_void_p) # Needed for ARCH and smp checks below
 
582
AC_CHECK_SIZEOF(void *) # Needed for ARCH and smp checks below
 
583
if test "x$ac_cv_sizeof_void_p" = x8; then
 
584
  AC_SUBST(EXTERNAL_WORD_SIZE, 64)
 
585
else
 
586
  AC_SUBST(EXTERNAL_WORD_SIZE, 32)
 
587
fi
468
588
 
469
589
dnl
470
590
dnl Figure out operating system and cpu architecture
471
591
dnl
472
592
 
473
 
if test "x$erl_xcomp_os" != "x"; then
474
 
    chk_opsys_=$erl_xcomp_os
 
593
if test "x$host_alias" != "x"; then
 
594
    chk_opsys_=$host_os
475
595
else
476
 
    if test "x$host_os" = "xwin32"; then
477
 
        chk_opsys_=win32
478
 
    else
479
 
        chk_opsys_=`uname -s`
480
 
        if test "x$chk_opsys_" = "xSunOS"; then
481
 
            chk_opsys_=$chk_opsys_`uname -r`
482
 
        fi
 
596
    chk_opsys_=`uname -s`
 
597
    if test "x$chk_opsys_" = "xSunOS"; then
 
598
        chk_opsys_=$chk_opsys_`uname -r`
483
599
    fi
484
600
fi
485
601
case $chk_opsys_ in
491
607
    *)                          OPSYS=noopsys
492
608
esac
493
609
 
494
 
if test "x$erl_xcomp_hw" != "x"; then
495
 
    chk_arch_=$erl_xcomp_hw
 
610
if test "x$host_alias" != "x" -a "x$host_cpu" != "x"; then
 
611
    chk_arch_=$host_cpu
496
612
else
497
613
    chk_arch_=`uname -m`
498
614
fi
 
615
 
499
616
case $chk_arch_ in
500
617
    sun4u)      ARCH=ultrasparc;;
501
618
    sparc64)    ARCH=sparc64;;
613
730
                                        LDFLAGS="-m64 $LDFLAGS"
614
731
                                ;;
615
732
                        esac
 
733
                fi;
 
734
                if test X${enable_m32_build} = Xyes; then
 
735
                        AC_MSG_NOTICE([Adjusting LDFLAGS to use -m32]) ;
 
736
                        case $LDFLAGS in
 
737
                                *-m32*)
 
738
                                        ;;
 
739
                                *)
 
740
                                        LDFLAGS="-m32 $LDFLAGS"
 
741
                                ;;
 
742
                        esac ;
616
743
                fi
617
744
                ;;
618
745
esac
635
762
        
636
763
AC_SUBST(LIBCARBON)
637
764
 
 
765
dnl Check if we should/can build a halfword emulator
 
766
 
 
767
AC_MSG_CHECKING(if we are building a halfword emulator (32bit heap on 64bit machine))
 
768
if test "$enable_halfword_emulator" = "yes"; then
 
769
        if test "$ARCH" = "amd64"; then
 
770
                AC_DEFINE(HALFWORD_HEAP_EMULATOR, [1],
 
771
                          [Define if building a halfword-heap 64bit emulator])
 
772
                AC_MSG_RESULT([yes])
 
773
        else
 
774
                AC_MSG_ERROR(no; halfword emulator not supported on this architecture)
 
775
        fi
 
776
else
 
777
        AC_MSG_RESULT([no])
 
778
fi
 
779
 
 
780
 
 
781
 
 
782
 
 
783
 
638
784
dnl some tests below will call this if we haven't already - and autoconf
639
785
dnl can't handle those tests being done conditionally at runtime
640
786
AC_PROG_CPP
649
795
AC_PROG_LN_S
650
796
 
651
797
 
652
 
AC_CHECK_PROG(AR, ar, ar, false)
 
798
AC_CHECK_TOOL([AR], [ar], [false])
653
799
if test "$ac_cv_prog_AR" = false; then
654
800
  AC_MSG_ERROR([No 'ar' command found in PATH])
655
801
fi
680
826
AC_CHECK_PROGS(XSLTPROC, xsltproc)
681
827
if test -z "$XSLTPROC"; then
682
828
  echo "xsltproc" >> doc/CONF_INFO
683
 
  AC_MSG_WARN([No 'xsltproc' command found: the documentation can not be built])
 
829
  AC_MSG_WARN([No 'xsltproc' command found: the documentation cannot be built])
684
830
fi
685
831
 
686
832
AC_CHECK_PROGS(FOP, fop)
687
833
if test -z "$FOP"; then
 
834
  FOP="$ERL_TOP/make/fakefop"
688
835
  echo "fop" >> doc/CONF_INFO
689
 
  AC_MSG_WARN([No 'fop' command found: the documentation can not be built])
 
836
  AC_MSG_WARN([No 'fop' command found: going to generate placeholder PDF files])
690
837
fi
691
838
 
692
839
dnl
740
887
HCFLAGS=""          AC_SUBST(HCFLAGS)
741
888
HCFLAGS="$HCFLAGS -I${ERL_TOP}/erts/$host"
742
889
vxworks_reclaim=""  AC_SUBST(vxworks_reclaim)
743
 
LD='$(CC)'          AC_SUBST(LD)
744
 
 
 
890
 
 
891
dnl We want to use $(CC) as linker for the emulator regardless of
 
892
dnl what the user say. This might not be the right way to do it, but
 
893
dnl for now that is the way we do it.
 
894
USER_LD=$LD
 
895
USER_LDFLAGS="$LDFLAGS"
 
896
LD='$(CC)'
 
897
AC_SUBST(LD)
 
898
 
 
899
LDFLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH"
 
900
AC_SUBST(LDFLAG_RUNTIME_LIBRARY_PATH)
745
901
 
746
902
dnl Check for cygwin and object/exe files extension
747
903
dnl AC_CYGWIN is deprecated
898
1054
        fi
899
1055
 
900
1056
        AC_DEFINE(ERTS_HAVE_SMP_EMU, 1, [Define if the smp emulator is built])
 
1057
 
 
1058
        case "$ethr_have_native_atomics-$ethr_have_native_spinlock" in
 
1059
          yes-*)
 
1060
                ;;
 
1061
 
 
1062
          no-yes)
 
1063
 
 
1064
                test -f "$ERL_TOP/erts/CONF_INFO" ||
 
1065
                    echo "" > "$ERL_TOP/erts/CONF_INFO"
 
1066
                cat >> $ERL_TOP/erts/CONF_INFO <<EOF
 
1067
 
 
1068
                 No native atomic implementation available.
 
1069
                 Fallbacks implemented using spinlocks will be
 
1070
                 used. Note that the performance of the SMP
 
1071
                 runtime system will suffer due to this.
 
1072
 
 
1073
EOF
 
1074
                ;;
 
1075
 
 
1076
          no-no)
 
1077
 
 
1078
                test -f "$ERL_TOP/erts/CONF_INFO" ||
 
1079
                    echo "" > "$ERL_TOP/erts/CONF_INFO"
 
1080
                cat >> "$ERL_TOP/erts/CONF_INFO" <<EOF
 
1081
 
 
1082
                 No native atomic implementation, nor no native
 
1083
                 spinlock implementation available. Fallbacks
 
1084
                 implemented using mutexes will be used. Note
 
1085
                 that the performance of the SMP runtime system
 
1086
                 will suffer much due to this.
 
1087
 
 
1088
EOF
 
1089
                ;;
 
1090
 
 
1091
        esac
 
1092
 
901
1093
        enable_threads=force
902
1094
fi
903
1095
 
904
1096
AC_SUBST(ERTS_BUILD_SMP_EMU)
905
1097
 
 
1098
AC_CHECK_FUNCS([posix_fadvise])
906
1099
 
907
1100
 
908
1101
#
997
1190
                enable_child_waiter_thread=yes
998
1191
                ;;
999
1192
            linux*)
1000
 
                AC_DEFINE(USE_RECURSIVE_MALLOC_MUTEX,[1],
1001
 
                        [Define if malloc should use a recursive mutex])
1002
1193
                AC_MSG_CHECKING([whether dlopen() needs to be called before first call to dlerror()])
1003
 
                if test "x$ETHR_THR_LIB_BASE_NAME" != "xnptl"; then
 
1194
                if test "x$ETHR_THR_LIB_BASE_TYPE" != "xposix_nptl"; then
1004
1195
                    AC_DEFINE(ERTS_NEED_DLOPEN_BEFORE_DLERROR,[1],
1005
1196
                        [Define if dlopen() needs to be called before first call to dlerror()])
1006
1197
                        AC_MSG_RESULT(yes)
1007
1198
                else
1008
1199
                        AC_MSG_RESULT(no)
1009
1200
                fi
1010
 
                if test "x$ETHR_THR_LIB_BASE_NAME" != "xnptl"; then
 
1201
                if test "x$ETHR_THR_LIB_BASE_TYPE" != "xposix_nptl"; then
1011
1202
                    # Child waiter thread cannot be enabled
1012
1203
                    disable_child_waiter_thread=yes
1013
1204
                    enable_child_waiter_thread=no
1069
1260
 
1070
1261
AC_SUBST(EMU_LOCK_CHECKING)
1071
1262
 
1072
 
ERTS_INTERNAL_X_LIBS=
1073
 
 
1074
 
AC_CHECK_LIB(kstat, kstat_open,
1075
 
[AC_DEFINE(HAVE_KSTAT, 1, [Define if you have kstat])
1076
 
ERTS_INTERNAL_X_LIBS="$ERTS_INTERNAL_X_LIBS -lkstat"])
1077
 
 
1078
 
AC_SUBST(ERTS_INTERNAL_X_LIBS)
 
1263
ERL_INTERNAL_LIBS
1079
1264
 
1080
1265
dnl THR_LIBS and THR_DEFS are only used by odbc
1081
1266
THR_LIBS=$ETHR_X_LIBS
1120
1305
dnl -------------
1121
1306
 
1122
1307
AC_ARG_ENABLE(shared-zlib,
1123
 
[  --enable-shared-zlib        enable using shared zlib library
1124
 
  --disable-shared-zlib       disable shared zlib, compile own zlib source (default)],
 
1308
AS_HELP_STRING([--enable-shared-zlib], [enable using shared zlib library]),
1125
1309
[ case "$enableval" in
1126
1310
    no) enable_shared_zlib=no ;;
1127
1311
    *)  enable_shared_zlib=yes ;;
1296
1480
dnl Some Linuxes needs <sys/socketio.h> instead of <sys/sockio.h>
1297
1481
dnl
1298
1482
AC_CHECK_HEADERS(fcntl.h limits.h unistd.h syslog.h dlfcn.h ieeefp.h \
1299
 
                 sys/stropts.h sys/sysctl.h \
 
1483
                 sys/types.h sys/stropts.h sys/sysctl.h \
1300
1484
                 sys/ioctl.h sys/time.h sys/uio.h \
1301
1485
                 sys/socket.h sys/sockio.h sys/socketio.h \
1302
1486
                 net/errno.h malloc.h mach-o/dyld.h arpa/nameser.h \
1303
 
                 pty.h util.h utmp.h langinfo.h)
 
1487
                 pty.h util.h utmp.h langinfo.h poll.h sdkddkver.h)
1304
1488
 
1305
1489
AC_CHECK_HEADER(sys/resource.h,
1306
1490
        [AC_DEFINE(HAVE_SYS_RESOURCE_H, 1,
1318
1502
 
1319
1503
dnl Check for kernel SCTP support
1320
1504
AC_SUBST(LIBSCTP)
1321
 
if test "x$enable_sctp" == "xyes" ; then
 
1505
if test "x$enable_sctp" = "xyes" ; then
1322
1506
    AC_CHECK_HEADER(netinet/sctp.h,
1323
1507
        [LIBSCTP=libsctp.so.1
1324
1508
         AC_DEFINE(HAVE_SCTP_H, [1],
1389
1573
LM_STRUCT_EXCEPTION
1390
1574
 
1391
1575
AC_CHECK_SIZEOF(char, 1)
1392
 
AC_CHECK_SIZEOF(short, $erl_xcomp_short)
1393
 
AC_CHECK_SIZEOF(int, $erl_xcomp_int)
1394
 
AC_CHECK_SIZEOF(long, $erl_xcomp_long)
1395
 
AC_CHECK_SIZEOF(void *, $erl_xcomp_void_p)
1396
 
AC_CHECK_SIZEOF(long long, $erl_xcomp_long_long)
 
1576
AC_CHECK_SIZEOF(short)
 
1577
AC_CHECK_SIZEOF(int)
 
1578
AC_CHECK_SIZEOF(long)
 
1579
AC_CHECK_SIZEOF(void *)
 
1580
AC_CHECK_SIZEOF(long long)
 
1581
AC_CHECK_SIZEOF(size_t)
 
1582
AC_CHECK_SIZEOF(off_t)
1397
1583
 
1398
1584
BITS64=
1399
1585
 
1457
1643
    abort ();
1458
1644
  return 0;
1459
1645
}
1460
 
],AC_MSG_RESULT(no)
1461
 
,AC_MSG_RESULT(yes)
1462
 
AC_MSG_ERROR([This gcc miscompiles the Erlang runtime system; please use a different version])
1463
 
,AC_MSG_RESULT(no))
1464
 
fi
1465
 
 
1466
 
dnl AC_CHECK_SIZEOF(size_t, 4)dnl Assumes all cross compiling is to 32bit uP
1467
 
dnl
1468
 
dnl The disabled one above does not include stddef.h, alas!
1469
 
dnl
1470
 
AC_CACHE_CHECK([size of size_t], ac_cv_sizeof_size_t, 
1471
 
AC_TRY_RUN([
1472
 
#include <sys/types.h>
1473
 
#include <stdio.h>
1474
 
#include <stdlib.h>
1475
 
#include <stddef.h>
1476
 
int main(int argc, char **argv) {
1477
 
    FILE *f = fopen("conftestval", "w");
1478
 
    if (! f)
1479
 
        exit(1); /* Failed */
1480
 
    fprintf(f, "%d\n", (int) sizeof(size_t));
1481
 
    exit(0); /* OK */
1482
 
}
1483
 
], ac_cv_sizeof_size_t=`cat conftestval`
1484
 
,  ac_cv_sizeof_size_t=0
1485
 
,  ac_cv_sizeof_size_t=$erl_xcomp_sizeof_size_t))
1486
 
AC_DEFINE_UNQUOTED(SIZEOF_SIZE_T, $ac_cv_sizeof_size_t, [The number of bytes in a size_t])
1487
 
 
1488
 
dnl A standard size check does not include sys/types.h
1489
 
dnl
1490
 
AC_CACHE_CHECK([size of off_t], ac_cv_sizeof_off_t, 
1491
 
AC_TRY_RUN([
1492
 
#include <sys/types.h>
1493
 
#include <stdio.h>
1494
 
#include <stdlib.h>
1495
 
#include <stddef.h>
1496
 
int main(int argc, char **argv) {
1497
 
    FILE *f = fopen("conftestval", "w");
1498
 
    if (! f)
1499
 
        exit(1); /* Failed */
1500
 
    fprintf(f, "%d\n", (int) sizeof(off_t));
1501
 
    exit(0); /* OK */
1502
 
}
1503
 
], ac_cv_sizeof_off_t=`cat conftestval`
1504
 
,  ac_cv_sizeof_off_t=0
1505
 
,  ac_cv_sizeof_off_t=$erl_xcomp_sizeof_off_t))
1506
 
AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
1507
 
        [The number of bytes in an off_t])
1508
 
 
1509
 
AC_MSG_CHECKING([int/long/void*/size_t sizes])
1510
 
AC_TRY_RUN([
1511
 
#include <stdlib.h>
1512
 
#include <stddef.h>
1513
 
int main(int argc, char **argv) {
1514
 
    if (sizeof(void *) >= 4 &&
1515
 
        sizeof(void *) == sizeof(size_t) &&
1516
 
        (sizeof(void *) == sizeof(int) || sizeof(void *) == sizeof(long))) {
1517
 
        exit(0); /* OK */
1518
 
    }
1519
 
    exit(1); /* Failed */
1520
 
}
1521
 
],AC_MSG_RESULT(ok)
1522
 
,AC_MSG_RESULT(failed)
1523
 
AC_MSG_ERROR([Cannot handle this combination of int/long/void*/size_t sizes])
1524
 
,AC_MSG_RESULT(ok))
1525
 
 
1526
 
if test "x$erl_xcomp_bigendian" != "x"; then
1527
 
        ac_cv_c_bigendian=$erl_xcomp_bigendian
1528
 
fi
 
1646
], gcc_4_3_0_bug=no, gcc_4_3_0_bug=yes, gcc_4_3_0_bug=cross)
 
1647
 
 
1648
case $gcc_4_3_0_bug in
 
1649
        yes|no)
 
1650
                gcc_4_3_0_bug_result=$gcc_4_3_0_bug;;
 
1651
        cross)
 
1652
                gcc_dumped_vsn=`$CC -dumpversion 2>/dev/null`
 
1653
                case gcc-$gcc_dumped_vsn in
 
1654
                        gcc-4.3.0) gcc_4_3_0_bug=yes;;
 
1655
                        *) gcc_4_3_0_bug=no;;
 
1656
                esac
 
1657
                gcc_4_3_0_bug_result="$gcc_4_3_0_bug; could not run test since cross compiling, checked version number ($gcc_dumped_vsn) instead";;
 
1658
esac
 
1659
 
 
1660
AC_MSG_RESULT([$gcc_4_3_0_bug_result])
 
1661
if test $gcc_4_3_0_bug = yes; then
 
1662
        AC_MSG_ERROR([This gcc miscompiles the Erlang runtime system; please use a different version])  
 
1663
fi
 
1664
 
 
1665
fi
 
1666
 
 
1667
case X$erl_xcomp_bigendian in
 
1668
    X) ;;
 
1669
    Xyes|Xno) ac_cv_c_bigendian=$erl_xcomp_bigendian;;
 
1670
    *) AC_MSG_ERROR([Bad erl_xcomp_bigendian value: $erl_xcomp_bigendian]);;
 
1671
esac
1529
1672
 
1530
1673
AC_C_BIGENDIAN
1531
1674
 
1541
1684
 
1542
1685
dnl Check if we have these, in which case we'll try to build
1543
1686
dnl inet_gethost with ipv6 support.
1544
 
AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes, have_getaddrinfo=no)
 
1687
AC_CHECK_HEADERS(windows.h)
 
1688
AC_CHECK_HEADERS(winsock2.h)
 
1689
AC_CHECK_HEADERS(ws2tcpip.h,[],[],[
 
1690
#ifdef HAVE_WINSOCK2_H
 
1691
#include <winsock2.h>
 
1692
#endif
 
1693
#ifdef HAVE_WINDOWS_H
 
1694
#include <windows.h>
 
1695
#endif
 
1696
])
 
1697
dnl AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes, have_getaddrinfo=no)
 
1698
AC_MSG_CHECKING(for getaddrinfo)
 
1699
AC_TRY_LINK([
 
1700
#include <stdlib.h>
 
1701
#include <string.h>
 
1702
#ifdef HAVE_WINSOCK2_H
 
1703
#include <winsock2.h>
 
1704
#endif
 
1705
#ifdef HAVE_WINDOWS_H
 
1706
#include <windows.h>
 
1707
#endif
 
1708
#ifdef HAVE_WS2TCPIP_H
 
1709
#include <ws2tcpip.h>
 
1710
#endif
 
1711
#ifndef __WIN32__
 
1712
#include <sys/socket.h>
 
1713
#include <netdb.h>
 
1714
#endif
 
1715
], 
 
1716
[
 
1717
getaddrinfo("","",NULL,NULL);
 
1718
],have_getaddrinfo=yes, have_getaddrinfo=no)
1545
1719
if test $have_getaddrinfo = yes; then
 
1720
        AC_MSG_RESULT([yes])
1546
1721
        AC_MSG_CHECKING([whether getaddrinfo accepts enough flags])
1547
 
        AC_TRY_RUN([
 
1722
        AC_TRY_COMPILE([
1548
1723
#include <stdlib.h>
1549
1724
#include <string.h>
 
1725
#ifdef HAVE_WINSOCK2_H
 
1726
#include <winsock2.h>
 
1727
#endif
 
1728
#ifdef HAVE_WINDOWS_H
 
1729
#include <windows.h>
 
1730
#endif
 
1731
#ifdef HAVE_WS2TCPIP_H
 
1732
#include <ws2tcpip.h>
 
1733
#endif
 
1734
#ifndef __WIN32__
1550
1735
#include <sys/socket.h>
1551
1736
#include <netdb.h>
1552
 
int main(int argc, char **argv) {
 
1737
#endif
 
1738
],
 
1739
[
1553
1740
    struct addrinfo hints, *ai;
1554
1741
    memset(&hints, 0, sizeof(hints));
1555
 
    hints.ai_flags = (AI_CANONNAME|AI_V4MAPPED|AI_ADDRCONFIG);
 
1742
    hints.ai_flags = AI_CANONNAME;
1556
1743
    hints.ai_socktype = SOCK_STREAM;
1557
1744
    hints.ai_family = AF_INET6;
1558
1745
    if (getaddrinfo("::", NULL, &hints, &ai) == 0) {
1561
1748
    } else {
1562
1749
        exit(1);
1563
1750
    }
1564
 
}
1565
 
        ],, have_getaddrinfo=no,
1566
 
        if test "x$erl_xcomp_getaddrinfo" != "x"; then
1567
 
            have_getaddrinfo=$erl_xcomp_getaddrinfo
1568
 
        else
1569
 
            have_getaddrinfo=no
1570
 
        fi)
1571
 
        if test $have_getaddrinfo = yes; then
1572
 
                AC_MSG_RESULT(yes)
 
1751
],, have_getaddrinfo=no)
 
1752
        AC_MSG_RESULT($have_getaddrinfo)
 
1753
        case $have_getaddrinfo in
 
1754
            yes)
1573
1755
                AC_DEFINE(HAVE_GETADDRINFO, [1], 
1574
 
                          [Define to 1 if you have a good `getaddrinfo' function.])
1575
 
        else
1576
 
                AC_MSG_RESULT(no)
1577
 
        fi
1578
 
fi
1579
 
AC_CHECK_FUNCS([getnameinfo getipnodebyname getipnodebyaddr gethostbyname2])
 
1756
                          [Define to 1 if you have a good `getaddrinfo' function.]);;
 
1757
            *) ;;
 
1758
        esac
 
1759
else
 
1760
    AC_MSG_RESULT([no])
 
1761
fi
 
1762
AC_MSG_CHECKING(for getnameinfo)
 
1763
AC_TRY_LINK([
 
1764
#include <stdlib.h>
 
1765
#include <string.h>
 
1766
#ifdef HAVE_WINSOCK2_H
 
1767
#include <winsock2.h>
 
1768
#endif
 
1769
#ifdef HAVE_WINDOWS_H
 
1770
#include <windows.h>
 
1771
#endif
 
1772
#ifdef HAVE_WS2TCPIP_H
 
1773
#include <ws2tcpip.h>
 
1774
#endif
 
1775
#ifndef __WIN32__
 
1776
#include <sys/socket.h>
 
1777
#include <netdb.h>
 
1778
#endif
 
1779
], 
 
1780
[
 
1781
getnameinfo(NULL,0,NULL,0,NULL,0,0);
 
1782
],have_getnameinfo=yes, have_getnameinfo=no)
 
1783
if test $have_getnameinfo = yes; then
 
1784
        AC_MSG_RESULT([yes])
 
1785
        AC_DEFINE(HAVE_GETNAMEINFO, [1], 
 
1786
                  [Define to 1 if you have a good `getnameinfo' function.])
 
1787
else
 
1788
        AC_MSG_RESULT([no])       
 
1789
fi
 
1790
 
 
1791
 
 
1792
AC_CHECK_FUNCS([getipnodebyname getipnodebyaddr gethostbyname2])
1580
1793
 
1581
1794
AC_CHECK_FUNCS([ieee_handler fpsetmask finite isnan isinf res_gethostbyname dlopen \
1582
1795
                pread pwrite writev memmove strerror strerror_r strncasecmp \
1583
 
                gethrtime localtime_r gmtime_r mremap memcpy mallopt \
 
1796
                gethrtime localtime_r gmtime_r mmap mremap memcpy mallopt \
1584
1797
                sbrk _sbrk __sbrk brk _brk __brk \
1585
 
                flockfile fstat strlcpy strlcat setsid posix2time setlocale nl_langinfo])
 
1798
                flockfile fstat strlcpy strlcat setsid posix2time setlocale nl_langinfo poll])
 
1799
 
 
1800
AC_CHECK_DECLS([posix2time],,,[#include <time.h>])
 
1801
 
1586
1802
if test "X$host" = "Xwin32"; then
1587
1803
        ac_cv_func_setvbuf_reversed=yes
1588
1804
fi
1612
1828
fi
1613
1829
 
1614
1830
AC_FUNC_VPRINTF
1615
 
AC_FUNC_MMAP
1616
1831
 
1617
1832
dnl The AC_DEFINEs are necessary for autoheader to work. :-(
1618
1833
dnl for gzio
1644
1859
dnl Need by run_erl.
1645
1860
AC_CHECK_FUNCS([openpty])
1646
1861
 
 
1862
dnl fdatasync syscall (Unix only)
 
1863
AC_CHECK_FUNCS([fdatasync])
 
1864
 
 
1865
dnl Find which C libraries are required to use fdatasync
 
1866
AC_SEARCH_LIBS(fdatasync, [rt])
 
1867
 
 
1868
AC_CHECK_HEADERS(net/if_dl.h ifaddrs.h netpacket/packet.h)
 
1869
AC_CHECK_FUNCS([getifaddrs])
 
1870
 
1647
1871
dnl ----------------------------------------------------------------------
1648
1872
dnl Checks for features/quirks in the system that affects Erlang.
1649
1873
dnl ----------------------------------------------------------------------
1705
1929
        AC_DEFINE(HAVE_PROCESSOR_BIND, 1, [Define if you have processor_bind functionality])
1706
1930
fi
1707
1931
 
 
1932
AC_MSG_CHECKING([for cpuset_getaffinity/cpuset_setaffinity])
 
1933
AC_TRY_COMPILE([
 
1934
#include <sys/param.h>
 
1935
#include <sys/cpuset.h>
 
1936
],
 
1937
[
 
1938
        int res;
 
1939
        cpuset_t cpuset;
 
1940
        CPU_ZERO(&cpuset);
 
1941
        CPU_SET(1, &cpuset);
 
1942
        res = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(cpuset_t), &cpuset);
 
1943
        res = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(cpuset_t), &cpuset);
 
1944
        res = CPU_ISSET(1, &cpuset);
 
1945
        CPU_CLR(1, &cpuset);
 
1946
],
 
1947
                cpuset_xetaffinity=yes,
 
1948
                cpuset_xetaffinity=no)
 
1949
AC_MSG_RESULT([$cpuset_xetaffinity])
 
1950
if test $cpuset_xetaffinity = yes; then
 
1951
        AC_DEFINE(HAVE_CPUSET_xETAFFINITY, 1, [Define if you have cpuset_getaffinity/cpuset_setaffinity])
 
1952
fi
1708
1953
 
1709
1954
AC_CACHE_CHECK([for 'end' symbol],
1710
1955
                erts_cv_have_end_symbol,
1856
2101
        ],
1857
2102
        erts_cv___after_morecore_hook_can_track_malloc=yes,
1858
2103
        erts_cv___after_morecore_hook_can_track_malloc=no,
1859
 
        if test "x$erl_xcomp_after_morecore_hook" != "x"; then
1860
 
                erts_cv___after_morecore_hook_can_track_malloc=$erl_xcomp_after_morecore_hook
1861
 
        fi)])
 
2104
        [
 
2105
        case X$erl_xcomp_after_morecore_hook in
 
2106
            X) erts_cv___after_morecore_hook_can_track_malloc=cross;;
 
2107
            Xyes|Xno) erts_cv___after_morecore_hook_can_track_malloc=$erl_xcomp_after_morecore_hook;;
 
2108
            *) AC_MSG_ERROR([Bad erl_xcomp_after_morecore_hook value: $erl_xcomp_after_morecore_hook]);;
 
2109
        esac
 
2110
        ]
 
2111
        )])
1862
2112
 
1863
 
if test "x$erts_cv___after_morecore_hook_can_track_malloc" = "xyes"; then
1864
 
        AC_DEFINE(ERTS___AFTER_MORECORE_HOOK_CAN_TRACK_MALLOC, 1, \
1865
 
[Define if __after_morecore_hook can track malloc()s core memory use.])
1866
 
fi
 
2113
case $erts_cv___after_morecore_hook_can_track_malloc in
 
2114
        yes) AC_DEFINE(ERTS___AFTER_MORECORE_HOOK_CAN_TRACK_MALLOC, 1, \
 
2115
[Define if __after_morecore_hook can track malloc()s core memory use.]);;
 
2116
        cross) AC_MSG_WARN([result no guessed because of cross compilation]);;
 
2117
        *) ;;
 
2118
esac
1867
2119
 
1868
2120
if test "x$ac_cv_func_sbrk" = "xyes"; then
1869
2121
    AC_CACHE_CHECK([types of sbrk()s return value and argument],
2116
2368
        ],
2117
2369
            erts_cv_brk_wrappers_can_track_malloc=yes,
2118
2370
            erts_cv_brk_wrappers_can_track_malloc=no,
2119
 
            erts_cv_brk_wrappers_can_track_malloc=no)])
2120
 
        if test $erts_cv_brk_wrappers_can_track_malloc = yes; then
 
2371
            [
 
2372
            case X$erl_xcomp_dlsym_brk_wrappers in
 
2373
                X) erts_cv_brk_wrappers_can_track_malloc=cross;;
 
2374
                Xyes|Xno) erts_cv_brk_wrappers_can_track_malloc=$erl_xcomp_dlsym_brk_wrappers;;
 
2375
                *) AC_MSG_ERROR([Bad erl_xcomp_dlsym_brk_wrappers value: $erl_xcomp_dlsym_brk_wrappers]);;
 
2376
            esac
 
2377
            ])])
 
2378
        case $erts_cv_brk_wrappers_can_track_malloc in
 
2379
            yes)
2121
2380
                AC_DEFINE(ERTS_BRK_WRAPPERS_CAN_TRACK_MALLOC, 1, \
2122
 
[Define if sbrk()/brk() wrappers can track malloc()s core memory use])
2123
 
        fi
 
2381
[Define if sbrk()/brk() wrappers can track malloc()s core memory use]);;
 
2382
            cross)
 
2383
                AC_MSG_WARN([result no guessed because of cross compilation]);;
 
2384
            *) ;;
 
2385
        esac
2124
2386
fi
2125
2387
 
2126
2388
dnl Restore LIBS
2133
2395
ERL_TIME_CORRECTION
2134
2396
AC_CHECK_PROG(M4, m4, m4)
2135
2397
dnl check to auto-enable hipe here...
2136
 
if test X${enable_hipe} != Xno; then
 
2398
if test "$cross_compiling" != "yes" && test X${enable_hipe} != Xno; then
2137
2399
  if test -z "$M4"; then
2138
2400
        enable_hipe=no
2139
2401
        AC_MSG_NOTICE([HiPE disabled as no valid m4 is found in PATH])
2140
2402
  else
2141
2403
        case "$ARCH-$OPSYS" in
2142
 
            x86-linux|amd64-linux|ppc-linux|ppc-darwin|arm-linux|amd64-freebsd|x86-freebsd|x86-sol2|amd64-sol2|ultrasparc-linux)
 
2404
            x86-linux|amd64-linux|x86-darwin*|amd64-darwin*|ppc-linux|ppc-darwin|arm-linux|amd64-freebsd|x86-freebsd|x86-sol2|amd64-sol2|ultrasparc-linux)
2143
2405
                enable_hipe=yes
2144
2406
                ;;      
2145
2407
        esac
2146
2408
  fi
2147
2409
fi
 
2410
 
 
2411
case $ARCH-$OPSYS in
 
2412
        amd64-darwin*|x86-darwin*)
 
2413
                AC_MSG_CHECKING([For modern (leopard) style mcontext_t])
 
2414
                AC_TRY_COMPILE([
 
2415
                                #include <stdlib.h>
 
2416
                                #include <sys/types.h>
 
2417
                                #include <unistd.h>
 
2418
                                #include <mach/mach.h>
 
2419
                                #include <pthread.h>
 
2420
                                #include <machine/signal.h>
 
2421
                                #include <ucontext.h>
 
2422
                                ],[
 
2423
                                #if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__)
 
2424
                                #define __DARWIN__ 1
 
2425
                                #endif
 
2426
 
 
2427
                                #ifndef __DARWIN__
 
2428
                                #error inpossible
 
2429
                                #else
 
2430
 
 
2431
                                mcontext_t mc = NULL;
 
2432
                                int x = mc->__fs.__fpu_mxcsr;
 
2433
 
 
2434
                                #endif
 
2435
                                ],darwin_mcontext_leopard=yes,
 
2436
                                darwin_mcontext_leopard=no)
 
2437
                                if test X"$darwin_mcontext_leopard" = X"yes"; then
 
2438
                                   AC_DEFINE(DARWIN_MODERN_MCONTEXT,[],[Modern style mcontext_t in MacOSX])
 
2439
                                   AC_MSG_RESULT(yes)
 
2440
                                else
 
2441
                                   AC_MSG_RESULT(no)
 
2442
                                fi
 
2443
                ;;
 
2444
        *)
 
2445
                darwin_mcontext_leopard=no
 
2446
                ;;
 
2447
esac
2148
2448
if test X${enable_fp_exceptions} = Xauto ; then
2149
2449
   if test X${enable_hipe} = Xyes; then
2150
2450
      enable_fp_exceptions=yes
2474
2774
 * Implement SIGFPE handler based on CPU/OS combination
2475
2775
 */
2476
2776
 
2477
 
#if (defined(__linux__) && (defined(__i386__) || defined(__x86_64__) || defined(__sparc__) || defined(__powerpc__))) || (defined(__DARWIN__) && (defined(__i386__) || defined(__x86_64__) || defined(__ppc__))) || (defined(__FreeBSD__) && (defined(__i386__) || defined(__x86_64__))) || (defined(__OpenBSD__) && defined(__x86_64__)) || (defined(__sun__) && defined(__x86_64__))
 
2777
#if (defined(__linux__) && (defined(__i386__) || defined(__x86_64__) || defined(__sparc__) || defined(__powerpc__))) || (defined(__DARWIN__) && (defined(__i386__) || defined(__x86_64__) || defined(__ppc__))) || (defined(__FreeBSD__) && (defined(__i386__) || defined(__x86_64__))) || ((defined(__OpenBSD__) || defined(__NetBSD__)) && defined(__x86_64__)) || (defined(__sun__) && defined(__x86_64__))
2478
2778
 
2479
2779
#if defined(__linux__) && defined(__i386__)
2480
2780
#if !defined(X86_FXSR_MAGIC)
2534
2834
    regs[PT_FPSCR] = 0x80|0x40|0x10;    /* VE, OE, ZE; not UE or XE */
2535
2835
#endif
2536
2836
#elif defined(__DARWIN__)
 
2837
#if defined(DARWIN_MODERN_MCONTEXT)
2537
2838
#if defined(__x86_64__)
2538
2839
    mcontext_t mc = uc->uc_mcontext;
2539
2840
    struct __darwin_x86_float_state64 *fpstate = &mc->__fs;
2549
2850
    mc->ss.srr0 += 4;
2550
2851
    mc->fs.fpscr = 0x80|0x40|0x10;
2551
2852
#endif
 
2853
#else
 
2854
#if defined(__x86_64__)
 
2855
    mcontext_t mc = uc->uc_mcontext;
 
2856
    struct x86_float_state64_t *fpstate = &mc->fs;
 
2857
    fpstate->fpu_mxcsr = 0x1F80;
 
2858
    *(unsigned short *)&fpstate->fpu_fsw &= ~0xFF;
 
2859
#elif defined(__i386__)
 
2860
    mcontext_t mc = uc->uc_mcontext;
 
2861
    x86_float_state32_t *fpstate = &mc->fs;
 
2862
    fpstate->fpu_mxcsr = 0x1F80;
 
2863
    *(unsigned short *)&fpstate->fpu_fsw &= ~0xFF;
 
2864
#elif defined(__ppc__)
 
2865
    mcontext_t mc = uc->uc_mcontext;
 
2866
    mc->ss.srr0 += 4;
 
2867
    mc->fs.fpscr = 0x80|0x40|0x10;
 
2868
#endif
 
2869
#endif
2552
2870
#elif defined(__FreeBSD__) && defined(__x86_64__)
2553
2871
    mcontext_t *mc = &uc->uc_mcontext;
2554
2872
    struct savefpu *savefpu = (struct savefpu*)&mc->mc_fpstate;
2570
2888
    struct fxsave64 *fxsave = uc->sc_fpstate;
2571
2889
    fxsave->fx_mxcsr = 0x1F80;
2572
2890
    fxsave->fx_fsw &= ~0xFF;
 
2891
#elif defined(__NetBSD__) && defined(__x86_64__)
 
2892
    mcontext_t *mc = &uc->uc_mcontext;
 
2893
    struct fxsave64 *fxsave = (struct fxsave64 *)&mc->__fpregs;
 
2894
    fxsave->fx_mxcsr = 0x1F80;
 
2895
    fxsave->fx_fsw &= ~0xFF;
2573
2896
#elif defined(__sun__) && defined(__x86_64__)
2574
2897
    mcontext_t *mc = &uc->uc_mcontext;
2575
2898
    struct fpchip_state *fpstate = &mc->fpregs.fp_reg_set.fpchip_state;
2643
2966
    do_fmul();
2644
2967
    return do_check();
2645
2968
}
2646
 
], erl_ok=reliable, erl_ok=unreliable, erl_ok=unreliable)
2647
 
    if test $erl_ok = unreliable; then
2648
 
        AC_DEFINE(NO_FPE_SIGNALS,[],
2649
 
            [Define if floating points exceptions are non-existing/not reliable])
2650
 
        AC_MSG_RESULT([unreliable; testing in software instead])
2651
 
        FPE=unreliable
2652
 
    else
 
2969
],
 
2970
erl_ok=yes,
 
2971
erl_ok=no,
 
2972
[
 
2973
case X$erl_xcomp_reliable_fpe in
 
2974
    X) erl_ok=cross;;
 
2975
    Xyes|Xno) erl_ok=$erl_xcomp_reliable_fpe;;
 
2976
    *) AC_MSG_ERROR([Bad erl_xcomp_reliable_fpe value: $erl_xcomp_reliable_fpe]);;
 
2977
esac
 
2978
])
 
2979
 
 
2980
    if test $erl_ok = yes; then
 
2981
        FPE=reliable
2653
2982
        AC_MSG_RESULT(reliable)
2654
 
        FPE=reliable
 
2983
    else
 
2984
        FPE=unreliable
 
2985
        AC_MSG_RESULT([unreliable; testing in software instead])
 
2986
        AC_DEFINE(NO_FPE_SIGNALS,[],[Define if floating points exceptions are non-existing/not reliable])
 
2987
        if test $erl_ok = cross; then
 
2988
            AC_MSG_WARN([result unreliable guessed because of cross compilation])
 
2989
        fi
2655
2990
    fi
2656
2991
fi      
2657
2992
 
2658
 
case $ARCH-$OPSYS in
2659
 
        amd64-darwin*|x86-darwin*)
2660
 
                AC_MSG_CHECKING([For modern (leopard) style mcontext_t])
2661
 
                AC_TRY_COMPILE([
2662
 
                                #include <stdlib.h>
2663
 
                                #include <sys/types.h>
2664
 
                                #include <unistd.h>
2665
 
                                #include <mach/mach.h>
2666
 
                                #include <pthread.h>
2667
 
                                #include <machine/signal.h>
2668
 
                                #include <ucontext.h>
2669
 
                                ],[
2670
 
                                #if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__)
2671
 
                                #define __DARWIN__ 1
2672
 
                                #endif
2673
 
 
2674
 
                                #ifndef __DARWIN__
2675
 
                                #error inpossible
2676
 
                                #else
2677
 
 
2678
 
                                mcontext_t mc = NULL;
2679
 
                                int x = mc->__fs.__fpu_mxcsr;
2680
 
 
2681
 
                                #endif
2682
 
                                ],darwin_mcontext_leopard=yes,
2683
 
                                darwin_mcontext_leopard=no)
2684
 
                                if test X"$darwin_mcontext_leopard" = X"yes"; then
2685
 
                                   AC_DEFINE(DARWIN_MODERN_MCONTEXT,[],[Modern style mcontext_t in MacOSX])
2686
 
                                   AC_MSG_RESULT(yes)
2687
 
                                else
2688
 
                                   AC_MSG_RESULT(no)
2689
 
                                fi              
2690
 
                ;;
2691
 
        *)      
2692
 
                darwin_mcontext_leopard=no
2693
 
                ;;
2694
 
esac
2695
2993
        
2696
2994
         
2697
2995
                
2749
3047
    no-*)
2750
3048
        AC_MSG_RESULT([no; disabled by user])
2751
3049
        ERTS_BUILD_HYBRID_EMU=no;;
2752
 
    *-win32|*-vxworks|*-ose) # vxworks and ose have their own "configure scripts"...
 
3050
    *-win32|*-vxworks) # vxworks have their own "configure scripts"...
2753
3051
        AC_MSG_RESULT([no; default on this platform])
2754
3052
        ERTS_BUILD_HYBRID_EMU=no;;
2755
3053
    *)
2812
3110
fi
2813
3111
 
2814
3112
#
2815
 
# Check if we should use elib_malloc.
2816
 
#
2817
 
 
2818
 
if test X${enable_elib_malloc} = Xyes; then
2819
 
 AC_DEFINE(ENABLE_ELIB_MALLOC,[],[Define to enable use of elib_malloc (a malloc() replacement)])
2820
 
 AC_DEFINE(ELIB_HEAP_SBRK,[],[Elib sbrk])
2821
 
 AC_DEFINE(ELIB_ALLOC_IS_CLIB,[],[Use elib malloc as clib])
2822
 
 AC_DEFINE(ELIB_SORTED_BLOCKS,[],[Define to enable the use of sorted blocks when using elib_malloc])
2823
 
fi
2824
 
 
2825
 
#
2826
3113
# Check for working poll().
2827
3114
#
2828
3115
AC_MSG_CHECKING([for working poll()])
2829
 
if test "x$erl_xcomp_poll" != "x"; then
2830
 
        poll_works=$erl_xcomp_poll
 
3116
if test "x$ac_cv_header_poll_h" != "xyes" -o "x$ac_cv_func_poll" != "xyes"; then
 
3117
 
 
3118
poll_works=no
 
3119
 
2831
3120
else
 
3121
 
2832
3122
AC_TRY_RUN([
2833
3123
#include <poll.h>
2834
3124
main()
2848
3138
  exit(0);
2849
3139
#endif
2850
3140
}
2851
 
], poll_works=true, poll_works=false, poll_works=false)
 
3141
],
 
3142
poll_works=yes,
 
3143
poll_works=no,
 
3144
[
 
3145
case X$erl_xcomp_poll in
 
3146
    X) poll_works=cross;;
 
3147
    Xyes|Xno) poll_works=$erl_xcomp_poll;;
 
3148
    *) AC_MSG_ERROR([Bad erl_xcomp_poll value: $erl_xcomp_poll]);;
 
3149
esac
 
3150
])
 
3151
 
2852
3152
fi
2853
 
case $poll_works in
2854
 
true)
2855
 
        AC_DEFINE(ERTS_USE_POLL, 1, [Define if poll() should be used instead of select()])
2856
 
        AC_MSG_RESULT(ok)
2857
 
        ;;
2858
 
*)
 
3153
 
 
3154
case $poll_works-$host_os in
 
3155
    no-*|cross-darwin*)
2859
3156
        #
2860
3157
        # The USE_SELECT define is used by the ssl application (should not
2861
3158
        # be used by erts).
2862
3159
        #
2863
3160
        AC_DEFINE(USE_SELECT, 1, [Define if select() should be used instead of poll()])
2864
 
        AC_MSG_RESULT(broken or based on select())
2865
 
        ;;
 
3161
        if test $poll_works = cross; then
 
3162
            AC_MSG_RESULT(cross)
 
3163
            AC_MSG_WARN([result no guessed based on OS ($host_os) because of cross compilation])
 
3164
        else
 
3165
            AC_MSG_RESULT([no; non-existing, broken, or based on select()])
 
3166
        fi
 
3167
        poll_works=no;;
 
3168
    yes-*|cross-*)
 
3169
        AC_DEFINE(ERTS_USE_POLL, 1, [Define if poll() should be used instead of select()])
 
3170
        if test $poll_works = cross; then
 
3171
            AC_MSG_RESULT(cross)
 
3172
            AC_MSG_WARN([result yes guessed based on OS ($host_os) because of cross compilation])
 
3173
        else
 
3174
            AC_MSG_RESULT(yes)
 
3175
        fi
 
3176
        poll_works=yes;;
2866
3177
esac
2867
3178
 
2868
3179
#
2869
3180
# If kqueue() found, check that it can be selected or polled on...
2870
3181
#
2871
3182
if test $have_kernel_poll = kqueue; then
2872
 
        if test $poll_works = true; then
 
3183
        if test $poll_works = yes; then
2873
3184
                kqueue_with=poll
2874
3185
        else
2875
3186
                kqueue_with=select
2900
3211
    }
2901
3212
    return 0;
2902
3213
}
2903
 
        ], ok_kqueue=true, ok_kqueue=false, ok_kqueue=false)
2904
 
        if test $ok_kqueue = true; then
2905
 
                AC_MSG_RESULT(yes);
2906
 
        else
2907
 
                AC_MSG_RESULT(no);
 
3214
        ],
 
3215
        ok_kqueue=yes,
 
3216
        ok_kqueue=no,
 
3217
        [
 
3218
        case X$erl_xcomp_kqueue in
 
3219
            X) ok_kqueue=cross;;
 
3220
            Xyes|Xno) ok_kqueue=$erl_xcomp_kqueue;;
 
3221
            *) AC_MSG_ERROR([Bad erl_xcomp_kqueue value: $erl_xcomp_kqueue]);;
 
3222
        esac
 
3223
        ])
 
3224
        AC_MSG_RESULT($ok_kqueue);
 
3225
        case $ok_kqueue in
 
3226
            yes)
 
3227
                ;;
 
3228
            cross)
2908
3229
                have_kernel_poll=no
2909
 
        fi
 
3230
                AC_MSG_WARN([result no guessed because of cross compilation]);;
 
3231
            *)
 
3232
                have_kernel_poll=no;;
 
3233
        esac
2910
3234
fi
2911
3235
 
2912
3236
#
2990
3314
            return 5;
2991
3315
    return 0;
2992
3316
}
2993
 
], copying_putenv=yes, copying_putenv=no, copying_putenv=no)
2994
 
if test $copying_putenv = yes; then
2995
 
        AC_DEFINE(HAVE_COPYING_PUTENV,[1],[Define if you have a putenv() that stores a copy of the key-value pair])
2996
 
fi
 
3317
],
 
3318
copying_putenv=yes,
 
3319
copying_putenv=no,
 
3320
[
 
3321
case X$erl_xcomp_putenv_copy in
 
3322
    X) copying_putenv=cross;;
 
3323
    Xyes|Xno) copying_putenv=$erl_xcomp_putenv_copy;;
 
3324
    *) AC_MSG_ERROR([Bad erl_xcomp_putenv_copy value: $erl_xcomp_putenv_copy]);;
 
3325
esac
 
3326
])
 
3327
 
2997
3328
AC_MSG_RESULT($copying_putenv)
 
3329
case $copying_putenv in
 
3330
    yes)
 
3331
        AC_DEFINE(HAVE_COPYING_PUTENV,[1],\
 
3332
[Define if you have a putenv() that stores a copy of the key-value pair]);;
 
3333
    cross)
 
3334
        AC_MSG_WARN([result no guessed because of cross compilation]);;
 
3335
    *) ;;
 
3336
esac
2998
3337
 
2999
3338
dnl ----------------------------------------------------------------------
3000
3339
dnl Stuff that should be moved into their respective application
3022
3361
#
3023
3362
#--------------------------------------------------------------------
3024
3363
 
3025
 
DED_INCLUDE="-I${ERL_TOP}/erts/emulator/beam -I${ERL_TOP}/erts/include -I${ERL_TOP}/erts/include/$host"
 
3364
DED_SYS_INCLUDE="-I${ERL_TOP}/erts/emulator/beam -I${ERL_TOP}/erts/include -I${ERL_TOP}/erts/include/$host -I${ERL_TOP}/erts/include/internal -I${ERL_TOP}/erts/include/internal/$host -I${ERL_TOP}/erts/emulator/sys/$ERLANG_OSTYPE"
3026
3365
 
3027
 
DED_CFLAGS="$DED_INCLUDE $CFLAGS $CPPFLAGS $EMU_THR_DEFS"
 
3366
if test "X$ETHR_DEFS" = "X"; then
 
3367
    DED_THR_DEFS="-D_THREAD_SAFE -D_REENTRANT"
 
3368
else
 
3369
    DED_THR_DEFS="$ETHR_DEFS"
 
3370
fi
 
3371
DED_EMU_THR_DEFS=$EMU_THR_DEFS
 
3372
DED_CFLAGS="$CFLAGS $CPPFLAGS"
3028
3373
if test "x$GCC" = xyes; then
3029
3374
    DED_CFLAGS="$DED_CFLAGS -fPIC"
3030
3375
fi
3031
3376
 
3032
 
STATIC_CFLAGS=""
 
3377
DED_EXT=so
 
3378
case $host_os in
 
3379
    win32) DED_EXT=dll;;
 
3380
    darwin*)
 
3381
        DED_CFLAGS="$DED_CFLAGS -fno-common"
 
3382
        if test "X$STATIC_CFLAGS" = "X"; then
 
3383
            STATIC_CFLAGS="-mdynamic-no-pic"
 
3384
        fi;;
 
3385
    *)
 
3386
        ;;
 
3387
esac
3033
3388
 
3034
 
# If DED_LD is set in environment, we expect all DED variables to be specified
3035
 
# (cross compiling)
 
3389
# If DED_LD is set in environment, we expect all DED_LD* variables
 
3390
# to be specified (cross compiling)
3036
3391
if test "x$DED_LD" = "x"; then
3037
3392
 
3038
 
if test "x$LD" = "x"; then
3039
 
    DED_LD=ld
3040
 
else
3041
 
    DED_LD=$LD
3042
 
fi      
3043
3393
DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R"
3044
 
 
3045
3394
case $host_os in
3046
3395
        win32)
3047
 
                DED_LD=ld.sh    
 
3396
                DED_LD="ld.sh"
3048
3397
                DED_LDFLAGS="-dll"
3049
3398
                DED_LD_FLAG_RUNTIME_LIBRARY_PATH=
3050
3399
        ;;
3078
3427
                if test X${enable_darwin_universal} = Xyes; then
3079
3428
                        DED_LDFLAGS="-arch ppc -arch i386 $DED_LDFLAGS"
3080
3429
                fi      
3081
 
                DED_CFLAGS="$DED_CFLAGS -fno-common"
3082
3430
                DED_LD="$CC"
3083
 
                DED_LD_FLAG_RUNTIME_LIBRARY_PATH=
3084
 
                STATIC_CFLAGS="-mdynamic-no-pic"
 
3431
                DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH"
3085
3432
        ;;
3086
3433
        linux*)
3087
3434
                DED_LD="$CC"
 
3435
                DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH"
3088
3436
                DED_LDFLAGS="-shared -Wl,-Bsymbolic"
3089
 
                DED_LD_FLAG_RUNTIME_LIBRARY_PATH=
3090
3437
                if test X${enable_m64_build} = Xyes; then
3091
3438
                        DED_LDFLAGS="-m64 $DED_LDFLAGS"
 
3439
                fi;
 
3440
                if test X${enable_m32_build} = Xyes; then
 
3441
                        DED_LDFLAGS="-m32 $DED_LDFLAGS"
3092
3442
                fi
3093
3443
        ;;      
3094
3444
        freebsd*)
3095
3445
                DED_LD="$CC"
 
3446
                DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH"
3096
3447
                DED_LDFLAGS="-shared"
3097
3448
                if test X${enable_m64_build} = Xyes; then
3098
3449
                        DED_LDFLAGS="-m64 $DED_LDFLAGS"
 
3450
                fi;
 
3451
                if test X${enable_m32_build} = Xyes; then
 
3452
                        DED_LDFLAGS="-m32 $DED_LDFLAGS"
3099
3453
                fi
3100
3454
        ;;      
3101
3455
        osf*)
3110
3464
        ;;
3111
3465
esac
3112
3466
 
 
3467
if test "$DED_LD" = "" && test "$USER_LD" != ""; then
 
3468
    DED_LD="$USER_LD"
 
3469
    DED_LDFLAGS="$USER_LDFLAGS $DED_LDFLAGS"
3113
3470
fi
3114
3471
 
 
3472
fi # "x$DED_LD" = "x"
 
3473
 
 
3474
AC_CHECK_TOOL(DED_LD, ld, false)
 
3475
test "$DED_LD" != "false" || AC_MSG_ERROR([No linker found])
 
3476
 
3115
3477
AC_MSG_CHECKING(for compiler flags for loadable drivers)
3116
3478
AC_MSG_RESULT([$DED_CFLAGS])
3117
3479
AC_MSG_CHECKING(for linker for loadable drivers)
3125
3487
        AC_MSG_RESULT([not found])
3126
3488
fi
3127
3489
 
 
3490
AC_SUBST(DED_EXT)
 
3491
AC_SUBST(DED_SYS_INCLUDE)
3128
3492
AC_SUBST(DED_CFLAGS)
3129
3493
AC_SUBST(DED_LD)
3130
3494
AC_SUBST(DED_LDFLAGS)
3131
3495
AC_SUBST(DED_LD_FLAG_RUNTIME_LIBRARY_PATH)
 
3496
AC_SUBST(DED_THR_DEFS)
 
3497
AC_SUBST(DED_EMU_THR_DEFS)
3132
3498
AC_SUBST(STATIC_CFLAGS)
3133
3499
 
3134
3500
dnl
3151
3517
AC_SUBST(SSL_INCLUDE)
3152
3518
AC_SUBST(SSL_ROOT)
3153
3519
AC_SUBST(SSL_LIBDIR)
 
3520
AC_SUBST(SSL_CC_RUNTIME_LIBRARY_PATH)
 
3521
AC_SUBST(SSL_LD_RUNTIME_LIBRARY_PATH)
 
3522
AC_SUBST(SSL_DED_LD_RUNTIME_LIBRARY_PATH)
3154
3523
AC_SUBST(SSL_DYNAMIC_ONLY)
3155
3524
AC_SUBST(SSL_LINK_WITH_KERBEROS)
3156
3525
AC_SUBST(STATIC_KERBEROS_LIBS)
3157
3526
AC_SUBST(SSL_LINK_WITH_ZLIB)
3158
3527
AC_SUBST(STATIC_ZLIB_LIBS)
3159
 
AC_SUBST(OPENSSL_CMD)
 
3528
 
 
3529
std_ssl_locations="/usr/local /usr/sfw /opt/local /usr /usr/pkg /usr/local/openssl /usr/lib/openssl /usr/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl"
3160
3530
 
3161
3531
AC_ARG_WITH(ssl-zlib,
3162
 
[  --with-ssl-zlib=PATH    specify location of ZLib to be used by OpenSSL
3163
 
  --with-ssl-zlib         link SSL with  Zlib (default if found)
3164
 
  --without-ssl-zlib      don't link SSL with ZLib])
 
3532
AS_HELP_STRING([--with-ssl-zlib=PATH],
 
3533
               [specify location of ZLib to be used by OpenSSL])
 
3534
AS_HELP_STRING([--with-ssl-zlib],
 
3535
               [link SSL with  Zlib (default if found)])
 
3536
AS_HELP_STRING([--without-ssl-zlib],
 
3537
               [don't link SSL with ZLib]))
3165
3538
 
3166
3539
 
3167
3540
if  test "x$with_ssl_zlib" = "xno"; then
3168
3541
        SSL_LINK_WITH_ZLIB=no
3169
3542
        STATIC_ZLIB_LIBS=
3170
 
elif test "x$with_ssl_zlib" = "xyes" -o "x$with_ssl_zlib" = "x" ;then
3171
 
        if  test "x$MIXED_CYGWIN" = "xyes"; then
 
3543
elif test "x$with_ssl_zlib" = "xyes" || test "x$with_ssl_zlib" = "x"; then
 
3544
        if test $erl_xcomp_without_sysroot = yes; then
 
3545
                AC_MSG_WARN([Cannot search for zlib; missing cross system root (erl_xcomp_sysroot).])
 
3546
                SSL_LINK_WITH_ZLIB=no   
 
3547
                STATIC_ZLIB_LIBS=       
 
3548
        elif  test "x$MIXED_CYGWIN" = "xyes"; then
3172
3549
                SSL_LINK_WITH_ZLIB=no   
3173
3550
                STATIC_ZLIB_LIBS=       
3174
3551
        else
3175
3552
                SSL_LINK_WITH_ZLIB=no
3176
3553
                STATIC_ZLIB_LIBS=
3177
3554
                AC_MSG_CHECKING(for static ZLib to be used by SSL in standard locations) 
3178
 
                for dir in /usr/local /usr/sfw /usr /usr/pkg \
3179
 
                /usr/local/openssl /usr/lib/openssl /usr/openssl \
3180
 
                /usr/local/ssl /usr/lib/ssl /usr/ssl
3181
 
                do
 
3555
                for rdir in $std_ssl_locations; do
 
3556
                        dir="$erl_xcomp_sysroot$rdir"
3182
3557
                        if test "x$ac_cv_sizeof_void_p" = "x8"; then
3183
3558
                                if test -f "$dir/lib64/libz.a"; then
3184
3559
                                        SSL_LINK_WITH_ZLIB=yes
3228
3603
                
3229
3604
                        
3230
3605
AC_ARG_WITH(ssl,
3231
 
[  --with-ssl=PATH         specify location of OpenSSL include and lib
3232
 
  --with-ssl              use SSL (default)
3233
 
  --without-ssl           don't use SSL])
 
3606
AS_HELP_STRING([--with-ssl=PATH], [specify location of OpenSSL include and lib])
 
3607
AS_HELP_STRING([--with-ssl], [use SSL (default)])
 
3608
AS_HELP_STRING([--without-ssl], [don't use SSL]))
3234
3609
 
3235
3610
AC_ARG_ENABLE(dynamic-ssl-lib,
3236
 
[  --enable-dynamic-ssl-lib        enable using dynamic openssl libraries
3237
 
  --disable-dynamic-ssl-lib       disable using dynamic openssl libraries],
 
3611
AS_HELP_STRING([--disable-dynamic-ssl-lib],
 
3612
               [disable using dynamic openssl libraries]),
3238
3613
[ case "$enableval" in
3239
3614
    no) enable_dynamic_ssl=no ;;
3240
3615
    *)  enable_dynamic_ssl=yes ;;
3259
3634
 
3260
3635
SSL_DYNAMIC_ONLY=$enable_dynamic_ssl
3261
3636
 
3262
 
if test "x$with_ssl" = "xno"; then
 
3637
case "$erl_xcomp_without_sysroot-$with_ssl" in
 
3638
  yes-* | no-no)
3263
3639
    SSL_APP=
3264
3640
    CRYPTO_APP=
3265
3641
    SSH_APP=
 
3642
    if test "$with_ssl" = "no"; then
 
3643
        skip="User gave --without-ssl option"
 
3644
    else
 
3645
        skip="Cannot search for ssl; missing cross system root (erl_xcomp_sysroot)."
 
3646
    fi
3266
3647
    for a in ssl crypto ssh; do
3267
 
        echo "User gave --without-ssl option" > $ERL_TOP/lib/$a/SKIP
 
3648
        echo "$skip" > $ERL_TOP/lib/$a/SKIP
3268
3649
    done
3269
 
elif test "x$with_ssl" = "xyes" -o "x$with_ssl" = "x" ;then
 
3650
    ;;
 
3651
  no-yes | no- )
3270
3652
    # On windows, we could try to find the installation
3271
3653
    # of Shining Light OpenSSL, which can be found by poking in
3272
3654
    # the uninstall section in the registry, it's worth a try...
3293
3675
    SSH_APP=ssh
3294
3676
 
3295
3677
    AC_MSG_CHECKING(for OpenSSL >= 0.9.7 in standard locations) 
3296
 
    for dir in $extra_dir /cygdrive/c/OpenSSL \
3297
 
                /usr/local /usr/sfw /opt/local /usr /usr/pkg \
3298
 
                /usr/local/openssl /usr/lib/openssl /usr/openssl \
3299
 
                /usr/local/ssl /usr/lib/ssl /usr/ssl
3300
 
        do
3301
 
       if test -f $dir/include/openssl/opensslv.h; then
 
3678
    for rdir in $extra_dir /cygdrive/c/OpenSSL $std_ssl_locations; do
 
3679
        dir="$erl_xcomp_sysroot$rdir"
 
3680
        if test -f "$erl_xcomp_isysroot$rdir/include/openssl/opensslv.h"; then
3302
3681
                is_real_ssl=yes
3303
3682
                SSL_ROOT="$dir"
3304
3683
                if test "x$MIXED_CYGWIN" = "xyes" ; then
3305
 
                        if test -f "$dir/lib/VC/ssleay32.lib" -o \
3306
 
                                -f "$dir/lib/VC/openssl.lib"; then 
 
3684
                        if test -f "$dir/lib/VC/ssleay32.lib" || \
 
3685
                           test -f "$dir/lib/VC/openssl.lib"; then 
 
3686
                                SSL_RUNTIME_LIBDIR="$rdir/lib/VC"
3307
3687
                                SSL_LIBDIR="$dir/lib/VC"
3308
 
                        elif test -f "$dir/lib/ssleay32.lib" -o \
3309
 
                                -f "$dir/lib/openssl.lib"; then
 
3688
                        elif test -f "$dir/lib/ssleay32.lib" || \
 
3689
                             test -f "$dir/lib/openssl.lib"; then
 
3690
                                SSL_RUNTIME_LIBDIR="$rdir/lib"
3310
3691
                                SSL_LIBDIR="$dir/lib"
3311
3692
                        else
3312
3693
                                is_real_ssl=no
3314
3695
                else
3315
3696
                        if test "x$ac_cv_sizeof_void_p" = "x8"; then
3316
3697
                                if test -f "$dir/lib64/libcrypto.a"; then
 
3698
                                        SSL_RUNTIME_LIBDIR="$rdir/lib64"
3317
3699
                                        SSL_LIBDIR="$dir/lib64"
3318
3700
                                elif test -f "$dir/lib/64/libcrypto.a"; then
 
3701
                                        SSL_RUNTIME_LIBDIR="$rdir/lib/64"
3319
3702
                                        SSL_LIBDIR="$dir/lib/64"
3320
3703
                                elif test -f "$dir/lib64/libcrypto.so"; then
 
3704
                                        SSL_RUNTIME_LIBDIR="$rdir/lib64"
3321
3705
                                        SSL_LIBDIR="$dir/lib64"
3322
3706
                                elif test -f "$dir/lib/64/libcrypto.so"; then
 
3707
                                        SSL_RUNTIME_LIBDIR="$rdir/lib/64"
3323
3708
                                        SSL_LIBDIR="$dir/lib/64"
3324
3709
                                else
 
3710
                                        SSL_RUNTIME_LIBDIR="$rdir/lib"
3325
3711
                                        SSL_LIBDIR="$dir/lib"
3326
3712
                                fi
3327
3713
                        else     
 
3714
                                SSL_RUNTIME_LIBDIR="$rdir/lib"
3328
3715
                                SSL_LIBDIR="$dir/lib"
3329
3716
                        fi
3330
3717
                fi
3331
3718
                if test '!' -f $SSL_LIBDIR/libcrypto.a; then
3332
3719
                        SSL_DYNAMIC_ONLY=yes
3333
3720
                fi
3334
 
                SSL_BINDIR="$dir/bin"
3335
 
dnl             Should one use EXEEXT or ac_exeext?
3336
 
                if test -f "$SSL_BINDIR/openssl$EXEEXT"; then
3337
 
                        if "$SSL_BINDIR/openssl" version > /dev/null 2>&1; then
3338
 
                                OPENSSL_CMD="$SSL_BINDIR/openssl"
3339
 
                        else
3340
 
                                is_real_ssl=no
3341
 
                        fi
3342
 
                else
3343
 
                        is_real_ssl=no
3344
 
                fi
 
3721
                SSL_BINDIR="$rdir/bin"
3345
3722
                if test "x$is_real_ssl" = "xyes" ; then
3346
3723
                        SSL_INCLUDE="-I$dir/include"
3347
3724
                        old_CPPFLAGS=$CPPFLAGS
3382
3759
                                        LIBS="$saveLIBS"
3383
3760
                                fi
3384
3761
                        fi
3385
 
                        if test "x$ssl_found" = "xyes" -a "x$ssl_linkable" = "xyes"  ; then
 
3762
                        if test "x$ssl_found" = "xyes" && test "x$ssl_linkable" = "xyes"; then
3386
3763
                                AC_MSG_RESULT([$dir])
3387
3764
                                break;
3388
3765
                        fi
3396
3773
        dnl
3397
3774
        case $host_os in
3398
3775
        openbsd*)
3399
 
               if test -f /usr/include/openssl/opensslv.h; then
 
3776
               if test -f "$erl_xcomp_isysroot/usr/include/openssl/opensslv.h"; then
3400
3777
                  # Trust OpenBSD to have everything the in the correct locations.
3401
3778
                  ssl_found=yes
3402
3779
                  ssl_linkable=yes
3403
 
                  SSL_ROOT="/usr/sbin"
 
3780
                  SSL_ROOT="$erl_xcomp_sysroot/usr"
3404
3781
                  AC_MSG_RESULT([$SSL_ROOT])
3405
 
                  SSL_LIB="/usr/lib"
 
3782
                  SSL_RUNTIME_LIB="/usr/lib"
 
3783
                  SSL_LIB="$erl_xcomp_sysroot/usr/lib"
3406
3784
                  SSL_BINDIR="/usr/sbin"
3407
 
                  OPENSSL_CMD="$SSL_BINDIR/openssl"
3408
3785
                  dnl OpenBSD requires us to link with -L and -l
3409
3786
                  SSL_DYNAMIC_ONLY="yes" 
3410
3787
                fi
3415
3792
dnl             that cannot build shared libraries (i.e. not PIC)
3416
3793
dnl             One could argue that this is wrong, but
3417
3794
dnl             so it is - be adoptable
3418
 
    if test "x$ssl_found" = "xyes" -a  "x$ssl_linkable" = "xyes" -a "x$SSL_DYNAMIC_ONLY" != "xyes" ; then
 
3795
    if test "$ssl_found" = "yes" && test "$ssl_linkable" = "yes" && test "$SSL_DYNAMIC_ONLY" != "yes"; then
3419
3796
        case $host_os in
3420
3797
                linux*)
3421
3798
                        saveCFLAGS="$CFLAGS"
3447
3824
                                
3448
3825
 
3449
3826
 
3450
 
    if test "x$ssl_found" != "xyes" -o  "x$ssl_linkable" != "xyes"; then
 
3827
    if test "x$ssl_found" != "xyes" || test  "x$ssl_linkable" != "xyes"; then
3451
3828
       if test "x$ssl_found" = "xyes"; then 
3452
3829
                AC_MSG_RESULT([found; but not usable])
3453
3830
       else
3462
3839
           echo "No usable OpenSSL found" > $ERL_TOP/lib/$a/SKIP
3463
3840
       done
3464
3841
    fi
3465
 
else
 
3842
    ;;
 
3843
  *)
3466
3844
    # Option given with PATH to package
3467
3845
    if test ! -d "$with_ssl" ; then
3468
3846
       AC_MSG_ERROR(Invalid path to option --with-ssl=PATH)
3469
3847
    fi
3470
3848
    SSL_ROOT="$with_ssl"
3471
 
    if test "x$MIXED_CYGWIN" = "xyes" -a -d "$with_ssl/lib/VC"; then
 
3849
    if test "x$MIXED_CYGWIN" = "xyes" && test -d "$with_ssl/lib/VC"; then
3472
3850
        SSL_LIBDIR="$with_ssl/lib/VC"
3473
3851
    elif test "x$ac_cv_sizeof_void_p" = "x8"; then
3474
3852
        if test -f "$with_ssl/lib64/libcrypto.a"; then
3489
3867
        SSL_DYNAMIC_ONLY=yes
3490
3868
    fi
3491
3869
    SSL_INCLUDE="-I$with_ssl/include"
3492
 
    OPENSSL_CMD="$with_ssl/bin/openssl"
3493
3870
    SSL_APP=ssl
3494
3871
    CRYPTO_APP=crypto
3495
3872
    SSH_APP=ssh
3496
 
fi
 
3873
    if test "$cross_compiling" = "yes"; then
 
3874
        SSL_RUNTIME_LIBDIR=`echo "$SSL_LIBDIR" | sed -n "s|^$erl_xcomp_sysroot\(.*\)\$|\1|p"`
 
3875
    else
 
3876
        SSL_RUNTIME_LIBDIR="$SSL_LIBDIR"
 
3877
    fi
 
3878
esac
3497
3879
 
3498
3880
if test "x$SSL_APP" != "x" ; then
3499
3881
    dnl We found openssl, now check if we use kerberos 5 support
3509
3891
      AC_MSG_RESULT([yes])
3510
3892
      ssl_krb5_enabled=yes
3511
3893
      if test "x$SSL_DYNAMIC_ONLY" != "xyes"; then
3512
 
          if test -f $SSL_LIBDIR/libkrb5.a; then
 
3894
          if test -f "$SSL_LIBDIR/libkrb5.a"; then
3513
3895
              SSL_LINK_WITH_KERBEROS=yes
3514
3896
              STATIC_KERBEROS_LIBS="$SSL_LIBDIR/libkrb5.a"
3515
 
              if test -f $SSL_LIBDIR/libkrb5support.a; then
 
3897
              if test -f "$SSL_LIBDIR/libkrb5support.a"; then
3516
3898
                  STATIC_KERBEROS_LIBS="$STATIC_KERBEROS_LIBS $SSL_LIBDIR/libkrb5support.a"
3517
3899
              fi
3518
 
              if test -f $SSL_LIBDIR/libk5crypto.a; then
 
3900
              if test -f "$SSL_LIBDIR/libk5crypto.a"; then
3519
3901
                  STATIC_KERBEROS_LIBS="$STATIC_KERBEROS_LIBS $SSL_LIBDIR/libk5crypto.a"
3520
3902
              fi
3521
 
              if test -f $SSL_LIBDIR/libresolv.a; then
 
3903
              if test -f "$SSL_LIBDIR/libresolv.a"; then
3522
3904
                  STATIC_KERBEROS_LIBS="$STATIC_KERBEROS_LIBS $SSL_LIBDIR/libresolv.a"
3523
3905
              fi
3524
 
              if test -f $SSL_LIBDIR/libcom_err.a; then
 
3906
              if test -f "$SSL_LIBDIR/libcom_err.a"; then
3525
3907
                  STATIC_KERBEROS_LIBS="$STATIC_KERBEROS_LIBS $SSL_LIBDIR/libcom_err.a"
3526
3908
              fi
3527
3909
          else
3547
3929
    SSL_KRB5_INCLUDE=
3548
3930
    if test "x$ssl_krb5_enabled" = "xyes" ; then
3549
3931
        AC_MSG_CHECKING(for krb5.h in standard locations)
3550
 
        for dir in $extra_dir $SSL_ROOT/include $SSL_ROOT/include/openssl \
3551
 
                $SSL_ROOT/include/kerberos /cygdrive/c/kerberos/include \
3552
 
                /usr/local/kerberos/include /usr/kerberos/include \
3553
 
                /usr/include
 
3932
        for dir in $extra_dir "$SSL_ROOT/include" "$SSL_ROOT/include/openssl" \
 
3933
                "$SSL_ROOT/include/kerberos" \
 
3934
                "$erl_xcomp_isysroot/cygdrive/c/kerberos/include" \
 
3935
                "$erl_xcomp_isysroot/usr/local/kerberos/include" \
 
3936
                "$erl_xcomp_isysroot/usr/kerberos/include" \
 
3937
                "$erl_xcomp_isysroot/usr/include"
3554
3938
        do
3555
3939
            if test -f "$dir/krb5.h" ; then
3556
3940
                SSL_KRB5_INCLUDE="$dir"
3575
3959
 
3576
3960
done # while test ssl_done != yes
3577
3961
 
 
3962
SSL_CC_RUNTIME_LIBRARY_PATH=
 
3963
SSL_LD_RUNTIME_LIBRARY_PATH=
 
3964
SSL_DED_LD_RUNTIME_LIBRARY_PATH=
 
3965
cc_rflg="$CFLAG_RUNTIME_LIBRARY_PATH"
 
3966
ld_rflg="$LDFLAG_RUNTIME_LIBRARY_PATH"
 
3967
ded_ld_rflg="$DED_LD_FLAG_RUNTIME_LIBRARY_PATH"
 
3968
 
 
3969
if test "$SSL_APP" != "" && test "$SSL_DYNAMIC_ONLY" = "yes" && \
 
3970
   { test "$cc_rflg" != "" || test "$ld_rflg" != "" || test "$ded_ld_rflg" != ""; } ; then
 
3971
 
 
3972
    AC_MSG_CHECKING(for ssl runtime library path to use)
 
3973
 
 
3974
    libdirs="/lib"
 
3975
 
 
3976
    if test "$ac_cv_sizeof_void_p" = "8"; then
 
3977
        dir_lib64=no
 
3978
        dir_lib_64=no
 
3979
 
 
3980
        case "$SSL_RUNTIME_LIBDIR" in
 
3981
            */lib/64 | */lib/64/ ) dir_lib_64=yes;;
 
3982
            */lib64 | */lib64/ ) dir_lib64=yes;;
 
3983
            *) ;;
 
3984
        esac
 
3985
 
 
3986
        for dir in $std_ssl_locations; do
 
3987
            test $dir_lib_64 = no &&
 
3988
                test -d "$erl_xcomp_sysroot$dir/lib/64" &&
 
3989
                    dir_lib_64=yes
 
3990
            test $dir_lib64 = no &&
 
3991
                test -d "$erl_xcomp_sysroot$dir/lib64" &&
 
3992
                    dir_lib64=yes
 
3993
        done
 
3994
 
 
3995
        test $dir_lib_64 = yes && libdirs="/lib/64 $libdirs"
 
3996
        test $dir_lib64 = yes && libdirs="/lib64 $libdirs"
 
3997
    fi
 
3998
 
 
3999
    for type in std x_std curr; do
 
4000
 
 
4001
        cc_rpath="$cc_rflg$SSL_RUNTIME_LIBDIR"
 
4002
        ld_rpath="$ld_rflg$SSL_RUNTIME_LIBDIR"
 
4003
        ded_ld_rpath="$ded_ld_rflg$SSL_RUNTIME_LIBDIR"
 
4004
        rpath="$SSL_RUNTIME_LIBDIR"
 
4005
 
 
4006
        if test $type != curr; then
 
4007
            for ldir in $libdirs; do
 
4008
                for dir in $std_ssl_locations; do
 
4009
                    test "$SSL_LIBDIR" != "$dir$ldir" || continue
 
4010
                    test $type != x_std || test -d "$dir$ldir" || continue
 
4011
                    test "$cc_rflg" = "" ||
 
4012
                        cc_rpath="$cc_rpath $cc_rflg$dir$ldir"
 
4013
                    test "$ld_rflg" = "" ||
 
4014
                        ld_rpath="$ld_rpath $ld_rflg$dir$ldir"
 
4015
                    test "$ded_ld_rflg" = "" ||
 
4016
                        ded_ld_rpath="$ded_ld_rpath $ded_ld_rflg$dir$ldir"
 
4017
                    rpath="$rpath:$dir$ldir"
 
4018
                done
 
4019
            done
 
4020
        fi
 
4021
 
 
4022
        saveCFLAGS="$CFLAGS"
 
4023
        saveLDFLAGS="$LDFLAGS"
 
4024
        saveLIBS="$LIBS"
 
4025
        CFLAGS="$CFLAGS $SSL_INCLUDE"
 
4026
        LDFLAGS="$LDFLAGS $ld_rpath -L$SSL_LIBDIR"
 
4027
        LIBS="-lcrypto"
 
4028
        AC_TRY_LINK([
 
4029
                         #include <stdio.h>
 
4030
                         #include <openssl/hmac.h>
 
4031
                    ],
 
4032
                    [ 
 
4033
                         HMAC_CTX hc;
 
4034
                         HMAC_CTX_init(&hc);            
 
4035
                    ],
 
4036
                    [rpath_success=yes],
 
4037
                    [rpath_success=no])
 
4038
        CFLAGS="$saveCFLAGS"
 
4039
        LDFLAGS="$saveLDFLAGS"
 
4040
        LIBS="$saveLIBS"
 
4041
 
 
4042
        test "$rpath_success" = "yes" && break
 
4043
    done
 
4044
 
 
4045
    test "$rpath_success" = "yes" || { cc_rpath=; ld_rpath=; ded_ld_rpath=; rpath=; }
 
4046
 
 
4047
    SSL_CC_RUNTIME_LIBRARY_PATH="$cc_rpath"
 
4048
    SSL_LD_RUNTIME_LIBRARY_PATH="$ld_rpath"
 
4049
    SSL_DED_LD_RUNTIME_LIBRARY_PATH="$ded_ld_rpath"
 
4050
 
 
4051
    AC_MSG_RESULT([$rpath])
 
4052
    test "$rpath" != "" || AC_MSG_WARN([Cannot set run path during linking])
 
4053
fi
 
4054
 
3578
4055
#--------------------------------------------------------------------
3579
4056
# Os mon stuff.
3580
4057
#--------------------------------------------------------------------
3593
4070
                os_mon_programs="$os_mon_programs cpu_sup" ;;
3594
4071
esac
3595
4072
 
 
4073
                        
 
4074
AC_ARG_WITH(javac,
 
4075
AS_HELP_STRING([--with-javac=JAVAC], [specify Java compiler to use])
 
4076
AS_HELP_STRING([--with-javac], [use a Java compiler if found (default)])
 
4077
AS_HELP_STRING([--without-javac], [don't use any Java compiler]))
3596
4078
 
3597
4079
dnl
3598
4080
dnl Then there are a number of apps which needs a java compiler...
3604
4086
  /bin/rm -f $ERL_TOP/lib/$a/SKIP
3605
4087
done
3606
4088
 
3607
 
AC_CHECK_PROGS(JAVAC, javac.sh javac guavac gcj jikes bock)
 
4089
if test "X$with_javac" = "Xno"; then
 
4090
  for a in $need_java ; do
 
4091
        echo "Java compiler disabled by user" > $ERL_TOP/lib/$a/SKIP
 
4092
  done
 
4093
 
 
4094
else # begin - try to find javac
 
4095
 
 
4096
if test "X$with_javac" != "Xyes" -a "X$with_javac" != "X"; then
 
4097
    check_javac=$with_javac
 
4098
else
 
4099
  check_javac="javac.sh javac guavac gcj jikes bock"
 
4100
fi
 
4101
 
 
4102
AC_CHECK_PROGS(JAVAC, $check_javac)
3608
4103
if test -n "$JAVAC"; then
3609
4104
  dnl Make sure it's at least JDK 1.5
3610
4105
  AC_CACHE_CHECK(for JDK version 1.5, 
3616
4111
  fi
3617
4112
fi
3618
4113
if test -z "$JAVAC"; then
 
4114
 
 
4115
  if test "X$with_javac" != "X"; then
 
4116
        AC_MSG_ERROR([No java compiler found in PATH (checked for $check_javac)])
 
4117
  fi
 
4118
 
3619
4119
  AC_MSG_WARN([Could not find any usable java compiler, will skip: jinterface])
3620
4120
 
3621
4121
  for a in $need_java ; do
3623
4123
  done
3624
4124
fi
3625
4125
 
 
4126
fi # end - try to find javac
 
4127
 
3626
4128
dnl
3627
4129
dnl Orber has a c++ example, this isn't the right way to check for
3628
4130
dnl it, but....
3629
4131
dnl
3630
 
CXXFLAGS=
3631
4132
AC_SUBST(CXXFLAGS)
3632
4133
dnl this deliberately does not believe that 'gcc' is a C++ compiler
3633
 
AC_CHECK_PROGS(CXX, $CCC c++ g++ CC cxx cc++ cl, false)
 
4134
AC_CHECK_TOOLS(CXX, [$CCC c++ g++ CC cxx cc++ cl], false)
3634
4135
 
3635
4136
# Remove SKIP file from previous run
3636
4137
/bin/rm -f $ERL_TOP/lib/orber/SKIP
3762
4263
  ../lib/ic/c_src/$host/Makefile:../lib/ic/c_src/Makefile.in
3763
4264
  ../lib/os_mon/c_src/$host/Makefile:../lib/os_mon/c_src/Makefile.in
3764
4265
  ../lib/ssl/c_src/$host/Makefile:../lib/ssl/c_src/Makefile.in
3765
 
  ../lib/ssl/examples/certs/$host/Makefile:../lib/ssl/examples/certs/Makefile.in
3766
4266
  ../lib/crypto/c_src/$host/Makefile:../lib/crypto/c_src/Makefile.in
3767
4267
  ../lib/orber/c_src/$host/Makefile:../lib/orber/c_src/Makefile.in
3768
4268
  ../lib/runtime_tools/c_src/$host/Makefile:../lib/runtime_tools/c_src/Makefile.in
3769
4269
  ../lib/tools/c_src/$host/Makefile:../lib/tools/c_src/Makefile.in
3770
 
  ../lib/asn1/c_src/$host/Makefile:../lib/asn1/c_src/Makefile.in
3771
4270
  )
3772
4271