1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION($Revision: 1.35 $)
3 AC_INIT(mimetic/mimetic.h)
6 AM_INIT_AUTOMAKE(mimetic,0.9.3)
7 AM_CONFIG_HEADER(mimetic/config.h)
9 dnl Checks for programs.
14 dnl defines HAVE_MMAP if mmapping works
16 AC_CHECK_FUNCS(madvise)
25 INCLUDEDIR=$includedir/mimetic
29 dnl CFLAGS and CXXFLAGS default to -O2 -g
31 dnl CXXFLAGS="$CXXFLAGS -DNDEBUG -fno-exceptions"
32 CXXFLAGS="$CXXFLAGS -DNDEBUG"
35 [ --enable-debug[=LEVEL] enables debug symbols [default=2]],
36 if test "$enableval" = "yes"; then
40 if test "$enableval" != "no"; then
42 CXXFLAGS="-g$enableval -Wall"
47 AC_ARG_ENABLE(profile,
48 [ --enable-profile enables profiling],
49 if test "$enableval" = "yes"; then
50 CXXFLAGS="$CXXFLAGS -pg -a"
54 dnl *** Checks for libraries.
57 [ --with-stlport[=BASEDIR] use STLport],
60 if test "$withval" != "no"; then
61 if test $withval != "yes"; then
63 with_stlport_basedir=$withval
64 with_stlport_includes=${withval}/include/stlport
65 with_stlport_libraries=${withval}/lib
70 AC_ARG_WITH(stlport-includes,
71 [ --with-stlport-includes=DIR where the STLport includes are ],
72 [with_stlport_includes=$withval])
74 AC_ARG_WITH(stlport-libraries,
75 [ --with-stlport-libraries=DIR where STLport library is installed],
76 [with_stlport_libraries=$withval])
78 AC_ARG_WITH(stlport-libname,
79 [ --with-stlport-libname=NAME STLport lib base name],
80 [with_stlport_libname=$withval])
82 dnl AC_ARG_WITH(stlport-debug,
83 dnl [ --with-stlport-debug STLport debug mode on/off.[default: on with --enable-debug off otherwise],
84 dnl [ with_stlport_libname=${with_stlport_libname}_stldebug ])
86 if test "$enable_stlport" = "yes"; then
87 dnl ** debug enabled ?
88 if test "$debug_enabled" = "true"; then
89 CXXFLAGS="$CXXFLAGS -D_STLP_DEBUG"
91 dnl *** STLport include dir
92 if test "$with_stlport_includes"; then
93 AC_CHECK_HEADER(${with_stlport_includes}/stl_user_config.h,
94 stlp_headers_found=true)
96 stlp_include_dirs="/usr/local/include/stlport /usr/include/stlport"
97 for stlp_inc in $stlp_include_dirs; do
98 AC_CHECK_HEADER(${stlp_inc}/stl_user_config.h,
99 with_stlport_includes=$stlp_inc
100 export stlp_headers_found=true
105 if test "$stlp_headers_found" != "true"; then
106 AC_MSG_ERROR([I'm unable to find STLport include directory])
109 if test "$with_stlport_libraries"; then
110 stlp_ldflags="$stlp_ldflags -L${with_stlport_libraries}"
113 dnl *** STLport library(it must be linked with libm & libpthread on linux...
114 AC_CHECK_LIB(m, main,stlp_ldflags="$stlp_ldflags -lm")
117 stlp_ldflags="$stlp_ldflags -pthread";;
119 stlp_ldflags="$stlp_ldflags -L/usr/libexec -lm"
121 *) stlp_ldflags="$stlp_ldflags -lpthread"
122 AC_CHECK_LIB(pthread, main,stlp_ldflags="$stlp_ldflags -lpthread")
126 if test "$with_stlport_libname"; then
127 AC_CHECK_LIB($with_stlport_libname,main,stlp_lib_found=true,,
130 dnl *** try to get stlport library name
131 stlp_libs="stlport_gcc stlport_icl stlport_cygwin stlport_dec \
132 stlport_djgpp stlport_mingw32 stlport_aCC stlport_kcc stlport_misppro \
133 stlport_sunpro stlport_vc5 stlport_vc6 stlport_vc7 stlport_watcom"
134 for stlp_libname in $stlp_libs; do
135 test "$debug_enabled" = "true" && stlp_libname=${stlp_libname}_debug
136 AC_CHECK_LIB($stlp_libname, main,
137 with_stlport_libname=$stlp_libname
144 if test "$stlp_lib_found" != "true"; then
145 AC_MSG_ERROR([I'm unable to find STLport library. You must call configure
146 with the --with-stlport-libname option])
148 stlp_ldflags="$stlp_ldflags -l$with_stlport_libname"
149 CXXFLAGS="$CXXFLAGS -I$with_stlport_includes"
150 LDFLAGS="$LDFLAGS ${stlp_ldflags}"
153 CXXFLAGS="$CXXFLAGS -DHAVE_MIMETIC_CONFIG"
156 dnl ** check for STL required features
157 AC_MSG_CHECKING([STL required features])
158 AC_TRY_COMPILE([#include <string>],
159 [using namespace std; char_traits<char>::eq('a','a');],
161 AC_MSG_ERROR([std::char_traits unsupported])
163 AC_TRY_COMPILE([#include <streambuf>],
164 [using namespace std; struct sbd:public streambuf {} msb;],
166 AC_MSG_ERROR([std::streambuf unsupported])
171 dnl Checks for typedefs, structures, and compiler characteristics.
177 AC_CHECK_HEADERS(sys/stat.h)
178 AC_CHECK_HEADERS(sys/types.h)
179 AC_CHECK_HEADERS(sys/time.h)
180 AC_CHECK_HEADERS(stdint.h)
188 mimetic/codec/Makefile \
189 mimetic/rfc822/Makefile \
190 mimetic/os/Makefile \
191 mimetic/parser/Makefile \