source: rtems/aclocal.m4 @ be4284d0

4.104.114.84.95
Last change on this file since be4284d0 was 2c3840b, checked in by Joel Sherrill <joel.sherrill@…>, on 09/30/98 at 20:58:39

Added new autoconf test for i386 code16/code32 support. The guts of the
test were suggested by Ian Taylor <ian@…> and Joel did the
hard part of putting it in aclocal and editting all the offending
Makefiles and source code which could use this feature.

  • Property mode set to 100644
File size: 14.3 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
397
398AC_DEFUN(RTEMS_I386_GAS_CODE16,
399  if test "${target_cpu}" = "i386"; then
400    AC_CACHE_CHECK([for 16 bit mode assembler support],
401      rtems_cv_prog_gas_code16,
402      [cat > conftest.s << EOF
403         .code16
404         data32 addr32 lgdt 0
405EOF
406      if AC_TRY_COMMAND($AS_FOR_TARGET -o conftest.o conftest.s); then
407        rtems_cv_prog_gas_code16=yes
408      else
409        rtems_cv_prog_gas_code16=no
410      fi])
411    RTEMS_GAS_CODE16="$rtems_cv_prog_gas_code16"
412  fi
413)
414
415
416dnl
417dnl  $Id$
418dnl
419dnl Detect the Cygwin32 environment (unix under Win32)
420dnl
421dnl 98/06/16 David Fiddes       (D.J.Fiddes@hw.ac.uk)
422dnl                             Hacked from automake-1.3
423
424# Check to see if we're running under Cygwin32, without using
425# AC_CANONICAL_*.  If so, set output variable CYGWIN32 to "yes".
426# Otherwise set it to "no".
427
428dnl RTEMS_CYGWIN32()
429AC_DEFUN(RTEMS_CYGWIN32,
430[AC_CACHE_CHECK(for Cygwin32 environment, rtems_cv_cygwin32,
431[AC_TRY_COMPILE(,[return __CYGWIN32__;],
432rtems_cv_cygwin32=yes, rtems_cv_cygwin32=no)
433rm -f conftest*])
434CYGWIN32=
435test "$rtems_cv_cygwin32" = yes && CYGWIN32=yes])
436
437
438dnl
439dnl  $Id$
440dnl
441dnl Set the EXE extension
442dnl
443dnl 98/06/16 David Fiddes       (D.J.Fiddes@hw.ac.uk)
444dnl                             Hacked from automake-1.3
445
446# Check to see if we're running under Win32, without using
447# AC_CANONICAL_*.  If so, set output variable EXEEXT to ".exe".
448# Otherwise set it to "".
449
450dnl RTEMS_EXEEXT()
451dnl This knows we add .exe if we're building in the Cygwin32
452dnl environment. But if we're not, then it compiles a test program
453dnl to see if there is a suffix for executables.
454AC_DEFUN(RTEMS_EXEEXT,
455[AC_REQUIRE([RTEMS_CYGWIN32])
456AC_MSG_CHECKING([for executable suffix])
457AC_CACHE_VAL(rtems_cv_exeext,
458[if test "$CYGWIN32" = yes; then
459rtems_cv_exeext=.exe
460else
461cat > rtems_c_test.c << 'EOF'
462int main() {
463/* Nothing needed here */
464}
465EOF
466${CC-cc} -o rtems_c_test $CFLAGS $CPPFLAGS $LDFLAGS rtems_c_test.c $LIBS 1>&5
467rtems_cv_exeext=`echo rtems_c_test.* | grep -v rtems_c_test.c | sed -e s/rtems_c_test//`
468rm -f rtems_c_test*])
469test x"${rtems_cv_exeext}" = x && rtems_cv_exeext=no
470fi
471EXEEXT=""
472test x"${rtems_cv_exeext}" != xno && EXEEXT=${rtems_cv_exeext}
473AC_MSG_RESULT(${rtems_cv_exeext})
474AC_SUBST(EXEEXT)])
475
476
477dnl
478dnl $Id$
479dnl
480dnl Check for System V IPC calls used by Unix simulators
481dnl
482dnl 98/07/17 Dario Alcocer     alcocer@netcom.com
483dnl          Ralf Corsepius    corsepiu@faw.uni-ulm.de
484dnl
485dnl Note: $host_os should probably *not* ever be used here to
486dnl determine if host supports System V IPC calls, since some
487dnl (e.g. FreeBSD 2.x) are configured by default to include only
488dnl a subset of the System V IPC calls.  Therefore, to make sure
489dnl all of the required calls are found, test for each call explicitly.
490dnl
491dnl All of the calls use IPC_PRIVATE, so tests will not unintentionally
492dnl modify any existing key sets.  See the man pages for semget, shmget,
493dnl msgget, semctl, shmctl and msgctl for details.
494
495AC_DEFUN(RTEMS_SYSV_SEM,
496[AC_REQUIRE([RTEMS_PROG_CC])
497AC_REQUIRE([AC_CANONICAL_HOST])
498AC_CACHE_CHECK(whether $RTEMS_HOST supports System V semaphores,
499rtems_cv_sysv_sem,
500[
501AC_TRY_RUN([
502#include <sys/types.h>
503#include <sys/ipc.h>
504#include <sys/sem.h>
505int main () {
506#if !defined(sun)
507  union semun arg ;
508#else
509  union semun {
510    int val;
511    struct semid_ds *buf;
512    ushort *array;
513  } arg;
514#endif
515  int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
516  if (id == -1)
517    exit(1);
518  arg.val = 0; /* avoid implicit type cast to union */
519  if (semctl(id, 0, IPC_RMID, arg) == -1)
520    exit(1);
521  exit(0);
522}
523],
524rtems_cv_sysv_sem="yes", rtems_cv_sysv_sem="no", :)
525])
526])
527
528AC_DEFUN(RTEMS_SYSV_SHM,
529[AC_REQUIRE([RTEMS_PROG_CC])
530AC_REQUIRE([AC_CANONICAL_HOST])
531AC_CACHE_CHECK(whether $RTEMS_HOST supports System V shared memory,
532rtems_cv_sysv_shm,
533[
534AC_TRY_RUN([
535#include <sys/types.h>
536#include <sys/ipc.h>
537#include <sys/shm.h>
538int main () {
539  int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
540  if (id == -1)
541    exit(1);
542  if (shmctl(id, IPC_RMID, 0) == -1)
543    exit(1);
544  exit(0);
545}
546],
547rtems_cv_sysv_shm="yes", rtems_cv_sysv_shm="no", :)
548])
549])
550
551AC_DEFUN(RTEMS_SYSV_MSG,
552[AC_REQUIRE([RTEMS_PROG_CC])
553AC_REQUIRE([AC_CANONICAL_HOST])
554AC_CACHE_CHECK(whether $RTEMS_HOST supports System V messages,
555rtems_cv_sysv_msg,
556[
557AC_TRY_RUN([
558#include <sys/types.h>
559#include <sys/ipc.h>
560#include <sys/msg.h>
561int main () {
562  int id=msgget(IPC_PRIVATE,IPC_CREAT|0400);
563  if (id == -1)
564    exit(1);
565  if (msgctl(id, IPC_RMID, 0) == -1)
566    exit(1);
567  exit(0);
568}
569],
570rtems_cv_sysv_msg="yes", rtems_cv_sysv_msg="no", :)
571])
572])
573
574dnl
575dnl $Id$
576dnl
577
578dnl RTEMS_CHECK_MAKEFILE(path)
579dnl Search for Makefile.in's within the directory starting
580dnl at path and append an entry for Makefile to global variable
581dnl "makefiles" (from configure.in) for each Makefile.in found
582dnl
583AC_DEFUN(RTEMS_CHECK_MAKEFILE,
584[RTEMS_CHECK_FILES_IN($1,Makefile,makefiles)
585])
586
587dnl
588dnl $Id$
589dnl
590
591dnl RTEMS_CHECK_FILES_IN(path,file,var)
592dnl path .. path relative to srcdir, where to start searching for files
593dnl file .. name of the files to search for
594dnl var  .. shell variable to append files found
595
596AC_DEFUN(RTEMS_CHECK_FILES_IN,
597[
598AC_MSG_CHECKING(for $2.in in $1)
599if test -d $srcdir/$1; then
600  rtems_av_save_dir=`pwd`;
601  cd $srcdir;
602  rtems_av_tmp=`find $1 -name "$2.in" -print | sed "s/$2\.in/%/" | sort | sed "s/%/$2/"`
603  $3="$$3 $rtems_av_tmp";
604  cd $rtems_av_save_dir;
605  AC_MSG_RESULT(done)
606else
607  AC_MSG_RESULT(no)
608fi
609])
610
611
Note: See TracBrowser for help on using the repository browser.