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(var,prog,prefix,override)
53 dnl This is common code for AROS_PROG and AROS_KERNEL
56 [if test "$4" = ""; then
57 if test "$cross_compiling" = "yes" ; then
58 AC_PATH_PROG([$1],[$3][$2])
60 AROS_TOOL_CCPATH($1, $2)
63 ac_tool_optarg=`expr "X$4" : '[[^ ]]* \(.*\)'`
65 $1="[$]$1 $ac_tool_optarg"
68 dnl AROS_KERNEL_TARGET(var,prog,override)
69 dnl This is effectively the same as AROS_PROG, but adds the appropriate
70 dnl arch prefix when cross compiling.
72 AC_DEFUN([AROS_TOOL_KERNEL],
74 AROS_TOOL([$1],[$2].[${kernel_tool_prefix}],[$3])
78 dnl AROS_TOOL_TARGET(var,prog,override)
79 dnl This is effectively the same as AROS_PROG, but adds the appropriate
80 dnl arch prefix when cross compiling.
82 AC_DEFUN([AROS_TOOL_TARGET],
84 AROS_TOOL([$1],[$2].[${target_tool_prefix}],[$3])
87 dnl AROS_KERNEL_TARGET(var,prog,override)
88 dnl This is effectively the same as AROS_PROG, but adds the appropriate
89 dnl arch prefix when cross compiling.
91 AC_DEFUN([AROS_TOOL_KERNEL],
93 if test "$3" = ""; then
94 if test "$cross_compiling" = "yes" ; then
95 AC_PATH_PROG([$1],${kernel_tool_prefix}[$2])
97 AROS_TOOL_CCPATH($1, $2)
100 ac_tool_optarg=`expr "X$3" : '[[^ ]]* \(.*\)'`
102 $1="[$]$1 $ac_tool_optarg"
106 dnl AROS_CACHE_CHECK(message, var, check)
107 dnl This is similar to the AC_CACHE_CHECK macro, but it hides the
108 dnl prefix and stuff from the coders. We will get aros_$2 on the
109 dnl variable, and aros_cv_$2 on the cache variable.
110 AC_DEFUN([AROS_CACHE_CHECK],
111 [AC_MSG_CHECKING([$1])
112 AC_CACHE_VAL(aros_cv_[$2],
114 aros_cv_[$2]="[$]aros_[$2]"
116 aros_[$2]="[$]aros_cv_[$2]"
117 AC_MSG_RESULT([$]aros_$2)])