/[jscoverage]/trunk/js/aclocal.m4
ViewVC logotype

Annotation of /trunk/js/aclocal.m4

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations)
Wed Aug 1 13:51:53 2007 UTC (12 years, 3 months ago) by siliconforks
File size: 7755 byte(s)
Initial import.

1 siliconforks 2 dnl ##
2     dnl ## SA - OSSP Socket Abstraction Library
3     dnl ## Copyright (c) 2001-2003 Ralf S. Engelschall <rse@engelschall.com>
4     dnl ## Copyright (c) 2001-2003 The OSSP Project <http://www.ossp.org/>
5     dnl ## Copyright (c) 2001-2003 Cable & Wireless Deutschland <http://www.cw.com/de/>
6     dnl ##
7     dnl ## This file is part of OSSP SA, a socket abstraction library which
8     dnl ## can be found at http://www.ossp.org/pkg/sa/.
9     dnl ##
10     dnl ## Permission to use, copy, modify, and distribute this software for
11     dnl ## any purpose with or without fee is hereby granted, provided that
12     dnl ## the above copyright notice and this permission notice appear in all
13     dnl ## copies.
14     dnl ##
15     dnl ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
16     dnl ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17     dnl ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18     dnl ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
19     dnl ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20     dnl ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21     dnl ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22     dnl ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23     dnl ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24     dnl ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25     dnl ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26     dnl ## SUCH DAMAGE.
27     dnl ##
28     dnl ## aclocal.m4: GNU Autoconf local macro definitions
29     dnl ##
30    
31     dnl ##
32     dnl ## Check whether compiler option works
33     dnl ##
34     dnl ## configure.in:
35     dnl ## AC_COMPILER_OPTION(<name>, <display>, <option>,
36     dnl ## <action-success>, <action-failure>)
37     dnl ##
38    
39     AC_DEFUN(AC_COMPILER_OPTION,[dnl
40     AC_MSG_CHECKING(whether compiler option(s) $2 work)
41     AC_CACHE_VAL(ac_cv_compiler_option_$1,[
42     SAVE_CFLAGS="$CFLAGS"
43     CFLAGS="$CFLAGS $3"
44     AC_TRY_COMPILE([],[], ac_cv_compiler_option_$1=yes, ac_cv_compiler_option_$1=no)
45     CFLAGS="$SAVE_CFLAGS"
46     ])dnl
47     if test ".$ac_cv_compiler_option_$1" = .yes; then
48     ifelse([$4], , :, [$4])
49     else
50     ifelse([$5], , :, [$5])
51     fi
52     AC_MSG_RESULT([$ac_cv_compiler_option_$1])
53     ])dnl
54    
55     dnl ##
56     dnl ## Debugging Support
57     dnl ##
58     dnl ## configure.in:
59     dnl ## AC_CHECK_DEBUGGING
60     dnl ##
61    
62     AC_DEFUN(AC_CHECK_DEBUGGING,[dnl
63     AC_ARG_ENABLE(debug,dnl
64     [ --enable-debug build for debugging (default=no)],
65     [dnl
66     if test ".$ac_cv_prog_gcc" = ".yes"; then
67     case "$CFLAGS" in
68     *-O* ) ;;
69     * ) CFLAGS="$CFLAGS -O0" ;;
70     esac
71     case "$CFLAGS" in
72     *-g* ) ;;
73     * ) CFLAGS="$CFLAGS -g" ;;
74     esac
75     case "$CFLAGS" in
76     *-pipe* ) ;;
77     * ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CFLAGS="$CFLAGS -pipe") ;;
78     esac
79     AC_COMPILER_OPTION(defdbg, -DDEBUG, -DDEBUG, CFLAGS="$CFLAGS -DDEBUG")
80     CFLAGS="$CFLAGS -pedantic"
81     CFLAGS="$CFLAGS -Wall"
82     WMORE="-Wpointer-arith -Wcast-align -Winline"
83     WMORE="$WMORE -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
84     AC_COMPILER_OPTION(wmore, -W<xxx>, $WMORE, CFLAGS="$CFLAGS $WMORE")
85     AC_COMPILER_OPTION(wnolonglong, -Wno-long-long, -Wno-long-long, CFLAGS="$CFLAGS -Wno-long-long")
86     else
87     case "$CFLAGS" in
88     *-g* ) ;;
89     * ) CFLAGS="$CFLAGS -g" ;;
90     esac
91     fi
92     msg="enabled"
93     ],[
94     AC_COMPILER_OPTION(defnodbg, -DNDEBUG, -DNDEBUG, CFLAGS="$CFLAGS -DNDEBUG")
95     if test ".$ac_cv_prog_gcc" = ".yes"; then
96     case "$CFLAGS" in
97     *-pipe* ) ;;
98     * ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CFLAGS="$CFLAGS -pipe") ;;
99     esac
100     fi
101     case "$CFLAGS" in
102     *-g* ) CFLAGS=`echo "$CFLAGS" |\
103     sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
104     esac
105     case "$CXXFLAGS" in
106     *-g* ) CXXFLAGS=`echo "$CXXFLAGS" |\
107     sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
108     esac
109     msg=disabled
110     ])dnl
111     AC_MSG_CHECKING(for compilation debug mode)
112     AC_MSG_RESULT([$msg])
113     if test ".$msg" = .enabled; then
114     enable_shared=no
115     fi
116     ])
117    
118     dnl ##
119     dnl ## Check for C99 va_copy() implementation
120     dnl ## (and provide fallback implementation if neccessary)
121     dnl ##
122     dnl ## configure.in:
123     dnl ## AC_CHECK_VA_COPY
124     dnl ## foo.c:
125     dnl ## #include "config.h"
126     dnl ## [...]
127     dnl ## va_copy(d,s)
128     dnl ##
129     dnl ## This check is rather complex: first because we really have to
130     dnl ## try various possible implementations in sequence and second, we
131     dnl ## cannot define a macro in config.h with parameters directly.
132     dnl ##
133    
134     dnl # test program for va_copy() implementation
135     changequote(<<,>>)
136     m4_define(__va_copy_test, <<[
137     #include <stdlib.h>
138     #include <stdarg.h>
139     #include <string.h>
140     #define DO_VA_COPY(d, s) $1
141     void test(char *str, ...)
142     {
143     va_list ap, ap2;
144     int i;
145     va_start(ap, str);
146     DO_VA_COPY(ap2, ap);
147     for (i = 1; i <= 9; i++) {
148     int k = (int)va_arg(ap, int);
149     if (k != i)
150     abort();
151     }
152     DO_VA_COPY(ap, ap2);
153     for (i = 1; i <= 9; i++) {
154     int k = (int)va_arg(ap, int);
155     if (k != i)
156     abort();
157     }
158     va_end(ap);
159     }
160     int main(int argc, char *argv[])
161     {
162     test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9);
163     exit(0);
164     }
165     ]>>)
166     changequote([,])
167    
168     dnl # test driver for va_copy() implementation
169     m4_define(__va_copy_check, [
170     AH_VERBATIM($1,
171     [/* Predefined possible va_copy() implementation (id: $1) */
172     #define __VA_COPY_USE_$1(d, s) $2])
173     if test ".$ac_cv_va_copy" = .; then
174     AC_TRY_RUN(__va_copy_test($2), [ac_cv_va_copy="$1"])
175     fi
176     ])
177    
178     dnl # Autoconf check for va_copy() implementation checking
179     AC_DEFUN(AC_CHECK_VA_COPY,[
180     dnl # provide Autoconf display check message
181     AC_MSG_CHECKING(for va_copy() function)
182     dnl # check for various implementations in priorized sequence
183     AC_CACHE_VAL(ac_cv_va_copy, [
184     ac_cv_va_copy=""
185     dnl # 1. check for standardized C99 macro
186     __va_copy_check(C99, [va_copy((d), (s))])
187     dnl # 2. check for alternative/deprecated GCC macro
188     __va_copy_check(GCM, [VA_COPY((d), (s))])
189     dnl # 3. check for internal GCC macro (high-level define)
190     __va_copy_check(GCH, [__va_copy((d), (s))])
191     dnl # 4. check for internal GCC macro (built-in function)
192     __va_copy_check(GCB, [__builtin_va_copy((d), (s))])
193     dnl # 5. check for assignment approach (assuming va_list is a struct)
194     __va_copy_check(ASS, [do { (d) = (s); } while (0)])
195     dnl # 6. check for assignment approach (assuming va_list is a pointer)
196     __va_copy_check(ASP, [do { *(d) = *(s); } while (0)])
197     dnl # 7. check for memory copying approach (assuming va_list is a struct)
198     __va_copy_check(CPS, [memcpy((void *)&(d), (void *)&(s)), sizeof((s))])
199     dnl # 8. check for memory copying approach (assuming va_list is a pointer)
200     __va_copy_check(CPP, [memcpy((void *)(d), (void *)(s)), sizeof(*(s))])
201     if test ".$ac_cv_va_copy" = .; then
202     AC_ERROR([no working implementation found])
203     fi
204     ])
205     dnl # optionally activate the fallback implementation
206     if test ".$ac_cv_va_copy" = ".C99"; then
207     AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy() macro exists (and no fallback implementation is required)])
208     fi
209     dnl # declare which fallback implementation to actually use
210     AC_DEFINE_UNQUOTED([__VA_COPY_USE], [__VA_COPY_USE_$ac_cv_va_copy],
211     [Define to id of used va_copy() implementation])
212     dnl # provide activation hook for fallback implementation
213     AH_VERBATIM([__VA_COPY_ACTIVATION],
214     [/* Optional va_copy() implementation activation */
215     #ifndef HAVE_VA_COPY
216     #define va_copy(d, s) __VA_COPY_USE(d, s)
217     #endif
218     ])
219     dnl # provide Autoconf display result message
220     if test ".$ac_cv_va_copy" = ".C99"; then
221     AC_MSG_RESULT([yes])
222     else
223     AC_MSG_RESULT([no (using fallback implementation)])
224     fi
225     ])
226    

  ViewVC Help
Powered by ViewVC 1.1.24