blob: 6e79fc41f59f2ea7973307d99b92d5ea6c3489fe [file] [log] [blame]
Emeric Vigier2f625822012-08-06 11:09:52 -04001dnl Copyright (C) 2000-2003 Open Source Telecom Corporation.
2dnl
3dnl This program is free software; you can redistribute it and/or modify
4dnl it under the terms of the GNU General Public License as published by
5dnl the Free Software Foundation; either version 2 of the License, or
6dnl (at your option) any later version.
7dnl
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11dnl GNU General Public License for more details.
12dnl
13dnl You should have received a copy of the GNU General Public License
14dnl along with this program; if not, write to the Free Software
15dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16dnl
17dnl As a special exception to the GNU General Public License, if you
18dnl distribute this file as part of a program that contains a configuration
19dnl script generated by Autoconf, you may include it under the same
20dnl distribution terms that you use for the rest of that program.
21
22dnl OST_CCXX2_VERSION([MINIMUM-VERSION[,ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]]])
23dnl Test for usable version of CommonC++
24
25AC_DEFUN([OST_CCXX2_DYNLOADER],[
26 ost_cv_dynloader=`$CCGNU2_CONFIG --dso`
27 if test "$ost_cv_dynloader" = "yes" ; then
28 MODULE_FLAGS=`$CCGNU2_CONFIG --module`
29 AC_SUBST(MODULE_FLAGS)
30 fi
31])
32
33AC_DEFUN([OST_CCXX2_LD_THREADING],[
34 LD_THREADING=`$CCGNU2_CONFIG --cclibs`
35 AC_SUBST(LD_THREADING)
36])
37
38AC_DEFUN([OST_CCXX2_VERSION],
39[
40 if test -d ${exec_prefix}/bin ; then
41 PATH=${exec_prefix}/bin:$PATH
42 elif test -d ${prefix}/bin ; then
43 PATH=${prefix}/bin:$PATH ; fi
44
45 AC_PATH_PROG(CCGNU2_CONFIG, ccgnu2-config, no)
46 ccgnu2_version=ifelse([$1], ,0.99.0,$1)
47 AC_MSG_CHECKING(for commoncpp2 version >= $ccgnu2_version)
48 if test "$CCGNU2_CONFIG" = "no" ; then
49 AC_MSG_RESULT(not found)
50 echo "*** The ccgnu2-config script installed by commoncpp2 0.99"
51 echo "*** or later could not be found."
52 echo "*** You need to install GNU Common C++ 2, whose later releases are"
53 echo "*** available from http://www.gnu.org/software/commoncpp/ and any"
54 echo "*** GNU mirror."
55 ifelse([$3], , :, [$3])
56 exit -1
57 else
58 config_version=`$CCGNU2_CONFIG --version`
59 ccgnu2_config_major_version=`echo $config_version | \
60 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
61 ccgnu2_config_minor_version=`echo $config_version | \
62 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
63 ccgnu2_config_micro_version=`echo $config_version | \
64 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
65
66 ccgnu2_check_major_version=`echo "$ccgnu2_version" | \
67 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
68 ccgnu2_check_minor_version=`echo "$ccgnu2_version" | \
69 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
70 ccgnu2_check_micro_version=`echo "$ccgnu2_version" | \
71 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
72
73 version_ok=no
74 if test $ccgnu2_config_major_version -gt $ccgnu2_check_major_version ; then
75 version_ok=yes
76 elif test $ccgnu2_config_major_version -eq $ccgnu2_check_major_version \
77 && test $ccgnu2_config_minor_version -gt $ccgnu2_check_minor_version ; then
78 version_ok=yes
79 elif test $ccgnu2_config_major_version -eq $ccgnu2_check_major_version \
80 && test $ccgnu2_config_minor_version -eq $ccgnu2_check_minor_version \
81 && test $ccgnu2_config_micro_version -ge $ccgnu2_check_micro_version; then
82
83 version_ok=yes
84 fi
85
86 if test "$version_ok" = "no"; then
87 AC_MSG_RESULT(no)
88 ost_cv_ccxx_config=false
89 echo "*** An old version of CommonC++ of $config_version was found."
90 echo "*** You need a version of commoncpp2 newer than $ccgnu2_version. The latest version of"
91 echo "*** CommonC++ is always available from ftp://ftp.gnu.org/gnu/commonc++/."
92 ifelse([$3], , :, [$3])
93 else
94 AC_MSG_RESULT(yes)
95 ost_cv_ccxx_config=true
96 SINGLE_FLAGS="$CXXFLAGS"
97 SINGLE_LIBS="$LIBS"
98 AC_SUBST(SINGLE_LIBS)
99 AC_SUBST(SINGLE_FLAGS)
100 CXXFLAGS="$CXXFLAGS "`$CCGNU2_CONFIG --flags`
101 GNULIBS="$LIBS "`$CCGNU2_CONFIG --gnulibs`
102 EXTLIBS=`$CCGNU2_CONFIG --extlibs`
103 LIBS="$LIBS `$CCGNU2_CONFIG --stdlibs`"
104 AC_SUBST(GNULIBS)
105 AC_SUBST(EXTLIBS)
106 fi
107 fi
108])
109
110AC_DEFUN([OST_CCXX2_CHECK],
111[
112 if test -d ${exec_prefix}/bin ; then
113 PATH=${exec_prefix}/bin:$PATH
114 elif test -d ${prefix}/bin ; then
115 PATH=${prefix}/bin:$PATH ; fi
116
117 AC_PATH_PROG(CCGNU2_CONFIG, ccgnu2-config, no)
118 ccgnu2_version=ifelse([$1], ,0.99.0,$1)
119 AC_MSG_CHECKING(for commoncpp2 version >= $ccgnu2_version)
120 if test "$CCGNU2_CONFIG" = "no" ; then
121 AC_MSG_RESULT(not found)
122 echo "*** The ccgnu2-config script installed by commoncpp2 0.99"
123 echo "*** or later could not be found."
124 echo "*** You need to install GNU Common C++ 2, whose later releases are"
125 echo "*** available from http://www.gnu.org/software/commoncpp/ and any"
126 echo "*** GNU mirror."
127 ifelse([$3], , :, [$3])
128 exit -1
129 else
130 config_version=`$CCGNU2_CONFIG --version`
131 ccgnu2_config_major_version=`echo $config_version | \
132 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
133 ccgnu2_config_minor_version=`echo $config_version | \
134 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
135 ccgnu2_config_micro_version=`echo $config_version | \
136 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
137
138 ccgnu2_check_major_version=`echo "$ccgnu2_version" | \
139 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
140 ccgnu2_check_minor_version=`echo "$ccgnu2_version" | \
141 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
142 ccgnu2_check_micro_version=`echo "$ccgnu2_version" | \
143 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
144
145 version_ok=no
146 if test $ccgnu2_config_major_version -gt $ccgnu2_check_major_version ; then
147 version_ok=yes
148 elif test $ccgnu2_config_major_version -eq $ccgnu2_check_major_version \
149 && test $ccgnu2_config_minor_version -gt $ccgnu2_check_minor_version ; then
150 version_ok=yes
151 elif test $ccgnu2_config_major_version -eq $ccgnu2_check_major_version \
152 && test $ccgnu2_config_minor_version -eq $ccgnu2_check_minor_version \
153 && test $ccgnu2_config_micro_version -ge $ccgnu2_check_micro_version; then
154
155 version_ok=yes
156 fi
157
158 if test "$version_ok" = "no"; then
159 AC_MSG_RESULT(no)
160 ost_cv_ccxx_config=false
161 echo "*** An old version of CommonC++ of $config_version was found."
162 echo "*** You need a version of commoncpp2 newer than $ccgnu2_version. The latest version of"
163 echo "*** CommonC++ is always available from ftp://ftp.gnu.org/gnu/commonc++/."
164 ifelse([$3], , :, [$3])
165 else
166 AC_MSG_RESULT(yes)
167 ost_cv_ccxx_config=true
168 CCFLAGS2=`$CCGNU2_CONFIG --flags`
169 LDCCGNU2=`$CCGNU2_CONFIG --gnulibs`
170 LDCCEXT2=`$CCGNU2_CONFIG --stdlibs`
171 AC_SUBST(LDCCGNU2)
172 AC_SUBST(LDCCEXT2)
173 AC_SUBST(CCFLAGS2)
174 fi
175 fi
176])
177
178AC_DEFUN([OST_CCXX2_FOX],[
179 AC_LANG_SAVE
180 AC_LANG_CPLUSPLUS
181 ost_cv_lib_fox=false
182 AC_CHECK_HEADERS(fox/fx.h,[
183 AC_DEFINE(HAVE_FOX_FX_H)
184 ost_cv_lib_fox=true])
185 AC_LANG_RESTORE
186])
187
188dnl OST_CCXX2_XML([ACTION-IF-TRUE[,ACTION-IF-FALSE]])
189AC_DEFUN([OST_CCXX2_HOARD],[
190 AC_ARG_ENABLE(hoard, [--disable-hoard Disable hoard support])
191 AC_ARG_ENABLE(mpatrol, [--enable-mpatrol Enable mpatrol debugging])
192 if test "$enable_mpatrol" = "yes" ; then
193 LIBS="$LIBS -lmpatrolmt -lbfd -liberty"
194 elif test "$enable_hoard" != "no" ; then
195 AC_CHECK_LIB(hoard, free, [LIBS="$LIBS -lhoard"])
196 fi
197])
198
199AC_DEFUN([OST_CCXX2_XML],
200[
201 AC_MSG_CHECKING(for commoncpp2 xml parsing)
202 AC_LANG_PUSH(C++)
203 AC_REQUIRE_CPP
204 AC_TRY_RUN([
205#include <cc++/config.h>
206#ifndef COMMON_XML_PARSING
207#error ""
208#endif
209int main() {
210 return 0;
211}
212], ost_cv_ccxx_xml=yes, ost_cv_ccxx_xml=no)
213 AC_LANG_POP(C++)
214 if test "x$ost_cv_ccxx_xml" = "xyes" ; then
215 AC_MSG_RESULT(yes)
216 AC_DEFINE(HAVE_OST_CCXX2_XML_PARSING, 1, [Define this if the CommonC++ library was compiled with XML parsing support])
217 ifelse([$1], , :, [$1])
218 else
219 AC_MSG_RESULT(no)
220 ifelse([$2], , :, [$2])
221 fi
222])
223
224dnl ACCONFIG TEMPLATE
225dnl #undef CCXX_CONFIG_H_
226dnl #undef HAVE_FOX_FX_H
227dnl END ACCONFIG