| 1 |
dnl $Id: configure.in,v 1.154 2004/06/28 10:13:09 deletek Exp $ |
|---|
| 2 |
|
|---|
| 3 |
AC_INIT([libgadu], [20050128.jggtrans.1], []) |
|---|
| 4 |
AC_CONFIG_SRCDIR([lib/libgadu.h]) |
|---|
| 5 |
AM_INIT_AUTOMAKE |
|---|
| 6 |
|
|---|
| 7 |
AC_PREREQ(2.50) |
|---|
| 8 |
AM_CONFIG_HEADER([config.h]) |
|---|
| 9 |
AC_DISABLE_SHARED |
|---|
| 10 |
AC_PROG_LIBTOOL |
|---|
| 11 |
|
|---|
| 12 |
AC_SUBST(CFLAGS_LIBGADU) |
|---|
| 13 |
AC_SUBST(LIBS_LIBGADU) |
|---|
| 14 |
AC_SUBST(OBJS) |
|---|
| 15 |
AC_SUBST(IOCTLD_OBJS) |
|---|
| 16 |
AC_SUBST(PC_REQUIRES) |
|---|
| 17 |
|
|---|
| 18 |
AC_SUBST(strip_ekg, "") |
|---|
| 19 |
AC_SUBST(strip_ioctld, "") |
|---|
| 20 |
AC_SUBST(strip_libgadu_so, "") |
|---|
| 21 |
|
|---|
| 22 |
AC_SUBST(ioctld, "") |
|---|
| 23 |
AC_SUBST(install_ioctld, "") |
|---|
| 24 |
|
|---|
| 25 |
AC_SUBST(shared, "") |
|---|
| 26 |
AC_SUBST(install_shared, "") |
|---|
| 27 |
|
|---|
| 28 |
AC_SUBST(lgadu, "") |
|---|
| 29 |
AC_SUBST(libgadu_a, "") |
|---|
| 30 |
|
|---|
| 31 |
AC_SUBST(static, "static") |
|---|
| 32 |
AC_SUBST(install_static, "install-static") |
|---|
| 33 |
|
|---|
| 34 |
AC_SUBST(ekg, "") |
|---|
| 35 |
AC_SUBST(install_ekg, "") |
|---|
| 36 |
AC_SUBST(clean_ekg, "") |
|---|
| 37 |
AC_SUBST(distclean_ekg, "") |
|---|
| 38 |
AC_SUBST(uninstall_ekg, "") |
|---|
| 39 |
AC_SUBST(dep_ekg, "") |
|---|
| 40 |
|
|---|
| 41 |
AC_SUBST(make_ekgwap, "") |
|---|
| 42 |
AC_SUBST(install_ekgwap, "") |
|---|
| 43 |
|
|---|
| 44 |
dnl |
|---|
| 45 |
dnl Zaczynamy testy... |
|---|
| 46 |
dnl |
|---|
| 47 |
|
|---|
| 48 |
AC_PROG_CC |
|---|
| 49 |
AC_PROG_CPP |
|---|
| 50 |
AC_PROG_INSTALL |
|---|
| 51 |
AC_PROG_LN_S |
|---|
| 52 |
AC_C_CONST |
|---|
| 53 |
|
|---|
| 54 |
AC_PATH_PROG(GMAKE, gmake, no) |
|---|
| 55 |
|
|---|
| 56 |
if test "x$GMAKE" = "xno"; then |
|---|
| 57 |
AC_PATH_PROG(MAKE, make, no) |
|---|
| 58 |
|
|---|
| 59 |
if test "x$MAKE" = "xno"; then |
|---|
| 60 |
AC_MSG_ERROR([make ]) |
|---|
| 61 |
fi |
|---|
| 62 |
else |
|---|
| 63 |
MAKE="$GMAKE" |
|---|
| 64 |
fi |
|---|
| 65 |
|
|---|
| 66 |
AC_CHECK_TOOL(AR, ar, no) |
|---|
| 67 |
|
|---|
| 68 |
if test "x$AR" = "xno"; then |
|---|
| 69 |
AC_MSG_ERROR([ar ]) |
|---|
| 70 |
fi |
|---|
| 71 |
|
|---|
| 72 |
AC_CHECK_TOOL(STRIP, strip, :) |
|---|
| 73 |
|
|---|
| 74 |
dnl |
|---|
| 75 |
dnl Tworzymy osobny plik lib/libgadu-config.h niezale�ny od autoconfa |
|---|
| 76 |
dnl z w�asn� przestrzeni� nazw (__GG_LIBGADU), �eby m�o spokojnie |
|---|
| 77 |
dnl w��czy� <libgadu.h> |
|---|
| 78 |
dnl |
|---|
| 79 |
|
|---|
| 80 |
mkdir -p lib |
|---|
| 81 |
|
|---|
| 82 |
AC_DEFUN([AC_LIBGADU_DEFINE], |
|---|
| 83 |
[ |
|---|
| 84 |
sed 's/#undef __GG_LIBGADU_$1/#define __GG_LIBGADU_$1/' < lib/libgadu-config.h > lib/libgadu-config.h- |
|---|
| 85 |
mv -f lib/libgadu-config.h- lib/libgadu-config.h |
|---|
| 86 |
]) |
|---|
| 87 |
|
|---|
| 88 |
AC_DEFUN([AC_LIBGADU_UNDEF], |
|---|
| 89 |
[ |
|---|
| 90 |
sed 's/#undef __GG_LIBGADU_$1.*/\/* & *\//' < lib/libgadu-config.h > lib/libgadu-config.h- |
|---|
| 91 |
mv -f lib/libgadu-config.h- lib/libgadu-config.h |
|---|
| 92 |
]) |
|---|
| 93 |
|
|---|
| 94 |
echo "/* Generated automatically by configure. Do not edit. */" > lib/libgadu-config.h |
|---|
| 95 |
cat ${srcdir}/lib/libgadu-config.h.in >> lib/libgadu-config.h |
|---|
| 96 |
|
|---|
| 97 |
dnl |
|---|
| 98 |
dnl Najpierw sprawdzamy te opcje, kt�s� wsp� dla libgadu i ekg. |
|---|
| 99 |
dnl |
|---|
| 100 |
|
|---|
| 101 |
AC_C_BIGENDIAN |
|---|
| 102 |
|
|---|
| 103 |
if test "x$ac_cv_c_bigendian" = "xyes"; then |
|---|
| 104 |
AC_LIBGADU_DEFINE([BIGENDIAN]) |
|---|
| 105 |
fi |
|---|
| 106 |
|
|---|
| 107 |
AC_NEED_STDINT_H |
|---|
| 108 |
|
|---|
| 109 |
if test "x$STDINT_H" = "x"; then |
|---|
| 110 |
cp stdint.h lib/libgadu-stdint.h |
|---|
| 111 |
STDINT_H=libgadu-stdint.h |
|---|
| 112 |
fi |
|---|
| 113 |
|
|---|
| 114 |
sed "s/#include <stdint.h>/#include <$STDINT_H>/" < lib/libgadu-config.h > lib/libgadu-config.h- |
|---|
| 115 |
mv -f lib/libgadu-config.h- lib/libgadu-config.h |
|---|
| 116 |
|
|---|
| 117 |
dnl SunOS |
|---|
| 118 |
AC_CHECK_LIB(nsl, t_accept, LIBS="$LIBS -lnsl") |
|---|
| 119 |
AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket") |
|---|
| 120 |
|
|---|
| 121 |
dnl BeOS |
|---|
| 122 |
|
|---|
| 123 |
AC_ARG_WITH(bind, |
|---|
| 124 |
[ --without-bind Disable linking with libbind when found]) |
|---|
| 125 |
|
|---|
| 126 |
if test "x$with_bind" != "xno"; then |
|---|
| 127 |
AC_CHECK_LIB(bind, __inet_addr, LIBS="$LIBS -lbind") |
|---|
| 128 |
fi |
|---|
| 129 |
|
|---|
| 130 |
dnl threadsafe |
|---|
| 131 |
AC_CHECK_FUNCS([gethostbyname_r], [AC_LIBGADU_DEFINE([HAVE_GETHOSTBYNAME_R])]) |
|---|
| 132 |
|
|---|
| 133 |
dnl inet_pton |
|---|
| 134 |
AC_CHECK_FUNCS(inet_pton) |
|---|
| 135 |
|
|---|
| 136 |
AC_MSG_CHECKING([for va_copy]) |
|---|
| 137 |
AC_TRY_LINK([#include <stdarg.h>], [va_list a, b; va_copy(a, b);], |
|---|
| 138 |
[ |
|---|
| 139 |
AC_MSG_RESULT([yes]) |
|---|
| 140 |
AC_LIBGADU_DEFINE([HAVE_VA_COPY]) |
|---|
| 141 |
], [ |
|---|
| 142 |
AC_MSG_RESULT([no]) |
|---|
| 143 |
]) |
|---|
| 144 |
|
|---|
| 145 |
AC_MSG_CHECKING([for __va_copy]) |
|---|
| 146 |
AC_TRY_LINK([#include <stdarg.h>], [va_list a, b; __va_copy(a, b);], |
|---|
| 147 |
[ |
|---|
| 148 |
AC_MSG_RESULT([yes]) |
|---|
| 149 |
AC_LIBGADU_DEFINE([HAVE___VA_COPY]) |
|---|
| 150 |
], [ |
|---|
| 151 |
AC_MSG_RESULT([no]) |
|---|
| 152 |
]) |
|---|
| 153 |
|
|---|
| 154 |
AC_ARG_ENABLE(debug, |
|---|
| 155 |
[ --disable-debug Compile without debugging support]) |
|---|
| 156 |
|
|---|
| 157 |
if test "x$enable_debug" = "xno"; then |
|---|
| 158 |
AC_MSG_WARN([--disable-debug is obsolete.]) |
|---|
| 159 |
fi |
|---|
| 160 |
|
|---|
| 161 |
dnl if test "x$enable_debug" = "xno"; then |
|---|
| 162 |
dnl CFLAGS="$CFLAGS -DGG_DEBUG_DISABLE" |
|---|
| 163 |
dnl CFLAGS_LIBGADU="$CFLAGS_LIBGADU -DGG_DEBUG_DISABLE" |
|---|
| 164 |
dnl strip_ekg="strip-ekg" |
|---|
| 165 |
dnl strip_ioctld="strip-ioctld" |
|---|
| 166 |
dnl strip_libgadu_so="strip-libgadu-so" |
|---|
| 167 |
dnl else |
|---|
| 168 |
dnl CFLAGS="$CFLAGS -g" |
|---|
| 169 |
dnl fi |
|---|
| 170 |
|
|---|
| 171 |
dnl |
|---|
| 172 |
dnl Jak� wersj�ibgadu kompilujemy? |
|---|
| 173 |
dnl |
|---|
| 174 |
|
|---|
| 175 |
AC_ARG_ENABLE(shared, |
|---|
| 176 |
[ --enable-shared Compile shared version of libgadu]) |
|---|
| 177 |
|
|---|
| 178 |
lib_shared_enabled=no |
|---|
| 179 |
|
|---|
| 180 |
if test "x$enable_shared" = "xyes"; then |
|---|
| 181 |
shared="shared" |
|---|
| 182 |
install_shared="install-shared" |
|---|
| 183 |
lib_shared_enabled=yes |
|---|
| 184 |
fi |
|---|
| 185 |
|
|---|
| 186 |
AC_ARG_ENABLE(static, |
|---|
| 187 |
[ --disable-static Don't compile static version of libgadu |
|---|
| 188 |
|
|---|
| 189 |
Optional ekg Features:]) |
|---|
| 190 |
|
|---|
| 191 |
lib_static_enabled=yes |
|---|
| 192 |
|
|---|
| 193 |
if test "x$enable_static" = "xno"; then |
|---|
| 194 |
static="" |
|---|
| 195 |
install_static="" |
|---|
| 196 |
lib_static_enabled=no |
|---|
| 197 |
fi |
|---|
| 198 |
|
|---|
| 199 |
if test "x$enable_static" = "xno" -a "x$enable_shared" != "xyes"; then |
|---|
| 200 |
AC_MSG_ERROR([You must choose either static or shared version of libgadu.]) |
|---|
| 201 |
fi |
|---|
| 202 |
|
|---|
| 203 |
AC_ARG_ENABLE(dynamic, |
|---|
| 204 |
[ --enable-dynamic Link ekg dynamically with libgadu]) |
|---|
| 205 |
|
|---|
| 206 |
dnl |
|---|
| 207 |
dnl Sprawd�my, jak� wersj�snprintf() dostajemy. Dodatkowa opcja jest |
|---|
| 208 |
dnl dla crosskompilacji, bo nie mo�na wtedy korzysta� AC_TRY_RUN(). |
|---|
| 209 |
dnl |
|---|
| 210 |
|
|---|
| 211 |
AC_ARG_WITH(c99-vsnprintf, |
|---|
| 212 |
[ --with-c99-vsnprintf Target system has C99-compatible vsnprintf()]) |
|---|
| 213 |
|
|---|
| 214 |
if test "x$with_c99_vsnprintf" = "xyes"; then |
|---|
| 215 |
AC_LIBGADU_DEFINE([HAVE_C99_VSNPRINTF]) |
|---|
| 216 |
fi |
|---|
| 217 |
|
|---|
| 218 |
if test "x$with_c99_vsnprintf" = "x"; then |
|---|
| 219 |
AC_MSG_CHECKING([for C99-compatible vsnprintf()]) |
|---|
| 220 |
AC_TRY_RUN( |
|---|
| 221 |
[ |
|---|
| 222 |
#include <stdio.h> |
|---|
| 223 |
int main() |
|---|
| 224 |
{ |
|---|
| 225 |
char tmp; |
|---|
| 226 |
return (snprintf(&tmp, sizeof(tmp), "test") != 4); |
|---|
| 227 |
} |
|---|
| 228 |
], [ |
|---|
| 229 |
AC_MSG_RESULT([yes]) |
|---|
| 230 |
AC_LIBGADU_DEFINE([HAVE_C99_VSNPRINTF]) |
|---|
| 231 |
], [ |
|---|
| 232 |
AC_MSG_RESULT([no]) |
|---|
| 233 |
]) |
|---|
| 234 |
fi |
|---|
| 235 |
|
|---|
| 236 |
dnl |
|---|
| 237 |
dnl Resolver libgadu oparty na pthread |
|---|
| 238 |
dnl |
|---|
| 239 |
|
|---|
| 240 |
AC_ARG_WITH(pthread, |
|---|
| 241 |
[ --with-pthread Use pthread in resolver]) |
|---|
| 242 |
|
|---|
| 243 |
if test "x$with_pthread" = "xyes"; then |
|---|
| 244 |
ACX_PTHREAD( |
|---|
| 245 |
[ |
|---|
| 246 |
dnl workaround dla pkconfiga |
|---|
| 247 |
if test "x$PTHREAD_CFLAGS" = "x-pthread"; then |
|---|
| 248 |
PTHREAD_LIBS="$PTHREAD_LIBS -pthread" |
|---|
| 249 |
fi |
|---|
| 250 |
|
|---|
| 251 |
LIBS="$PTHREAD_LIBS $LIBS" |
|---|
| 252 |
CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
|---|
| 253 |
CFLAGS_LIBGADU="$CFLAGS_LIBGADU $PTHREAD_CFLAGS" |
|---|
| 254 |
CC="$PTHREAD_CC" |
|---|
| 255 |
have_pthread=yes |
|---|
| 256 |
|
|---|
| 257 |
AC_LIBGADU_DEFINE([HAVE_PTHREAD]) |
|---|
| 258 |
], [ |
|---|
| 259 |
AC_MSG_ERROR([Your system is not supporting pthreads]) |
|---|
| 260 |
]) |
|---|
| 261 |
fi |
|---|
| 262 |
|
|---|
| 263 |
dnl |
|---|
| 264 |
dnl Sprawdzamy, czy jest ,,long long'' na potrzeby oblicze�as�CC |
|---|
| 265 |
dnl |
|---|
| 266 |
|
|---|
| 267 |
AC_MSG_CHECKING([for long long]) |
|---|
| 268 |
|
|---|
| 269 |
AC_TRY_COMPILE([], |
|---|
| 270 |
[ |
|---|
| 271 |
long long a = 1LL; |
|---|
| 272 |
unsigned long long b = 1LL; |
|---|
| 273 |
], [ |
|---|
| 274 |
AC_MSG_RESULT([yes]) |
|---|
| 275 |
AC_LIBGADU_DEFINE([HAVE_LONG_LONG]) |
|---|
| 276 |
]) |
|---|
| 277 |
|
|---|
| 278 |
dnl |
|---|
| 279 |
dnl Sprawdzamy OpenSSL |
|---|
| 280 |
dnl |
|---|
| 281 |
|
|---|
| 282 |
AC_CHECK_OPENSSL |
|---|
| 283 |
|
|---|
| 284 |
if test "x$have_openssl" = "xyes"; then |
|---|
| 285 |
OBJS="$OBJS simlite.o" |
|---|
| 286 |
LDFLAGS="$OPENSSL_LIBS $LDFLAGS" |
|---|
| 287 |
LIBS_LIBGADU="$LIBS_LIBGADU $OPENSSL_LIBS" |
|---|
| 288 |
CFLAGS="$CFLAGS $OPENSSL_INCLUDES" |
|---|
| 289 |
CFLAGS_LIBGADU="$CFLAGS_LIBGADU $OPENSSL_INCLUDES" |
|---|
| 290 |
PC_REQUIRES="$PC_REQUIRES openssl" |
|---|
| 291 |
AC_LIBGADU_DEFINE([HAVE_OPENSSL]) |
|---|
| 292 |
fi |
|---|
| 293 |
|
|---|
| 294 |
dnl |
|---|
| 295 |
dnl Zachowujemy opcje dla libgadu |
|---|
| 296 |
dnl |
|---|
| 297 |
|
|---|
| 298 |
LIBS_LIBGADU="$LIBS_LIBGADU $LIBS" |
|---|
| 299 |
|
|---|
| 300 |
|
|---|
| 301 |
AC_CONFIG_FILES(Makefile lib/Makefile lib/libgadu.pc) |
|---|
| 302 |
|
|---|
| 303 |
AC_OUTPUT |
|---|
| 304 |
|
|---|
| 305 |
echo |
|---|
| 306 |
echo "configured options:" |
|---|
| 307 |
|
|---|
| 308 |
if test "x$lib_static_enabled" = "xyes"; then |
|---|
| 309 |
if test "x$lib_static_default" = "xyes"; then |
|---|
| 310 |
echo " - static libgadu: enabled (default)" |
|---|
| 311 |
else |
|---|
| 312 |
echo " - static libgadu: enabled" |
|---|
| 313 |
fi |
|---|
| 314 |
else |
|---|
| 315 |
echo " - static libgadu: disabled" |
|---|
| 316 |
fi |
|---|
| 317 |
|
|---|
| 318 |
if test "x$lib_shared_enabled" = "xyes"; then |
|---|
| 319 |
if test "x$lib_shared_default" = "xyes"; then |
|---|
| 320 |
echo " - shared libgadu: enabled (default)" |
|---|
| 321 |
else |
|---|
| 322 |
echo " - shared libgadu: enabled" |
|---|
| 323 |
fi |
|---|
| 324 |
else |
|---|
| 325 |
echo " - shared libgadu: disabled" |
|---|
| 326 |
fi |
|---|
| 327 |
|
|---|
| 328 |
|
|---|