root/mpich2/branches/dev/kumudb/confdb/aclocal_make.m4 @ 4870

Revision 4870, 11.0 KB (checked in by kumudb, 5 months ago)

Merge from trunk to kumudb r4748:r4869

Line 
1dnl
2dnl We need routines to check that make works.  Possible problems with
3dnl make include
4dnl
5dnl It is really gnumake, and contrary to the documentation on gnumake,
6dnl it insists on screaming everytime a directory is changed.  The fix
7dnl is to add the argument --no-print-directory to the make
8dnl
9dnl It is really BSD 4.4 make, and can't handle 'include'.  For some
10dnl systems, this can be fatal; there is no fix (other than removing this
11dnl alleged make).
12dnl
13dnl It is the OSF V3 make, and can't handle a comment in a block of target
14dnl code.  There is no acceptable fix.
15dnl
16dnl
17dnl
18dnl
19dnl Find a make program if none is defined.
20AC_DEFUN([PAC_PROG_MAKE_PROGRAM],[true
21if test "X$MAKE" = "X" ; then
22   AC_CHECK_PROGS(MAKE,make gnumake nmake pmake smake)
23fi
24])dnl
25dnl/*D
26dnl PAC_PROG_MAKE_ECHOS_DIR - Check whether make echos all directory changes
27dnl
28dnl Synopsis:
29dnl PAC_PROG_MAKE_ECHOS_DIR
30dnl
31dnl Output Effect:
32dnl  If make echos directory changes, append '--no-print-directory' to the
33dnl  symbol 'MAKE'.  If 'MAKE' is not set, chooses 'make' for 'MAKE'.
34dnl
35dnl  You can override this test (if, for example, you want make to be
36dnl  more noisy) by setting the environment variable MAKE_MAY_PRINT_DIR to
37dnl  yes
38dnl
39dnl See also:
40dnl PAC_PROG_MAKE
41dnl D*/
42dnl
43AC_DEFUN([PAC_PROG_MAKE_ECHOS_DIR],[
44if test "$MAKE_MAY_PRINT_DIR" != "yes" ; then
45    AC_CACHE_CHECK([whether make echos directory changes],
46pac_cv_prog_make_echos_dir,
47[
48AC_REQUIRE([PAC_PROG_MAKE_PROGRAM])
49# This is needed for Mac OSX 10.5
50rm -rf conftest.dSYM
51rm -f conftest
52cat > conftest <<.
53SHELL=/bin/sh
54ALL:
55        @(dir="`pwd`" ; cd .. ; \$(MAKE) -f "\$\$dir/conftest" SUB)
56SUB:
57        @echo "success"
58.
59str="`$MAKE -f conftest 2>&1`"
60if test "$str" != "success" ; then
61    str="`$MAKE --no-print-directory -f conftest 2>&1`"
62    if test "$str" = "success" ; then
63        pac_cv_prog_make_echos_dir="yes using --no-print-directory"
64    else
65        pac_cv_prog_make_echos_dir="no"
66        echo "Unexpected output from make with program" >>config.log
67        cat conftest >>config.log
68        echo "str" >> config.log
69    fi
70else
71    pac_cv_prog_make_echos_dir="no"
72fi
73# This is needed for Mac OSX 10.5
74rm -rf conftest.dSYM
75rm -f conftest
76str=""
77])
78    if test "$pac_cv_prog_make_echos_dir" = "yes using --no-print-directory" ; then
79        MAKE="$MAKE --no-print-directory"
80    fi
81fi
82])dnl
83dnl
84dnl/*D
85dnl PAC_PROG_MAKE_INCLUDE - Check whether make supports include
86dnl
87dnl Synopsis:
88dnl PAC_PROG_MAKE_INCLUDE([action if true],[action if false])
89dnl
90dnl Output Effect:
91dnl   None
92dnl
93dnl Notes:
94dnl  This checks for makes that do not support 'include filename'.  Some
95dnl  versions of BSD 4.4 make required '#include' instead; some versions of
96dnl  'pmake' have the same syntax.
97dnl
98dnl See Also:
99dnl  PAC_PROG_MAKE
100dnl
101dnl D*/
102dnl
103AC_DEFUN([PAC_PROG_MAKE_INCLUDE],[
104AC_CACHE_CHECK([whether make supports include],pac_cv_prog_make_include,[
105AC_REQUIRE([PAC_PROG_MAKE_PROGRAM])
106# This is needed for Mac OSX 10.5
107rm -rf conftest.dSYM
108rm -f conftest
109cat > conftest <<.
110ALL:
111        @echo "success"
112.
113cat > conftest1 <<.
114include conftest
115.
116pac_str=`$MAKE -f conftest1 2>&1`
117# This is needed for Mac OSX 10.5
118rm -rf conftest.dSYM
119rm -f conftest conftest1
120if test "$pac_str" != "success" ; then
121    pac_cv_prog_make_include="no"
122else
123    pac_cv_prog_make_include="yes"
124fi
125])
126if test "$pac_cv_prog_make_include" = "no" ; then
127    ifelse([$2],,:,[$2])
128else
129    ifelse([$1],,:,[$1])
130fi
131])dnl
132dnl
133dnl/*D
134dnl PAC_PROG_MAKE_ALLOWS_COMMENTS - Check whether comments are allowed in
135dnl   shell commands in a makefile
136dnl
137dnl Synopsis:
138dnl PAC_PROG_MAKE_ALLOWS_COMMENTS([false text])
139dnl
140dnl Output Effect:
141dnl Issues a warning message if comments are not allowed in a makefile.
142dnl Executes the argument if one is given.
143dnl
144dnl Notes:
145dnl Some versions of OSF V3 make do not all comments in action commands.
146dnl
147dnl See Also:
148dnl  PAC_PROG_MAKE
149dnl D*/
150dnl
151AC_DEFUN([PAC_PROG_MAKE_ALLOWS_COMMENTS],[
152AC_CACHE_CHECK([whether make allows comments in actions],
153pac_cv_prog_make_allows_comments,[
154AC_REQUIRE([PAC_PROG_MAKE_PROGRAM])
155# This is needed for Mac OSX 10.5
156rm -rf conftest.dSYM
157rm -f conftest
158cat > conftest <<.
159SHELL=/bin/sh
160ALL:
161        @# This is a valid comment!
162        @echo "success"
163.
164pac_str=`$MAKE -f conftest 2>&1`
165# This is needed for Mac OSX 10.5
166rm -rf conftest.dSYM
167rm -f conftest
168if test "$pac_str" != "success" ; then
169    pac_cv_prog_make_allows_comments="no"
170else
171    pac_cv_prog_make_allows_comments="yes"
172fi
173])
174if test "$pac_cv_prog_make_allows_comments" = "no" ; then
175    AC_MSG_WARN([Your make does not allow comments in target code.
176Using this make may cause problems when building programs.
177You should consider using gnumake instead.])
178    ifelse([$1],,[$1])
179fi
180])dnl
181dnl
182dnl/*D
183dnl PAC_PROG_MAKE_VPATH - Check whether make supports source-code paths.
184dnl
185dnl Synopsis:
186dnl PAC_PROG_MAKE_VPATH
187dnl
188dnl Output Effect:
189dnl Sets the variable 'VPATH' to either
190dnl.vb
191dnl VPATH = .:${srcdir}
192dnl.ve
193dnl or
194dnl.vb
195dnl .PATH: . ${srcdir}
196dnl.ve
197dnl
198dnl Notes:
199dnl The test checks that the path works with implicit targets (some makes
200dnl support only explicit targets with 'VPATH' or 'PATH').
201dnl
202dnl NEED TO DO: Check that $< works on explicit targets.
203dnl
204dnl See Also:
205dnl PAC_PROG_MAKE
206dnl
207dnl D*/
208dnl
209AC_DEFUN([PAC_PROG_MAKE_VPATH],[
210AC_SUBST(VPATH)AM_IGNORE(VPATH)
211AC_CACHE_CHECK([for virtual path format],
212pac_cv_prog_make_vpath,[
213AC_REQUIRE([PAC_PROG_MAKE_PROGRAM])
214# This is needed for Mac OSX 10.5
215rm -rf conftest.dSYM
216rm -rf conftest*
217mkdir conftestdir
218cat >conftestdir/a.c <<EOF
219A sample file
220EOF
221cat > conftest <<EOF
222all: a.o
223VPATH=.:conftestdir
224.c.o:
225        @echo \$<
226EOF
227ac_out=`$MAKE -f conftest 2>&1 | grep 'conftestdir/a.c'`
228if test -n "$ac_out" ; then
229    pac_cv_prog_make_vpath="VPATH"
230else
231    rm -f conftest
232    cat > conftest <<EOF
233all: a.o
234.PATH: . conftestdir
235.c.o:
236        @echo \$<
237EOF
238    ac_out=`$MAKE -f conftest 2>&1 | grep 'conftestdir/a.c'`
239    if test -n "$ac_out" ; then
240        pac_cv_prog_make_vpath=".PATH"
241    else
242        pac_cv_prog_make_vpath="neither VPATH nor .PATH works"
243    fi
244fi
245# This is needed for Mac OSX 10.5
246rm -rf conftest.dSYM
247rm -rf conftest*
248])
249if test "$pac_cv_prog_make_vpath" = "VPATH" ; then
250    VPATH='VPATH=.:${srcdir}'
251elif test "$pac_cv_prog_make_vpath" = ".PATH" ; then
252    VPATH='.PATH: . ${srcdir}'
253fi
254])dnl
255dnl
256dnl/*D
257dnl PAC_PROG_MAKE_SET_CFLAGS - Check whether make sets CFLAGS
258dnl
259dnl Synopsis:
260dnl PAC_PROG_MAKE_SET_CFLAGS([action if true],[action if false])
261dnl
262dnl Output Effects:
263dnl Executes the first argument if 'CFLAGS' is set by 'make'; executes
264dnl the second argument if 'CFLAGS' is not set by 'make'.
265dnl
266dnl Notes:
267dnl If 'CFLAGS' is set by make, you may wish to override that choice in your
268dnl makefile.
269dnl
270dnl See Also:
271dnl PAC_PROG_MAKE
272dnl D*/
273AC_DEFUN([PAC_PROG_MAKE_SET_CFLAGS],[
274AC_CACHE_CHECK([whether make sets CFLAGS],
275pac_cv_prog_make_set_cflags,[
276AC_REQUIRE([PAC_PROG_MAKE_PROGRAM])
277# This is needed for Mac OSX 10.5
278rm -rf conftest.dSYM
279rm -f conftest
280cat > conftest <<EOF
281SHELL=/bin/sh
282ALL:
283        @echo X[\$]{CFLAGS}X
284EOF
285pac_str=`$MAKE -f conftest 2>&1`
286# This is needed for Mac OSX 10.5
287rm -rf conftest.dSYM
288rm -f conftest
289if test "$pac_str" = "XX" ; then
290    pac_cv_prog_make_set_cflags="no"
291else
292    pac_cv_prog_make_set_cflags="yes"
293fi
294])
295if test "$pac_cv_prog_make_set_cflags" = "no" ; then
296    ifelse([$2],,:,[$2])
297else
298    ifelse([$1],,:,[$1])
299fi
300])dnl
301dnl/*D
302dnl PAC_PROG_MAKE_CLOCK_SKEW - Check whether there is a problem with
303dnl clock skew in suing make.
304dnl
305dnl Effect:
306dnl Sets the cache variable 'pac_cv_prog_make_found_clock_skew' to yes or no
307dnl D*/
308AC_DEFUN([PAC_PROG_MAKE_CLOCK_SKEW],[
309AC_CACHE_CHECK([whether clock skew breaks make],
310pac_cv_prog_make_found_clock_skew,[
311AC_REQUIRE([PAC_PROG_MAKE_PROGRAM])
312# This is needed for Mac OSX 10.5
313rm -rf conftest.dSYM
314rm -f conftest*
315cat > conftest <<EOF
316ALL:
317        @-echo "success"
318EOF
319$MAKE -f conftest > conftest.out 2>&1
320if grep -i skew conftest >/dev/null 2>&1 ; then
321    pac_cv_prog_make_found_clock_skew=yes
322else
323    pac_cv_prog_make_found_clock_skew=no
324fi
325# This is needed for Mac OSX 10.5
326rm -rf conftest.dSYM
327rm -f conftest*
328])
329dnl We should really do something if we detect clock skew.  The question is,
330dnl what?
331if test "$pac_cv_prog_make_found_clock_skew" = "yes" ; then
332    AC_MSG_WARN([Clock skew found by make.  The configure and build may fail.
333Consider building in a local instead of NFS filesystem.])
334fi
335])
336dnl
337dnl/*D
338dnl PAC_PROG_MAKE_HAS_PATTERN_RULES - Determine if the make program supports
339dnl pattern rules
340dnl
341dnl Synopsis:
342dnl PAC_PROG_MAKE_HAS_PATTERN_RULES([action if true],[action if false])
343dnl
344dnl Output Effect:
345dnl Executes the first argument if patterns of the form
346dnl.vb
347dnl   prefix%suffix: prefix%suffix
348dnl.ve
349dnl are supported by make (gnumake and Solaris make are known to support
350dnl this form of target).  If patterns are not supported, executes the
351dnl second argument.
352dnl
353dnl See Also:
354dnl PAC_PROG_MAKE
355dnl
356dnl D*/
357AC_DEFUN([PAC_PROG_MAKE_HAS_PATTERN_RULES],[
358AC_CACHE_CHECK([whether make has pattern rules],
359pac_cv_prog_make_has_patterns,[
360AC_REQUIRE([PAC_PROG_MAKE_PROGRAM])
361# This is needed for Mac OSX 10.5
362rm -rf conftest.dSYM
363rm -f conftest*
364cat > conftestmm <<EOF
365# Test for pattern rules
366.SUFFIXES:
367.SUFFIXES: .dep .c
368conftest%.dep: %.c
369        @cat \[$]< >\[$]@
370EOF
371date > conftest.c
372if ${MAKE} -f conftestmm conftestconftest.dep 1>&AC_FD_CC 2>&1 </dev/null ; then
373    pac_cv_prog_make_has_patterns="yes"
374else
375    pac_cv_prog_make_has_patterns="no"
376fi
377# This is needed for Mac OSX 10.5
378rm -rf conftest.dSYM
379rm -f conftest*
380])
381if test "$pac_cv_prog_make_has_patterns" = "no" ; then
382    ifelse([$2],,:,[$2])
383else
384    ifelse([$1],,:,[$1])
385fi
386])dnl
387dnl
388dnl/*D
389dnl PAC_PROG_MAKE - Checks for the varieties of MAKE, including support for
390dnl VPATH
391dnl
392dnl Synopsis:
393dnl PAC_PROG_MAKE
394dnl
395dnl Output Effect:
396dnl Sets 'MAKE' to the make program to use if 'MAKE' is not already set.
397dnl Sets the variable 'SET_CFLAGS' to 'CFLAGS =' if make sets 'CFLAGS'.
398dnl
399dnl Notes:
400dnl This macro uses 'PAC_PROG_MAKE_ECHOS_DIR', 'PAC_PROG_MAKE_INCLUDE',
401dnl 'PAC_PROG_MAKE_ALLOWS_COMMENTS', 'PAC_PROG_MAKE_VPATH', and
402dnl 'PAC_PROG_MAKE_SET_CFLAGS'.  See those commands for details about their
403dnl actions.
404dnl
405dnl It may call 'AC_PROG_MAKE_SET', which sets 'SET_MAKE' to 'MAKE = @MAKE@'
406dnl if the make program does not set the value of make, otherwise 'SET_MAKE'
407dnl is set to empty; if the make program echos the directory name, then
408dnl 'SET_MAKE' is set to 'MAKE = $MAKE'.
409dnl
410dnl A recent change has been to remove the test on make echoing
411dnl directories.  This was done to make the build process behave more
412dnl like other builds that do not work around this behavior in gnumake.
413dnl D*/
414dnl
415AC_DEFUN([PAC_PROG_MAKE],[
416PAC_PROG_MAKE_PROGRAM
417PAC_PROG_MAKE_CLOCK_SKEW
418dnl PAC_PROG_MAKE_ECHOS_DIR
419PAC_PROG_MAKE_INCLUDE
420PAC_PROG_MAKE_ALLOWS_COMMENTS
421PAC_PROG_MAKE_VPATH
422dnl
423dnl We're not using patterns any more, and Compaq/DEC OSF-1 sometimes hangs
424dnl at this test
425dnl PAC_PROG_MAKE_HAS_PATTERN_RULES
426AC_SUBST(SET_CFLAGS)AM_IGNORE(SET_CFLAGS)
427PAC_PROG_MAKE_SET_CFLAGS([SET_CFLAGS='CFLAGS='])
428if test "$pac_cv_prog_make_echos_dir" = "no" ; then
429    AC_PROG_MAKE_SET
430else
431    SET_MAKE="MAKE=${MAKE-make}"
432fi
433])
Note: See TracBrowser for help on using the browser.