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,
17 #ident "$Id: aclocal.m4,v 1.7 2007/05/16 23:59:12 steve Exp $"
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)
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])]
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
72 # Combined check for several flavors of Microsoft Windows so
73 # their "issues" can be dealt with
78 AC_MSG_CHECKING([for Microsoft Windows])
79 if test "$CYGWIN" = "yes" -o "$MINGW32" = "yes"
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])
96 if test "$MINGW32" = "yes"; then
102 AC_MSG_RESULT($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])
113 shared="-shared -Wl,--enable-auto-image-base"
121 shared="-bundle -undefined suppress"
125 shared="-bundle -undefined suppress -flat_namespace"
129 AC_MSG_RESULT($shared)
130 ])# AX_LD_SHAREDLIB_OPTS
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])
151 AC_MSG_RESULT($PICFLAG)
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])
165 rdynamic="-Wl,--export-dynamic"
169 rdynamic="-Wl,--export-dynamic"
185 rdynamic="-Wl,-all_load"
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)
199 AC_DEFUN([AX_CPP_PRECOMP],
200 [# Darwin requires -no-cpp-precomp
203 CPPFLAGS="-no-cpp-precomp $CPPFLAGS"
204 CFLAGS="-no-cpp-precomp $CFLAGS"