summaryrefslogtreecommitdiffstats
path: root/kpilot/conduits/configure.in.in
blob: c6a0d14378babcb4ef6166ccfb8b353e828025af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
dnl Configure.in.in for KPilot conduits.
dnl
dnl Copyright (C) 2000,2001 Adriaan de Groot
dnl Copyright (C) 2002 Reinhold Kainhofer
dnl
dnl This file is released under the terms of the Gnu General Public
dnl Licence (GPL) Version 2.




dnl ----------------------------------------------------------------------------
dnl
dnl                     checks for the MAL conduit
dnl
dnl ----------------------------------------------------------------------------

dnl
dnl
dnl Check to see if MAL header and library are available
dnl

dnl
dnl Questions and comments can be sent to kde-pim@kde.org
dnl
dnl This was copied and adapted from kabc's ldap configure.in.in


AC_DEFUN([KPILOT_CHECK_MAL],
[
AC_REQUIRE([KDE_CHECK_LIB64])
AC_REQUIRE([KPILOT_CHECK_PISOCK])

AC_MSG_CHECKING(for libmal (for KPilots MAL conduit))
AC_ARG_WITH(mal,
[  --with-mal=PATH         set path for libmal files @<:@default=check@:>@],
[ case "$withval" in
  yes)
    with_mal=CHECK
    ;;
  esac ],
[ with_mal=CHECK ]
)dnl

if test "x$with_mal" = "xCHECK" ; then
  with_mal=NOTFOUND
  search_incs_tmp="$kde_includes /usr/include /usr/local/include"
	dnl build the list of include dirs, both with and without libmal appended
	search_incs="";
	for idir in $search_incs_tmp; do
		search_incs="$search_incs $idir $idir/libmal"
	done
  AC_FIND_FILE(libmal.h, $search_incs, mal_incdir)
  if test -r $mal_incdir/libmal.h ; then
    test "x$mal_incdir" != "x/usr/include" && MAL_INCLUDE="-I$mal_incdir"
    with_mal=FOUND
  fi
  if test $with_mal = FOUND ; then
    with_mal=NOTFOUND
    for ext in la so sl a ; do
      AC_FIND_FILE(libmal.$ext, $kde_libraries $libdir /usr/lib$kdelibsuff /usr/local/lib$kdelibsuff $libdir/libmal /usr/lib/libmal /usr/local/lib/libmal,
        mal_libdir)
      if test -r $mal_libdir/libmal.$ext ; then
        if test "x$mal_libdir" != "x/usr/lib$kdelibsuff" ; then
          MAL_LIB="-L$mal_libdir "
          test "$USE_RPATH" = yes && MAL_RPATH="-R $mal_libdir"
        fi
        MAL_LIB="${MAL_LIB}-lmal"
        with_mal=FOUND
        break
      fi
    done
  fi
fi

case "$with_mal" in
no) AC_MSG_RESULT(no) ;;
NOTFOUND) AC_MSG_RESULT(searched but not found) ;;
*)
  if test "x$with_mal" = "xFOUND" ; then
    msg="incs=$mal_incdir libs=$mal_libdir"
  else
    msg="$with_mal"
    MAL_ROOT="$with_mal"
    if test "x$MAL_ROOT" != "x/usr" ; then
      MAL_INCLUDE="-I${MAL_ROOT}/include"
      MAL_LIB="-L${MAL_ROOT}/lib$kdelibsuff "
      if test "$USE_RPATH" = "yes" ; then
        MAL_RPATH="-R ${MAL_ROOT}/lib$kdelibsuff"
      fi
    fi
    MAL_LIB="${MAL_LIBS}-lmal"
  fi

  kde_save_LIBS="$LIBS"
  kde_save_CFLAGS="$CFLAGS"
  kde_save_CPPFLAGS="$CPPFLAGS"
  kde_save_LDFLAGS="$LDFLAGS"
  LIBS="$LIBS $PISOCK_LIB $MAL_LIB"
  CFLAGS="$CFLAGS $MAL_INCLUDE"
  CPPFLAGS="$CPPFLAGS $all_includes $PISOCK_INCLUDE $MAL_INCLUDE"
  LDFLAGS="$LDFLAGS $PISOCK_LDFLAGS $all_libraries"
  AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_TRY_LINK(dnl
  [
  #include <libmal.h>
  ],
  [
  PalmSyncInfo *psi;
  ],
  , with_mal=no
  )
  if test "$with_mal" = "no" ; then
    MAL_LIB="$MAL_LIB -ldl"
    LIBS="$LIBS $PISOCK_LIB $MAL_LIB"
    with_mal=yes
    AC_TRY_LINK(dnl
    [
    #include <libmal.h>
    ],
    [
    PalmSyncInfo *psi;
    ],
    , with_mal=no
    )
  fi
  if test "$with_mal" = "no" ; then
    MAL_INCLUDE=
    MAL_LIB=
    MAL_RPATH=
    AC_MSG_RESULT(no (but first try gave $msg))
  else
    AC_DEFINE(HAVE_LIBMAL, 1, [Define if you have MAL libraries])
		dnl check which version we have (pre 0.40 or >=0.40):
    AC_TRY_LINK(dnl
    [#include <libmal.h>],
    [
    PalmSyncInfo *psi;
		psi->httpProxy;
    ],
    , mal_version20=yes
    )
    if test "$mal_version20" = "yes" ; then
			AC_DEFINE(LIBMAL20, 1, [Define if we have the old libmal version (<0.40)])
		fi
    HAVE_LIBMAL=1
    AC_MSG_RESULT($msg)
  fi
  AC_LANG_RESTORE
  CFLAGS=$kde_save_CFLAGS
  CPPFLAGS=$kde_save_CPPFLAGS
  LIBS=$kde_save_LIBS
  LDFLAGS=$kde_save_LDFLAGS
  ;;
esac

AC_SUBST(MAL_INCLUDE)
AC_SUBST(MAL_LIB)
AC_SUBST(MAL_RPATH)

AM_CONDITIONAL(include_malconduit, test "$HAVE_LIBMAL" = 1)

])

dnl ----------------------------------------------------------------------------
dnl
dnl                     checks for the addressbook conduit
dnl
dnl ----------------------------------------------------------------------------

AC_DEFUN([KPILOT_CHECK_KABC],[HAVE_KABC=0
KDE_CHECK_HEADER(kresources/factory.h,HAVE_KABC=1,
	AC_MSG_WARN([KPILOT: Older kaddressbook version detected. No address book
	conduit will be compiled.]))
AM_CONDITIONAL(include_abc, test "$HAVE_KABC" = 1)
])

dnl ----------------------------------------------------------------------------
dnl
dnl                     checks for the notepad conduit
dnl
dnl ----------------------------------------------------------------------------

AC_DEFUN([KPILOT_CHECK_NOTEPAD],[HAVE_NOTEPAD=0
kpilot_save_cflags="$CPPFLAGS"
kpilot_save_ldflags="$LDFLAGS"

test -z "$PISOCK_INCLUDE" || CPPFLAGS="$CPPFLAGS $PISOCK_INCLUDE"
KDE_CHECK_HEADER(pi-notepad.h,HAVE_NOTEPAD=1,
	AC_MSG_WARN([KPILOT: No notepad.h for pilot-link. Your pilot-link is too old.]))

CPPFLAGS="$kpilot_save_cflags"
LDFLAGS="$kpilot_save_ldflags"
unset kpilot_save_cflags
unset kpilot_save_ldflags

AM_CONDITIONAL(include_notepad, test "$HAVE_NOTEPAD" = 1)
])

dnl ----------------------------------------------------------------------------
dnl
dnl                     checks for embedded language conduits
dnl
dnl ----------------------------------------------------------------------------

AC_DEFUN([KPILOT_CHECK_PERL],[HAVE_PERL=0
AC_MSG_CHECKING([for Perl embedding])
if perl -MExtUtils::Embed -e ccopts > /dev/null 2> /dev/null ; then
	PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts 2> /dev/null`
	PERL_LDFLAGS=`perl -MExtUtils::Embed -e ldopts 2> /dev/null`
	HAVE_PERL=1
	AC_MSG_RESULT(yes)
else
	PERL_CFLAGS=""
	PERL_LDFLAGS=""
	AC_MSG_RESULT(no)
fi
AC_SUBST(PERL_CFLAGS)
AC_SUBST(PERL_LDFLAGS)
AM_CONDITIONAL(include_perl, test "$HAVE_PERL" = 1)
])

AC_DEFUN([KPILOT_CHECK_PYTHON],[HAVE_PYTHON=0
AC_MSG_CHECKING([for Python embedding])
AM_CONDITIONAL(include_python, test "$HAVE_PYTHON" = 1)
AC_MSG_RESULT(N/A)
])

dnl ----------------------------------------------------------------------------
dnl
dnl                   actually call the checks
dnl
dnl ----------------------------------------------------------------------------

KPILOT_CHECK_MAL
KPILOT_CHECK_KABC
KPILOT_CHECK_PERL
KPILOT_CHECK_PYTHON
KPILOT_CHECK_NOTEPAD