1AC_DEFUN([AC_ENABLE_CXXMPH], [AC_ARG_ENABLE([cxxmph],
2	[  --enable-cxxmph	enable the c++ cxxmph library ],
3	[case "${enableval}" in
4		yes) cxxmph=true ;;
5		no)  cxxmph=false ;;
6		*) AC_MSG_ERROR([bad value ${enableval} for --enable-cxxmph]) ;;
7	esac],[cxxmph=false])])
8
9AC_DEFUN([AC_CHECK_SPOON], [
10	AC_ARG_WITH(spoon, [  --with-spoon=SPOON this is inocuous, since the truth is that there is no spoon ])
11	AC_MSG_CHECKING(if there is spoon)
12	AC_MSG_RESULT(no)
13])
14
15dnl Check for baseline language coverage in the compiler for the C++0x standard.
16# AC_COMPILE_STDCXX_OX
17AC_DEFUN([AC_COMPILE_STDCXX_0X], [
18  AC_CACHE_CHECK(if compiler supports C++0x features without additional flags,
19  ac_cv_cxx_compile_cxx0x_native,
20  [AC_LANG_SAVE
21  AC_LANG_CPLUSPLUS
22  AC_TRY_COMPILE([
23  #include <unordered_map>
24  #include <unordered_set>
25  template <typename T>
26    struct check
27    {
28      static_assert(sizeof(int) <= sizeof(T), "not big enough");
29    };
30
31    typedef check<check<bool>> right_angle_brackets;
32
33    int a;
34    decltype(a) b;
35    ],,
36  ac_cv_cxx_compile_cxx0x_native=yes, ac_cv_cxx_compile_cxx0x_native=no)
37  AC_LANG_RESTORE
38  ])
39
40  AC_CACHE_CHECK(if compiler supports C++0x features with -std=c++0x,
41  ac_cv_cxx_compile_cxx0x_cxx,
42  [AC_LANG_SAVE
43  AC_LANG_CPLUSPLUS
44  ac_save_CXXFLAGS="$CXXFLAGS"
45  CXXFLAGS="$CXXFLAGS -std=c++0x"
46  AC_TRY_COMPILE([
47  #include <unordered_map>
48  template <typename T>
49    struct check
50    {
51      static_assert(sizeof(int) <= sizeof(T), "not big enough");
52    };
53
54    typedef check<check<bool>> right_angle_brackets;
55
56    int a;
57    decltype(a) b;],,
58  ac_cv_cxx_compile_cxx0x_cxx=yes, ac_cv_cxx_compile_cxx0x_cxx=no)
59  CXXFLAGS="$ac_save_CXXFLAGS"
60  AC_LANG_RESTORE
61  ])
62
63  AC_CACHE_CHECK(if compiler supports C++0x features with -std=gnu++0x,
64  ac_cv_cxx_compile_cxx0x_gxx,
65  [AC_LANG_SAVE
66  AC_LANG_CPLUSPLUS
67  ac_save_CXXFLAGS="$CXXFLAGS"
68  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
69  AC_TRY_COMPILE([
70  #include <unordered_map>
71  template <typename T>
72    struct check
73    {
74      static_assert(sizeof(int) <= sizeof(T), "not big enough");
75    };
76
77    typedef check<check<bool>> right_angle_brackets;
78
79    int a;
80    decltype(a) b;],,
81  ac_cv_cxx_compile_cxx0x_gxx=yes, ac_cv_cxx_compile_cxx0x_gxx=no)
82  CXXFLAGS="$ac_save_CXXFLAGS"
83  AC_LANG_RESTORE
84  ])
85
86  if test "$ac_cv_cxx_compile_cxx0x_native" = yes ||
87     test "$ac_cv_cxx_compile_cxx0x_cxx" = yes ||
88     test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then
89    AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ])
90  fi
91])
92
93dnl By default, many hosts won't let programs access large files;
94dnl one must use special compiler options to get large-file access to work.
95dnl For more details about this brain damage please see:
96dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
97
98dnl Written by Paul Eggert <eggert@twinsun.com>.
99
100dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
101dnl AC_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME)
102AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_FLAGS],
103  [AC_CACHE_CHECK([for $1 value to request large file support],
104     ac_cv_sys_largefile_$1,
105     [ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
106	ac_cv_sys_largefile_$1=no
107	ifelse($1, CFLAGS,
108	  [case "$host_os" in
109	   # IRIX 6.2 and later require cc -n32.
110changequote(, )dnl
111	   irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
112changequote([, ])dnl
113	     if test "$GCC" != yes; then
114	       ac_cv_sys_largefile_CFLAGS=-n32
115	     fi
116	     ac_save_CC="$CC"
117	     CC="$CC $ac_cv_sys_largefile_CFLAGS"
118	     AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
119	     CC="$ac_save_CC"
120	   esac])
121      }])])
122
123dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
124dnl AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(VAR, VAL)
125AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND],
126  [case $2 in
127   no) ;;
128   ?*)
129     case "[$]$1" in
130     '') $1=$2 ;;
131     *) $1=[$]$1' '$2 ;;
132     esac ;;
133   esac])
134
135dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
136dnl AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
137AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE],
138  [AC_CACHE_CHECK([for $1], $2,
139     [$2=no
140changequote(, )dnl
141      $4
142      for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
143	case "$ac_flag" in
144	-D$1)
145	  $2=1 ;;
146	-D$1=*)
147	  $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
148	esac
149      done
150changequote([, ])dnl
151      ])
152   if test "[$]$2" != no; then
153     AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
154   fi])
155
156AC_DEFUN([AC_SYS_EXTRA_LARGEFILE],
157  [AC_REQUIRE([AC_CANONICAL_HOST])
158   AC_ARG_ENABLE(largefile,
159     [  --disable-largefile     omit support for large files])
160   if test "$enable_largefile" != no; then
161     AC_CHECK_TOOL(GETCONF, getconf)
162     AC_SYS_EXTRA_LARGEFILE_FLAGS(CFLAGS)
163     AC_SYS_EXTRA_LARGEFILE_FLAGS(LDFLAGS)
164     AC_SYS_EXTRA_LARGEFILE_FLAGS(LIBS)
165
166     for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
167       case "$ac_flag" in
168       no) ;;
169       -D_FILE_OFFSET_BITS=*) ;;
170       -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
171       -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
172       -D?* | -I?*)
173	 AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
174       *)
175	 AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
176       esac
177     done
178     AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
179     AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
180     AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
181       ac_cv_sys_file_offset_bits,
182       [Number of bits in a file offset, on hosts where this is settable.])
183       [case "$host_os" in
184	# HP-UX 10.20 and later
185	hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
186	  ac_cv_sys_file_offset_bits=64 ;;
187	esac]
188     AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
189       ac_cv_sys_largefile_source,
190       [Define to make fseeko etc. visible, on some hosts.],
191       [case "$host_os" in
192	# HP-UX 10.20 and later
193	hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
194	  ac_cv_sys_largefile_source=1 ;;
195	esac])
196     AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
197       ac_cv_sys_large_files,
198       [Define for large files, on AIX-style hosts.],
199       [case "$host_os" in
200	# AIX 4.2 and later
201	aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
202	  ac_cv_sys_large_files=1 ;;
203	esac])
204   fi
205  ])
206
207
208