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_PATH_PROG(var,prog,args)
29 dnl Like AROS_PROG but gets the full path
31 AC_DEFUN([AROS_PATH_PROG],
32 [AC_PATH_PROG([$1],[$2],[$2 $3])])
34 dnl AROS_BUILDCMD(var,prog,ext)
35 dnl appends the cmd part of prog with ext
37 AC_DEFUN([AROS_BUILDCMD],
38 [if test "$3" != ""; then
39 if test "$2" != ""; then
40 ac_prog_args=`expr "X$2" : '[[^ ]]* \(.*\)'`
41 ac_prog_cmd=`expr "X$2" : '^\S*'`
42 $1="$ac_prog_cmd[$]$3 $ac_prog_args"
46 dnl AROS_TOOL_CCPATH(var,prog,override)
47 dnl This will first look for the tool in the CC path and then in the
48 dnl normal path (CC path only supported for gcc at the moment)
49 AC_DEFUN([AROS_TOOL_CCPATH],
51 if test "$3" = ""; then
56 if test "$GCC" = "yes"; then
57 aros_gcc_[$2]=`$CC -print-prog-name=$ac_tool_[$2]`
58 AC_PATH_PROG([$1], [`basename $aros_gcc_[$2]`], , [`dirname $aros_gcc_[$2]`])
60 if test "$[$1]" = ""; then
61 AC_PATH_PROGS([$1],[$ac_tool_[$2]])
65 dnl AROS_TOOL_TARGET(var,prog,override)
66 dnl This is effectively the same as AROS_PROG, but adds the appropriate
67 dnl arch prefix when cross compiling.
69 AC_DEFUN([AROS_TOOL_TARGET],
71 if test "$3" = ""; then
72 if test "$cross_compiling" = "yes" ; then
73 AC_PATH_PROG([$1],${target_tool_prefix}[$2])
75 AROS_TOOL_CCPATH($1, $2)
78 ac_tool_optarg=`expr "X$3" : '[[^ ]]* \(.*\)'`
80 $1="[$]$1 $ac_tool_optarg"
84 dnl AROS_TOOL_KERNEL(var,prog,override)
85 dnl This is effectively the same as AROS_PROG, but adds the appropriate
86 dnl arch prefix when cross compiling.
88 AC_DEFUN([AROS_TOOL_KERNEL],
90 if test "$3" = ""; then
91 if test "$cross_compiling" = "yes" ; then
92 AC_PATH_PROG([$1],${kernel_tool_prefix}[$2])
94 AROS_TOOL_CCPATH($1, $2)
97 ac_tool_optarg=`expr "X$3" : '[[^ ]]* \(.*\)'`
99 $1="[$]$1 $ac_tool_optarg"
103 dnl AROS_CACHE_CHECK(message, var, check)
104 dnl This is similar to the AC_CACHE_CHECK macro, but it hides the
105 dnl prefix and stuff from the coders. We will get aros_$2 on the
106 dnl variable, and aros_cv_$2 on the cache variable.
107 AC_DEFUN([AROS_CACHE_CHECK],
108 [AC_MSG_CHECKING([$1])
109 AC_CACHE_VAL(aros_cv_[$2],
111 aros_cv_[$2]="[$]aros_[$2]"
113 aros_[$2]="[$]aros_cv_[$2]"
114 AC_MSG_RESULT([$]aros_$2)])