4
# Copyright Ericsson AB 2000-2009. All Rights Reserved.
4
# Copyright Ericsson AB 2000-2010. All Rights Reserved.
6
6
# The contents of this file are subject to the Erlang Public License,
7
7
# Version 1.1, (the "License"); you may not use this file except in
8
8
# compliance with the License. You should have received a copy of the
9
9
# Erlang Public License along with this software. If not, it can be
10
10
# retrieved online at http://www.erlang.org/.
12
12
# Software distributed under the License is distributed on an "AS IS"
13
13
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
# the License for the specific language governing rights and limitations
15
15
# under the License.
19
19
# Process this file with autoconf to produce a configure script.
68
AC_CONFIG_HEADER([src/$host/config.h:src/auxdir/config.h.in])
68
AC_CONFIG_HEADER([src/$host/config.h:config.h.in])
70
70
dnl ----------------------------------------------------------------------
71
71
dnl Optional features
72
72
dnl ----------------------------------------------------------------------
74
AC_ARG_WITH(xcomp-conf,
75
[ --with-xcompconf=PATH path to cross compilation configuration])
76
if test "x$with_xcompconf" != "xno" -a "x$with_xcompconf" != "x" ; then
80
74
# Use --disable-threads to force building single threaded libs even
81
75
# if pthreads exists (for test purposes).
82
76
AC_ARG_ENABLE(threads,
96
90
dnl AC_PROG_LIBTOOL
98
if test "x$LD" = "x"; then
99
AC_CHECK_TOOL([LD],[ld],[ld])
92
AC_CHECK_PROG(LD, ld.sh)
93
AC_CHECK_TOOL(LD, ld, '$(CC)')
103
AC_CHECK_SIZEOF(short, $erl_xcomp_short)
104
AC_CHECK_SIZEOF(int, $erl_xcomp_int)
105
AC_CHECK_SIZEOF(long, $erl_xcomp_long)
106
AC_CHECK_SIZEOF(void *, $erl_xcomp_void_p)
107
AC_CHECK_SIZEOF(long long, $erl_xcomp_long_long)
96
AC_CHECK_SIZEOF(short)
99
AC_CHECK_SIZEOF(void *)
100
AC_CHECK_SIZEOF(long long)
109
102
if test $ac_cv_sizeof_void_p = 8; then
110
103
CFLAGS="$CFLAGS -DEI_64BIT"
113
AC_CHECK_PROG(AR, ar, ar, false)
114
if test "$ac_cv_prog_AR" = false; then
106
AC_CHECK_TOOL(AR, ar, false)
107
if test "$AR" = false; then
115
108
AC_MSG_ERROR([No 'ar' command found in PATH])
164
157
#include <sys/socket.h>],
165
158
[socklen_t mylen;],
166
159
[AC_MSG_RESULT(yes)
167
AC_DEFINE(HAVE_SOCKLEN_T)],
160
AC_DEFINE(HAVE_SOCKLEN_T, [], [Define if you have the `socklen_t' type])],
168
161
[AC_MSG_RESULT(no)])
170
163
# Checks for library functions.
209
202
AC_CHECK_HEADER($dir/include/gmp.h, ac_cv_gmp=yes, ac_cv_gmp=no)
210
203
if test $ac_cv_gmp = yes ; then
211
204
CFLAGS="$CFLAGS -I$dir/include -L$dir/lib"
212
AC_DEFINE(HAVE_GMP_H)
205
AC_DEFINE(HAVE_GMP_H, [], [Define if you have "gmp.h"])
227
220
AC_MSG_RESULT(yes)
228
221
CFLAGS="$CFLAGS -I$with_gmp/include -L$with_gmp/lib"
229
AC_DEFINE(HAVE_GMP_H)
222
AC_DEFINE(HAVE_GMP_H, [], [Define if you have "gmp.h"])
230
223
AC_CHECK_LIB(gmp, __gmpz_export)
231
224
# FIXME return ERROR if no lib
286
277
AC_SUBST(THR_LIBS)
287
278
AC_SUBST(THR_DEFS)
288
279
AC_SUBST(EI_THREADS)
290
281
case "$threads_disabled" in
292
AC_MSG_CHECKING([for native win32 threads])
293
if test "X$host_os" = "Xwin32"; then
294
THR_DEFS="-DWIN32_THREADS"
298
AC_MSG_CHECKING([for __declspec(thread) usability])
299
if test "X$GCC" = "Xyes"; then
302
THR_DEFS="$THR_DEFS -DUSE_DECLSPEC_THREAD"
308
dnl Check for POSIX threads
311
AC_CHECK_LIB(pthread,
316
THR_DEFS="-D_REENTRANT -D_THREAD_SAFE -DPOSIX_THREADS"
317
pthread_lib=pthread])
319
# FreeBSD has pthreads in special c library, c_r
320
if test $found_threads = no; then
326
THR_DEFS="-D_REENTRANT -D_THREAD_SAFE -DPOSIX_THREADS"
330
if test "x$pthread_lib" != "x"; then
331
AC_CHECK_LIB($pthread_lib,pthread_atfork,AC_DEFINE(HAVE_PTHREAD_ATFORK))
332
AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
333
dnl Some Linuxes have <pthread/mit/pthread.h> instead of <pthread.h>
334
AC_CHECK_HEADER(pthread/mit/pthread.h, AC_DEFINE(HAVE_MIT_PTHREAD_H))
337
THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS";;
339
dnl NPTL test stolen from $ERL_TOP/erts/aclocal.m4
340
AC_MSG_CHECKING(for Native POSIX Thread Library)
341
case `getconf GNU_LIBPTHREAD_VERSION 2>/dev/null` in
347
if test $nptl = yes; then
349
AC_CHECK_HEADER(nptl/pthread.h, need_nptl_incldir=yes)
350
if test $need_nptl_incldir = yes; then
352
nptl_path="$C_INCLUDE_PATH:$CPATH:/usr/local/include:/usr/include"
354
save_ifs="$IFS"; IFS=":"
355
for dir in $nptl_path; do
356
if test "x$dir" != "x"; then
357
nptl_ws_path="$nptl_ws_path $dir"
362
for dir in $nptl_ws_path; do
363
AC_CHECK_HEADER($dir/nptl/pthread.h,
364
nptl_incldir=$dir/nptl)
365
if test "x$nptl_incldir" != "x"; then
366
THR_DEFS="$THR_DEFS -isystem $nptl_incldir"
370
if test "x$nptl_incldir" = "x"; then
371
AC_MSG_ERROR(Failed to locate nptl system include directory)
285
case "$THR_LIB_NAME" in
291
THR_DEFS="$THR_DEFS -D_WIN32_WINNT=0x0500 -DWINVER=0x0500"
298
AC_MSG_WARN([Unexpected thread library: $THR_LIB_NAME])
388
308
# ---------------------------------------------------------------------------