5
5
# Strange, VxWorks HAVE_SENS not set here, see "ei_resolve.h"
7
# For unknown reasons the detection of gethosbyname in this file
8
# conflicts with "$ERL_TOP/erts/configure.in" if they share the
9
# cache so we turn that stupid thing of!
10
define([AC_CACHE_LOAD], )dnl
11
define([AC_CACHE_SAVE], )dnl
13
7
# Find the erl_interface version number and set m4 macro to it.
14
8
# We do this because AC_INIT can't handle shell variables. Still broken.
15
9
dnl m4_define(EI_VERSION,`grep EI_VSN ../vsn.mk | sed 's/^.*=[ ]*//'`)
16
10
dnl m4_define(EI_VERSION,regexp(m4_include(VERSION),[version \([-.0-9A-Za-z]+\)],[\1]))
18
AC_INIT([src/misc/eidef.h])
14
if test "x$no_recursion" != "xyes"; then
15
# We do not want to use a common cache!
20
19
dnl How to set srcdir absolute is taken from the GNU Emacs distribution
21
20
#### Make srcdir absolute, if it isn't already. It's important to
170
204
# FIXME return ERROR if no lib
175
# Figure out if we should use threads. The default is set above in the
176
# enable_threads variable. It can have the following values:
178
# nothreads don't look for threads
179
# threads-ok look for threads but it is ok if you can't find them
180
# threads-error look for threads and if you can't find them it is an error
209
AC_MSG_CHECKING(for mixed cygwin and native VC++ environment)
210
if test "X$CC" = "Xcc.sh" -a "X$host" = "Xwin32" -a "x$GCC" != x"yes"; then
211
if test -x /usr/bin/cygpath; then
217
AC_MSG_RESULT([undeterminable])
218
AC_MSG_ERROR(Seems to be mixed windows but not with cygwin, cannot handle this!)
224
AC_SUBST(MIXED_CYGWIN_VC)
226
AC_MSG_CHECKING(for mixed cygwin and native MinGW environment)
227
if test "X$CC" = "Xcc.sh" -a "X$host" = "Xwin32" -a "x$GCC" = x"yes"; then
228
if test -x /usr/bin/cygpath; then
232
MIXED_CYGWIN_MINGW=yes
234
AC_MSG_RESULT([undeterminable])
235
AC_MSG_ERROR(Seems to be mixed windows but not with cygwin, cannot handle this!)
239
MIXED_CYGWIN_MINGW=no
241
AC_SUBST(MIXED_CYGWIN_MINGW)
243
AC_MSG_CHECKING(if we mix cygwin with any native compiler)
244
if test "X$MIXED_CYGWIN" = "Xyes" ; then
250
AC_SUBST(MIXED_CYGWIN)
184
259
AC_SUBST(THR_LIBS)
185
260
AC_SUBST(THR_DEFS)
186
# As a matter of fact, the windows erlang emulator can never run without
187
# threads. It has to be enable or the emulator will crash. Until that is fixed
188
# we force threads on win32.
189
AC_MSG_CHECKING([if native win32 threads should be used])
190
if test "X$host_os" = "Xwin32"; then
192
THR_DEFS="-DUSE_THREADS"
193
# If someoune wants to check this later, it might as well be consistent
194
# with variable values on other platforms with threads enabled...
195
enable_threads="threads-error"
197
ENABLE_ALLOC_TYPE_VARS="$ENABLE_ALLOC_TYPE_VARS threads"
198
AC_MSG_RESULT([yes, required and therefore forced])
201
case "$enable_threads" in
204
THR_DEFS="-DUSE_THREADS -D_REENTRANT"
207
# Check for POSIX threads
209
if test "$found_threads" = "0"; then
210
AC_CHECK_LIB(pthread, pthread_create, [found_threads=1
212
THR_DEFS="$THR_DEFS -DPOSIX_THREADS -D_THREAD_SAFE"
213
pthread_lib=pthread],
217
# FreeBSD has pthreads in special c library, c_r
218
if test "$found_threads" = "0"; then
219
AC_CHECK_LIB(c_r, pthread_create, [found_threads=1
221
THR_DEFS="$THR_DEFS -DPOSIX_THREADS -D_THREAD_SAFE"
226
case "$found_threads"-"$enable_threads" in
228
# We couldn't find any threads, but that is ok
233
# If user specifically asked for threads give an error msg.
234
AC_MSG_ERROR([don't know how to enable threads])
263
case "$threads_disabled" in
265
AC_MSG_CHECKING([for native win32 threads])
266
if test "X$host_os" = "Xwin32"; then
267
THR_DEFS="-DWIN32_THREADS"
271
AC_MSG_CHECKING([for __declspec(thread) usability])
272
if test "X$GCC" = "Xyes"; then
275
THR_DEFS="$THR_DEFS -DUSE_DECLSPEC_THREAD"
281
dnl Check for POSIX threads
284
AC_CHECK_LIB(pthread,
289
THR_DEFS="-D_REENTRANT -D_THREAD_SAFE -DPOSIX_THREADS"
290
pthread_lib=pthread])
292
# FreeBSD has pthreads in special c library, c_r
293
if test $found_threads = no; then
299
THR_DEFS="-D_REENTRANT -D_THREAD_SAFE -DPOSIX_THREADS"
238
303
if test "x$pthread_lib" != "x"; then
239
AC_CHECK_LIB($pthread_lib, pthread_atfork,
240
AC_DEFINE(HAVE_PTHREAD_ATFORK))
304
AC_CHECK_LIB($pthread_lib,pthread_atfork,AC_DEFINE(HAVE_PTHREAD_ATFORK))
305
AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
306
dnl Some Linuxes have <pthread/mit/pthread.h> instead of <pthread.h>
307
AC_CHECK_HEADER(pthread/mit/pthread.h, AC_DEFINE(HAVE_MIT_PTHREAD_H))
310
THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS";;
312
dnl NPTL test stolen from $ERL_TOP/erts/aclocal.m4
313
AC_MSG_CHECKING(for Native POSIX Thread Library)
314
case `getconf GNU_LIBPTHREAD_VERSION 2>/dev/null` in
320
if test $nptl = yes; then
322
AC_CHECK_HEADER(nptl/pthread.h, need_nptl_incldir=yes)
323
if test $need_nptl_incldir = yes; then
325
nptl_path="$C_INCLUDE_PATH:$CPATH:/usr/local/include:/usr/include"
327
save_ifs="$IFS"; IFS=":"
328
for dir in $nptl_path; do
329
if test "x$dir" != "x"; then
330
nptl_ws_path="$nptl_ws_path $dir"
335
for dir in $nptl_ws_path; do
336
AC_CHECK_HEADER($dir/nptl/pthread.h,
337
nptl_incldir=$dir/nptl)
338
if test "x$nptl_incldir" != "x"; then
339
THR_DEFS="$THR_DEFS -isystem $nptl_incldir"
343
if test "x$nptl_incldir" = "x"; then
344
AC_MSG_ERROR(Failed to locate nptl system include directory)
244
if test "x$pthread_lib" != "x"; then
245
THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS"
247
AC_DEFINE(ENABLE_CHILD_WAITER_THREAD) ;;
249
AC_DEFINE(INIT_MUTEX_IN_CHILD_AT_FORK) ;;
251
ENABLE_ALLOC_TYPE_VARS="$ENABLE_ALLOC_TYPE_VARS threads"
256
357
# Threads disabled
261
361
# ---------------------------------------------------------------------------
262
362
# Warning flags to the C compiler