Initial attempt to detect HP C compiler
[platform/upstream/curl.git] / m4 / curl-compilers.m4
1 #***************************************************************************
2 #                                  _   _ ____  _
3 #  Project                     ___| | | |  _ \| |
4 #                             / __| | | | |_) | |
5 #                            | (__| |_| |  _ <| |___
6 #                             \___|\___/|_| \_\_____|
7 #
8 # Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
9 #
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.
13 #
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.
17 #
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
20 #
21 # $Id$
22 #***************************************************************************
23
24 # File version for 'aclocal' use. Keep it a single number.
25 # serial 5
26
27
28 dnl CURL_CHECK_COMPILER
29 dnl -------------------------------------------------
30 dnl Verify if the C compiler being used is known.
31
32 AC_DEFUN([CURL_CHECK_COMPILER], [
33   #
34   compiler_id="unknown"
35   compiler_num="0"
36   #
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"
43   #
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   #
50   if test "$compiler_id" = "unknown"; then
51   cat <<_EOF 1>&2
52 ***
53 *** Warning: This configure script does not have information about the
54 *** compiler you are using, relative to the flags required to enable or
55 *** disable generation of debug info, optimization options or warnings.
56 ***
57 *** Whatever settings are present in CFLAGS will be used for this run.
58 ***
59 *** If you wish to help the cURL project to better support your compiler
60 *** you can report this and the required info on the libcurl development
61 *** mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/
62 ***
63 _EOF
64   fi
65 ])
66
67
68 dnl CURL_CHECK_COMPILER_DEC
69 dnl -------------------------------------------------
70 dnl Verify if the C compiler being used is DEC's.
71
72 AC_DEFUN([CURL_CHECK_COMPILER_DEC], [
73   AC_MSG_CHECKING([whether we are using the DEC/Compaq C compiler])
74   CURL_CHECK_DEF([__DECC], [], [silent])
75   CURL_CHECK_DEF([__DECC_VER], [], [silent])
76   if test "$curl_cv_have_def___DECC" = "yes" &&
77     test "$curl_cv_have_def___DECC_VER" = "yes"; then
78     AC_MSG_RESULT([yes])
79     compiler_id="DECC"
80     flags_dbg_all="-g -g0 -g1 -g2 -g3"
81     flags_dbg_yes="-g2"
82     flags_dbg_off="-g0"
83     flags_opt_all="-O -O0 -O1 -O2 -O3 -O4"
84     flags_opt_yes="-O1"
85     flags_opt_off="-O0"
86   else
87     AC_MSG_RESULT([no])
88   fi
89 ])
90
91
92 dnl CURL_CHECK_COMPILER_GNU
93 dnl -------------------------------------------------
94 dnl Verify if the C compiler being used is GNU's.
95
96 AC_DEFUN([CURL_CHECK_COMPILER_GNU], [
97   AC_REQUIRE([CURL_CHECK_COMPILER_INTEL])dnl
98   #
99   AC_MSG_CHECKING([whether we are using the GNU C compiler])
100   CURL_CHECK_DEF([__GNUC__], [], [silent])
101   if test "$curl_cv_have_def___GNUC__" = "yes" &&
102     test "$compiler_id" = "unknown"; then
103     AC_MSG_RESULT([yes])
104     compiler_id="GNUC"
105     gccver=`$CC -dumpversion`
106     gccvhi=`echo $gccver | cut -d . -f1`
107     gccvlo=`echo $gccver | cut -d . -f2`
108     compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
109     flags_dbg_all="-g -g0 -g1 -g2 -g3"
110     flags_dbg_all="$flags_dbg_all -ggdb"
111     flags_dbg_all="$flags_dbg_all -gstabs"
112     flags_dbg_all="$flags_dbg_all -gstabs+"
113     flags_dbg_all="$flags_dbg_all -gcoff"
114     flags_dbg_all="$flags_dbg_all -gxcoff"
115     flags_dbg_all="$flags_dbg_all -gdwarf-2"
116     flags_dbg_all="$flags_dbg_all -gvms"
117     flags_dbg_yes="-g"
118     flags_dbg_off="-g0"
119     flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
120     flags_opt_yes="-O2"
121     flags_opt_off="-O0"
122   else
123     AC_MSG_RESULT([no])
124   fi
125 ])
126
127
128 dnl CURL_CHECK_COMPILER_HP
129 dnl -------------------------------------------------
130 dnl Verify if the C compiler being used is HP's.
131
132 AC_DEFUN([CURL_CHECK_COMPILER_HP], [
133   AC_MSG_CHECKING([whether we are using the HP C compiler])
134   CURL_CHECK_DEF([__HP_cc], [], [silent])
135   if test "$curl_cv_have_def___HP_cc" = "yes"; then
136     AC_MSG_RESULT([yes])
137     compiler_id="HPC"
138     flags_dbg_all="-g -s"
139     flags_dbg_yes="-g"
140     flags_dbg_off="-s"
141     flags_opt_all="-O +O0 +O1 +O2 +O3 +O4"
142     flags_opt_yes="+O2"
143     flags_opt_off="+O0"
144   else
145     AC_MSG_RESULT([no])
146   fi
147 ])
148
149
150 dnl CURL_CHECK_COMPILER_IBM
151 dnl -------------------------------------------------
152 dnl Verify if the C compiler being used is IBM's.
153
154 AC_DEFUN([CURL_CHECK_COMPILER_IBM], [
155   AC_MSG_CHECKING([whether we are using the IBM C compiler])
156   CURL_CHECK_DEF([__IBMC__], [], [silent])
157   if test "$curl_cv_have_def___IBMC__" = "yes"; then
158     AC_MSG_RESULT([yes])
159     compiler_id="IBMC"
160     flags_dbg_all="-g -g0 -g1 -g2 -g3"
161     flags_dbg_yes="-g"
162     flags_dbg_off=""
163     flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5"
164     flags_opt_all="$flags_opt_all -qnooptimize"
165     flags_opt_all="$flags_opt_all -qoptimize=0"
166     flags_opt_all="$flags_opt_all -qoptimize=1"
167     flags_opt_all="$flags_opt_all -qoptimize=2"
168     flags_opt_all="$flags_opt_all -qoptimize=3"
169     flags_opt_all="$flags_opt_all -qoptimize=4"
170     flags_opt_all="$flags_opt_all -qoptimize=5"
171     flags_opt_yes="-O2"
172     flags_opt_off="-qnooptimize"
173   else
174     AC_MSG_RESULT([no])
175   fi
176 ])
177
178
179 dnl CURL_CHECK_COMPILER_INTEL
180 dnl -------------------------------------------------
181 dnl Verify if the C compiler being used is Intel's.
182
183 AC_DEFUN([CURL_CHECK_COMPILER_INTEL], [
184   AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU])dnl
185   AC_MSG_CHECKING([whether we are using the Intel C compiler])
186   CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent])
187   if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then
188     AC_MSG_RESULT([yes])
189     CURL_CHECK_DEF([__unix__], [], [silent])
190     if test "$curl_cv_have_def___unix__" = "yes"; then
191       compiler_id="ICC_unix"
192       flags_dbg_all="-g -g0"
193       flags_dbg_yes="-g"
194       flags_dbg_off="-g0"
195       flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
196       flags_opt_yes="-O2"
197       flags_opt_off="-O0"
198     else
199       compiler_id="ICC_windows"
200       flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-"
201       flags_dbg_all="$flags_dbg_all /debug"
202       flags_dbg_all="$flags_dbg_all /debug:none"
203       flags_dbg_all="$flags_dbg_all /debug:minimal"
204       flags_dbg_all="$flags_dbg_all /debug:partial"
205       flags_dbg_all="$flags_dbg_all /debug:full"
206       flags_dbg_all="$flags_dbg_all /debug:semantic_stepping"
207       flags_dbg_all="$flags_dbg_all /debug:extended"
208       flags_dbg_yes="/Zi /Oy-"
209       flags_dbg_off="/debug:none /Oy-"
210       flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-"
211       flags_opt_yes="/O2"
212       flags_opt_off="/Od"
213     fi
214     compiler_num="$curl_cv_def___INTEL_COMPILER"
215   else
216     AC_MSG_RESULT([no])
217   fi
218 ])
219
220
221 dnl CURL_SET_COMPILER_BASIC_OPTS
222 dnl -------------------------------------------------
223 dnl Sets compiler specific options/flags which do not
224 dnl depend on configure's debug, optimize or warnings
225 dnl options.
226
227 AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [
228   AC_REQUIRE([CURL_CHECK_COMPILER])dnl
229   #
230   if test "$compiler_id" = "DECC"; then
231     dnl Select strict ANSI C compiler mode
232     CFLAGS="$CFLAGS -std1"
233     dnl Turn off optimizer ANSI C aliasing rules
234     CFLAGS="$CFLAGS -noansi_alias"
235     dnl Generate warnings for missing function prototypes
236     CFLAGS="$CFLAGS -warnprotos"
237     dnl Change some warnings into fatal errors
238     CFLAGS="$CFLAGS -msg_fatal toofewargs,toomanyargs"
239   fi
240   #
241   if test "$compiler_id" = "HPC"; then
242     dnl Disallow run-time dereferencing of null pointers
243     CFLAGS="$CFLAGS -z"
244   fi
245   #
246   if test "$compiler_id" = "IBMC"; then
247     dnl Ensure that compiler optimizations are always thread-safe.
248     CFLAGS="$CFLAGS -qthreaded"
249     dnl Disable type based strict aliasing optimizations, using worst
250     dnl case aliasing assumptions when compiling. Type based aliasing
251     dnl would restrict the lvalues that could be safely used to access
252     dnl a data object.
253     CFLAGS="$CFLAGS -qnoansialias"
254     dnl Force compiler to stop after the compilation phase, without
255     dnl generating an object code file when compilation has errors.
256     CFLAGS="$CFLAGS -qhalt=e"
257   fi
258   #
259   if test "$compiler_id" = "ICC_unix"; then
260     dnl On unix this compiler uses gcc's header files, so
261     dnl we select ANSI C89 dialect plus GNU extensions.
262     CPPFLAGS="$CPPFLAGS -std=gnu89"
263     dnl Change some warnings into errors
264     dnl #140: too many arguments in function call
265     dnl #147: declaration is incompatible with 'previous one'
266     dnl #165: too few arguments in function call
267     dnl #266: function declared implicitly
268     CPPFLAGS="$CPPFLAGS -we 140,147,165,266"
269     dnl Disable some remarks
270     dnl #279: controlling expression is constant
271     dnl #981: operands are evaluated in unspecified order
272     dnl #1469: "cc" clobber ignored
273     if test "$compiler_num" -lt "910"; then
274       CPPFLAGS="$CPPFLAGS -wd 279"
275     fi
276     CPPFLAGS="$CPPFLAGS -wd 981,1469"
277     dnl Disable use of ANSI C aliasing rules in optimizations
278     CFLAGS="$CFLAGS -no-ansi-alias"
279     dnl Disable floating point optimizations
280     CFLAGS="$CFLAGS -fp-model precise"
281   fi
282 ])
283
284
285 dnl CURL_SET_COMPILER_DEBUG_OPTS
286 dnl -------------------------------------------------
287 dnl Sets compiler specific options/flags which depend
288 dnl on configure's debug option.
289
290 AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [
291   AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
292   AC_REQUIRE([CURL_CHECK_COMPILER])dnl
293   #
294   if test "$compiler_id" != "unknown"; then
295     #
296     ac_save_CFLAGS="$CFLAGS"
297     ac_save_CPPFLAGS="$CPPFLAGS"
298     #
299     honor_debug_option="yes"
300     CURL_VAR_STRIP([CFLAGS],[${flags_dbg_all}])
301     CURL_VAR_STRIP([CPPFLAGS],[${flags_dbg_all}])
302     if test "$want_debug" = "yes"; then
303       CFLAGS="$CFLAGS $flags_dbg_yes"
304       AC_MSG_CHECKING([if compiler accepts debug enabling flags $flags_dbg_yes])
305     fi
306     if test "$want_debug" = "no"; then
307       CFLAGS="$CFLAGS $flags_dbg_off"
308       AC_MSG_CHECKING([if compiler accepts debug disabling flags $flags_dbg_off])
309     fi
310     AC_COMPILE_IFELSE([
311       AC_LANG_PROGRAM([[
312       ]],[[
313         int i = 1;
314         return i;
315       ]])
316     ],[
317       AC_MSG_RESULT([yes])
318     ],[
319       AC_MSG_RESULT([no])
320       honor_debug_option="no"
321     ])
322     #
323     if test "$honor_debug_option" = "no"; then
324       CFLAGS="$ac_save_CFLAGS"
325       CPPFLAGS="$ac_save_CPPFLAGS"
326     fi
327     #
328   fi
329 ])
330
331
332 dnl CURL_SET_COMPILER_OPTIMIZE_OPTS
333 dnl -------------------------------------------------
334 dnl Sets compiler specific options/flags which depend
335 dnl on configure's optimize option.
336
337 AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
338   AC_REQUIRE([CURL_CHECK_OPTION_OPTIMIZE])dnl
339   AC_REQUIRE([CURL_CHECK_COMPILER])dnl
340   #
341   if test "$compiler_id" != "unknown"; then
342     #
343     ac_save_CFLAGS="$CFLAGS"
344     ac_save_CPPFLAGS="$CPPFLAGS"
345     #
346     dnl If optimization request setting has not been explicitly specified,
347     dnl it has been derived from the debug setting and initially assumed.
348     dnl This initially assumed optimizer setting will finally be ignored
349     dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies
350     dnl that an initially assumed optimizer setting might not be honored.
351     #
352     honor_optimize_option="yes"
353     if test "$want_optimize" = "assume_no" ||
354        test "$want_optimize" = "assume_yes"; then
355       AC_MSG_CHECKING([if compiler optimizer assumed setting might be used])
356       CURL_VAR_MATCH_IFELSE([CFLAGS],[${flags_opt_all}],[
357         honor_optimize_option="no"
358       ])
359       CURL_VAR_MATCH_IFELSE([CPPFLAGS],[${flags_opt_all}],[
360         honor_optimize_option="no"
361       ])
362       AC_MSG_RESULT([$honor_optimize_option])
363       if test "$honor_optimize_option" = "yes"; then
364         if test "$want_optimize" = "assume_yes"; then
365           want_optimize="yes"
366         fi
367         if test "$want_optimize" = "assume_no"; then
368           want_optimize="no"
369         fi
370       fi
371     fi
372     #
373     if test "$honor_optimize_option" = "yes"; then
374       CURL_VAR_STRIP([CFLAGS],[${flags_opt_all}])
375       CURL_VAR_STRIP([CPPFLAGS],[${flags_opt_all}])
376       if test "$want_optimize" = "yes"; then
377         CFLAGS="$CFLAGS $flags_opt_yes"
378         AC_MSG_CHECKING([if compiler accepts optimizer enabling flags $flags_opt_yes])
379       fi
380       if test "$want_optimize" = "no"; then
381         CFLAGS="$CFLAGS $flags_opt_off"
382         AC_MSG_CHECKING([if compiler accepts optimizer disabling flags $flags_opt_off])
383       fi
384       AC_COMPILE_IFELSE([
385         AC_LANG_PROGRAM([[
386         ]],[[
387           int i = 1;
388           return i;
389         ]])
390       ],[
391         AC_MSG_RESULT([yes])
392       ],[
393         AC_MSG_RESULT([no])
394         honor_optimize_option="no"
395       ])
396     fi
397     #
398     if test "$honor_optimize_option" = "no"; then
399       CFLAGS="$ac_save_CFLAGS"
400       CPPFLAGS="$ac_save_CPPFLAGS"
401     fi
402     #
403   fi
404 ])
405
406
407 dnl CURL_SET_COMPILER_WARNING_OPTS
408 dnl -------------------------------------------------
409 dnl Sets compiler options/flags which depend on
410 dnl configure's warnings given option.
411
412 AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
413   AC_REQUIRE([CURL_CHECK_OPTION_WARNINGS])dnl
414   AC_REQUIRE([CURL_CHECK_COMPILER])dnl
415   #
416   if test "$compiler_id" = "DECC"; then
417     if test "$want_warnings" = "yes"; then
418       dnl Select a higher warning level than default level2
419       CFLAGS="$CFLAGS -msg_enable level3"
420     fi
421   fi
422   #
423   if test "$compiler_id" = "HPC"; then
424     if test "$want_warnings" = "yes"; then
425       dnl Issue all warnings
426       CFLAGS="$CFLAGS +w1"
427     fi
428   fi
429   #
430   if test "$compiler_id" = "ICC_unix"; then
431     if test "$want_warnings" = "yes"; then
432       if test "$compiler_num" -gt "600"; then
433         dnl Show errors, warnings, and remarks
434         CPPFLAGS="$CPPFLAGS -Wall"
435         dnl Perform extra compile-time code checking
436         CPPFLAGS="$CPPFLAGS -Wcheck"
437       fi
438     fi
439   fi
440   #
441   if test "$compiler_id" = "GNUC"; then
442     #
443     # FIXME: Some of these warnings should be changed into errors
444     #        and moved to CURL-SET-COMPILER-BASIC-OPTS
445     #
446     if test "$want_warnings" = "yes"; then
447       dnl this is a set of options we believe *ALL* gcc versions support:
448       WARN="-W -Wall -Wwrite-strings -pedantic -Wpointer-arith -Wnested-externs -Winline -Wmissing-prototypes"
449       dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
450       if test "$compiler_num" -ge "207"; then
451         dnl gcc 2.7 or later
452         WARN="$WARN -Wmissing-declarations"
453       fi
454       if test "$compiler_num" -gt "295"; then
455         dnl only if the compiler is newer than 2.95 since we got lots of
456         dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
457         dnl gcc 2.95.4 on FreeBSD 4.9!
458         WARN="$WARN -Wundef -Wno-long-long -Wsign-compare -Wshadow -Wno-multichar"
459       fi
460       if test "$compiler_num" -ge "296"; then
461         dnl gcc 2.96 or later
462         WARN="$WARN -Wfloat-equal"
463       fi
464       if test "$compiler_num" -gt "296"; then
465         dnl this option does not exist in 2.96
466         WARN="$WARN -Wno-format-nonliteral"
467       fi
468       dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
469       dnl on i686-Linux as it gives us heaps with false positives.
470       dnl Also, on gcc 4.0.X it is totally unbearable and complains all
471       dnl over making it unusable for generic purposes. Let's not use it.
472       if test "$compiler_num" -ge "303"; then
473         dnl gcc 3.3 and later
474         WARN="$WARN -Wendif-labels -Wstrict-prototypes"
475       fi
476       if test "$compiler_num" -ge "304"; then
477         # try these on gcc 3.4
478         WARN="$WARN -Wdeclaration-after-statement"
479       fi
480       for flag in $CPPFLAGS; do
481         case "$flag" in
482           -I*)
483             dnl Include path, provide a -isystem option for the same dir
484             dnl to prevent warnings in those dirs. The -isystem was not very
485             dnl reliable on earlier gcc versions.
486             add=`echo $flag | sed 's/^-I/-isystem /g'`
487             WARN="$WARN $add"
488             ;;
489         esac
490       done
491       CFLAGS="$CFLAGS $WARN"
492       AC_MSG_NOTICE([Added this set of compiler options: $WARN])
493     fi
494   fi
495   #
496 ])
497
498
499 dnl CURL_PROCESS_DEBUG_BUILD_OPTS
500 dnl -------------------------------------------------
501 dnl Settings which depend on configure's debug given
502 dnl option, and further configure the build process.
503 dnl Don't use this macro for compiler dependant stuff.
504
505 AC_DEFUN([CURL_PROCESS_DEBUG_BUILD_OPTS], [
506   AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
507   AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
508   #
509   if test "$want_debug" = "yes"; then
510     CPPFLAGS="$CPPFLAGS -DCURLDEBUG"
511   fi
512   #
513 ])
514
515
516 dnl CURL_CHECK_PROG_CC
517 dnl -------------------------------------------------
518 dnl Check for compiler program, preventing CFLAGS and
519 dnl CPPFLAGS from being unexpectedly changed.
520
521 AC_DEFUN([CURL_CHECK_PROG_CC], [
522   ac_save_CFLAGS="$CFLAGS"
523   ac_save_CPPFLAGS="$CPPFLAGS"
524   AC_PROG_CC
525   CFLAGS="$ac_save_CFLAGS"
526   CPPFLAGS="$ac_save_CPPFLAGS"
527 ])
528
529
530 dnl CURL_VAR_MATCH (VARNAME, VALUE)
531 dnl -------------------------------------------------
532 dnl Verifies if shell variable VARNAME contains VALUE.
533 dnl Contents of variable VARNAME and VALUE are handled
534 dnl as whitespace separated lists of words. If at least
535 dnl one word of VALUE is present in VARNAME the match
536 dnl is considered positive, otherwise false.
537
538 AC_DEFUN([CURL_VAR_MATCH], [
539   ac_var_match_word="no"
540   for word1 in "${[$1]}"; do
541     for word2 in "[$2]"; do
542       if test "$word1" = "$word2"; then
543         ac_var_match_word="yes"
544       fi
545     done
546   done
547 ])
548
549
550 dnl CURL_VAR_MATCH_IFELSE (VARNAME, VALUE,
551 dnl                        [ACTION-IF-MATCH], [ACTION-IF-NOT-MATCH])
552 dnl -------------------------------------------------
553 dnl This performs a CURL_VAR_MATCH check and executes
554 dnl first branch if the match is positive, otherwise
555 dnl the second branch is executed.
556
557 AC_DEFUN([CURL_VAR_MATCH_IFELSE], [
558   CURL_VAR_MATCH([$1],[$2])
559   if test "$ac_var_match_word" = "yes"; then
560   ifelse($3,,:,[$3])
561   ifelse($4,,,[else
562     [$4]])
563   fi
564 ])
565
566
567 dnl CURL_VAR_STRIP (VARNAME, VALUE)
568 dnl -------------------------------------------------
569 dnl Contents of variable VARNAME and VALUE are handled
570 dnl as whitespace separated lists of words. Each word
571 dnl from VALUE is removed from VARNAME when present.
572
573 AC_DEFUN([CURL_VAR_STRIP], [
574   ac_var_stripped=""
575   for word1 in "${[$1]}"; do
576     ac_var_strip_word="no"
577     for word2 in "[$2]"; do
578       if test "$word1" = "$word2"; then
579         ac_var_strip_word="yes"
580       fi
581     done
582     if test "$ac_var_strip_word" = "no"; then
583       ac_var_stripped="$ac_var_stripped $word1"
584     fi
585   done
586   dnl squeeze whitespace out of result
587   [$1]=`eval echo $ac_var_stripped`
588 ])