1###   -*- autoconf -*-
2
3dnl    This file is part of the KDE libraries/packages
4dnl    Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
5dnl              (C) 1997,98,99 Stephan Kulow (coolo@kde.org)
6
7dnl    This file is free software; you can redistribute it and/or
8dnl    modify it under the terms of the GNU Library General Public
9dnl    License as published by the Free Software Foundation; either
10dnl    version 2 of the License, or (at your option) any later version.
11
12dnl    This library is distributed in the hope that it will be useful,
13dnl    but WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15dnl    Library General Public License for more details.
16
17dnl    You should have received a copy of the GNU Library General Public License
18dnl    along with this library; see the file COPYING.LIB.  If not, write to
19dnl    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20dnl    Boston, MA 02110-1301, USA.
21
22AC_DEFUN([KDE_CHECK_MICO],
23[
24AC_REQUIRE([KDE_CHECK_LIBDL])
25AC_REQUIRE([KDE_MISC_TESTS])
26AC_MSG_CHECKING(for MICO)
27
28if test -z "$MICODIR"; then
29    kde_micodir=/usr/local
30 else
31    kde_micodir="$MICODIR"
32fi
33
34AC_ARG_WITH(micodir,
35  [  --with-micodir=micodir  where mico is installed ],
36  kde_micodir=$withval,
37  kde_micodir=$kde_micodir
38)
39
40AC_CACHE_VAL(kde_cv_mico_incdir,
41[
42  mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include /opt/local/include $kde_extra_includes"
43AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir)
44
45])
46kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'`
47
48if test ! -r  $kde_micodir/include/CORBA.h; then
49  AC_MSG_ERROR([No CORBA.h found, specify another micodir])
50fi
51
52AC_MSG_RESULT($kde_micodir)
53
54MICO_INCLUDES=-I$kde_micodir/include
55AC_SUBST(MICO_INCLUDES)
56MICO_LDFLAGS=-L$kde_micodir/lib
57AC_SUBST(MICO_LDFLAGS)
58micodir=$kde_micodir
59AC_SUBST(micodir)
60
61AC_MSG_CHECKING([for MICO version])
62AC_CACHE_VAL(kde_cv_mico_version,
63[
64AC_LANG_C
65cat >conftest.$ac_ext <<EOF
66#include <stdio.h>
67#include <mico/version.h>
68int main() {
69
70   printf("MICO_VERSION=%s\n",MICO_VERSION);
71   return (0);
72}
73EOF
74ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest'
75if AC_TRY_EVAL(ac_compile); then
76  if eval `./conftest 2>&5`; then
77    kde_cv_mico_version=$MICO_VERSION
78  else
79    AC_MSG_ERROR([your system is not able to execute a small application to
80    find MICO version! Check $kde_micodir/include/mico/version.h])
81  fi
82else
83  AC_MSG_ERROR([your system is not able to compile a small application to
84  find MICO version! Check $kde_micodir/include/mico/version.h])
85fi
86])
87
88dnl installed MICO version
89mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'`
90mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
91mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'`
92
93if test "x$1" = "x"; then
94 req_version="2.3.0"
95else
96 req_version=$1
97fi
98
99dnl required MICO version
100req_v_maj=`echo $req_version | sed -e 's/^\(.*\)\..*\..*$/\1/'`
101req_v_mid=`echo $req_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
102req_v_min=`echo $req_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'`
103
104if test "$mico_v_maj" -lt "$req_v_maj" || \
105   ( test "$mico_v_maj" -eq "$req_v_maj" && \
106        test "$mico_v_mid" -lt "$req_v_mid" ) || \
107   ( test "$mico_v_mid" -eq "$req_v_mid" && \
108        test "$mico_v_min" -lt "$req_v_min" )
109
110then
111  AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $req_version \
112at least is required. You should upgrade MICO.])
113else
114  AC_MSG_RESULT([$kde_cv_mico_version (minimum version $req_version, ok)])
115fi
116
117LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBSOCKET $LIBDL"
118AC_SUBST(LIBMICO)
119if test -z "$IDL"; then
120  IDL='$(kde_bindir)/cuteidl'
121fi
122AC_SUBST(IDL)
123IDL_DEPENDENCIES='$(kde_includes)/CUTE.h'
124AC_SUBST(IDL_DEPENDENCIES)
125
126idldir="\$(includedir)/idl"
127AC_SUBST(idldir)
128
129])
130
131AC_DEFUN([KDE_CHECK_MINI_STL],
132[
133AC_REQUIRE([KDE_CHECK_MICO])
134
135AC_MSG_CHECKING(if we use mico's mini-STL)
136AC_CACHE_VAL(kde_cv_have_mini_stl,
137[
138AC_LANG_SAVE
139AC_LANG_CPLUSPLUS
140kde_save_cxxflags="$CXXFLAGS"
141CXXFLAGS="$CXXFLAGS $MICO_INCLUDES"
142AC_TRY_COMPILE(
143[
144#include <mico/config.h>
145],
146[
147#ifdef HAVE_MINI_STL
148#error "nothing"
149#endif
150],
151kde_cv_have_mini_stl=no,
152kde_cv_have_mini_stl=yes)
153CXXFLAGS="$kde_save_cxxflags"
154AC_LANG_RESTORE
155])
156
157if test "x$kde_cv_have_mini_stl" = "xyes"; then
158   AC_MSG_RESULT(yes)
159   $1
160else
161   AC_MSG_RESULT(no)
162   $2
163fi
164])
165
166])
167
168AC_DEFUN([KDE_CHECK_ANSI],
169[
170])
171
172AC_DEFUN([KDE_CHECK_INSURE],
173[
174  AC_ARG_ENABLE(insure, [  --enable-insure             use insure++ for debugging [default=no]],
175  [
176  if test $enableval = "no"; dnl
177	then ac_use_insure="no"
178	else ac_use_insure="yes"
179   fi
180  ], [ac_use_insure="no"])
181
182  AC_MSG_CHECKING(if we will use Insure++ to debug)
183  AC_MSG_RESULT($ac_use_insure)
184  if test "$ac_use_insure" = "yes"; dnl
185       then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "????
186   fi
187])
188
189AC_DEFUN([KDE_CHECK_NEWLIBS],
190[
191
192])
193