Ignore:
Timestamp:
Aug 10, 2005, 7:24:59 AM (15 years ago)
Author:
pguyot (Paul Guyot)
Message:

Clean up autoconf macros.
Test the presence of libcurl.
Compilation & link flags for libcurl.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/aclocal.m4

    r13352 r13443  
    375375])
    376376
     377# OD_TCL_PACKAGE
     378#       Determine if a Tcl package is present.
     379#
     380# Arguments:
     381#       Package name (may include the version)
     382#
     383# Syntax:
     384#   OD_TCL_PACKAGE (package, [action-if-found], [action-if-not-found])
     385#
     386# Requires:
     387#       TCLSH must be set
     388#
     389# Results:
     390#       Execute action-if-found or action-if-not-found
     391#---------------------------------------
     392AC_DEFUN([OD_TCL_PACKAGE],[
     393        AC_MSG_CHECKING([for Tcl $1 package])
     394        package_present=`echo 'if {[[catch {package require $1}]]} {puts -nonewline 0} else {puts -nonewline 1}' | $TCLSH`
     395        AS_IF([test "$package_present" = "1"], [$2], [$3])[]
     396])
     397
    377398# OD_TCL_THREAD_SUPPORT
    378 #       Determine if thread support is available in tclsh and if thread package is
    379 #   installed.
     399#       Determine if thread support is available in tclsh.
    380400#
    381401# Arguments:
     
    386406#
    387407# Results:
    388 #
    389 #   Fail if thread support isn't available.
    390 #
    391 #       Set the following vars:
    392 #               with_tclthread
     408#   Fails if thread support isn't available.
    393409#---------------------------------------
    394410AC_DEFUN([OD_TCL_THREAD_SUPPORT],[
    395     AC_ARG_WITH(
    396                 tclthread,
    397                 [  --with-tclthread        install included thread package.],
    398                 [with_tclthread="yes"],
    399                         [with_tclthread="no"])
    400 
    401411        AC_MSG_CHECKING([whether tclsh was compiled with threads])
    402412        tcl_threadenabled=`echo 'puts -nonewline [[info exists tcl_platform(threaded)]]' | $TCLSH`
     
    407417                AC_MSG_ERROR([tcl wasn't compiled with threads enabled])
    408418        fi
    409        
    410         if test "x$with_tclthread" = "xno" ; then
    411                 AC_MSG_CHECKING([for Tcl thread package])
    412                 tcl_present=`echo 'if {[[catch {package require Thread}]]} {puts -nonewline 0} else {puts -nonewline 1}' | $TCLSH`
    413                 if test "$tcl_present" = "1" ; then
    414                         AC_MSG_RESULT([yes])
    415                         with_tclthread=no
    416                 else
    417                         AC_MSG_RESULT([no])
    418                         with_tclthread=yes
    419                 fi
     419])
     420
     421# OD_LIBCURL_FLAGS
     422#       Sets the flags to compile with libcurl.
     423#
     424# Arguments:
     425#       None.
     426#
     427# Requires:
     428#   curl-config or user parameters to define the flags.
     429#
     430# Results:
     431#   defines some help strings.
     432#   sets CFLAGS_LIBCURL and LDFLAGS_LIBCURL
     433#---------------------------------------
     434AC_DEFUN([OD_LIBCURL_FLAGS],[
     435        AC_ARG_WITH(curlprefix,
     436                   [  --with-curlprefix       base directory for the cURL install '/usr', '/usr/local',...],
     437                   [  curlprefix=$withval ])
     438
     439        if test "x$curlprefix" = "x"; then
     440                AC_PATH_PROG([CURL_CONFIG], [curl-config])
     441        else
     442                AC_PATH_PROG([CURL_CONFIG], [curl-config], , [$curlprefix/bin])
     443        fi
     444
     445        if test "x$CURL_CONFIG" = "x"; then
     446                AC_MSG_ERROR([cannot find curl-config. Is libcurl installed?])
     447        fi
     448
     449        CFLAGS_LIBCURL=`$CURL_CONFIG --cflags`
     450        LDFLAGS_LIBCURL=`$CURL_CONFIG --libs`
     451
     452        AC_SUBST(CFLAGS_LIBCURL)
     453        AC_SUBST(LDFLAGS_LIBCURL)
     454])
     455
     456# OD_LIBCURL_VERSION
     457#       Determine the version of libcurl.
     458#
     459# Arguments:
     460#       None.
     461#
     462# Requires:
     463#       CURL must be set
     464#
     465# Results:
     466#   sets libcurl_version to "0" or some number
     467#---------------------------------------
     468AC_DEFUN([OD_LIBCURL_VERSION],[
     469        if test "x$CURL" = "x"; then
     470                libcurl_version="0"
     471        else
     472                AC_MSG_CHECKING([libcurl version])
     473                libcurl_version=`$CURL -V | sed '2,$d' | awk '{print $ 2}' | sed -e 's/\.//g' -e 's/-.*//g'`
     474                AC_MSG_RESULT([$libcurl_version])
    420475        fi
    421476])
Note: See TracChangeset for help on using the changeset viewer.