source: rtems/aclocal.m4 @ 50cf94da

4.104.114.84.95
Last change on this file since 50cf94da was a7a08713, checked in by Joel Sherrill <joel.sherrill@…>, on 03/20/98 at 16:52:10

Patch from Ralf Corsepius to properly detect that Cygwin32 does not
support the -pipe option on the compiler.

  • Property mode set to 100644
File size: 8.7 KB
Line 
1dnl aclocal.m4 generated automatically by aclocal 1.2
2
3dnl $Id$
4
5dnl macro to detect mkdir
6AC_DEFUN(RTEMS_PATH_MKDIR,
7[AC_PATH_PROG(MKDIR,mkdir)
8])
9
10dnl macro to check for mkdir -p
11AC_DEFUN(RTEMS_PROG_MKDIR_P,
12[
13AC_REQUIRE([RTEMS_PATH_MKDIR])
14AC_MSG_CHECKING([for working $MKDIR -p])
15AC_CACHE_VAL(rtems_cv_prog_mkdir_p,
16[rm -rf conftestdata
17if $MKDIR -p conftestdata 2>/dev/null ;then
18rtems_cv_prog_MKDIR_P="yes"
19else
20rtems_cv_prog_MKDIR_P="no"
21fi])dnl
22rm -rf conftestdata
23AC_MSG_RESULT($rtems_cv_prog_MKDIR_P)
24])
25
26dnl macro to check for mkdir -m 0755
27AC_DEFUN(RTEMS_PROG_MKDIR_M,
28[
29AC_REQUIRE([RTEMS_PATH_MKDIR])
30AC_MSG_CHECKING([for working $MKDIR -m 0755])
31AC_CACHE_VAL(rtems_cv_prog_MKDIR_P,
32[rm -rf conftestdata
33if $MKDIR -m 0775 conftestdata 2>/dev/null; then
34rtems_cv_prog_MKDIR_M="yes"
35else
36rtems_cv_prog_MKDIR_M="no"
37fi])dnl
38rm -rf conftestdata
39AC_MSG_RESULT($rtems_cv_prog_MKDIR_M)
40])
41
42
43dnl $Id$
44
45dnl canonicalize target name
46dnl NOTE: Most rtems targets do not fullfil autoconf's
47dnl target naming conventions "processor-vendor-os"
48dnl Therefore autoconf's AC_CANONICAL_TARGET will fail for them
49dnl and we have to fix it for rtems ourselves
50
51AC_DEFUN(RTEMS_CANONICAL_TARGET_CPU,
52[AC_MSG_CHECKING(rtems target cpu)
53changequote(<<, >>)dnl
54target_cpu=`echo $target | sed 's%^\([^-]*\)-\(.*\)$%\1%'`
55changequote([, ])dnl
56AC_MSG_RESULT($target_cpu)
57])
58
59dnl
60dnl $Id$
61dnl
62dnl Check for target gcc
63dnl
64dnl Adaptation of autoconf-2.12's AC_PROG_CC to rtems
65dnl
66dnl 98/02/10 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
67dnl
68
69AC_DEFUN(RTEMS_PROG_CC,
70[
71AC_BEFORE([$0], [AC_PROG_CPP])dnl
72AC_BEFORE([$0], [AC_PROG_CC])dnl
73AC_CHECK_PROG(CC, gcc, gcc)
74if test -z "$CC"; then
75  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
76  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
77fi
78
79RTEMS_PROG_CC_WORKS
80AC_PROG_CC_GNU
81
82if test $ac_cv_prog_gcc = yes; then
83  GCC=yes
84dnl Check whether -g works, even if CFLAGS is set, in case the package
85dnl plays around with CFLAGS (such as to build both debugging and
86dnl normal versions of a library), tasteless as that idea is.
87  ac_test_CFLAGS="${CFLAGS+set}"
88  ac_save_CFLAGS="$CFLAGS"
89  CFLAGS=
90  AC_PROG_CC_G
91  if test "$ac_test_CFLAGS" = set; then
92    CFLAGS="$ac_save_CFLAGS"
93  elif test $ac_cv_prog_cc_g = yes; then
94    CFLAGS="-g -O2"
95  else
96    CFLAGS="-O2"
97  fi
98else
99  GCC=
100  test "${CFLAGS+set}" = set || CFLAGS="-g"
101fi
102
103CC_FOR_TARGET=$CC
104rtems_cv_prog_gcc=$ac_cv_prog_gcc
105rtems_cv_prog_cc_g=$ac_cv_prog_cc_g
106
107dnl restore initial values
108unset CC
109unset ac_cv_prog_gcc
110unset ac_cv_prog_cc_g
111unset ac_cv_prog_CC
112])
113
114
115dnl Almost identical to AC_PROG_CC_WORKS
116dnl added malloc to program fragment, because rtems has its own malloc
117dnl which is not available while bootstrapping rtems
118
119AC_DEFUN(RTEMS_PROG_CC_WORKS,
120[AC_MSG_CHECKING([whether the target C compiler ($CC $CFLAGS $LDFLAGS) works])
121AC_LANG_SAVE
122AC_LANG_C
123AC_TRY_COMPILER(
124[void *malloc() { return 0; }
125 main(){return(0);}],
126rtems_cv_prog_cc_works, rtems_cv_prog_cc_cross)
127AC_LANG_RESTORE
128AC_MSG_RESULT($rtems_cv_prog_cc_works)
129if test $rtems_cv_prog_cc_works = no; then
130  AC_MSG_ERROR([installation or configuration problem: target C compiler cannot create executables.])
131fi
132AC_MSG_CHECKING([whether the target C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
133AC_MSG_RESULT($rtems_cv_prog_cc_cross)
134])
135
136dnl
137dnl $Id$
138dnl
139dnl Check whether the target compiler accepts -specs
140dnl
141dnl 98/02/11 Ralf Corsepius     corsepiu@faw.uni-ulm.de
142dnl
143
144AC_DEFUN(RTEMS_GCC_SPECS,
145[AC_REQUIRE([RTEMS_PROG_CC])
146AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts -specs,rtems_cv_gcc_specs,
147[touch confspec
148echo 'void f(){}' >conftest.c
149if test -z "`${CC_FOR_TARGET} -specs confspec -c conftest.c 2>&1`";then
150  rtems_cv_gcc_specs=yes
151else
152  rtems_cv_gcc_specs=no
153fi
154rm -f confspec conftest*
155])])
156
157dnl
158dnl $Id$
159dnl
160dnl Check whether the target compiler accepts -pipe
161dnl
162dnl 98/02/11 Ralf Corsepius     corsepiu@faw.uni-ulm.de
163dnl
164
165AC_DEFUN(RTEMS_GCC_PIPE,
166[AC_REQUIRE([RTEMS_PROG_CC])
167AC_REQUIRE([AC_CANONICAL_HOST])
168AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts --pipe,rtems_cv_gcc_pipe,
169[
170case "$host_os" in
171  cygwin32*)
172    rtems_cv_gcc_pipe=no
173    ;;
174  *)
175    echo 'void f(){}' >conftest.c
176    if test -z "`${CC_FOR_TARGET} --pipe -c conftest.c 2>&1`";then
177      rtems_cv_gcc_pipe=yes
178    else
179      rtems_cv_gcc_pipe=no
180    fi
181    rm -f conftest*
182    ;;
183esac
184])
185])
186
187dnl
188dnl $Id$
189dnl
190dnl Check for target g++
191dnl
192dnl Adaptation of autoconf-2.12's AC_PROG_CXX to rtems
193dnl
194dnl 98/02/10 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
195dnl
196 
197AC_DEFUN(RTEMS_PROG_CXX,
198[
199AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
200AC_BEFORE([$0], [AC_PROG_CXX])dnl
201AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
202
203RTEMS_PROG_CXX_WORKS
204AC_PROG_CXX_GNU
205
206if test $ac_cv_prog_gxx = yes; then
207  GXX=yes
208dnl Check whether -g works, even if CXXFLAGS is set, in case the package
209dnl plays around with CXXFLAGS (such as to build both debugging and
210dnl normal versions of a library), tasteless as that idea is.
211  ac_test_CXXFLAGS="${CXXFLAGS+set}"
212  ac_save_CXXFLAGS="$CXXFLAGS"
213  CXXFLAGS=
214  AC_PROG_CXX_G
215  if test "$ac_test_CXXFLAGS" = set; then
216    CXXFLAGS="$ac_save_CXXFLAGS"
217  elif test $ac_cv_prog_cxx_g = yes; then
218    CXXFLAGS="-g -O2"
219  else
220    CXXFLAGS="-O2"
221  fi
222else
223  GXX=
224  test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
225fi
226CXX_FOR_TARGET=$CXX
227
228dnl restore initial values
229unset CXX
230unset ac_cv_prog_gxx
231])
232
233
234dnl Almost identical to AC_PROG_CXX_WORKS
235dnl Additional handling of malloc
236dnl NOTE: using newlib with a native compiler is cross-compiling, indeed.
237AC_DEFUN(RTEMS_PROG_CXX_WORKS,
238[AC_MSG_CHECKING([whether the target C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
239AC_LANG_SAVE
240AC_LANG_CPLUSPLUS
241
242dnl this fails if rtems uses newlib, because rtems has its own malloc which
243dnl is not available at bootstrap
244AC_TRY_COMPILER(
245  [main(){return(0);}],
246  rtems_cv_prog_cxx_works, rtems_cv_prog_cxx_cross)
247if test "$rtems_cv_prog_cxx_works" = "no"; then
248  dnl now retry with our own version of malloc
249  AC_TRY_COMPILER(
250    [extern "C" void *malloc();
251     void *malloc() { return (0); }
252     main(){return(0);}],
253    rtems_cv_prog_cxx_works, rtems_cv_prog_cxx_cross)
254fi
255AC_LANG_RESTORE
256AC_MSG_RESULT($rtems_cv_prog_cxx_works)
257if test $rtems_cv_prog_cxx_works = no; then
258  AC_MSG_ERROR([installation or configuration problem: target C++ compiler cannot create executables.])
259fi
260AC_MSG_CHECKING([whether the target C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
261AC_MSG_RESULT($rtems_cv_prog_cxx_cross)
262])
263
264dnl $Id$
265dnl
266dnl Set target tools
267dnl
268dnl 98/02/12 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
269dnl
270
271AC_DEFUN(RTEMS_CANONICALIZE_TOOLS,
272[AC_REQUIRE([RTEMS_PROG_CC])dnl
273if test "$rtems_cv_prog_gcc" = "yes" ; then
274  dnl We are using gcc, now ask it about its tools
275  dnl Necessary if gcc was configured to use the target's native tools
276  dnl or uses prefixes for gnutools (e.g. gas instead of as)
277  AR_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=ar`
278  AS_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=as`
279  LD_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=ld`
280  NM_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=nm`
281  RANLIB_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=ranlib`
282fi
283
284dnl check whether the tools exist
285dnl FIXME: What shall be done if they don't exist?
286
287dnl NOTE: CC_FOR_TARGET should always be valid at this point,
288dnl       cf. RTEMS_PROG_CC 
289AC_PATH_PROG(CC_FOR_TARGET,"$program_prefix"gcc,no)
290
291dnl FIXME: This may fail if the compiler has not been recognized as gcc
292dnl       and uses tools with different names
293AC_PATH_PROG(AR_FOR_TARGET,"$program_prefix"ar,no)
294AC_PATH_PROG(AS_FOR_TARGET,"$program_prefix"as,no)
295AC_PATH_PROG(NM_FOR_TARGET,"$program_prefix"nm,no)
296AC_PATH_PROG(LD_FOR_TARGET,"$program_prefix"ld,no)
297
298dnl NOTE: This is doubtful, but should not disturb all current rtems'
299dnl       targets (remark: solaris fakes ranlib!!)
300AC_PATH_PROG(RANLIB_FOR_TARGET,"$program_prefix"ranlib,no)
301
302dnl NOTE: These may not be available, if not using gnutools
303AC_PATH_PROG(OBJCOPY_FOR_TARGET,"$program_prefix"objcopy,no)
304AC_PATH_PROG(SIZE_FOR_TARGET,"$program_prefix"size,no)
305])
306
307dnl $Id$
308
309dnl RTEMS_CHECK_MAKEFILE(path)
310dnl Search for Makefile.in's within the directory starting
311dnl at path and append an entry for Makefile to global variable
312dnl "makefiles" (from configure.in) for each Makefile.in found
313dnl
314AC_DEFUN(RTEMS_CHECK_MAKEFILE,
315[RTEMS_CHECK_FILES_IN($1,Makefile,makefiles)
316])
317
318dnl $Id$
319
320dnl RTEMS_CHECK_FILES_IN(path,file,var)
321dnl path .. path relative to srcdir, where to start searching for files
322dnl file .. name of the files to search for
323dnl var  .. shell variable to append files found
324AC_DEFUN(RTEMS_CHECK_FILES_IN,
325[
326AC_MSG_CHECKING(for $2.in in $1)
327if test -d $srcdir/$1; then
328  rtems_av_save_dir=`pwd`;
329  cd $srcdir;
330  rtems_av_tmp=`find $1 -name "$2.in" -print | sed "s/$2\.in/%/" | sort | sed "s/%/$2/"`
331  $3="$$3 $rtems_av_tmp";
332  cd $rtems_av_save_dir;
333  AC_MSG_RESULT(done)
334else
335  AC_MSG_RESULT(no)
336fi
337])
338
339
Note: See TracBrowser for help on using the repository browser.