1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION($Revision: 1.38 $)
3 AC_INIT(mimetic/mimetic.h)
5 AC_CONFIG_MACRO_DIR([m4])
7 AM_INIT_AUTOMAKE(mimetic,0.9.8)
8 AM_CONFIG_HEADER(mimetic/config.h)
10 dnl Checks for programs.
15 dnl defines HAVE_MMAP if mmapping works
17 AC_CHECK_FUNCS(madvise)
26 INCLUDEDIR=$includedir/mimetic
30 dnl CFLAGS and CXXFLAGS default to -O2 -g
32 dnl CXXFLAGS="$CXXFLAGS -DNDEBUG -fno-exceptions"
33 CXXFLAGS="$CXXFLAGS -DNDEBUG"
36 [ --enable-debug[=LEVEL] enables debug symbols [default=2]],
37 if test "$enableval" = "yes"; then
41 if test "$enableval" != "no"; then
43 CXXFLAGS="-g$enableval -Wall"
48 AC_ARG_ENABLE(profile,
49 [ --enable-profile enables profiling],
50 if test "$enableval" = "yes"; then
51 CXXFLAGS="$CXXFLAGS -pg -a"
55 dnl *** Checks for libraries.
58 [ --with-stlport[=BASEDIR] use STLport],
61 if test "$withval" != "no"; then
62 if test $withval != "yes"; then
64 with_stlport_basedir=$withval
65 with_stlport_includes=${withval}/include/stlport
66 with_stlport_libraries=${withval}/lib
71 AC_ARG_WITH(stlport-includes,
72 [ --with-stlport-includes=DIR where the STLport includes are ],
73 [with_stlport_includes=$withval])
75 AC_ARG_WITH(stlport-libraries,
76 [ --with-stlport-libraries=DIR where STLport library is installed],
77 [with_stlport_libraries=$withval])
79 AC_ARG_WITH(stlport-libname,
80 [ --with-stlport-libname=NAME STLport lib base name],
81 [with_stlport_libname=$withval])
83 dnl AC_ARG_WITH(stlport-debug,
84 dnl [ --with-stlport-debug STLport debug mode on/off.[default: on with --enable-debug off otherwise],
85 dnl [ with_stlport_libname=${with_stlport_libname}_stldebug ])
87 if test "$enable_stlport" = "yes"; then
88 dnl ** debug enabled ?
89 if test "$debug_enabled" = "true"; then
90 CXXFLAGS="$CXXFLAGS -D_STLP_DEBUG"
92 dnl *** STLport include dir
93 if test "$with_stlport_includes"; then
94 AC_CHECK_HEADER(${with_stlport_includes}/stl_user_config.h,
95 stlp_headers_found=true)
97 stlp_include_dirs="/usr/local/include/stlport /usr/include/stlport"
98 for stlp_inc in $stlp_include_dirs; do
99 AC_CHECK_HEADER(${stlp_inc}/stl_user_config.h,
100 with_stlport_includes=$stlp_inc
101 export stlp_headers_found=true
106 if test "$stlp_headers_found" != "true"; then
107 AC_MSG_ERROR([I'm unable to find STLport include directory])
110 if test "$with_stlport_libraries"; then
111 stlp_ldflags="$stlp_ldflags -L${with_stlport_libraries}"
114 dnl *** STLport library(it must be linked with libm & libpthread on linux...
115 AC_CHECK_LIB(m, main,stlp_ldflags="$stlp_ldflags -lm")
118 stlp_ldflags="$stlp_ldflags -pthread";;
120 stlp_ldflags="$stlp_ldflags -L/usr/libexec -lm"
122 *) stlp_ldflags="$stlp_ldflags -lpthread"
123 AC_CHECK_LIB(pthread, main,stlp_ldflags="$stlp_ldflags -lpthread")
127 if test "$with_stlport_libname"; then
128 AC_CHECK_LIB($with_stlport_libname,main,stlp_lib_found=true,,
131 dnl *** try to get stlport library name
132 stlp_libs="stlport_gcc stlport_icl stlport_cygwin stlport_dec \
133 stlport_djgpp stlport_mingw32 stlport_aCC stlport_kcc stlport_misppro \
134 stlport_sunpro stlport_vc5 stlport_vc6 stlport_vc7 stlport_watcom"
135 for stlp_libname in $stlp_libs; do
136 test "$debug_enabled" = "true" && stlp_libname=${stlp_libname}_debug
137 AC_CHECK_LIB($stlp_libname, main,
138 with_stlport_libname=$stlp_libname
145 if test "$stlp_lib_found" != "true"; then
146 AC_MSG_ERROR([I'm unable to find STLport library. You must call configure
147 with the --with-stlport-libname option])
149 stlp_ldflags="$stlp_ldflags -l$with_stlport_libname"
150 CXXFLAGS="$CXXFLAGS -I$with_stlport_includes"
151 LDFLAGS="$LDFLAGS ${stlp_ldflags}"
154 CXXFLAGS="$CXXFLAGS -DHAVE_MIMETIC_CONFIG"
157 dnl ** check for STL required features
158 AC_MSG_CHECKING([STL required features])
159 AC_TRY_COMPILE([#include <string>],
160 [using namespace std; char_traits<char>::eq('a','a');],
162 AC_MSG_ERROR([std::char_traits unsupported])
164 AC_TRY_COMPILE([#include <streambuf>],
165 [using namespace std; struct sbd:public streambuf {} msb;],
167 AC_MSG_ERROR([std::streambuf unsupported])
172 dnl Checks for typedefs, structures, and compiler characteristics.
178 AC_CHECK_HEADERS(sys/stat.h)
179 AC_CHECK_HEADERS(sys/types.h)
180 AC_CHECK_HEADERS(sys/time.h)
181 AC_CHECK_HEADERS(stdint.h)
189 mimetic/codec/Makefile \
190 mimetic/rfc822/Makefile \
191 mimetic/os/Makefile \
192 mimetic/parser/Makefile \