~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to lib/erl_interface/configure.in

  • Committer: Bazaar Package Importer
  • Author(s): Erlang Packagers, Sergei Golovan
  • Date: 2006-12-03 17:07:44 UTC
  • mfrom: (2.1.11 feisty)
  • Revision ID: james.westby@ubuntu.com-20061203170744-rghjwupacqlzs6kv
Tags: 1:11.b.2-4
[ Sergei Golovan ]
Fixed erlang-base and erlang-base-hipe prerm scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
# Strange, VxWorks HAVE_SENS not set here, see "ei_resolve.h"
6
6
 
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
12
 
 
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]))
17
11
 
18
 
AC_INIT([src/misc/eidef.h])
 
12
AC_INIT()
 
13
 
 
14
if test "x$no_recursion" != "xyes"; then
 
15
    # We do not want to use a common cache!
 
16
    cache_file=/dev/null
 
17
fi
19
18
 
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
55
54
dnl Optional features
56
55
dnl ----------------------------------------------------------------------
57
56
 
 
57
# Use --disable-threads to force building single threaded libs even 
 
58
# if pthreads exists (for test purposes).
58
59
AC_ARG_ENABLE(threads,
59
 
[  --enable-threads        use threads],
 
60
[  --disable-threads       use to only build single threaded libs],
60
61
[ case "$enableval" in
61
 
    no) enable_threads=nothreads ;;
62
 
    *)  enable_threads=threads-error ;;
63
 
  esac ], enable_threads=nothreads)
 
62
    no) threads_disabled=yes ;;
 
63
    *)  threads_disabled=no ;;
 
64
  esac ],
 
65
[ threads_disabled=no ])
64
66
 
65
67
dnl ----------------------------------------------------------------------
66
68
dnl Checks for programs
86
88
  AC_MSG_ERROR([No 'ar' command found in PATH])
87
89
fi
88
90
 
 
91
dnl
 
92
dnl We can live with Solaris /usr/ucb/install
 
93
dnl
 
94
case $host in
 
95
  *-*-solaris*|free_source)
 
96
    if test -x /usr/ucb/install; then
 
97
      INSTALL="/usr/ucb/install -c"
 
98
    fi
 
99
    ;;
 
100
  *)
 
101
    ;;
 
102
esac
 
103
 
89
104
AC_PROG_INSTALL
90
105
INSTALL_DIR="\${INSTALL} -d"
91
106
AC_SUBST(INSTALL_DIR)
92
107
 
 
108
case $host_os in
 
109
        darwin*)
 
110
                dnl Need to preserve modification time on archives;
 
111
                dnl otherwise, ranlib has to be run on archives
 
112
                dnl again after installation.
 
113
                INSTALL_DATA="$INSTALL_DATA -p";;
 
114
        *)
 
115
                ;;
 
116
esac
 
117
 
93
118
# Checks for libraries.
94
119
AC_CHECK_LIB([nsl], [gethostbyname])
95
120
AC_CHECK_LIB([socket], [getpeername])
97
122
# Checks for header files.
98
123
AC_HEADER_STDC
99
124
AC_HEADER_SYS_WAIT
100
 
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/param.h sys/socket.h sys/select.h sys/time.h unistd.h pthread.h])
101
 
dnl Some Linuxes have <pthread/mit/pthread.h> instead of <pthread.h>
102
 
AC_CHECK_HEADER(pthread/mit/pthread.h, AC_DEFINE(HAVE_MIT_PTHREAD_H))
 
125
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/param.h sys/socket.h sys/select.h sys/time.h unistd.h sys/types.h])
103
126
 
104
127
# Checks for typedefs, structures, and compiler characteristics.
105
128
# fixme AC_C_CONST & AC_C_VOLATILE needed for Windows?
109
132
AC_TYPE_PID_T
110
133
AC_TYPE_SIZE_T
111
134
AC_HEADER_TIME
 
135
AC_MSG_CHECKING([for socklen_t usability])
 
136
AC_TRY_COMPILE([#include <sys/types.h>
 
137
#include <sys/socket.h>], 
 
138
[socklen_t mylen;],
 
139
[AC_MSG_RESULT(yes) 
 
140
 AC_DEFINE(HAVE_SOCKLEN_T)],
 
141
[AC_MSG_RESULT(no)])
112
142
 
113
143
# Checks for library functions.
114
144
AC_FUNC_ALLOCA
123
153
dnl AC_TYPE_SIGNAL
124
154
dnl AC_FUNC_STRERROR_R
125
155
dnl AC_FUNC_VPRINTF
126
 
AC_CHECK_FUNCS([clock_gettime dup2 gethostbyaddr gethostbyname \
 
156
AC_CHECK_FUNCS([dup2 gethostbyaddr gethostbyname \
 
157
        gethostbyaddr_r \
127
158
        gethostbyname_r gethostname writev \
128
159
        gethrtime gettimeofday inet_ntoa memchr memmove memset select \
129
160
        socket strchr strerror strrchr strstr uname])
130
161
AC_CHECK_FUNC(res_gethostbyname, [],
131
162
    AC_CHECK_LIB(resolv, res_gethostbyname)
132
163
)
 
164
AC_CHECK_FUNC(clock_gettime, [],
 
165
    AC_CHECK_LIB(rt, clock_gettime)
 
166
)
133
167
 
134
168
# ---------------------------------------------------------------------------
135
169
# We don't link against libgmp except for "make check"
170
204
    # FIXME return ERROR if no lib
171
205
fi
172
206
 
173
 
 
174
 
#
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:
177
 
#
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
181
 
#
 
207
MIXED_CYGWIN=no
 
208
 
 
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
 
212
                CFLAGS="-O2"
 
213
                MIXED_CYGWIN=yes
 
214
                AC_MSG_RESULT([yes])
 
215
                MIXED_CYGWIN_VC=yes
 
216
        else
 
217
                AC_MSG_RESULT([undeterminable])
 
218
                AC_MSG_ERROR(Seems to be mixed windows but not with cygwin, cannot handle this!)
 
219
        fi
 
220
else
 
221
        AC_MSG_RESULT([no])
 
222
        MIXED_CYGWIN_VC=no
 
223
fi
 
224
AC_SUBST(MIXED_CYGWIN_VC)
 
225
 
 
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
 
229
                CFLAGS="-O2"
 
230
                MIXED_CYGWIN=yes
 
231
                AC_MSG_RESULT([yes])
 
232
                MIXED_CYGWIN_MINGW=yes
 
233
        else
 
234
                AC_MSG_RESULT([undeterminable])
 
235
                AC_MSG_ERROR(Seems to be mixed windows but not with cygwin, cannot handle this!)
 
236
        fi
 
237
else
 
238
        AC_MSG_RESULT([no])
 
239
        MIXED_CYGWIN_MINGW=no
 
240
fi
 
241
AC_SUBST(MIXED_CYGWIN_MINGW)
 
242
 
 
243
AC_MSG_CHECKING(if we mix cygwin with any native compiler)
 
244
if test "X$MIXED_CYGWIN" = "Xyes" ; then
 
245
        AC_MSG_RESULT([yes])    
 
246
else
 
247
        AC_MSG_RESULT([no])
 
248
fi
 
249
 
 
250
AC_SUBST(MIXED_CYGWIN)
 
251
        
 
252
dnl
 
253
dnl Threads
 
254
dnl
 
255
found_threads=no
182
256
THR_LIBS=
183
257
THR_DEFS=
 
258
EI_THREADS="false"
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
191
 
    THR_LIBS=
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"
196
 
    found_threads=1
197
 
    ENABLE_ALLOC_TYPE_VARS="$ENABLE_ALLOC_TYPE_VARS threads"
198
 
    AC_MSG_RESULT([yes, required and therefore forced])
199
 
else
200
 
    AC_MSG_RESULT(no)
201
 
    case "$enable_threads" in
202
 
        threads-*)
203
 
            THR_LIBS=
204
 
            THR_DEFS="-DUSE_THREADS -D_REENTRANT"
205
 
            found_threads=0
206
 
 
207
 
            # Check for POSIX threads
208
 
            pthread_lib=""
209
 
            if test "$found_threads" = "0"; then
210
 
                AC_CHECK_LIB(pthread, pthread_create, [found_threads=1
211
 
                    THR_LIBS="-lpthread"
212
 
                    THR_DEFS="$THR_DEFS -DPOSIX_THREADS -D_THREAD_SAFE"
213
 
                    pthread_lib=pthread],
214
 
                    found_threads=0)
215
 
            fi
216
 
 
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
220
 
                    THR_LIBS="-lc_r"
221
 
                    THR_DEFS="$THR_DEFS -DPOSIX_THREADS -D_THREAD_SAFE"
222
 
                    pthread_lib=c_r],
223
 
                    found_threads=0)
224
 
            fi
225
 
 
226
 
            case "$found_threads"-"$enable_threads" in
227
 
                0-threads-ok)
228
 
                    # We couldn't find any threads, but that is ok
229
 
                    THR_LIBS=
230
 
                    THR_DEFS=
231
 
                    ;;
232
 
                0-threads-error)
233
 
                    # If user specifically asked for threads give an error msg.
234
 
                    AC_MSG_ERROR([don't know how to enable threads])
235
 
                    ;;
236
 
                *)
237
 
                    # Threads found
 
261
AC_SUBST(EI_THREADS)
 
262
 
 
263
case "$threads_disabled" in
 
264
        no)
 
265
                AC_MSG_CHECKING([for native win32 threads])
 
266
                if test "X$host_os" = "Xwin32"; then
 
267
                    THR_DEFS="-DWIN32_THREADS"
 
268
                    found_threads=yes
 
269
                    EI_THREADS="true"   
 
270
                    AC_MSG_RESULT([yes])
 
271
                    AC_MSG_CHECKING([for __declspec(thread) usability])
 
272
                    if test "X$GCC" = "Xyes"; then
 
273
                        AC_MSG_RESULT([no])
 
274
                    else
 
275
                        THR_DEFS="$THR_DEFS -DUSE_DECLSPEC_THREAD"
 
276
                        AC_MSG_RESULT([yes])
 
277
                    fi  
 
278
                else
 
279
                    AC_MSG_RESULT(no)
 
280
 
 
281
                    dnl Check for POSIX threads
 
282
 
 
283
                    pthread_lib=""
 
284
                    AC_CHECK_LIB(pthread,
 
285
                                 pthread_create,
 
286
                                 [found_threads=yes
 
287
                                  EI_THREADS="true"
 
288
                                  THR_LIBS="-lpthread"
 
289
                                  THR_DEFS="-D_REENTRANT -D_THREAD_SAFE -DPOSIX_THREADS"
 
290
                                  pthread_lib=pthread])
 
291
 
 
292
                    # FreeBSD has pthreads in special c library, c_r
 
293
                    if test $found_threads = no; then
 
294
                        AC_CHECK_LIB(c_r,
 
295
                                     pthread_create,
 
296
                                     [found_threads=yes
 
297
                                      EI_THREADS="true"
 
298
                                      THR_LIBS="-lc_r"
 
299
                                      THR_DEFS="-D_REENTRANT -D_THREAD_SAFE -DPOSIX_THREADS"
 
300
                                      pthread_lib=c_r])
 
301
                    fi
 
302
 
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))
 
308
                        case $host_os in
 
309
                            solaris*)
 
310
                                THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS";;
 
311
                            linux*)
 
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
 
315
                                    nptl*) nptl=yes;;
 
316
                                    NPTL*) nptl=yes;;
 
317
                                    *)  nptl=no;;
 
318
                                esac
 
319
                                AC_MSG_RESULT($nptl)
 
320
                                if test $nptl = yes; then
 
321
                                    need_nptl_incldir=no
 
322
                                    AC_CHECK_HEADER(nptl/pthread.h, need_nptl_incldir=yes)
 
323
                                    if test $need_nptl_incldir = yes; then
 
324
                                        # Ahh...
 
325
                                        nptl_path="$C_INCLUDE_PATH:$CPATH:/usr/local/include:/usr/include"
 
326
                                        nptl_ws_path=
 
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"
 
331
                                            fi
 
332
                                        done
 
333
                                        IFS=$save_ifs
 
334
                                        nptl_incldir=
 
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"
 
340
                                                break
 
341
                                            fi
 
342
                                        done
 
343
                                        if test "x$nptl_incldir" = "x"; then
 
344
                                            AC_MSG_ERROR(Failed to locate nptl system include directory)
 
345
                                        fi
 
346
                                    fi
 
347
                                fi
 
348
 
 
349
                                ;;
 
350
                            *)
 
351
                                ;;
 
352
                        esac
241
353
                    fi
242
 
                    case $host_os in
243
 
                        solaris*)
244
 
                            if test "x$pthread_lib" != "x"; then
245
 
                                THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS"
246
 
                            fi
247
 
                            AC_DEFINE(ENABLE_CHILD_WAITER_THREAD) ;;
248
 
                        linux*)
249
 
                            AC_DEFINE(INIT_MUTEX_IN_CHILD_AT_FORK) ;;
250
 
                    esac
251
 
                    ENABLE_ALLOC_TYPE_VARS="$ENABLE_ALLOC_TYPE_VARS threads"
252
 
                    ;;
253
 
            esac
254
 
            ;;
255
 
        *)
 
354
                fi
 
355
                ;;
 
356
        yes)
256
357
            # Threads disabled
257
358
            ;;
258
 
    esac
259
 
fi
 
359
esac
260
360
 
261
361
# ---------------------------------------------------------------------------
262
362
# Warning flags to the C compiler
310
410
# XXX
311
411
# ---------------------------------------------------------------------------
312
412
 
313
 
AC_OUTPUT([src/$host/Makefile:src/Makefile.in])
 
413
AC_OUTPUT(
 
414
        src/$host/Makefile:src/Makefile.in
 
415
        src/$host/eidefs.mk:src/eidefs.mk.in
 
416
        )