File: acinclude.m4

package info (click to toggle)
lwp 2.3%2Bdebian-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,808 kB
  • ctags: 613
  • sloc: sh: 9,024; ansic: 2,923; asm: 684; makefile: 122
file content (131 lines) | stat: -rw-r--r-- 3,432 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131

dnl ---------------------------------------------
dnl translate easy to remember target names into recognizable gnu variants and
dnl test the cross compilation platform and adjust default settings

AC_DEFUN([CODA_SETUP_BUILD],

[AC_SUBST(LIBTOOL_LDFLAGS)

case ${host_alias} in
  djgpp | dos ) host_alias=i386-pc-msdos ; dosmmap=false ;;
  win95 | win98 ) host_alias=i386-pc-msdos ; dosmmap=true ;;
  cygwin* | winnt | nt ) host_alias=i386-pc-cygwin ;;
  arm ) host_alias=arm-unknown-linux-gnuelf ;;
esac

AC_CANONICAL_HOST

dnl Shared libraries work for i386, mips, sparc, and alpha platforms. They
dnl might work for all platforms. If not, read the PORTING document.

dnl When cross-compiling, pick the right compiler toolchain.
dnl Can be overridden by providing the CROSS_COMPILE environment variable.
if test ${cross_compiling} = yes ; then
  dnl We have to override some things the configure script tends to
  dnl get wrong as it tests the build platform feature
  ac_cv_func_mmap_fixed_mapped=yes

  case ${host} in
   i*86-pc-msdos )
    dnl no shared libs for dos
    enable_shared=no

    if ${dosmmap} ; then 
      CC="dos-gcc -bmmap"	
      CXX="dos-gcc -bmmap"
    else
      CC="dos-gcc -bw95"	
      CXX="dos-gcc -bw95"
    fi

    AR="dos-ar"
    RANLIB="true"
    AS="dos-as"
    NM="dos-nm"

    dnl avoid using mmap for allocating lwp stacks
    ac_cv_func_mmap_fixed_mapped=no
    ;;
   i*86-pc-cygwin )
    dnl -D__CYGWIN32__ should be defined but sometimes isn't (wasn't?)
    CC="gnuwin32gcc -D__CYGWIN32__"
    CXX="gnuwin32g++"
    AR="gnuwin32ar"
    RANLIB="gnuwin32ranlib"
    AS="gnuwin32as"
    NM="gnuwin32nm"
    DLLTOOL="gnuwin32dlltool"
    OBJDUMP="gnuwin32objdump"

    LDFLAGS="-L/usr/gnuwin32/lib"

    dnl We need these to get a dll built
    libtool_flags="--enable-win32-dll"
    LIBTOOL_LDFLAGS="-no-undefined"
    ;;
   arm-unknown-linux-gnuelf )
    CROSS_COMPILE="arm-unknown-linuxelf-"
    ;;
 esac
fi
if test "${CROSS_COMPILE}" ; then
  CC=${CROSS_COMPILE}gcc
  CXX=${CROSS_COMPILE}g++
  CPP="${CC} -E"
  AS=${CROSS_COMPILE}as
  LD=${CROSS_COMPILE}ld
  AR=${CROSS_COMPILE}ar
  RANLIB=${CROSS_COMPILE}ranlib
  NM=${CROSS_COMPILE}nm
  OBJDUMP=${CROSS_COMPILE}objdump
  DLLTOOL=${CROSS_COMPILE}dlltool
  ac_cv_func_mmap_fixed_mapped=yes
fi
])

dnl ---------------------------------------------
dnl Define library version

AC_SUBST(LIBTOOL_VERSION)
AC_SUBST(MAJOR_VERSION)
AC_SUBST(LINUX_VERSION)
AC_SUBST(DLL_VERSION)
AC_SUBST(FREEBSD_VERSION)
AC_SUBST(GENERIC_VERSION)
AC_DEFUN([CODA_LIBRARY_VERSION],
  [LIBTOOL_VERSION="$2:$1:$3"; major=`expr $2 - $3`
   MAJOR_VERSION="$major"
   LINUX_VERSION="$major.$3.$1"
   DLL_VERSION="$major-$3-$1"
   FREEBSD_VERSION="$2"
   GENERIC_VERSION="$2.$1"])

AC_DEFUN([CODA_CHECK_MAKECONTEXT],
   [AC_MSG_CHECKING(if makecontext correctly passes stack pointers)
    makecontext=no
    AC_TRY_RUN([
#if STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UCONTEXT_H
#include <ucontext.h>
#endif
void *ptr;
void test(void *arg) { exit(ptr != arg); }
int main(int argc, char **argv) {
#ifdef HAVE_UCONTEXT_H
ucontext_t x;
int arg = 0;
ptr = &arg;
getcontext(&x);
x.uc_stack.ss_sp = malloc(16384);
x.uc_stack.ss_size = 16384;
makecontext(&x, (void (*)(void))test, 1, &arg);
setcontext(&x);
#endif
exit(2);
}], [AC_DEFINE(CODA_USE_UCONTEXT, 1,
	      [makecontext correctly passes stack pointers])
     makecontext=yes])
  AC_MSG_RESULT($makecontext)])