File: xerces_curl_prefix.m4

package info (click to toggle)
xerces-c 3.2.4%2Bdebian-1.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 19,948 kB
  • sloc: cpp: 167,201; xml: 23,619; sh: 4,789; ansic: 3,988; makefile: 1,438; perl: 355; javascript: 18
file content (104 lines) | stat: -rw-r--r-- 2,437 bytes parent folder | download | duplicates (3)
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
dnl @synopsis XERCES_CURL_PREFIX
dnl
dnl Determines the prefix for libcurl
dnl
dnl @category C
dnl @author James Berry
dnl @version 2005-05-23
dnl @license AllPermissive
dnl
dnl $Id$

AC_DEFUN([XERCES_CURL_PREFIX],
	[
	AC_ARG_WITH([curl],
		[AS_HELP_STRING([--with-curl[[[[=DIR]]]]],[Specify location of libcurl])],
		[
			if test x"$with_curl" = x"yes"; then
				with_curl=
			fi
		],
		[with_curl=])

	# Determine if curl is available
	AC_CACHE_VAL([xerces_cv_curl_present],
	[
		xerces_cv_curl_present=no
		if test x"$with_curl" != x"no"; then

		# See if we were given a prefix.
		#
		if test -n "$with_curl"; then
			AC_PATH_PROG([curl_config], [curl-config],[],[$with_curl/bin])
		else
			AC_PATH_PROG([curl_config], [curl-config],[])
		fi

		if test -n "$curl_config"; then
			curl_flags=`$curl_config --cflags`
			curl_libs=`$curl_config --libs`
		else
			if test -n "$with_curl"; then
				curl_flags="-I$with_curl/include"
				curl_libs="-L$with_curl/lib -lcurl"
			else
				# Default compiler paths.
				#
				curl_flags=
				curl_libs=-lcurl
			fi
		fi

		# Check that the headers exist and can be compiled.
		#
		orig_cppflags=$CPPFLAGS
		if test -n "$curl_flags"; then
			CPPFLAGS="$curl_flags $CPPFLAGS"
		fi
		AC_CHECK_HEADER([curl/curl.h], [xerces_cv_curl_present=yes])
		CPPFLAGS=$orig_cppflags

		if test x"$xerces_cv_curl_present" != x"no"; then

			# Check that the library can be linked.
			#
			AC_MSG_CHECKING([for curl_multi_init in -lcurl])

			orig_libs=$LIBS
			LIBS="$curl_libs $LIBS"
                        CPPFLAGS="$curl_flags $CPPFLAGS"

			AC_LINK_IFELSE(
				[AC_LANG_SOURCE([
                    #include <curl/curl.h>
                    #include <curl/multi.h>
                    #include <curl/easy.h>

                    int main ()
                    {
                      curl_multi_init();
                      return 0;
                    }
				])],
				[], [xerces_cv_curl_present=no])

			LIBS=$orig_libs
                        CPPFLAGS=$orig_cppflags

			if test x"$xerces_cv_curl_present" != x"no"; then
				AC_MSG_RESULT([yes])
			else
				AC_MSG_RESULT([no])
			fi
		fi
	fi
	])

	AC_CACHE_VAL([xerces_cv_curl_flags], [xerces_cv_curl_flags=$curl_flags])
	AC_CACHE_VAL([xerces_cv_curl_libs], [xerces_cv_curl_libs=$curl_libs])

	AC_SUBST([CURL_PRESENT], [$xerces_cv_curl_present])
	AC_SUBST([CURL_FLAGS], [$xerces_cv_curl_flags])
	AC_SUBST([CURL_LIBS], [$xerces_cv_curl_libs])
	]
)