summaryrefslogtreecommitdiff
path: root/m4/curl.m4
diff options
context:
space:
mode:
authorShashank2017-05-29 12:40:26 +0530
committerShashank2017-05-29 12:40:26 +0530
commit0345245e860375a32c9a437c4a9d9cae807134e9 (patch)
treead51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /m4/curl.m4
downloadscilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip
CMSCOPE changed
Diffstat (limited to 'm4/curl.m4')
-rwxr-xr-xm4/curl.m493
1 files changed, 93 insertions, 0 deletions
diff --git a/m4/curl.m4 b/m4/curl.m4
new file mode 100755
index 000000000..19d1362d8
--- /dev/null
+++ b/m4/curl.m4
@@ -0,0 +1,93 @@
+dnl
+dnl Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+dnl Copyright (C) S/E - 2012 - Sylvestre Ledru
+dnl
+dnl This file must be used under the terms of the CeCILL.
+dnl This source file is licensed as described in the file COPYING, which
+dnl you should have received as part of this distribution. The terms
+dnl are also available at
+dnl http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+dnl
+dnl CURL detection
+dnl
+
+dnl CURL is mandatory in Scilab
+dnl When we check :
+dnl * if the path is provided or that we have to find it ourself
+dnl * if it is available
+dnl * what are the compilation flags
+dnl * what are linking flags
+AC_DEFUN([AC_CURL], [
+
+
+AC_ARG_WITH(curl,
+ AC_HELP_STRING([--with-curl=DIR],[Set the path to your CURL installation]),
+ [with_curl=$withval],
+ [with_curl='yes']
+ )
+
+if test "$with_curl" != 'yes' -a "$with_curl" != 'no'; then
+ # Look if curl-config (which provides cflags and ldflags) is available
+ AC_MSG_CHECKING([curl, for curl-config])
+ CURL_FOUND=0
+ CURL_CONFIG="$with_curl/bin/curl-config"
+ if test -x "$CURL_CONFIG"; then
+ AC_MSG_RESULT([$CURL_CONFIG])
+ CURL_FOUND=1
+ fi
+ if test $CURL_FOUND -eq 0; then
+ CURL_CONFIG="$with_curl/curl-config"
+ if test -x "$CURL_CONFIG"; then
+ CURL_FOUND=1
+ AC_MSG_RESULT([$CURL_CONFIG])
+ fi
+ fi
+ if test $CURL_FOUND -eq 0; then
+ AC_MSG_ERROR([Unable to find $CURL_CONFIG. Please check the path you provided])
+ else
+ unset CURL_FOUND
+ fi
+else
+ if $WITH_DEVTOOLS; then # Scilab thirdparties
+ CURL_CONFIG="$DEVTOOLS_BINDIR/curl-config"
+ else
+ AC_CHECK_PROGS(CURL_CONFIG,curl-config,no)
+ if test "x$CURL_CONFIG" = "xno"; then
+ AC_MSG_ERROR([Unable to find curl-config in the path. Please check your installation of curl (example : libcurl3 & libcurl3-dev with Debian)])
+ fi
+ fi
+fi
+saved_cflags="$CFLAGS"
+saved_LIBS="$LIBS"
+
+CURL_CFLAGS=`$CURL_CONFIG --cflags`
+CURL_LIBS=`$CURL_CONFIG --libs`
+CURL_VERSION=`$CURL_CONFIG --version`
+
+CURL_REQUIRED_VERSION=7.6
+ PKG_CHECK_MODULES(CURL,
+ libcurl >= $CURL_REQUIRED_VERSION)
+
+LIBS="$CURL_LIBS $LIBS"
+CFLAGS="$CURL_CFLAGS $CFLAGS"
+
+AC_CHECK_LIB([curl], [curl_easy_setopt],
+ [],
+ [AC_MSG_ERROR([curl : library missing. (Cannot find symbol curl_easy_setopt). Check if curl is installed and if the version is correct])]
+ )
+
+AC_CHECK_HEADERS([curl.h])
+
+LIBS="$saved_LIBS"
+CFLAGS="$saved_cflags"
+
+AC_SUBST(CURL_CFLAGS)
+AC_SUBST(CURL_LIBS)
+AC_SUBST(CURL_VERSION)
+
+AC_DEFINE_UNQUOTED([CURL_CFLAGS],["$CURL_CFLAGS"],[CURL flags])
+AC_DEFINE_UNQUOTED([CURL_LIBS],["$CURL_LIBS"],[CURL library])
+AC_DEFINE_UNQUOTED([CURL_VERSION],["$CURL_VERSION"],[CURL version])
+
+# Gets compilation and library flags
+])