1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
10 # This software is licensed as described in the file COPYING, which
11 # you should have received as part of this distribution. The terms
12 # are also available at http://curl.haxx.se/docs/copyright.html.
14 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 # copies of the Software, and permit persons to whom the Software is
16 # furnished to do so, under the terms of the COPYING file.
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
22 #***************************************************************************
24 # File version for 'aclocal' use. Keep it a single number.
28 dnl CURL_CHECK_COMPILER
29 dnl -------------------------------------------------
30 dnl Verify if the C compiler being used is known.
32 AC_DEFUN([CURL_CHECK_COMPILER], [
37 flags_dbg_all="unknown"
38 flags_dbg_yes="unknown"
39 flags_dbg_off="unknown"
40 flags_opt_all="unknown"
41 flags_opt_yes="unknown"
42 flags_opt_off="unknown"
44 CURL_CHECK_COMPILER_DEC
45 CURL_CHECK_COMPILER_HP
46 CURL_CHECK_COMPILER_IBM
47 CURL_CHECK_COMPILER_INTEL
48 CURL_CHECK_COMPILER_GNU
49 CURL_CHECK_COMPILER_SGI
50 CURL_CHECK_COMPILER_SUN
52 if test "$compiler_id" = "unknown"; then
55 *** Warning: This configure script does not have information about the
56 *** compiler you are using, relative to the flags required to enable or
57 *** disable generation of debug info, optimization options or warnings.
59 *** Whatever settings are present in CFLAGS will be used for this run.
61 *** If you wish to help the cURL project to better support your compiler
62 *** you can report this and the required info on the libcurl development
63 *** mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/
70 dnl CURL_CHECK_COMPILER_DEC
71 dnl -------------------------------------------------
72 dnl Verify if the C compiler being used is DEC's.
74 AC_DEFUN([CURL_CHECK_COMPILER_DEC], [
75 AC_MSG_CHECKING([whether we are using the DEC/Compaq C compiler])
76 CURL_CHECK_DEF([__DECC], [], [silent])
77 CURL_CHECK_DEF([__DECC_VER], [], [silent])
78 if test "$curl_cv_have_def___DECC" = "yes" &&
79 test "$curl_cv_have_def___DECC_VER" = "yes"; then
82 flags_dbg_all="-g -g0 -g1 -g2 -g3"
85 flags_opt_all="-O -O0 -O1 -O2 -O3 -O4"
94 dnl CURL_CHECK_COMPILER_GNU
95 dnl -------------------------------------------------
96 dnl Verify if the C compiler being used is GNU's.
98 AC_DEFUN([CURL_CHECK_COMPILER_GNU], [
99 AC_REQUIRE([CURL_CHECK_COMPILER_INTEL])dnl
101 AC_MSG_CHECKING([whether we are using the GNU C compiler])
102 CURL_CHECK_DEF([__GNUC__], [], [silent])
103 if test "$curl_cv_have_def___GNUC__" = "yes" &&
104 test "$compiler_id" = "unknown"; then
107 gccver=`$CC -dumpversion`
108 gccvhi=`echo $gccver | cut -d . -f1`
109 gccvlo=`echo $gccver | cut -d . -f2`
110 compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
111 flags_dbg_all="-g -g0 -g1 -g2 -g3"
112 flags_dbg_all="$flags_dbg_all -ggdb"
113 flags_dbg_all="$flags_dbg_all -gstabs"
114 flags_dbg_all="$flags_dbg_all -gstabs+"
115 flags_dbg_all="$flags_dbg_all -gcoff"
116 flags_dbg_all="$flags_dbg_all -gxcoff"
117 flags_dbg_all="$flags_dbg_all -gdwarf-2"
118 flags_dbg_all="$flags_dbg_all -gvms"
121 flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
130 dnl CURL_CHECK_COMPILER_HP
131 dnl -------------------------------------------------
132 dnl Verify if the C compiler being used is HP's.
134 AC_DEFUN([CURL_CHECK_COMPILER_HP], [
135 AC_MSG_CHECKING([whether we are using the HP C compiler])
136 CURL_CHECK_DEF([__HP_cc], [], [silent])
137 if test "$curl_cv_have_def___HP_cc" = "yes"; then
140 flags_dbg_all="-g -s"
143 flags_opt_all="-O +O0 +O1 +O2 +O3 +O4"
152 dnl CURL_CHECK_COMPILER_IBM
153 dnl -------------------------------------------------
154 dnl Verify if the C compiler being used is IBM's.
156 AC_DEFUN([CURL_CHECK_COMPILER_IBM], [
157 AC_MSG_CHECKING([whether we are using the IBM C compiler])
158 CURL_CHECK_DEF([__IBMC__], [], [silent])
159 if test "$curl_cv_have_def___IBMC__" = "yes"; then
162 flags_dbg_all="-g -g0 -g1 -g2 -g3"
165 flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5"
166 flags_opt_all="$flags_opt_all -qnooptimize"
167 flags_opt_all="$flags_opt_all -qoptimize=0"
168 flags_opt_all="$flags_opt_all -qoptimize=1"
169 flags_opt_all="$flags_opt_all -qoptimize=2"
170 flags_opt_all="$flags_opt_all -qoptimize=3"
171 flags_opt_all="$flags_opt_all -qoptimize=4"
172 flags_opt_all="$flags_opt_all -qoptimize=5"
174 flags_opt_off="-qnooptimize"
181 dnl CURL_CHECK_COMPILER_INTEL
182 dnl -------------------------------------------------
183 dnl Verify if the C compiler being used is Intel's.
185 AC_DEFUN([CURL_CHECK_COMPILER_INTEL], [
186 AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU])dnl
187 AC_MSG_CHECKING([whether we are using the Intel C compiler])
188 CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent])
189 if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then
191 CURL_CHECK_DEF([__unix__], [], [silent])
192 if test "$curl_cv_have_def___unix__" = "yes"; then
193 compiler_id="ICC_unix"
194 flags_dbg_all="-g -g0"
197 flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
201 compiler_id="ICC_windows"
202 flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-"
203 flags_dbg_all="$flags_dbg_all /debug"
204 flags_dbg_all="$flags_dbg_all /debug:none"
205 flags_dbg_all="$flags_dbg_all /debug:minimal"
206 flags_dbg_all="$flags_dbg_all /debug:partial"
207 flags_dbg_all="$flags_dbg_all /debug:full"
208 flags_dbg_all="$flags_dbg_all /debug:semantic_stepping"
209 flags_dbg_all="$flags_dbg_all /debug:extended"
210 flags_dbg_yes="/Zi /Oy-"
211 flags_dbg_off="/debug:none /Oy-"
212 flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-"
216 compiler_num="$curl_cv_def___INTEL_COMPILER"
223 dnl CURL_CHECK_COMPILER_SGI
224 dnl -------------------------------------------------
225 dnl Verify if the C compiler being used is SGI's.
227 AC_DEFUN([CURL_CHECK_COMPILER_SGI], [
228 AC_MSG_CHECKING([whether we are using the SGI C compiler])
229 CURL_CHECK_DEF([_SGI_COMPILER_VERSION], [], [silent])
230 CURL_CHECK_DEF([_COMPILER_VERSION], [], [silent])
231 CURL_CHECK_DEF([__GNUC__], [], [silent])
232 CURL_CHECK_DEF([__sgi], [], [silent])
233 if test "$curl_cv_have_def___GNUC__ " = "no"; then
234 if test "$curl_cv_have_def__SGI_COMPILER_VERSION" = "yes"; then
237 if test "$curl_cv_have_def__COMPILER_VERSION " = "yes" &&
238 test "$curl_cv_have_def___sgi " = "yes"; then
242 if test "$compiler_id" != "SGIC"; then
245 flags_dbg_all="-g -g0 -g1 -g2 -g3"
248 flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
257 dnl CURL_CHECK_COMPILER_SUN
258 dnl -------------------------------------------------
259 dnl Verify if the C compiler being used is SUN's.
261 AC_DEFUN([CURL_CHECK_COMPILER_SUN], [
262 AC_MSG_CHECKING([whether we are using the SUN C compiler])
263 CURL_CHECK_DEF([__SUNPRO_C], [], [silent])
264 if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then
267 flags_dbg_all="-g -s"
270 flags_opt_all="-O -xO1 -xO2 -xO3 -xO4 -xO5"
279 dnl CURL_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS])
280 dnl -------------------------------------------------
281 dnl Verify if the C compiler seems to work with the
282 dnl settings that are 'active' at the time the test
285 AC_DEFUN([CURL_COMPILER_WORKS_IFELSE], [
286 dnl compilation capability verification
287 tmp_compiler_works="unknown"
295 tmp_compiler_works="yes"
297 tmp_compiler_works="no"
299 dnl linking capability verification
300 if test "$tmp_compiler_works" = "yes"; then
308 tmp_compiler_works="yes"
310 tmp_compiler_works="no"
313 dnl only do runtime verification when not cross-compiling
314 if test "x$cross_compiling" != "xyes" &&
315 test "$tmp_compiler_works" = "yes"; then
323 tmp_compiler_works="yes"
325 tmp_compiler_works="no"
328 dnl branch upon test result
329 if test "$tmp_compiler_works" = "yes"; then
337 dnl CURL_SET_COMPILER_BASIC_OPTS
338 dnl -------------------------------------------------
339 dnl Sets compiler specific options/flags which do not
340 dnl depend on configure's debug, optimize or warnings
343 AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [
344 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
346 if test "$compiler_id" != "unknown"; then
348 tmp_save_CPPFLAGS="$CPPFLAGS"
349 tmp_save_CFLAGS="$CFLAGS"
353 case "$compiler_id" in
357 dnl Select strict ANSI C compiler mode
358 tmp_CFLAGS="$tmp_CFLAGS -std1"
359 dnl Turn off optimizer ANSI C aliasing rules
360 tmp_CFLAGS="$tmp_CFLAGS -noansi_alias"
361 dnl Generate warnings for missing function prototypes
362 tmp_CFLAGS="$tmp_CFLAGS -warnprotos"
363 dnl Change some warnings into fatal errors
364 tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs"
370 tmp_CFLAGS="$tmp_CFLAGS"
375 dnl Disallow run-time dereferencing of null pointers
376 tmp_CFLAGS="$tmp_CFLAGS -z"
377 dnl Disable some remarks
378 dnl #4227: padding struct with n bytes to align member
379 dnl #4255: padding size of struct with n bytes to alignment boundary
380 tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255"
385 dnl Ensure that compiler optimizations are always thread-safe.
386 tmp_CFLAGS="$tmp_CFLAGS -qthreaded"
387 dnl Disable type based strict aliasing optimizations, using worst
388 dnl case aliasing assumptions when compiling. Type based aliasing
389 dnl would restrict the lvalues that could be safely used to access
391 tmp_CFLAGS="$tmp_CFLAGS -qnoansialias"
392 dnl Force compiler to stop after the compilation phase, without
393 dnl generating an object code file when compilation has errors.
394 tmp_CFLAGS="$tmp_CFLAGS -qhalt=e"
399 dnl On unix this compiler uses gcc's header files, so
400 dnl we select ANSI C89 dialect plus GNU extensions.
401 tmp_CPPFLAGS="$tmp_CPPFLAGS -std=gnu89"
402 dnl Change some warnings into errors
403 dnl #140: too many arguments in function call
404 dnl #147: declaration is incompatible with 'previous one'
405 dnl #165: too few arguments in function call
406 dnl #266: function declared implicitly
407 tmp_CPPFLAGS="$tmp_CPPFLAGS -we 140,147,165,266"
408 dnl Disable some remarks
409 dnl #279: controlling expression is constant
410 dnl #981: operands are evaluated in unspecified order
411 dnl #1469: "cc" clobber ignored
412 tmp_CPPFLAGS="$tmp_CPPFLAGS -wd 279,981,1469"
413 dnl Disable use of ANSI C aliasing rules in optimizations
414 tmp_CFLAGS="$tmp_CFLAGS -no-ansi-alias"
415 dnl Disable floating point optimizations
416 tmp_CFLAGS="$tmp_CFLAGS -fp-model precise"
422 tmp_CFLAGS="$tmp_CFLAGS"
428 tmp_CFLAGS="$tmp_CFLAGS"
434 tmp_CFLAGS="$tmp_CFLAGS"
439 tmp_CPPFLAGS=`eval echo $tmp_CPPFLAGS`
440 tmp_CFLAGS=`eval echo $tmp_CFLAGS`
442 if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
443 AC_MSG_CHECKING([if compiler accepts some basic options])
444 CPPFLAGS=`eval echo $tmp_save_CPPFLAGS $tmp_CPPFLAGS`
445 CFLAGS=`eval echo $tmp_save_CFLAGS $tmp_CFLAGS`
446 CURL_COMPILER_WORKS_IFELSE([
448 AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
451 AC_MSG_NOTICE([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
452 dnl restore initial settings
453 CPPFLAGS="$tmp_save_CPPFLAGS"
454 CFLAGS="$tmp_save_CFLAGS"
462 dnl CURL_SET_COMPILER_DEBUG_OPTS
463 dnl -------------------------------------------------
464 dnl Sets compiler specific options/flags which depend
465 dnl on configure's debug option.
467 AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [
468 AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
469 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
471 if test "$compiler_id" != "unknown"; then
473 tmp_save_CFLAGS="$CFLAGS"
474 tmp_save_CPPFLAGS="$CPPFLAGS"
478 tmp_CPPFLAGS="$CPPFLAGS"
479 CURL_VAR_STRIP([tmp_CFLAGS],[$flags_dbg_all])
480 CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_dbg_all])
482 if test "$want_debug" = "yes"; then
483 AC_MSG_CHECKING([if compiler accepts debug enabling options])
484 tmp_options="$flags_dbg_yes"
486 if test "$want_debug" = "no"; then
487 AC_MSG_CHECKING([if compiler accepts debug disabling options])
488 tmp_options="$flags_dbg_off"
491 CPPFLAGS=`eval echo $tmp_CPPFLAGS`
492 CFLAGS=`eval echo $tmp_CFLAGS $tmp_options`
493 CURL_COMPILER_WORKS_IFELSE([
495 AC_MSG_NOTICE([compiler options added: $tmp_options])
498 AC_MSG_NOTICE([compiler options rejected: $tmp_options])
499 dnl restore initial settings
500 CPPFLAGS="$tmp_save_CPPFLAGS"
501 CFLAGS="$tmp_save_CFLAGS"
508 dnl CURL_SET_COMPILER_OPTIMIZE_OPTS
509 dnl -------------------------------------------------
510 dnl Sets compiler specific options/flags which depend
511 dnl on configure's optimize option.
513 AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
514 AC_REQUIRE([CURL_CHECK_OPTION_OPTIMIZE])dnl
515 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
517 if test "$compiler_id" != "unknown"; then
519 tmp_save_CFLAGS="$CFLAGS"
520 tmp_save_CPPFLAGS="$CPPFLAGS"
524 tmp_CPPFLAGS="$CPPFLAGS"
525 honor_optimize_option="yes"
527 dnl If optimization request setting has not been explicitly specified,
528 dnl it has been derived from the debug setting and initially assumed.
529 dnl This initially assumed optimizer setting will finally be ignored
530 dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies
531 dnl that an initially assumed optimizer setting might not be honored.
533 if test "$want_optimize" = "assume_no" ||
534 test "$want_optimize" = "assume_yes"; then
535 AC_MSG_CHECKING([if compiler optimizer assumed setting might be used])
536 CURL_VAR_MATCH_IFELSE([tmp_CFLAGS],[$flags_opt_all],[
537 honor_optimize_option="no"
539 CURL_VAR_MATCH_IFELSE([tmp_CPPFLAGS],[$flags_opt_all],[
540 honor_optimize_option="no"
542 AC_MSG_RESULT([$honor_optimize_option])
543 if test "$honor_optimize_option" = "yes"; then
544 if test "$want_optimize" = "assume_yes"; then
547 if test "$want_optimize" = "assume_no"; then
553 if test "$honor_optimize_option" = "yes"; then
554 CURL_VAR_STRIP([tmp_CFLAGS],[$flags_opt_all])
555 CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_opt_all])
556 if test "$want_optimize" = "yes"; then
557 AC_MSG_CHECKING([if compiler accepts optimizer enabling options])
558 tmp_options="$flags_opt_yes"
560 if test "$want_optimize" = "no"; then
561 AC_MSG_CHECKING([if compiler accepts optimizer disabling options])
562 tmp_options="$flags_opt_off"
564 CPPFLAGS=`eval echo $tmp_CPPFLAGS`
565 CFLAGS=`eval echo $tmp_CFLAGS $tmp_options`
566 CURL_COMPILER_WORKS_IFELSE([
568 AC_MSG_NOTICE([compiler options added: $tmp_options])
571 AC_MSG_NOTICE([compiler options rejected: $tmp_options])
572 dnl restore initial settings
573 CPPFLAGS="$tmp_save_CPPFLAGS"
574 CFLAGS="$tmp_save_CFLAGS"
582 dnl CURL_SET_COMPILER_WARNING_OPTS
583 dnl -------------------------------------------------
584 dnl Sets compiler options/flags which depend on
585 dnl configure's warnings given option.
587 AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
588 AC_REQUIRE([CURL_CHECK_OPTION_WARNINGS])dnl
589 AC_REQUIRE([CURL_CHECK_COMPILER])dnl
591 if test "$compiler_id" = "DECC"; then
592 if test "$want_warnings" = "yes"; then
593 dnl Select a higher warning level than default level2
594 CFLAGS="$CFLAGS -msg_enable level3"
598 if test "$compiler_id" = "GNUC"; then
600 # FIXME: Some of these warnings should be changed into errors
601 # and moved to CURL-SET-COMPILER-BASIC-OPTS
603 if test "$want_warnings" = "yes"; then
604 dnl this is a set of options we believe *ALL* gcc versions support:
605 WARN="-W -Wall -Wwrite-strings -pedantic -Wpointer-arith -Wnested-externs -Winline -Wmissing-prototypes"
606 dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
607 if test "$compiler_num" -ge "207"; then
609 WARN="$WARN -Wmissing-declarations"
611 if test "$compiler_num" -gt "295"; then
612 dnl only if the compiler is newer than 2.95 since we got lots of
613 dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
614 dnl gcc 2.95.4 on FreeBSD 4.9!
615 WARN="$WARN -Wundef -Wno-long-long -Wsign-compare -Wshadow -Wno-multichar"
617 if test "$compiler_num" -ge "296"; then
618 dnl gcc 2.96 or later
619 WARN="$WARN -Wfloat-equal"
621 if test "$compiler_num" -gt "296"; then
622 dnl this option does not exist in 2.96
623 WARN="$WARN -Wno-format-nonliteral"
625 dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
626 dnl on i686-Linux as it gives us heaps with false positives.
627 dnl Also, on gcc 4.0.X it is totally unbearable and complains all
628 dnl over making it unusable for generic purposes. Let's not use it.
629 if test "$compiler_num" -ge "303"; then
630 dnl gcc 3.3 and later
631 WARN="$WARN -Wendif-labels -Wstrict-prototypes"
633 if test "$compiler_num" -ge "304"; then
634 # try these on gcc 3.4
635 WARN="$WARN -Wdeclaration-after-statement"
637 for flag in $CPPFLAGS; do
640 dnl Include path, provide a -isystem option for the same dir
641 dnl to prevent warnings in those dirs. The -isystem was not very
642 dnl reliable on earlier gcc versions.
643 add=`echo $flag | sed 's/^-I/-isystem /g'`
648 CFLAGS="$CFLAGS $WARN"
649 AC_MSG_NOTICE([Added this set of compiler options: $WARN])
653 if test "$compiler_id" = "HPUXC"; then
654 if test "$want_warnings" = "yes"; then
655 dnl Issue all warnings
660 if test "$compiler_id" = "ICC_unix"; then
661 if test "$want_warnings" = "yes"; then
662 if test "$compiler_num" -gt "600"; then
663 dnl Show errors, warnings, and remarks
664 CPPFLAGS="$CPPFLAGS -Wall"
665 dnl Perform extra compile-time code checking
666 CPPFLAGS="$CPPFLAGS -Wcheck"
671 if test "$compiler_id" = "SGIC"; then
672 if test "$want_warnings" = "yes"; then
673 dnl Perform stricter semantic and lint-like checks
674 CFLAGS="$CFLAGS -fullwarn"
678 if test "$compiler_id" = "SUNC"; then
679 if test "$want_warnings" = "yes"; then
680 dnl Perform stricter semantic and lint-like checks
688 dnl CURL_PROCESS_DEBUG_BUILD_OPTS
689 dnl -------------------------------------------------
690 dnl Settings which depend on configure's debug given
691 dnl option, and further configure the build process.
692 dnl Don't use this macro for compiler dependant stuff.
694 AC_DEFUN([CURL_PROCESS_DEBUG_BUILD_OPTS], [
695 AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
696 AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
698 if test "$want_debug" = "yes"; then
699 CPPFLAGS="$CPPFLAGS -DCURLDEBUG"
705 dnl CURL_CHECK_PROG_CC
706 dnl -------------------------------------------------
707 dnl Check for compiler program, preventing CFLAGS and
708 dnl CPPFLAGS from being unexpectedly changed.
710 AC_DEFUN([CURL_CHECK_PROG_CC], [
711 ac_save_CFLAGS="$CFLAGS"
712 ac_save_CPPFLAGS="$CPPFLAGS"
714 CFLAGS="$ac_save_CFLAGS"
715 CPPFLAGS="$ac_save_CPPFLAGS"
719 dnl CURL_VAR_MATCH (VARNAME, VALUE)
720 dnl -------------------------------------------------
721 dnl Verifies if shell variable VARNAME contains VALUE.
722 dnl Contents of variable VARNAME and VALUE are handled
723 dnl as whitespace separated lists of words. If at least
724 dnl one word of VALUE is present in VARNAME the match
725 dnl is considered positive, otherwise false.
727 AC_DEFUN([CURL_VAR_MATCH], [
728 ac_var_match_word="no"
729 for word1 in "$[$1]"; do
730 for word2 in "[$2]"; do
731 if test "$word1" = "$word2"; then
732 ac_var_match_word="yes"
739 dnl CURL_VAR_MATCH_IFELSE (VARNAME, VALUE,
740 dnl [ACTION-IF-MATCH], [ACTION-IF-NOT-MATCH])
741 dnl -------------------------------------------------
742 dnl This performs a CURL_VAR_MATCH check and executes
743 dnl first branch if the match is positive, otherwise
744 dnl the second branch is executed.
746 AC_DEFUN([CURL_VAR_MATCH_IFELSE], [
747 CURL_VAR_MATCH([$1],[$2])
748 if test "$ac_var_match_word" = "yes"; then
756 dnl CURL_VAR_STRIP (VARNAME, VALUE)
757 dnl -------------------------------------------------
758 dnl Contents of variable VARNAME and VALUE are handled
759 dnl as whitespace separated lists of words. Each word
760 dnl from VALUE is removed from VARNAME when present.
762 AC_DEFUN([CURL_VAR_STRIP], [
764 for word1 in "$[$1]"; do
765 ac_var_strip_word="no"
766 for word2 in "[$2]"; do
767 if test "$word1" = "$word2"; then
768 ac_var_strip_word="yes"
771 if test "$ac_var_strip_word" = "no"; then
772 ac_var_stripped="$ac_var_stripped $word1"
775 dnl squeeze whitespace out of result
776 [$1]=`eval echo $ac_var_stripped`