source: rtems/aclocal.m4 @ f44a81b

4.104.114.84.9
Last change on this file since f44a81b was f44a81b, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 5, 1998 at 12:52:31 PM

Modifed i386 gas test to put each directive on its own line per
problem report from Erik Ivanenko <erik.ivanenko@…>.

  • Property mode set to 100644
File size: 14.4 KB
Line 
1dnl aclocal.m4 generated automatically by aclocal 1.2
2
3dnl
4dnl $Id$
5dnl
6
7dnl macro to detect mkdir
8AC_DEFUN(RTEMS_PATH_MKDIR,
9[AC_PATH_PROG(MKDIR,mkdir)
10])
11
12dnl macro to check for mkdir -p
13AC_DEFUN(RTEMS_PROG_MKDIR_P,
14[
15AC_REQUIRE([RTEMS_PATH_MKDIR])
16AC_MSG_CHECKING([for working $MKDIR -p])
17AC_CACHE_VAL(rtems_cv_prog_mkdir_p,
18[rm -rf conftestdata
19if $MKDIR -p conftestdata 2>/dev/null ;then
20rtems_cv_prog_MKDIR_P="yes"
21else
22rtems_cv_prog_MKDIR_P="no"
23fi])dnl
24rm -rf conftestdata
25AC_MSG_RESULT($rtems_cv_prog_MKDIR_P)
26])
27
28dnl macro to check for mkdir -m 0755
29AC_DEFUN(RTEMS_PROG_MKDIR_M,
30[
31AC_REQUIRE([RTEMS_PATH_MKDIR])
32AC_MSG_CHECKING([for working $MKDIR -m 0755])
33AC_CACHE_VAL(rtems_cv_prog_MKDIR_P,
34[rm -rf conftestdata
35if $MKDIR -m 0775 conftestdata 2>/dev/null; then
36rtems_cv_prog_MKDIR_M="yes"
37else
38rtems_cv_prog_MKDIR_M="no"
39fi])dnl
40rm -rf conftestdata
41AC_MSG_RESULT($rtems_cv_prog_MKDIR_M)
42])
43
44
45dnl
46dnl $Id$
47dnl
48
49dnl canonicalize target name
50dnl NOTE: Most rtems targets do not fullfil autoconf's
51dnl target naming conventions "processor-vendor-os"
52dnl Therefore autoconf's AC_CANONICAL_TARGET will fail for them
53dnl and we have to fix it for rtems ourselves
54
55AC_DEFUN(RTEMS_CANONICAL_TARGET_CPU,
56[AC_MSG_CHECKING(rtems target cpu)
57changequote(<<, >>)dnl
58target_cpu=`echo $target | sed 's%^\([^-]*\)-\(.*\)$%\1%'`
59changequote([, ])dnl
60AC_MSG_RESULT($target_cpu)
61])
62
63dnl
64dnl  $Id$
65dnl
66dnl Set program_prefix
67dnl
68dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
69dnl                             Extracted from configure
70
71AC_DEFUN(RTEMS_TOOL_PREFIX,
72[AC_REQUIRE([AC_CANONICAL_TARGET])dnl
73AC_REQUIRE([AC_CANONICAL_BUILD])dnl
74
75if [[ "${program_prefix}" = "NONE" ]] ; then
76  if [[ "${target}" = "${host}" ]] ; then
77    program_prefix=
78  else
79    program_prefix=${target}-
80  fi
81fi
82])
83
84dnl
85dnl $Id$
86dnl
87dnl Check for target gcc
88dnl
89dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
90dnl                             Completely reworked
91
92AC_DEFUN(RTEMS_PROG_CC,
93[
94AC_BEFORE([$0], [AC_PROG_CPP])dnl
95AC_BEFORE([$0], [AC_PROG_CC])dnl
96AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
97
98dnl Only accept gcc and cc
99dnl NOTE: This might be too restrictive for native compilation
100AC_PATH_PROGS(CC_FOR_TARGET, "$program_prefix"gcc "$program_prefix"cc )
101test -z "$CC_FOR_TARGET" \
102  && AC_MSG_ERROR([no acceptable cc found in \$PATH])
103
104dnl backup
105rtems_save_CC=$CC
106rtems_save_CFLAGS=$CFLAGS
107
108dnl temporarily set CC
109CC=$CC_FOR_TARGET
110
111AC_PROG_CC_WORKS
112AC_PROG_CC_GNU
113
114if test $ac_cv_prog_gcc = yes; then
115  GCC=yes
116dnl Check whether -g works, even if CFLAGS is set, in case the package
117dnl plays around with CFLAGS (such as to build both debugging and
118dnl normal versions of a library), tasteless as that idea is.
119  ac_test_CFLAGS="${CFLAGS+set}"
120  ac_save_CFLAGS="$CFLAGS"
121  CFLAGS=
122  AC_PROG_CC_G
123  if test "$ac_test_CFLAGS" = set; then
124    CFLAGS="$ac_save_CFLAGS"
125  elif test $ac_cv_prog_cc_g = yes; then
126    CFLAGS="-g -O2"
127  else
128    CFLAGS="-O2"
129  fi
130else
131  GCC=
132  test "${CFLAGS+set}" = set || CFLAGS="-g"
133fi
134
135rtems_cv_prog_gcc=$ac_cv_prog_gcc
136rtems_cv_prog_cc_g=$ac_cv_prog_cc_g
137rtems_cv_prog_cc_works=$ac_cv_prog_cc_works
138rtems_cv_prog_cc_cross=$ac_cv_prog_cc_cross
139
140dnl restore initial values
141CC=$rtems_save_CC
142CFLAGS=$rtems_save_CFLAGS
143
144unset ac_cv_prog_gcc
145unset ac_cv_prog_cc_g
146unset ac_cv_prog_cc_works
147unset ac_cv_prog_cc_cross
148])
149
150dnl
151dnl $Id$
152dnl
153dnl Check whether the target compiler accepts -specs
154dnl
155dnl 98/02/11 Ralf Corsepius     corsepiu@faw.uni-ulm.de
156dnl
157
158AC_DEFUN(RTEMS_GCC_SPECS,
159[AC_REQUIRE([RTEMS_PROG_CC])
160AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts -specs,rtems_cv_gcc_specs,
161[
162rtems_cv_gcc_specs=no
163if test "$rtems_cv_prog_gcc" = "yes"; then
164  touch confspec
165  echo 'void f(){}' >conftest.c
166  if test -z "`${CC_FOR_TARGET} -specs confspec -c conftest.c 2>&1`";then
167    rtems_cv_gcc_specs=yes
168  fi
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,
182[AC_REQUIRE([RTEMS_PROG_CC])
183AC_REQUIRE([AC_CANONICAL_HOST])
184AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts --pipe,rtems_cv_gcc_pipe,
185[
186rtems_cv_gcc_pipe=no
187if test "$rtems_cv_prog_gcc" = "yes"; then
188case "$host_os" in
189  cygwin32*)
190    ;;
191  *)
192    echo 'void f(){}' >conftest.c
193    if test -z "`${CC_FOR_TARGET} --pipe -c conftest.c 2>&1`";then
194      rtems_cv_gcc_pipe=yes
195    fi
196    rm -f conftest*
197    ;;
198esac
199fi
200])
201])
202
203dnl
204dnl $Id$
205dnl
206dnl Check for target g++
207dnl
208dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
209dnl                             Completely reworked
210
211AC_DEFUN(RTEMS_PROG_CXX,
212[
213AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
214AC_BEFORE([$0], [AC_PROG_CXX])dnl
215AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
216
217dnl Only accept g++ and c++
218dnl NOTE: This might be too restrictive for native compilation
219AC_PATH_PROGS(CXX_FOR_TARGET, "$program_prefix"g++ "$program_prefix"c++)
220test -z "$CXX_FOR_TARGET" \
221  && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
222
223dnl backup
224rtems_save_CXX=$CXX
225rtems_save_CXXFLAGS=$CXXFLAGS
226
227dnl temporarily set CXX
228CXX=$CXX_FOR_TARGET
229
230AC_PROG_CXX_WORKS
231AC_PROG_CXX_GNU
232
233if test $ac_cv_prog_gxx = yes; then
234  GXX=yes
235dnl Check whether -g works, even if CXXFLAGS is set, in case the package
236dnl plays around with CXXFLAGS (such as to build both debugging and
237dnl normal versions of a library), tasteless as that idea is.
238  ac_test_CXXFLAGS="${CXXFLAGS+set}"
239  ac_save_CXXFLAGS="$CXXFLAGS"
240  CXXFLAGS=
241  AC_PROG_CXX_G
242  if test "$ac_test_CXXFLAGS" = set; then
243    CXXFLAGS="$ac_save_CXXFLAGS"
244  elif test $ac_cv_prog_cxx_g = yes; then
245    CXXFLAGS="-g -O2"
246  else
247    CXXFLAGS="-O2"
248  fi
249else
250  GXX=
251  test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
252fi
253
254rtems_cv_prog_gxx=$ac_cv_prog_gxx
255rtems_cv_prog_cxx_g=$ac_cv_prog_cxx_g
256rtems_cv_prog_cxx_works=$ac_cv_prog_cxx_works
257rtems_cv_prog_cxx_cross=$ac_cv_prog_cxx_cross
258
259CXX=$rtems_save_CXX
260CXXFLAGS=$rtems_save_CXXFLAGS
261
262dnl restore initial values
263unset ac_cv_prog_gxx
264unset ac_cv_prog_cc_g
265unset ac_cv_prog_cxx_works
266unset ac_cv_prog_cxx_cross
267])
268
269dnl
270dnl $Id$
271dnl
272dnl Set target tools
273dnl
274dnl 98/06/23 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
275dnl             fixing cache/environment variable handling
276dnl             adding checks for cygwin/egcs '\\'-bug
277dnl             adding checks for ranlib/ar -s problem
278dnl
279dnl 98/02/12 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
280dnl
281
282AC_DEFUN(RTEMS_GCC_PRINT,
283[ case $host_os in
284  *cygwin32*)
285    dnl FIXME: Hack for cygwin/egcs reporting mixed '\\' and '/'
286    dnl        Should be removed once cygwin/egcs reports '/' only
287    $1=`$CC_FOR_TARGET --print-prog-name=$2 | sed -e 's%\\\\%/%g' `
288    ;;
289  *)
290    $1=`$CC_FOR_TARGET --print-prog-name=$2`
291    ;;
292  esac
293])
294
295AC_DEFUN(RTEMS_PATH_TOOL,
296[
297AC_MSG_CHECKING([target's $2])
298AC_CACHE_VAL(ac_cv_path_$1,:)
299AC_MSG_RESULT([$ac_cv_path_$1])
300
301if test -n "$ac_cv_path_$1"; then
302  dnl retrieve the value from the cache
303  $1=$ac_cv_path_$1
304else
305  dnl the cache was not set
306  if test -z "[$]$1" ; then
307    if test "$rtems_cv_prog_gcc" = "yes"; then
308      # We are using gcc, ask it about its tool
309      # NOTE: Necessary if gcc was configured to use the target's
310      # native tools or uses prefixes for gnutools (e.g. gas instead of as)
311      RTEMS_GCC_PRINT($1,$2)
312    fi
313  else
314    # The user set an environment variable.
315    # Check whether it is an absolute path, otherwise AC_PATH_PROG
316    # will override the environment variable, which isn't what the user
317    # intends
318    AC_MSG_CHECKING([whether environment variable $1 is an absolute path])
319    case "[$]$1" in
320    /*) # valid
321      AC_MSG_RESULT("yes")
322    ;;
323    *)  # invalid for AC_PATH_PROG
324      AC_MSG_RESULT("no")
325      AC_MSG_ERROR([***]
326        [Environment variable $1 should ether]
327        [be unset (preferred) or contain an absolute path])
328    ;;
329    esac
330  fi
331
332  AC_PATH_PROG($1,"$program_prefix"$2,$3)
333fi
334])
335
336AC_DEFUN(RTEMS_CANONICALIZE_TOOLS,
337[AC_REQUIRE([RTEMS_PROG_CC])dnl
338
339dnl FIXME: What shall be done if these tools are not available?
340  RTEMS_PATH_TOOL(AR_FOR_TARGET,ar,no)
341  RTEMS_PATH_TOOL(AS_FOR_TARGET,as,no)
342  RTEMS_PATH_TOOL(LD_FOR_TARGET,ld,no)
343  RTEMS_PATH_TOOL(NM_FOR_TARGET,nm,no)
344
345dnl special treatment of ranlib
346  RTEMS_PATH_TOOL(RANLIB_FOR_TARGET,ranlib,no)
347  if test "$RANLIB_FOR_TARGET" = "no"; then
348    # ranlib wasn't found; check if ar -s is available
349    RTEMS_AR_FOR_TARGET_S
350    if test $rtems_cv_AR_FOR_TARGET_S = "yes" ; then
351      dnl override RANLIB_FOR_TARGET's cache
352      ac_cv_path_RANLIB_FOR_TARGET="$AR_FOR_TARGET -s"
353      RANLIB_FOR_TARGET=$ac_cv_path_RANLIB_FOR_TARGET
354    else
355      AC_MSG_ERROR([***]
356        [Can't figure out how to build a library index]
357        [Nether ranlib nor ar -s seem to be available] )
358    fi
359  fi
360
361dnl NOTE: These may not be available if not using gnutools
362  RTEMS_PATH_TOOL(OBJCOPY_FOR_TARGET,objcopy,no)
363  RTEMS_PATH_TOOL(SIZE_FOR_TARGET,size,no)
364])
365
366dnl
367dnl $Id$
368dnl
369
370AC_DEFUN(RTEMS_AR_FOR_TARGET_S,
371[
372AC_CACHE_CHECK(whether $AR_FOR_TARGET -s works,
373rtems_cv_AR_FOR_TARGET_S,
374[
375cat > conftest.$ac_ext <<EOF
376int foo( int b )
377{ return b; }
378EOF
379if AC_TRY_COMMAND($CC_FOR_TARGET -o conftest.o -c conftest.$ac_ext) \
380  && AC_TRY_COMMAND($AR_FOR_TARGET -sr conftest.a conftest.o) \
381  && test -s conftest.a ; \
382then
383  rtems_cv_AR_FOR_TARGET_S="yes"
384else
385  rtems_cv_AR_FOR_TARGET_S="no"
386fi
387  rm -f conftest*
388])
389])
390
391
392dnl
393dnl  $Id$
394dnl
395
396dnl check for i386 gas supporting 16 bit mode
397dnl     - binutils 2.9.1.0.7 and higher
398
399AC_DEFUN(RTEMS_I386_GAS_CODE16,
400  if test "${target_cpu}" = "i386"; then
401    AC_CACHE_CHECK([for 16 bit mode assembler support],
402      rtems_cv_prog_gas_code16,
403      [cat > conftest.s << EOF
404         .code16
405         data32
406         addr32
407         lgdt
408         0
409EOF
410      if AC_TRY_COMMAND($AS_FOR_TARGET -o conftest.o conftest.s); then
411        rtems_cv_prog_gas_code16=yes
412      else
413        rtems_cv_prog_gas_code16=no
414      fi])
415    RTEMS_GAS_CODE16="$rtems_cv_prog_gas_code16"
416  fi
417)
418
419
420dnl
421dnl  $Id$
422dnl
423dnl Detect the Cygwin32 environment (unix under Win32)
424dnl
425dnl 98/06/16 David Fiddes       (D.J.Fiddes@hw.ac.uk)
426dnl                             Hacked from automake-1.3
427
428# Check to see if we're running under Cygwin32, without using
429# AC_CANONICAL_*.  If so, set output variable CYGWIN32 to "yes".
430# Otherwise set it to "no".
431
432dnl RTEMS_CYGWIN32()
433AC_DEFUN(RTEMS_CYGWIN32,
434[AC_CACHE_CHECK(for Cygwin32 environment, rtems_cv_cygwin32,
435[AC_TRY_COMPILE(,[return __CYGWIN32__;],
436rtems_cv_cygwin32=yes, rtems_cv_cygwin32=no)
437rm -f conftest*])
438CYGWIN32=
439test "$rtems_cv_cygwin32" = yes && CYGWIN32=yes])
440
441
442dnl
443dnl  $Id$
444dnl
445dnl Set the EXE extension
446dnl
447dnl 98/06/16 David Fiddes       (D.J.Fiddes@hw.ac.uk)
448dnl                             Hacked from automake-1.3
449
450# Check to see if we're running under Win32, without using
451# AC_CANONICAL_*.  If so, set output variable EXEEXT to ".exe".
452# Otherwise set it to "".
453
454dnl RTEMS_EXEEXT()
455dnl This knows we add .exe if we're building in the Cygwin32
456dnl environment. But if we're not, then it compiles a test program
457dnl to see if there is a suffix for executables.
458AC_DEFUN(RTEMS_EXEEXT,
459[AC_REQUIRE([RTEMS_CYGWIN32])
460AC_MSG_CHECKING([for executable suffix])
461AC_CACHE_VAL(rtems_cv_exeext,
462[if test "$CYGWIN32" = yes; then
463rtems_cv_exeext=.exe
464else
465cat > rtems_c_test.c << 'EOF'
466int main() {
467/* Nothing needed here */
468}
469EOF
470${CC-cc} -o rtems_c_test $CFLAGS $CPPFLAGS $LDFLAGS rtems_c_test.c $LIBS 1>&5
471rtems_cv_exeext=`echo rtems_c_test.* | grep -v rtems_c_test.c | sed -e s/rtems_c_test//`
472rm -f rtems_c_test*])
473test x"${rtems_cv_exeext}" = x && rtems_cv_exeext=no
474fi
475EXEEXT=""
476test x"${rtems_cv_exeext}" != xno && EXEEXT=${rtems_cv_exeext}
477AC_MSG_RESULT(${rtems_cv_exeext})
478AC_SUBST(EXEEXT)])
479
480
481dnl
482dnl $Id$
483dnl
484dnl Check for System V IPC calls used by Unix simulators
485dnl
486dnl 98/07/17 Dario Alcocer     alcocer@netcom.com
487dnl          Ralf Corsepius    corsepiu@faw.uni-ulm.de
488dnl
489dnl Note: $host_os should probably *not* ever be used here to
490dnl determine if host supports System V IPC calls, since some
491dnl (e.g. FreeBSD 2.x) are configured by default to include only
492dnl a subset of the System V IPC calls.  Therefore, to make sure
493dnl all of the required calls are found, test for each call explicitly.
494dnl
495dnl All of the calls use IPC_PRIVATE, so tests will not unintentionally
496dnl modify any existing key sets.  See the man pages for semget, shmget,
497dnl msgget, semctl, shmctl and msgctl for details.
498
499AC_DEFUN(RTEMS_SYSV_SEM,
500[AC_REQUIRE([RTEMS_PROG_CC])
501AC_REQUIRE([AC_CANONICAL_HOST])
502AC_CACHE_CHECK(whether $RTEMS_HOST supports System V semaphores,
503rtems_cv_sysv_sem,
504[
505AC_TRY_RUN([
506#include <sys/types.h>
507#include <sys/ipc.h>
508#include <sys/sem.h>
509int main () {
510#if !defined(sun)
511  union semun arg ;
512#else
513  union semun {
514    int val;
515    struct semid_ds *buf;
516    ushort *array;
517  } arg;
518#endif
519  int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
520  if (id == -1)
521    exit(1);
522  arg.val = 0; /* avoid implicit type cast to union */
523  if (semctl(id, 0, IPC_RMID, arg) == -1)
524    exit(1);
525  exit(0);
526}
527],
528rtems_cv_sysv_sem="yes", rtems_cv_sysv_sem="no", :)
529])
530])
531
532AC_DEFUN(RTEMS_SYSV_SHM,
533[AC_REQUIRE([RTEMS_PROG_CC])
534AC_REQUIRE([AC_CANONICAL_HOST])
535AC_CACHE_CHECK(whether $RTEMS_HOST supports System V shared memory,
536rtems_cv_sysv_shm,
537[
538AC_TRY_RUN([
539#include <sys/types.h>
540#include <sys/ipc.h>
541#include <sys/shm.h>
542int main () {
543  int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
544  if (id == -1)
545    exit(1);
546  if (shmctl(id, IPC_RMID, 0) == -1)
547    exit(1);
548  exit(0);
549}
550],
551rtems_cv_sysv_shm="yes", rtems_cv_sysv_shm="no", :)
552])
553])
554
555AC_DEFUN(RTEMS_SYSV_MSG,
556[AC_REQUIRE([RTEMS_PROG_CC])
557AC_REQUIRE([AC_CANONICAL_HOST])
558AC_CACHE_CHECK(whether $RTEMS_HOST supports System V messages,
559rtems_cv_sysv_msg,
560[
561AC_TRY_RUN([
562#include <sys/types.h>
563#include <sys/ipc.h>
564#include <sys/msg.h>
565int main () {
566  int id=msgget(IPC_PRIVATE,IPC_CREAT|0400);
567  if (id == -1)
568    exit(1);
569  if (msgctl(id, IPC_RMID, 0) == -1)
570    exit(1);
571  exit(0);
572}
573],
574rtems_cv_sysv_msg="yes", rtems_cv_sysv_msg="no", :)
575])
576])
577
578dnl
579dnl $Id$
580dnl
581
582dnl RTEMS_CHECK_MAKEFILE(path)
583dnl Search for Makefile.in's within the directory starting
584dnl at path and append an entry for Makefile to global variable
585dnl "makefiles" (from configure.in) for each Makefile.in found
586dnl
587AC_DEFUN(RTEMS_CHECK_MAKEFILE,
588[RTEMS_CHECK_FILES_IN($1,Makefile,makefiles)
589])
590
591dnl
592dnl $Id$
593dnl
594
595dnl RTEMS_CHECK_FILES_IN(path,file,var)
596dnl path .. path relative to srcdir, where to start searching for files
597dnl file .. name of the files to search for
598dnl var  .. shell variable to append files found
599
600AC_DEFUN(RTEMS_CHECK_FILES_IN,
601[
602AC_MSG_CHECKING(for $2.in in $1)
603if test -d $srcdir/$1; then
604  rtems_av_save_dir=`pwd`;
605  cd $srcdir;
606  rtems_av_tmp=`find $1 -name "$2.in" -print | sed "s/$2\.in/%/" | sort | sed "s/%/$2/"`
607  $3="$$3 $rtems_av_tmp";
608  cd $rtems_av_save_dir;
609  AC_MSG_RESULT(done)
610else
611  AC_MSG_RESULT(no)
612fi
613])
614
615
Note: See TracBrowser for help on using the repository browser.