source: rtems/aclocal.m4 @ 04c99873

4.104.114.84.95
Last change on this file since 04c99873 was 04c99873, checked in by Joel Sherrill <joel.sherrill@…>, on 03/21/98 at 15:27:00

Fixed RTEMS_PROG_CC_WORKS and RTEMS_PROG_CXX_WORKS so they could
successfully work on powerpc-rtems and hppa1.1-rtems.

  • Property mode set to 100644
File size: 9.7 KB
RevLine 
[e81ef51]1dnl aclocal.m4 generated automatically by aclocal 1.2
2
3dnl $Id$
[b5ddb74]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])
[1670eede]41
[e81ef51]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(
[04c99873]124[
125#if defined(__PPC__)
126  int __SDATA_START__;  int __SDATA2_START__;
127  int __GOT_START__;    int __GOT_END__;
128  int __GOT2_START__;   int __GOT2_END__;
129  int __SBSS_END__;     int __SBSS2_END__;
130  int __FIXUP_START__;  int __FIXUP_END__;
131  int __EXCEPT_START__; int __EXCEPT_END__;
132  int __init;           int __fini;
133#endif
134#if defined(__hppa__)
135  asm ( ".subspa \$GLOBAL\$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=40");
136  asm ( ".export \$global\$" );
137  asm ( "\$global\$:");
138#endif
139 int atexit() { return 0; }
140 void *malloc() { return 0; }
[e81ef51]141 main(){return(0);}],
142rtems_cv_prog_cc_works, rtems_cv_prog_cc_cross)
143AC_LANG_RESTORE
144AC_MSG_RESULT($rtems_cv_prog_cc_works)
145if test $rtems_cv_prog_cc_works = no; then
146  AC_MSG_ERROR([installation or configuration problem: target C compiler cannot create executables.])
147fi
148AC_MSG_CHECKING([whether the target C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
149AC_MSG_RESULT($rtems_cv_prog_cc_cross)
150])
151
152dnl
153dnl $Id$
154dnl
155dnl Check whether the target compiler accepts -specs
156dnl
157dnl 98/02/11 Ralf Corsepius     corsepiu@faw.uni-ulm.de
158dnl
159
160AC_DEFUN(RTEMS_GCC_SPECS,
161[AC_REQUIRE([RTEMS_PROG_CC])
162AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts -specs,rtems_cv_gcc_specs,
163[touch confspec
164echo 'void f(){}' >conftest.c
165if test -z "`${CC_FOR_TARGET} -specs confspec -c conftest.c 2>&1`";then
166  rtems_cv_gcc_specs=yes
167else
168  rtems_cv_gcc_specs=no
169fi
170rm -f confspec conftest*
171])])
172
173dnl
174dnl $Id$
175dnl
176dnl Check whether the target compiler accepts -pipe
177dnl
178dnl 98/02/11 Ralf Corsepius     corsepiu@faw.uni-ulm.de
179dnl
180
181AC_DEFUN(RTEMS_GCC_PIPE,
[a7a08713]182[AC_REQUIRE([RTEMS_PROG_CC])
183AC_REQUIRE([AC_CANONICAL_HOST])
[e81ef51]184AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts --pipe,rtems_cv_gcc_pipe,
185[
[a7a08713]186case "$host_os" in
187  cygwin32*)
188    rtems_cv_gcc_pipe=no
189    ;;
190  *)
191    echo 'void f(){}' >conftest.c
192    if test -z "`${CC_FOR_TARGET} --pipe -c conftest.c 2>&1`";then
193      rtems_cv_gcc_pipe=yes
194    else
195      rtems_cv_gcc_pipe=no
196    fi
197    rm -f conftest*
198    ;;
199esac
200])
201])
[e81ef51]202
203dnl
204dnl $Id$
205dnl
206dnl Check for target g++
207dnl
208dnl Adaptation of autoconf-2.12's AC_PROG_CXX to rtems
209dnl
210dnl 98/02/10 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
211dnl
212 
213AC_DEFUN(RTEMS_PROG_CXX,
214[
215AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
216AC_BEFORE([$0], [AC_PROG_CXX])dnl
217AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
218
219RTEMS_PROG_CXX_WORKS
220AC_PROG_CXX_GNU
221
222if test $ac_cv_prog_gxx = yes; then
223  GXX=yes
224dnl Check whether -g works, even if CXXFLAGS is set, in case the package
225dnl plays around with CXXFLAGS (such as to build both debugging and
226dnl normal versions of a library), tasteless as that idea is.
227  ac_test_CXXFLAGS="${CXXFLAGS+set}"
228  ac_save_CXXFLAGS="$CXXFLAGS"
229  CXXFLAGS=
230  AC_PROG_CXX_G
231  if test "$ac_test_CXXFLAGS" = set; then
232    CXXFLAGS="$ac_save_CXXFLAGS"
233  elif test $ac_cv_prog_cxx_g = yes; then
234    CXXFLAGS="-g -O2"
235  else
236    CXXFLAGS="-O2"
237  fi
238else
239  GXX=
240  test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
241fi
242CXX_FOR_TARGET=$CXX
243
244dnl restore initial values
245unset CXX
246unset ac_cv_prog_gxx
247])
248
249
250dnl Almost identical to AC_PROG_CXX_WORKS
251dnl Additional handling of malloc
252dnl NOTE: using newlib with a native compiler is cross-compiling, indeed.
253AC_DEFUN(RTEMS_PROG_CXX_WORKS,
254[AC_MSG_CHECKING([whether the target C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
255AC_LANG_SAVE
256AC_LANG_CPLUSPLUS
257
258dnl this fails if rtems uses newlib, because rtems has its own malloc which
259dnl is not available at bootstrap
260AC_TRY_COMPILER(
261  [main(){return(0);}],
262  rtems_cv_prog_cxx_works, rtems_cv_prog_cxx_cross)
263if test "$rtems_cv_prog_cxx_works" = "no"; then
264  dnl now retry with our own version of malloc
265  AC_TRY_COMPILER(
[04c99873]266    [extern "C" void *malloc(); void *malloc() { return (0); }
267     extern "C" int atexit();   int atexit() { return 0; }
268#if defined(__PPC__)
269  int __SDATA_START__;  int __SDATA2_START__;
270  int __GOT_START__;    int __GOT_END__;
271  int __GOT2_START__;   int __GOT2_END__;
272  int __SBSS_END__;     int __SBSS2_END__;
273  int __FIXUP_START__;  int __FIXUP_END__;
274  int __EXCEPT_START__; int __EXCEPT_END__;
275  int __init;           int __fini;
276#endif
277#if defined(__hppa__)
278  asm ( ".subspa \$GLOBAL\$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=40");
279  asm ( ".export \$global\$" );
280  asm ( "\$global\$:");
281#endif
282
[e81ef51]283     main(){return(0);}],
284    rtems_cv_prog_cxx_works, rtems_cv_prog_cxx_cross)
285fi
286AC_LANG_RESTORE
287AC_MSG_RESULT($rtems_cv_prog_cxx_works)
288if test $rtems_cv_prog_cxx_works = no; then
289  AC_MSG_ERROR([installation or configuration problem: target C++ compiler cannot create executables.])
290fi
291AC_MSG_CHECKING([whether the target C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
292AC_MSG_RESULT($rtems_cv_prog_cxx_cross)
293])
294
295dnl $Id$
296dnl
297dnl Set target tools
298dnl
299dnl 98/02/12 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
300dnl
301
302AC_DEFUN(RTEMS_CANONICALIZE_TOOLS,
303[AC_REQUIRE([RTEMS_PROG_CC])dnl
304if test "$rtems_cv_prog_gcc" = "yes" ; then
305  dnl We are using gcc, now ask it about its tools
306  dnl Necessary if gcc was configured to use the target's native tools
307  dnl or uses prefixes for gnutools (e.g. gas instead of as)
308  AR_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=ar`
309  AS_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=as`
310  LD_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=ld`
311  NM_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=nm`
312  RANLIB_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=ranlib`
313fi
314
315dnl check whether the tools exist
316dnl FIXME: What shall be done if they don't exist?
317
318dnl NOTE: CC_FOR_TARGET should always be valid at this point,
319dnl       cf. RTEMS_PROG_CC 
320AC_PATH_PROG(CC_FOR_TARGET,"$program_prefix"gcc,no)
321
322dnl FIXME: This may fail if the compiler has not been recognized as gcc
323dnl       and uses tools with different names
324AC_PATH_PROG(AR_FOR_TARGET,"$program_prefix"ar,no)
325AC_PATH_PROG(AS_FOR_TARGET,"$program_prefix"as,no)
326AC_PATH_PROG(NM_FOR_TARGET,"$program_prefix"nm,no)
327AC_PATH_PROG(LD_FOR_TARGET,"$program_prefix"ld,no)
328
329dnl NOTE: This is doubtful, but should not disturb all current rtems'
330dnl       targets (remark: solaris fakes ranlib!!)
331AC_PATH_PROG(RANLIB_FOR_TARGET,"$program_prefix"ranlib,no)
332
333dnl NOTE: These may not be available, if not using gnutools
334AC_PATH_PROG(OBJCOPY_FOR_TARGET,"$program_prefix"objcopy,no)
335AC_PATH_PROG(SIZE_FOR_TARGET,"$program_prefix"size,no)
336])
337
338dnl $Id$
339
340dnl RTEMS_CHECK_MAKEFILE(path)
341dnl Search for Makefile.in's within the directory starting
342dnl at path and append an entry for Makefile to global variable
343dnl "makefiles" (from configure.in) for each Makefile.in found
344dnl
345AC_DEFUN(RTEMS_CHECK_MAKEFILE,
346[RTEMS_CHECK_FILES_IN($1,Makefile,makefiles)
347])
348
349dnl $Id$
350
[37717818]351dnl RTEMS_CHECK_FILES_IN(path,file,var)
352dnl path .. path relative to srcdir, where to start searching for files
353dnl file .. name of the files to search for
[e81ef51]354dnl var  .. shell variable to append files found
[37717818]355AC_DEFUN(RTEMS_CHECK_FILES_IN,
356[
[2f03a608]357AC_MSG_CHECKING(for $2.in in $1)
[37717818]358if test -d $srcdir/$1; then
359  rtems_av_save_dir=`pwd`;
360  cd $srcdir;
[2f03a608]361  rtems_av_tmp=`find $1 -name "$2.in" -print | sed "s/$2\.in/%/" | sort | sed "s/%/$2/"`
[37717818]362  $3="$$3 $rtems_av_tmp";
363  cd $rtems_av_save_dir;
364  AC_MSG_RESULT(done)
365else
366  AC_MSG_RESULT(no)
367fi
[1670eede]368])
369
370
Note: See TracBrowser for help on using the repository browser.