1AC_INIT(binio,1.5,[dn.tlp@gmx.net],libbinio)
2AC_CONFIG_SRCDIR(src/binio.cpp)
3AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile src/binio.h libbinio.pc])
4AM_INIT_AUTOMAKE
5AM_MAINTAINER_MODE
6#AM_DISABLE_SHARED
7AM_PROG_LIBTOOL
8AC_LANG(C++)
9
10# Check for a sane C/C++ build environment.
11AC_PROG_MAKE_SET
12AC_PROG_INSTALL
13AC_PROG_CXX
14
15# Check if 'long long' or 'long double' are available and use them instead.
16AC_CHECK_TYPE(long long, AC_SUBST(TYPE_INT,"long long"),
17		   AC_SUBST(TYPE_INT,long))
18AC_CHECK_TYPE(long double, AC_SUBST(TYPE_FLOAT,"long double"),
19		   AC_SUBST(TYPE_FLOAT,double))
20
21# Conditionally build iostream wrappers
22AC_ARG_ENABLE([iostream], AC_HELP_STRING([--disable-iostream],
23	[Do not build iostream wrapper streams]))
24
25if test ${enable_iostream:=yes} = yes; then
26   AC_CHECK_LIB(stdc++,main, AC_SUBST(ENABLE_IOSTREAM,1),
27      AC_SUBST(ENABLE_IOSTREAM,0))
28else
29	AC_SUBST(ENABLE_IOSTREAM,0)
30fi
31
32# Conditionally build std::string methods
33AC_ARG_ENABLE([string], AC_HELP_STRING([--disable-string],
34	[Do not build std::string methods]))
35
36if test ${enable_string:=yes} = yes; then
37   AC_CHECK_LIB(stdc++, main, AC_SUBST(ENABLE_STRING,1),
38			      AC_SUBST(ENABLE_STRING,0))
39else
40	AC_SUBST(ENABLE_STRING,0)
41fi
42
43# Check if we are using the ISO standard C++ library
44AC_ARG_WITH([iso],AC_HELP_STRING([--with-iso],
45	[Force ISO C++ standard library compliance]))
46
47if test x${with_iso} = xyes; then
48   AC_SUBST(ISO_STDLIB,1)
49elif test x${with_iso} = xno; then
50   AC_SUBST(ISO_STDLIB,0)
51else
52	AC_CHECK_TYPE([std::basic_istream<char>],
53		AC_SUBST(ISO_STDLIB,1),
54		AC_SUBST(ISO_STDLIB,0),
55		[#include <iostream>])
56fi
57
58# Conditionally build with 'math.h' (and maybe library) dependencies
59AC_ARG_WITH([math],AC_HELP_STRING([--without-math],
60	[Do not build routines depending on 'math.h']))
61
62if test ${with_math:=yes} = yes; then
63   AC_CHECK_FUNC(ldexp, AC_SUBST(WITH_MATH,1), AC_SUBST(WITH_MATH,0))
64else
65	AC_SUBST(WITH_MATH,0)
66fi
67
68AC_OUTPUT
69