acinclude.m4 19 KB
Newer Older
1 2 3 4
# Configure paths for libogg
# Jack Moffitt <jack@icecast.org> 10-21-2000
# Shamelessly stolen from Owen Taylor and Manish Singh

5
dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
6 7
dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
dnl
8
AC_DEFUN([XIPH_PATH_OGG],
9 10 11
[dnl 
dnl Get the cflags and libraries
dnl
12 13 14 15
AC_ARG_WITH(ogg,AC_HELP_STRING([--with-ogg=PFX],[Prefix where libogg is installed (optional)]), ogg_prefix="$withval", ogg_prefix="")
AC_ARG_WITH(ogg-libraries,AC_HELP_STRING([--with-ogg-libraries=DIR],[Directory where libogg library is installed (optional)]), ogg_libraries="$withval", ogg_libraries="")
AC_ARG_WITH(ogg-includes,AC_HELP_STRING([--with-ogg-includes=DIR],[Directory where libogg header files are installed (optional)]), ogg_includes="$withval", ogg_includes="")
AC_ARG_ENABLE(oggtest,AC_HELP_STRING([--disable-oggtest],[Do not try to compile and run a test Ogg program]),, enable_oggtest=yes)
16

17 18
  if test "x$ogg_libraries" != "x" ; then
    OGG_LIBS="-L$ogg_libraries"
19 20
  elif test "x$ogg_prefix" = "xno" || test "x$ogg_prefix" = "xyes" ; then
    OGG_LIBS=""
21
  elif test "x$ogg_prefix" != "x" ; then
22
    OGG_LIBS="-L$ogg_prefix/lib"
23
  elif test "x$prefix" != "xNONE" ; then
24
    OGG_LIBS="-L$prefix/lib"
25 26
  fi

27 28 29
  if test "x$ogg_prefix" != "xno" ; then
    OGG_LIBS="$OGG_LIBS -logg"
  fi
30

31 32
  if test "x$ogg_includes" != "x" ; then
    OGG_CFLAGS="-I$ogg_includes"
33 34
  elif test "x$ogg_prefix" = "xno" || test "x$ogg_prefix" = "xyes" ; then
    OGG_CFLAGS=""
35 36
  elif test "x$ogg_prefix" != "x" ; then
    OGG_CFLAGS="-I$ogg_prefix/include"
37
  elif test "x$prefix" != "xNONE"; then
38 39 40
    OGG_CFLAGS="-I$prefix/include"
  fi

41
  AC_MSG_CHECKING(for Ogg)
42 43 44 45 46 47
  if test "x$ogg_prefix" = "xno" ; then
    no_ogg="disabled"
    enable_oggtest="no"
  else
    no_ogg=""
  fi
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


  if test "x$enable_oggtest" = "xyes" ; then
    ac_save_CFLAGS="$CFLAGS"
    ac_save_LIBS="$LIBS"
    CFLAGS="$CFLAGS $OGG_CFLAGS"
    LIBS="$LIBS $OGG_LIBS"
dnl
dnl Now check if the installed Ogg is sufficiently new.
dnl
      rm -f conf.oggtest
      AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ogg/ogg.h>

int main ()
{
  system("touch conf.oggtest");
  return 0;
}

],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
       CFLAGS="$ac_save_CFLAGS"
       LIBS="$ac_save_LIBS"
  fi

76 77 78 79
  if test "x$no_ogg" = "xdisabled" ; then
     AC_MSG_RESULT(no)
     ifelse([$2], , :, [$2])
  elif test "x$no_ogg" = "x" ; then
80
     AC_MSG_RESULT(yes)
81
     ifelse([$1], , :, [$1])
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
  else
     AC_MSG_RESULT(no)
     if test -f conf.oggtest ; then
       :
     else
       echo "*** Could not run Ogg test program, checking why..."
       CFLAGS="$CFLAGS $OGG_CFLAGS"
       LIBS="$LIBS $OGG_LIBS"
       AC_TRY_LINK([
#include <stdio.h>
#include <ogg/ogg.h>
],     [ return 0; ],
       [ echo "*** The test program compiled, but did not run. This usually means"
       echo "*** that the run-time linker is not finding Ogg or finding the wrong"
       echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
       echo "*** is required on your system"
       echo "***"
       echo "*** If you have an old version installed, it is best to remove it, although"
       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
       [ echo "*** The test program failed to compile or link. See the file config.log for the"
       echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
       echo "*** or that you have moved Ogg since it was installed. In the latter case, you"
       echo "*** may want to edit the ogg-config script: $OGG_CONFIG" ])
       CFLAGS="$ac_save_CFLAGS"
       LIBS="$ac_save_LIBS"
     fi
     OGG_CFLAGS=""
     OGG_LIBS=""
     ifelse([$2], , :, [$2])
  fi
  AC_SUBST(OGG_CFLAGS)
  AC_SUBST(OGG_LIBS)
  rm -f conf.oggtest
])

# Configure paths for libvorbis
# Jack Moffitt <jack@icecast.org> 10-21-2000
# Shamelessly stolen from Owen Taylor and Manish Singh

123
dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
124 125
dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
dnl
126
AC_DEFUN([XIPH_PATH_VORBIS],
127 128 129
[dnl 
dnl Get the cflags and libraries
dnl
130 131 132 133
AC_ARG_WITH(vorbis,AC_HELP_STRING([--with-vorbis=PFX],[Prefix where libvorbis is installed (optional)]), vorbis_prefix="$withval", vorbis_prefix="")
AC_ARG_WITH(vorbis-libraries,AC_HELP_STRING([--with-vorbis-libraries=DIR],[Directory where libvorbis library is installed (optional)]), vorbis_libraries="$withval", vorbis_libraries="")
AC_ARG_WITH(vorbis-includes,AC_HELP_STRING([--with-vorbis-includes=DIR],[Directory where libvorbis header files are installed (optional)]), vorbis_includes="$withval", vorbis_includes="")
AC_ARG_ENABLE(vorbistest,AC_HELP_STRING([--disable-vorbistest],[Do not try to compile and run a test Vorbis program]),, enable_vorbistest=yes)
134

135 136
  if test "x$vorbis_libraries" != "x" ; then
    VORBIS_LIBS="-L$vorbis_libraries"
137 138
  elif test "x$vorbis_prefix" = "xno" || test "x$vorbis_prefix" = "xyes" ; then
    VORBIS_LIBS=""
139 140
  elif test "x$vorbis_prefix" != "x" ; then
    VORBIS_LIBS="-L$vorbis_prefix/lib"
141
  elif test "x$prefix" != "xNONE"; then
142
    VORBIS_LIBS="-L$prefix/lib"
143 144
  fi

145 146
  VORBISFILE_LIBS="$VORBIS_LIBS -lvorbisfile"
  VORBISENC_LIBS="$VORBIS_LIBS -lvorbisenc"
147 148 149
  if test "x$vorbis_prefix" != "xno" ; then
    VORBIS_LIBS="$VORBIS_LIBS -lvorbis"
  fi
150

151 152
  if test "x$vorbis_includes" != "x" ; then
    VORBIS_CFLAGS="-I$vorbis_includes"
153 154
  elif test "x$vorbis_prefix" = "xno" || test "x$vorbis_prefix" = "xyes" ; then
    VORBIS_CFLAGS=""
155 156 157 158 159 160
  elif test "x$vorbis_prefix" != "x" ; then
    VORBIS_CFLAGS="-I$vorbis_prefix/include"
  elif test "x$prefix" != "xNONE"; then
    VORBIS_CFLAGS="-I$prefix/include"
  fi

161 162 163 164 165 166
  xiph_saved_LIBS="$LIBS"
  LIBS=""
  AC_SEARCH_LIBS(cos, m, [VORBIS_LIBS="$VORBIS_LIBS $LIBS"], [
    AC_MSG_WARN([cos() not found in math library, vorbis installation may not work])
  ])
  LIBS="$xiph_saved_LIBS"
167

168
  AC_MSG_CHECKING(for Vorbis)
169 170 171 172 173 174
  if test "x$vorbis_prefix" = "xno" ; then
    no_vorbis="disabled"
    enable_vorbistest="no"
  else
    no_vorbis=""
  fi
175 176 177 178 179


  if test "x$enable_vorbistest" = "xyes" ; then
    ac_save_CFLAGS="$CFLAGS"
    ac_save_LIBS="$LIBS"
180
    CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
    LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
dnl
dnl Now check if the installed Vorbis is sufficiently new.
dnl
      rm -f conf.vorbistest
      AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vorbis/codec.h>

int main ()
{
  system("touch conf.vorbistest");
  return 0;
}

],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
       CFLAGS="$ac_save_CFLAGS"
       LIBS="$ac_save_LIBS"
  fi

203 204 205 206
  if test "x$no_vorbis" = "xdisabled" ; then
     AC_MSG_RESULT(no)
     ifelse([$2], , :, [$2])
  elif test "x$no_vorbis" = "x" ; then
207
     AC_MSG_RESULT(yes)
208
     ifelse([$1], , :, [$1])
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
  else
     AC_MSG_RESULT(no)
     if test -f conf.vorbistest ; then
       :
     else
       echo "*** Could not run Vorbis test program, checking why..."
       CFLAGS="$CFLAGS $VORBIS_CFLAGS"
       LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
       AC_TRY_LINK([
#include <stdio.h>
#include <vorbis/codec.h>
],     [ return 0; ],
       [ echo "*** The test program compiled, but did not run. This usually means"
       echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
       echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
       echo "*** is required on your system"
       echo "***"
       echo "*** If you have an old version installed, it is best to remove it, although"
       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
       [ echo "*** The test program failed to compile or link. See the file config.log for the"
       echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
       echo "*** or that you have moved Vorbis since it was installed." ])
       CFLAGS="$ac_save_CFLAGS"
       LIBS="$ac_save_LIBS"
     fi
     VORBIS_CFLAGS=""
     VORBIS_LIBS=""
238 239
     VORBISFILE_LIBS=""
     VORBISENC_LIBS=""
240 241 242 243
     ifelse([$2], , :, [$2])
  fi
  AC_SUBST(VORBIS_CFLAGS)
  AC_SUBST(VORBIS_LIBS)
244 245
  AC_SUBST(VORBISFILE_LIBS)
  AC_SUBST(VORBISENC_LIBS)
246 247
  rm -f conf.vorbistest
])
Jack Moffitt's avatar
Jack Moffitt committed
248 249 250 251 252 253

# ao.m4
# Configure paths for libao
# Jack Moffitt <jack@icecast.org> 10-21-2000
# Shamelessly stolen from Owen Taylor and Manish Singh

254
dnl XIPH_PATH_AO([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
Jack Moffitt's avatar
Jack Moffitt committed
255 256
dnl Test for libao, and define AO_CFLAGS and AO_LIBS
dnl
257
AC_DEFUN([XIPH_PATH_AO],
Jack Moffitt's avatar
Jack Moffitt committed
258 259 260
[dnl 
dnl Get the cflags and libraries
dnl
261 262 263 264
AC_ARG_WITH(ao,AC_HELP_STRING([--with-ao=PFX],[Prefix where libao is installed (optional)]), ao_prefix="$withval", ao_prefix="")
AC_ARG_WITH(ao-libraries,AC_HELP_STRING([--with-ao-libraries=DIR],[Directory where libao library is installed (optional)]), ao_libraries="$withval", ao_libraries="")
AC_ARG_WITH(ao-includes,AC_HELP_STRING([--with-ao-includes=DIR],[Directory where libao header files are installed (optional)]), ao_includes="$withval", ao_includes="")
AC_ARG_ENABLE(aotest,AC_HELP_STRING([--disable-aotest],[Do not try to compile and run a test ao program]),, enable_aotest=yes)
Jack Moffitt's avatar
Jack Moffitt committed
265

266 267 268 269
  if test "x$ao_prefix" != "xno"
  then
    if test "x$ao_libraries" != "x" ; then
      AO_LIBS="-L$ao_libraries"
270 271
  elif test "x$ao_prefix" = "xno" || test "x$ao_prefix" = "xyes" ; then
    AO_LIBS=""
272 273 274 275 276 277 278 279
    elif test "x$ao_prefix" != "x" -a "x$ao_prefix" != "xyes"; then
      AO_LIBS="-L$ao_prefix/lib"
    elif test "x$prefix" != "xNONE"; then
      AO_LIBS="-L$prefix/lib"
    fi

    if test "x$ao_includes" != "x" ; then
      AO_CFLAGS="-I$ao_includes"
280 281
  elif test "x$ao_prefix" = "xno" || test "x$ao_prefix" = "xyes" ; then
    AO_CFLAGS=""
282 283 284 285 286 287 288 289 290 291 292 293
    elif test "x$ao_prefix" != "x" -a "x$ao_prefix" != "xyes"; then
      AO_CFLAGS="-I$ao_prefix/include"
    elif test "x$prefix" != "xNONE"; then
      AO_CFLAGS="-I$prefix/include"
    fi

    # see where dl* and friends live
    AC_CHECK_FUNCS(dlopen, [AO_DL_LIBS=""], [
      AC_CHECK_LIB(dl, dlopen, [AO_DL_LIBS="-ldl"], [
        AC_MSG_WARN([could not find dlopen() needed by libao sound drivers
        your system may not be supported.])
      ])
294 295
    ])

296
  if test "x$ao_prefix" != "xno" ; then
297
    AO_LIBS="$AO_LIBS -lao $AO_DL_LIBS"
298
  fi
Jack Moffitt's avatar
Jack Moffitt committed
299

300
    AC_MSG_CHECKING(for ao)
301 302 303 304
  if test "x$ao_prefix" = "xno" ; then
    no_ao="disabled"
    enable_aotest="no"
  else
305
    no_ao=""
306
  fi
Jack Moffitt's avatar
Jack Moffitt committed
307 308


309 310 311 312 313
    if test "x$enable_aotest" = "xyes" ; then
      ac_save_CFLAGS="$CFLAGS"
      ac_save_LIBS="$LIBS"
      CFLAGS="$CFLAGS $AO_CFLAGS"
      LIBS="$LIBS $AO_LIBS"
Jack Moffitt's avatar
Jack Moffitt committed
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
dnl
dnl Now check if the installed ao is sufficiently new.
dnl
      rm -f conf.aotest
      AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ao/ao.h>

int main ()
{
  system("touch conf.aotest");
  return 0;
}

],, no_ao=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
       CFLAGS="$ac_save_CFLAGS"
       LIBS="$ac_save_LIBS"
333 334
    fi

335 336 337 338
    if test "x$no_ao" = "xdisabled" ; then
       AC_MSG_RESULT(no)
       ifelse([$2], , :, [$2])
    elif test "x$no_ao" = "x" ; then
339
       AC_MSG_RESULT(yes)
340
       ifelse([$1], , :, [$1])
341 342 343 344 345 346 347 348
    else
       AC_MSG_RESULT(no)
       if test -f conf.aotest ; then
         :
       else
         echo "*** Could not run ao test program, checking why..."
         CFLAGS="$CFLAGS $AO_CFLAGS"
         LIBS="$LIBS $AO_LIBS"
Jack Moffitt's avatar
Jack Moffitt committed
349 350 351
       AC_TRY_LINK([
#include <stdio.h>
#include <ao/ao.h>
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
],       [ return 0; ],
         [ echo "*** The test program compiled, but did not run. This usually means"
         echo "*** that the run-time linker is not finding ao or finding the wrong"
         echo "*** version of ao. If it is not finding ao, you'll need to set your"
         echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
         echo "*** to the installed location  Also, make sure you have run ldconfig if that"
         echo "*** is required on your system"
         echo "***"
         echo "*** If you have an old version installed, it is best to remove it, although"
         echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
         [ echo "*** The test program failed to compile or link. See the file config.log for the"
         echo "*** exact error that occured. This usually means ao was incorrectly installed"
         echo "*** or that you have moved ao since it was installed." ])
         CFLAGS="$ac_save_CFLAGS"
         LIBS="$ac_save_LIBS"
       fi
       AO_CFLAGS=""
       AO_LIBS=""
       ifelse([$2], , :, [$2])
    fi
    AC_SUBST(AO_CFLAGS)
    AC_SUBST(AO_LIBS)
    rm -f conf.aotest
Jack Moffitt's avatar
Jack Moffitt committed
375 376
  fi
])
377

378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446
dnl This macros shamelessly stolen from
dnl http://gcc.gnu.org/ml/gcc-bugs/2001-06/msg01398.html.
dnl Written by Bruno Haible.

AC_DEFUN([AM_ICONV],
[
  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
  dnl those with the standalone portable GNU libiconv installed).

  AC_ARG_WITH([libiconv-prefix],
[  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
    for dir in `echo "$withval" | tr : ' '`; do
      if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
      if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
    done
   ])

  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
    am_cv_func_iconv="no, consider installing GNU libiconv"
    am_cv_lib_iconv=no
    AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
      [iconv_t cd = iconv_open("","");
       iconv(cd,NULL,NULL,NULL,NULL);
       iconv_close(cd);],
      am_cv_func_iconv=yes)
    if test "$am_cv_func_iconv" != yes; then
      am_save_LIBS="$LIBS"
      LIBS="$LIBS -liconv"
      AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
        [iconv_t cd = iconv_open("","");
         iconv(cd,NULL,NULL,NULL,NULL);
         iconv_close(cd);],
        am_cv_lib_iconv=yes
        am_cv_func_iconv=yes)
      LIBS="$am_save_LIBS"
    fi
  ])
  if test "$am_cv_func_iconv" = yes; then
    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
    AC_MSG_CHECKING([for iconv declaration])
    AC_CACHE_VAL(am_cv_proto_iconv, [
      AC_TRY_COMPILE([
#include <stdlib.h>
#include <iconv.h>
extern
#ifdef __cplusplus
"C"
#endif
#if defined(__STDC__) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
#else
size_t iconv();
#endif
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
    AC_MSG_RESULT([$]{ac_t:-
         }[$]am_cv_proto_iconv)
    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
      [Define as const if the declaration of iconv() needs const.])
  fi
  LIBICONV=
  if test "$am_cv_lib_iconv" = yes; then
    LIBICONV="-liconv"
  fi
  AC_SUBST(LIBICONV)
])
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462

dnl From Bruno Haible.
dnl
AC_DEFUN([AM_LANGINFO_CODESET],
[
  AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
    [AC_TRY_LINK([#include <langinfo.h>],
      [char* cs = nl_langinfo(CODESET);],
      am_cv_langinfo_codeset=yes,
      am_cv_langinfo_codeset=no)
    ])
  if test $am_cv_langinfo_codeset = yes; then
    AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
  fi
])
463 464 465 466

dnl AM_PATH_CURL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for libcurl, and define CURL_CFLAGS and CURL_LIBS
dnl
467
AC_DEFUN([AM_PATH_CURL],
468 469 470 471 472 473 474 475
[dnl 
dnl Get the cflags and libraries
dnl
AC_ARG_WITH(curl,[  --with-curl=PFX   Prefix where libcurl is installed (optional)], curl_prefix="$withval", curl_prefix="")
AC_ARG_WITH(curl-libraries,[  --with-curl-libraries=DIR   Directory where libcurl library is installed (optional)], curl_libraries="$withval", curl_libraries="")
AC_ARG_WITH(curl-includes,[  --with-curl-includes=DIR   Directory where libcurl header files are installed (optional)], curl_includes="$withval", curl_includes="")
AC_ARG_ENABLE(curltest, [  --disable-curltest       Do not try to compile and run a test libcurl program],, enable_curltest=yes)

Segher Boessenkool's avatar
Segher Boessenkool committed
476 477
if test "x$curl_prefix" != "xno" ; then

478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527
  if test "x$curl_libraries" != "x" ; then
    CURL_LIBS="-L$curl_libraries"
  elif test "x$curl_prefix" != "x" ; then
    CURL_LIBS="-L$curl_prefix/lib"
  elif test "x$prefix" != "xNONE" ; then
    CURL_LIBS="-L$prefix/lib"
  fi

  CURL_LIBS="$CURL_LIBS -lcurl"

  if test "x$curl_includes" != "x" ; then
    CURL_CFLAGS="-I$curl_includes"
  elif test "x$curl_prefix" != "x" ; then
    CURL_CFLAGS="-I$curl_prefix/include"
  elif test "x$prefix" != "xNONE"; then
    CURL_CFLAGS="-I$prefix/include"
  fi

  AC_MSG_CHECKING(for libcurl)
  no_curl=""


  if test "x$enable_curltest" = "xyes" ; then
    ac_save_CFLAGS="$CFLAGS"
    ac_save_LIBS="$LIBS"
    CFLAGS="$CFLAGS $CURL_CFLAGS"
    LIBS="$LIBS $CURL_LIBS"
dnl
dnl Now check if the installed libcurl is sufficiently new.
dnl
      rm -f conf.curltest
      AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>

int main ()
{
  system("touch conf.curltest");
  return 0;
}

],, no_curl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
       CFLAGS="$ac_save_CFLAGS"
       LIBS="$ac_save_LIBS"
  fi

  if test "x$no_curl" = "x" ; then
     AC_MSG_RESULT(yes)
528
     AC_DEFINE(HAVE_CURL, 1, [Define if you have libcurl.])
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560
     ifelse([$1], , :, [$1])     
  else
     AC_MSG_RESULT(no)
     if test -f conf.curltest ; then
       :
     else
       echo "*** Could not run libcurl test program, checking why..."
       CFLAGS="$CFLAGS $CURL_CFLAGS"
       LIBS="$LIBS $CURL_LIBS"
       AC_TRY_LINK([
#include <stdio.h>
#include <curl/curl.h>
],     [ return 0; ],
       [ echo "*** The test program compiled, but did not run. This usually means"
       echo "*** that the run-time linker is not finding libcurl or finding the wrong"
       echo "*** version of libcurl. If it is not finding libcurl, you'll need to set your"
       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
       echo "*** is required on your system"
       echo "***"
       echo "*** If you have an old version installed, it is best to remove it, although"
       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
       [ echo "*** The test program failed to compile or link. See the file config.log for the"
       echo "*** exact error that occured. This usually means libcurl was incorrectly installed"
       echo "*** or that you have moved libcurl since it was installed." ])
       CFLAGS="$ac_save_CFLAGS"
       LIBS="$ac_save_LIBS"
     fi
     CURL_CFLAGS=""
     CURL_LIBS=""
     ifelse([$2], , :, [$2])
  fi
Segher Boessenkool's avatar
Segher Boessenkool committed
561 562 563 564
else
  CURL_CFLAGS=""
  CURL_LIBS=""
fi
565 566 567 568
  AC_SUBST(CURL_CFLAGS)
  AC_SUBST(CURL_LIBS)
  rm -f conf.curltest
])