1 dnl Some autoconf macros for AROS
3 dnl Search for a file, and place the result into the cache.
5 dnl AROS_REQUIRED(name,var)
6 dnl Checks if var is defined, and aborts otherwise. name is just for
7 dnl presentation to the user.
9 AC_DEFUN([AROS_REQUIRED],
11 if test "$2" = ""; then
14 if test "$2" = "no"; then
17 if test "$req_avail" = "no"; then
18 AC_MSG_ERROR([$1 is required to build AROS. Please install and run configure again.])
21 dnl AROS_PROG(var,prog,args)
22 dnl Checks if prog is on the path. If it is, sets var to "prog args".
26 [AC_CHECK_PROG([$1],[$2],[$2 $3])])
28 dnl AROS_BUILDCMD(var,prog,ext)
29 dnl appends the cmd part of prog with ext
31 AC_DEFUN([AROS_BUILDCMD],
32 [if test "$3" != ""; then
33 if test "$2" != ""; then
34 ac_prog_args=`expr "X$2" : '[[^ ]]* \(.*\)'`
35 ac_prog_cmd=`expr "X$2" : '^\S*'`
36 $1="$ac_prog_cmd[$]$3 $ac_prog_args"
40 dnl AROS_TOOL_CCPATH(var,prog)
41 dnl This will first look for the tool in the CC path and then in the
42 dnl normal path (CC path only supported for gcc at the moment)
43 AC_DEFUN([AROS_TOOL_CCPATH],
44 [if test "$GCC" = "yes"; then
45 aros_gcc_[$2]=`$CC -print-prog-name=[$2]`
46 AC_PATH_PROG([$1], [`basename $aros_gcc_[$2]`], , [`dirname $aros_gcc_[$2]`])
48 if test "$[$1]" = ""; then
49 AC_PATH_PROG([$1],[$2])
52 dnl AROS_TOOL_TARGET(var,prog,override)
53 dnl This is effectively the same as AROS_PROG, but adds the appropriate
54 dnl arch prefix when cross compiling.
56 AC_DEFUN([AROS_TOOL_TARGET],
58 if test "$3" = ""; then
59 if test "$cross_compiling" = "yes" ; then
60 AC_PATH_PROG([$1],${target_tool_prefix}[$2])
62 AROS_TOOL_CCPATH($1, $2)
65 ac_tool_optarg=`expr "X$3" : '[[^ ]]* \(.*\)'`
67 $1="[$]$1 $ac_tool_optarg"
71 dnl AROS_TOOL_KERNEL(var,prog,override)
72 dnl This is effectively the same as AROS_PROG, but adds the appropriate
73 dnl arch prefix when cross compiling.
75 AC_DEFUN([AROS_TOOL_KERNEL],
77 if test "$3" = ""; then
78 if test "$cross_compiling" = "yes" ; then
79 AC_PATH_PROG([$1],${kernel_tool_prefix}[$2])
81 AROS_TOOL_CCPATH($1, $2)
84 ac_tool_optarg=`expr "X$3" : '[[^ ]]* \(.*\)'`
86 $1="[$]$1 $ac_tool_optarg"
90 dnl AROS_CACHE_CHECK(message, var, check)
91 dnl This is similar to the AC_CACHE_CHECK macro, but it hides the
92 dnl prefix and stuff from the coders. We will get aros_$2 on the
93 dnl variable, and aros_cv_$2 on the cache variable.
94 AC_DEFUN([AROS_CACHE_CHECK],
95 [AC_MSG_CHECKING([$1])
96 AC_CACHE_VAL(aros_cv_[$2],
98 aros_cv_[$2]="[$]aros_[$2]"
100 aros_[$2]="[$]aros_cv_[$2]"
101 AC_MSG_RESULT([$]aros_$2)])