1
2dnl AC_SNPRINTFV_CONVENIENCE[(dir)] - sets LIBSNPRINTFV to the link flags for
3dnl the snprintfv convenience library and INCSNPRINTFV to the include flags for
4dnl the snprintfv header and adds --enable-snprintfv-convenience to the
5dnl configure arguments.  Note that AC_CONFIG_SUBDIRS is not called.  If DIR
6dnl is not provided, it is assumed to be `snprintfv'.  LIBSNPRINTFV will be
7dnl prefixed with '${top_builddir}/' and INCSNPRINTFV will be prefixed with
8dnl '${top_srcdir}/' (note the single quotes!).  If your package is not
9dnl flat and you're not using automake, define top_builddir and
10dnl top_srcdir appropriately in the Makefiles.
11AC_DEFUN([AC_SNPRINTFV_CONVENIENCE],
12[case $enable_snprintfv_convenience in
13  no) AC_MSG_ERROR([this package needs a convenience snprintfv]) ;;
14  "") enable_snprintfv_convenience=yes
15      ac_configure_args="$ac_configure_args --enable-snprintfv-convenience" ;;
16  esac
17  LIBSNPRINTFV='${top_builddir}/'ifelse($#,1,[$1],['snprintfv'])/snprintfv/libsnprintfvc.la
18  INCSNPRINTFV='-I${top_builddir}/'ifelse($#,1,[$1],['snprintfv'])' -I${top_srcdir}/'ifelse($#,1,[$1],['snprintfv'])
19  AC_SUBST(LIBSNPRINTFV)
20  AC_SUBST(INCSNPRINTFV)
21])
22
23AC_DEFUN([INVOKE_SNPRINTFV_MACROS],[
24  AC_SNPRINTFV_CONVENIENCE
25  # ----------------------------------------------------------------------
26  # Set up and process configure options
27  # ----------------------------------------------------------------------
28  AC_ARG_ENABLE(snprintfv-install,
29  [  --enable-snprintfv-install  install libsnprintfv [yes]])
30  AM_CONDITIONAL(INSTALL_SNPRINTFV,
31  test x"${enable_snprintfv_install-no}" != xno)
32  AM_CONDITIONAL(CONVENIENCE_SNPRINTFV,
33  test x"${enable_snprintfv_convenience-no}" != xno)
34  AM_CONDITIONAL(SUBDIR_SNPRINTFV,
35  test x"${enable_subdir-no}" != xno)
36
37  AM_WITH_DMALLOC
38  AC_PROG_AWK
39
40  # ----------------------------------------------------------------------
41  # check for various programs used during the build.
42  # On OS/X, "wchar.h" needs "runetype.h" to work properly.
43  # ----------------------------------------------------------------------
44  AC_CHECK_HEADERS([runetype.h wchar.h], [], [],[
45    AC_INCLUDES_DEFAULT
46    #if HAVE_RUNETYPE_H
47    # include <runetype.h>
48    #endif
49    ])
50  dnl am_cv_prog_cc_stdc is set by AC_PROG_CC_STDC
51  case x$am_cv_prog_cc_stdc in
52  xno)
53    # Non ansi C => won't work with stdarg.h
54    AC_CHECK_HEADER(varargs.h)
55    ;;
56  *)
57    case x$ac_cv_header_varargs_h in
58    xyes)
59      # Parent package is using varargs.h which is incompatible with
60      # stdarg.h, so we do the same.
61      AC_CHECK_HEADER(varargs.h)
62      ;;
63    *)
64      # If stdarg.h is present define HAVE_STDARG_H, otherwise if varargs.h
65      # is present define HAVE_VARARGS_H.
66      AC_CHECK_HEADERS(stdarg.h varargs.h, break)
67      ;;
68    esac
69    ;;
70  esac
71
72  case x$ac_cv_header_stdarg_h$ac_cv_header_varargs_h in
73  x*yes*) ;;
74  *) AC_MSG_ERROR(Could not find either stdarg.h or varargs.h.) ;;
75  esac
76
77  # ----------------------------------------------------------------------
78  # Checks for typedefs
79  # ----------------------------------------------------------------------
80  AC_CHECK_TYPES(wchar_t)
81  AC_CHECK_TYPES(wint_t, [], [], [
82    AC_INCLUDES_DEFAULT
83    #if HAVE_RUNETYPE_H
84    # include <runetype.h>
85    #endif
86    #if HAVE_WCHAR_H
87    # include <wchar.h>
88    #endif
89    ])
90  AC_CHECK_TYPES([long double])
91
92  # ----------------------------------------------------------------------
93  # Checks for library calls
94  # ----------------------------------------------------------------------
95  AC_REPLACE_FUNCS(strtoul ldexpl frexpl)
96  AC_CHECK_LIB(m, log)
97  AC_CHECK_FUNCS(copysign copysignl)
98])
99