Check for extra digits in sized binary, octal and hex constants.
[iverilog.git] / aclocal.m4
blob76ddc0296e292800a9121d9a0cf00b1c2328ae85
1 # AX_CPP_IDENT
2 # ------------
3 # Check if the C compiler supports #ident
4 # Define and substitute ident_support if so.
6 # It would be simpler and more consistent with the rest of the autoconf
7 # structure to AC_DEFINE(HAVE_CPP_IDENT) instead of
8 # ident_support='-DHAVE_CVS_IDENT=1' and AC_SUBST(ident_support), but that
9 # change would require all C files in the icarus top level directory to
10 # put #include <config.h> before the #ifdef HAVE_CVS_IDENT (and change
11 # HAVE_CVS_IDENT to HAVE_CPP_IDENT).   That would also remove all special
12 # ident_support handling from the Makefile.  Manyana.
14 AC_DEFUN([AX_CPP_IDENT],
15 [AC_CACHE_CHECK([for ident support in C compiler], ax_cv_cpp_ident,
16 [AC_TRY_COMPILE([
17 #ident "$Id: aclocal.m4,v 1.7 2007/05/16 23:59:12 steve Exp $"
18 ],[while (0) {}],
19 [AS_VAR_SET(ax_cv_cpp_ident, yes)],
20 [AS_VAR_SET(ax_cv_cpp_ident, no)])])
21 if test $ax_cv_cpp_ident = yes; then
22   ident_support='-DHAVE_CVS_IDENT=1'
24 AC_SUBST(ident_support)
25 ])# AC_CPP_IDENT
28 # _AX_C_UNDERSCORES_MATCH_IFELSE(PATTERN, ACTION-IF-MATCH, ACTION-IF-NOMATCH)
29 # ------------------------------
30 # Sub-macro for AX_C_UNDERSCORES_LEADING and AX_C_UNDERSCORES_TRAILING.
31 # Unwarranted assumptions:
32 #   - the object file produced by AC_COMPILE_IFELSE is called "conftest.$ac_objext"
33 #   - the nm(1) utility is available, and its name is "nm".
34 AC_DEFUN([_AX_C_UNDERSCORES_MATCH_IF],
35 [AC_COMPILE_IFELSE([void underscore(void){}],
36 [AS_IF([nm conftest.$ac_objext|grep $1 >/dev/null 2>/dev/null],[$2],[$3])],
37 [AC_MSG_ERROR([underscore test crashed])]
38 )])
41 # AX_C_UNDERSCORES_LEADING
42 # ---------------------------------
43 # Check if symbol names in object files produced by C compiler have
44 # leading underscores. Define NEED_LU if so.
45 AC_DEFUN([AX_C_UNDERSCORES_LEADING],
46 [AC_CACHE_CHECK([for leading underscores], ax_cv_c_underscores_leading,
47 [_AX_C_UNDERSCORES_MATCH_IF([_underscore],
48 [AS_VAR_SET(ax_cv_c_underscores_leading, yes)],
49 [AS_VAR_SET(ax_cv_c_underscores_leading, no)])])
50 if test $ax_cv_c_underscores_leading = yes -a "$CYGWIN" != "yes" -a "$MINGW32" != "yes"; then
51  AC_DEFINE([NEED_LU], [1], [Symbol names in object files produced by C compiler have leading underscores.])
53 ])# AX_C_UNDERSCORES_LEADING
56 # AX_C_UNDERSCORES_TRAILING
57 # ---------------------------------
58 # Check if symbol names in object files produced by C compiler have
59 # trailing underscores.  Define NEED_TU if so.
60 AC_DEFUN([AX_C_UNDERSCORES_TRAILING],
61 [AC_CACHE_CHECK([for trailing underscores], ax_cv_c_underscores_trailing,
62 [_AX_C_UNDERSCORES_MATCH_IF([underscore_],
63 [AS_VAR_SET(ax_cv_c_underscores_trailing, yes)],
64 [AS_VAR_SET(ax_cv_c_underscores_trailing, no)])])
65 if test $ax_cv_c_underscores_trailing = yes; then
66  AC_DEFINE([NEED_TU], [1], [Symbol names in object files produced by C compiler have trailing underscores.])
68 ])# AX_C_UNDERSCORES_TRAILING
70 # AX_WIN32
71 # --------
72 # Combined check for several flavors of Microsoft Windows so
73 # their "issues" can be dealt with
74 AC_DEFUN([AX_WIN32],
75 [AC_CYGWIN
76 AC_MINGW32
77 WIN32=no
78 AC_MSG_CHECKING([for Microsoft Windows])
79 if test "$CYGWIN" = "yes" -o "$MINGW32" = "yes"
80 then
81     WIN32=yes
83 AC_SUBST(MINGW32)
84 AC_SUBST(WIN32)
85 AC_MSG_RESULT($WIN32)
86 ])# AX_WIN32
88 # AX_LD_EXTRALIBS
89 # ---------------
90 # mingw needs to link with libiberty.a, but cygwin alone can't tolerate it
91 AC_DEFUN([AX_LD_EXTRALIBS],
92 [AC_MSG_CHECKING([for extra libs needed])
93 EXTRALIBS=
94 case "${host}" in
95      *-*-cygwin* )
96         if test "$MINGW32" = "yes"; then
97             EXTRALIBS="-liberty"
98         fi
99         ;;
100 esac
101 AC_SUBST(EXTRALIBS)
102 AC_MSG_RESULT($EXTRALIBS)
103 ])# AX_LD_EXTRALIBS
105 # AX_LD_SHAREDLIB_OPTS
106 # --------------------
107 # linker options when building a shared library
108 AC_DEFUN([AX_LD_SHAREDLIB_OPTS],
109 [AC_MSG_CHECKING([for shared library link flag])
110 shared=-shared
111 case "${host}" in
112      *-*-cygwin*)
113         shared="-shared -Wl,--enable-auto-image-base"
114         ;;
116      *-*-hpux*)
117         shared="-b"
118         ;;
120      *-*-darwin1.[0123])
121         shared="-bundle -undefined suppress"
122         ;;
124      *-*-darwin*)
125         shared="-bundle -undefined suppress -flat_namespace"
126         ;;
127 esac
128 AC_SUBST(shared)
129 AC_MSG_RESULT($shared)
130 ])# AX_LD_SHAREDLIB_OPTS
132 # AX_C_PICFLAG
133 # ------------
134 # The -fPIC flag is used to tell the compiler to make position
135 # independent code. It is needed when making shared objects.
136 AC_DEFUN([AX_C_PICFLAG],
137 [AC_MSG_CHECKING([for flag to make position independent code])
138 PICFLAG=-fPIC
139 case "${host}" in
141      *-*-cygwin*)
142         PICFLAG=
143         ;;
145      *-*-hpux*)
146         PICFLAG=+z
147         ;;
149 esac
150 AC_SUBST(PICFLAG)
151 AC_MSG_RESULT($PICFLAG)
152 ])# AX_C_PICFLAG
154 # AX_LD_RDYNAMIC
155 # --------------
156 # The -rdynamic flag is used by iverilog when compiling the target,
157 # to know how to export symbols of the main program to loadable modules
158 # that are brought in by -ldl
159 AC_DEFUN([AX_LD_RDYNAMIC],
160 [AC_MSG_CHECKING([for -rdynamic compiler flag])
161 rdynamic=-rdynamic
162 case "${host}" in
164     *-*-netbsd*)
165         rdynamic="-Wl,--export-dynamic"
166         ;;
168     *-*-openbsd*)
169         rdynamic="-Wl,--export-dynamic"
170         ;;
172     *-*-solaris*)
173         rdynamic=""
174         ;;
176     *-*-cygwin*)
177         rdynamic=""
178         ;;
180     *-*-hpux*)
181         rdynamic="-E"
182         ;;
184     *-*-darwin*)
185         rdynamic="-Wl,-all_load"
186         strip_dynamic="-SX"
187         ;;
189 esac
190 AC_SUBST(rdynamic)
191 AC_MSG_RESULT($rdynamic)
192 AC_SUBST(strip_dynamic)
193 # since we didn't tell them we're "checking", no good place to tell the answer
194 # AC_MSG_RESULT($strip_dynamic)
195 ])# AX_LD_RDYNAMIC
197 # AX_CPP_PRECOMP
198 # --------------
199 AC_DEFUN([AX_CPP_PRECOMP],
200 [# Darwin requires -no-cpp-precomp
201 case "${host}" in
202     *-*-darwin*)
203         CPPFLAGS="-no-cpp-precomp $CPPFLAGS"
204         CFLAGS="-no-cpp-precomp $CFLAGS"
205         ;;
206 esac
207 ])# AX_CPP_PRECOMP