2 # Process this file with autoconf to produce a configure script.
5 #AC_INIT([crosstool-NG], [hg], [crossgcc@sourceware.org])
6 AC_INIT([crosstool-NG], [m4_esyscmd_s([cat .version])], [crossgcc@sourceware.org])
7 AC_CONFIG_AUX_DIR([scripts])
9 #--------------------------------------------------------------------
12 # Check for required tool
15 [AC_CHECK_TOOLS([$1], [$2])
18 [AC_MSG_ERROR([missing required tool: $2])])
21 # Check for required tool, set variable to full pathname
24 [ACX_CHECK_TOOL_REQ([$1], [$2])
28 [?*],[AC_MSG_CHECKING([for absolute path to $$1])
30 AC_MSG_RESULT([$$1])])])
32 # Check for required program
34 [ACX_CHECK_PROGS_REQ],
35 [AC_CHECK_PROGS([$1], [$2])
38 [AC_MSG_ERROR([missing required tool: $2])])
41 # Check for path to required program
44 [AC_PATH_PROGS([$1], [$2])
47 [AC_MSG_ERROR([missing required tool: $2])])
50 # Set the kconfig option
52 [ACX_SET_KCONFIG_OPTION],
55 [kconfig_options="$kconfig_options $1=y"],
56 [kconfig_options="$kconfig_options $1"])
59 #--------------------------------------------------------------------
60 # Allow dummy --{en,dis}able-{static,shared}
65 [don't install, and use current directory])])
66 AC_SUBST([enable_local], [${enable_local:-no}])
71 [build shared libraries (default=yes) (ignored)])])
76 [build static libraries (default=yes) (ignored)])])
78 #---------------------------------------------------------------------
79 # Check for --build and --host...
82 # ... but refuse --target
83 AS_IF([test -n "$target_alias"],
84 AC_MSG_ERROR([--target is not allowed]))
86 # Allow program name tranformation (--program-{prefix,suffix,transform-name})
89 #---------------------------------------------------------------------
90 # Initial checks that are usually done first (I don't know why, that's
91 # just what I seem to experience...)
92 #---------------------------------------------------------------------
95 AC_CACHE_VAL([ac_cv_path_SED],
97 AS_HELP_STRING([--with-sed=PATH],
98 [Specify the full PATH to sed]),
99 [ac_cv_path_SED=$withval])])
101 AC_MSG_CHECKING([whether sed understands -r -i -e])
102 touch .ct-ng.sed.test
103 if ${SED} -r -i -e 's/foo/bar/' .ct-ng.sed.test >/dev/null 2>&1; then
104 rm -f .ct-ng.sed.test
107 rm -f .ct-ng.sed.test
113 #--------------------------------------------------------------------
114 # A bunch of boring tests...
115 #--------------------------------------------------------------------
117 AS_IF([test -z "$CC"],
118 [AC_MSG_ERROR([no suitable compiler found])])
121 ACX_PATH_TOOL_REQ([OBJCOPY], [objcopy])
122 ACX_PATH_TOOL_REQ([OBJDUMP], [objdump])
123 ACX_PATH_TOOL_REQ([READELF], [readelf])
125 ACX_CHECK_PROGS_REQ([bison], [bison])
126 ACX_CHECK_PROGS_REQ([flex], [flex])
127 ACX_CHECK_PROGS_REQ([gperf], [gperf])
128 ACX_CHECK_PROGS_REQ([awk], [gawk mawk nawk awk])
129 ACX_CHECK_PROGS_REQ([makeinfo], [makeinfo])
130 ACX_CHECK_PROGS_REQ([cut], [cut])
131 ACX_CHECK_PROGS_REQ([stat], [stat])
132 ACX_CHECK_PROGS_REQ([readlink], [readlink])
133 ACX_CHECK_PROGS_REQ([curl], [curl])
134 ACX_CHECK_PROGS_REQ([tar], [tar])
135 ACX_CHECK_PROGS_REQ([gzip], [gzip])
136 ACX_CHECK_PROGS_REQ([bzip2], [bzip2])
138 #--------------------------------------------------------------------
139 # Still boring, but remember the path, now...
140 #--------------------------------------------------------------------
141 ACX_PATH_PROGS_REQ([PATCH], [patch])
143 #--------------------------------------------------------------------
144 # And a bunch of less boring tests...
145 #--------------------------------------------------------------------
146 # We need a bash that is >= 3.1
147 AC_CACHE_VAL([ac_cv_path__BASH],
149 AS_HELP_STRING([--with-bash=PATH],
150 [Specify the full PATH to bash >= 3.1]),
151 [ac_cv_path__BASH=$withval])])
152 AC_CACHE_CHECK([for bash >= 3.1], [ac_cv_path__BASH],
153 [AC_PATH_PROGS_FEATURE_CHECK([_BASH], [bash],
154 [[_BASH_ver=$($ac_path__BASH --version 2>&1 \
155 |$EGREP '^GNU bash, version (3\.[1-9]|4)')
156 test -n "$_BASH_ver" && ac_cv_path__BASH=$ac_path__BASH ac_path__BASH_found=:]],
158 AC_MSG_ERROR([could not find bash >= 3.1])])])
159 AC_SUBST([_BASH], [$ac_cv_path__BASH])
161 #----------------------------------------
162 # Check for GNU make 3.80 or above
163 AC_CACHE_VAL([ac_cv_path_MAKE],
165 AS_HELP_STRING([--with-make=PATH],
166 [Specify the full PATH to GNU make >= 3.80]),
167 [ac_cv_path_MAKE=$withval])])
168 AC_CACHE_CHECK([for GNU make >= 3.80], [ac_cv_path_MAKE],
169 [AC_PATH_PROGS_FEATURE_CHECK([MAKE], [make gmake],
170 [[MAKE_ver=$($ac_path_MAKE --version 2>&1 \
171 |$EGREP '^GNU Make (3.[89][[:digit:]]|[4-9])')
172 test -n "$MAKE_ver" && ac_cv_path_MAKE=$ac_path_MAKE ac_path_MAKE_found=:]],
174 AC_MSG_ERROR([could not find GNU make >= 3.80])])])
175 AC_SUBST([MAKE], [$ac_cv_path_MAKE])
178 #----------------------------------------
179 # Check for libtool >= 1.5.26
180 AC_CACHE_VAL([ac_cv_path_LIBTOOL],
181 [AC_ARG_WITH([libtool],
182 AS_HELP_STRING([--with-libtool=PATH],
183 [Specify the full PATH to GNU libtool >= 1.5.26]),
184 [ac_cv_path_LIBTOOL=$withval])])
185 AC_CACHE_CHECK([for GNU libtool >= 1.5.26], [ac_cv_path_LIBTOOL],
186 [AC_PATH_PROGS_FEATURE_CHECK([LIBTOOL], [libtool],
187 [[LIBTOOL_ver=$($ac_path_LIBTOOL --version 2>&1 \
188 |$EGREP '\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)')
189 test -n "$LIBTOOL_ver" && ac_cv_path_LIBTOOL=$ac_path_LIBTOOL ac_path_LIBTOOL_found=:]],
191 AC_MSG_ERROR([could not find GNU libtool >= 1.5.26])])])
192 AC_SUBST([LIBTOOL], [$ac_cv_path_LIBTOOL])
194 #----------------------------------------
195 # Check for libtoolize >= 1.5.26
196 AC_CACHE_VAL([ac_cv_path_LIBTOOLIZE],
197 [AC_ARG_WITH([libtoolize],
198 AS_HELP_STRING([--with-libtoolize=PATH],
199 [Specify the full PATH to GNU libtoolize >= 1.5.26]),
200 [ac_cv_path_LIBTOOLIZE=$withval])])
201 AC_CACHE_CHECK([for GNU libtoolize >= 1.5.26], [ac_cv_path_LIBTOOLIZE],
202 [AC_PATH_PROGS_FEATURE_CHECK([LIBTOOLIZE], [libtool],
203 [[LIBTOOLIZE_ver=$($ac_path_LIBTOOLIZE --version 2>&1 \
204 |$EGREP '\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)')
205 test -n "$LIBTOOLIZE_ver" && ac_cv_path_LIBTOOLIZE=$ac_path_LIBTOOLIZE ac_path_LIBTOOLIZE_found=:]],
207 AC_MSG_ERROR([could not find GNU libtoolize >= 1.5.26])])])
208 AC_SUBST([LIBTOOLIZE], [$ac_cv_path_LIBTOOLIZE])
210 #----------------------------------------
211 # Check for automake >= 1.10
212 AC_CACHE_VAL([ac_cv_path_automake],
213 [AC_ARG_WITH([automake],
214 AS_HELP_STRING([--with-automake=PATH],
215 [Specify the full PATH to GNU automake >= 1.10]),
216 [ac_cv_path_automake=$withval])])
217 AC_CACHE_CHECK([for GNU automake >= 1.10], [ac_cv_path_automake],
218 [AC_PATH_PROGS_FEATURE_CHECK([automake], [automake],
219 [[automake_ver=$($ac_path_automake --version 2>&1 \
220 |$EGREP '\(GNU automake\) (1\.[[:digit:]]{2,}|[2-9][[:digit:]]*\.)')
221 test -n "$automake_ver" && ac_cv_path_automake=$ac_path_automake ac_path_automake_found=:]],
223 AC_MSG_ERROR([could not find GNU automake >= 1.10])])])
224 AC_SUBST([automake], [$ac_cv_path_automake])
226 #--------------------------------------------------------------------
227 # Boring again... But still a bit of work to do...
228 #--------------------------------------------------------------------
229 AC_SUBST([kconfig_options])
231 #----------------------------------------
232 AC_CHECK_PROGS([xz], [xz])
233 ACX_SET_KCONFIG_OPTION([xz])
236 [AC_CHECK_PROGS([lzma], [lzma])])
237 ACX_SET_KCONFIG_OPTION([lzma])
239 #----------------------------------------
240 AC_CHECK_PROGS([cvs], [cvs])
241 ACX_SET_KCONFIG_OPTION([cvs])
243 #----------------------------------------
244 AC_CHECK_PROGS([svn], [svn])
245 ACX_SET_KCONFIG_OPTION([svn])
247 #--------------------------------------------------------------------
248 # Now, for some fun...
249 #--------------------------------------------------------------------
256 #----------------------------------------
257 # Check for gettext, for the kconfig frontends
261 [ac_ct_gettext_hdr=$ac_header; break])
263 [test -n "$ac_ct_gettext_hdr"],
265 [gettext],gettext=y,,
266 [#include <$ac_ct_gettext_hdr>])])
268 #----------------------------------------
269 # Check for ncurses, for the kconfig frontends
270 AC_SUBST([ac_ct_curses_hdr])
272 [ncurses/ncurses.h ncurses/curses.h ncursesw/curses.h ncurses.h curses.h],
273 [ac_ct_curses_hdr=$ac_header; break])
275 [test -z "$ac_ct_curses_hdr"],
276 [AC_MSG_ERROR([could not find curses header, required for the kconfig frontends])])
279 [ncursesw ncurses curses],
280 [ac_ct_curses_lib_found=yes; break])
282 [test -z "$ac_ct_curses_lib_found"],
283 [AC_MSG_ERROR([could not find curses library, required for the kconfig frontends])])
285 #--------------------------------------------------------------------
286 # Lastly, take care of crosstool-NG internal values
287 #--------------------------------------------------------------------
288 # Hey! We need the date! :-)
293 # Decorate the version string if needed
295 [test -f version.sh -a -x version.sh],
296 [V=$(./version.sh "${PACKAGE_VERSION}")])
299 [PACKAGE_VERSION="${V}"],
301 [${PACKAGE_VERSION}],
303 [rev_id="$( hg log -r . --template '{branch}-{node|short}\n' \
306 PACKAGE_VERSION="${PACKAGE_VERSION}@${rev_id:-unknown-$( date +%Y%m%d.%H%M%S )}"
308 # Arrange to have no / in the directory name, no need to create an
309 # arbitrarily deep directory structure
310 [PACKAGE_VERSION="$( printf "${PACKAGE_VERSION}\n" |"${SED}" -r -e 's:/+:_:g;' )"]
312 # Handle the local case
313 AC_SUBST([sublibdir])
314 AC_SUBST([subdocdir])
316 [test "x$enable_local" = "xyes"],
317 [AC_MSG_NOTICE([overiding all of --prefix and the likes, because --enable-local was set])
319 exec_prefix="$prefix"
323 docdir="$prefix""/docs"
325 datarootdir="$prefix"
327 [sublibdir="/ct-ng.\${VERSION}"
328 subdocdir="/ct-ng.\${VERSION}"])
330 #--------------------------------------------------------------------
331 # Finally, generate the output file(s)
332 #--------------------------------------------------------------------
333 AC_CONFIG_FILES([Makefile])
338 # AC_CONFIG_SRCDIR([kconfig/menu.c])
339 # AC_CONFIG_HEADERS([config.h])
341 # # Checks for programs.
343 # # Checks for libraries.
345 # # Checks for header files.
346 # AC_CHECK_HEADERS([fcntl.h inttypes.h libintl.h limits.h locale.h malloc.h stddef.h stdlib.h string.h sys/time.h unistd.h])
348 # # Checks for typedefs, structures, and compiler characteristics.
358 # # Checks for library functions.
361 # AC_CHECK_FUNCS([bzero gettimeofday memmove memset mkdir regcomp setlocale strcasecmp strchr strcspn strdup strncasecmp strpbrk strrchr strspn strtol uname])