1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
|
# Autoconf configure script for avr libc/libm main directory.
# Process this file with autoconf to produce a configure script.
# Copyright (c) 2002, 2003, 2004
# Reinhard Jessich <reinhard.jessich@telering.at>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holders nor the names of
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
AC_PREREQ(2.13)
AC_INIT(libc)
dnl Default to --enable-multilib
AC_ARG_ENABLE(multilib,
[ --enable-multilib build many library versions (default)],
[case "${enableval}" in
yes) multilib=yes ;;
no) multilib=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
esac], [multilib=yes])dnl
dnl TODO: Check for various tools used to build the documentation. If anything
dnl is missing, don't build the docs by default.
dnl Disable building of dox by default since it they may not build properly on
dnl all systems. This isn't optimal, but how do we work around the user not
dnl having fig2dev and still build all the formats?
AC_ARG_ENABLE(doc,
[ --enable-doc build all doc formats (disabled is default)],
[case "${enableval}" in
yes) enable_doc=yes ;;
no) enable_doc=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for global doc option) ;;
esac], [enable_doc=no])dnl
dnl Various documentation options. By default, we enable all of them,
dnl i. e. HTML, Postscript, PDF, and Unix-style man pages.
AC_ARG_ENABLE(html-doc,
[ --enable-html-doc build HTML documentation (default)],
[case "${enableval}" in
yes) html_doc=yes ;;
no) html_doc=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for html-doc option) ;;
esac], [html_doc=yes])dnl
AC_ARG_ENABLE(ps-doc,
[ --enable-ps-doc build Postscript documentation (default)],
[case "${enableval}" in
yes) ps_doc=yes ;;
no) ps_doc=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for ps-doc option) ;;
esac], [ps_doc=yes])dnl
AC_ARG_ENABLE(pdf-doc,
[ --enable-pdf-doc build PDF documentation (default)],
[case "${enableval}" in
yes) pdf_doc=yes ;;
no) pdf_doc=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for pdf-doc option) ;;
esac], [pdf_doc=yes])dnl
dnl Man pages are currently not tunable; they'll be built whenever
dnl the HTML documentation is built. However, it can be configured
dnl whether the result is about to be installed or not.
AC_ARG_ENABLE(man-doc,
[ --enable-man-doc build Unix-style manual pages (default)],
[case "${enableval}" in
yes) man_doc=yes ;;
no) man_doc=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for man-doc option) ;;
esac], [man_doc=yes])dnl
AC_ARG_ENABLE(versioned-doc,
[ --enable-versioned-doc install docs in directory with version name (default)],
[case "${enableval}" in
yes) versioned_doc=yes ;;
no) versioned_doc=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for versioned-doc option) ;;
esac], [versioned_doc=yes])dnl
if test "${target}" = "NONE"; then
target=avr
fi
case "${target}" in
avr) ;;
*) AC_MSG_ERROR(This is libc for the avr target only!) ;;
esac
if test "${host}" = "NONE"; then
host=avr
fi
if test "${build}" = "NONE"; then
build=`${srcdir}/config.guess`
fi
dnl We may get other options which we don't document:
dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
test -z "${with_target_subdir}" && with_target_subdir=.
if test "${srcdir}" = "."; then
if test "${with_target_subdir}" != "."; then
avrlib_basedir="${srcdir}/${with_multisrctop}.."
else
avrlib_basedir="${srcdir}/${with_multisrctop}"
fi
else
avrlib_basedir="${srcdir}"
fi
AC_SUBST(avrlib_basedir)
# Determine the host, build, and target systems
AC_CANONICAL_SYSTEM
dnl NOTE: Don't put a '-' in the version number or rpm will puke
dnl when building the package.
dnl
AM_INIT_AUTOMAKE(avr-libc, 1.2.3)
dnl AM_CONFIG_HEADER(version.h:version-h.in)
AC_DEFINE(__AVRLIBC__,1)
AC_DEFINE(__AVRLIBC_MINOR__,2)
dnl Use the AC_CHECK_TOOL macro to find also cross tools
AC_CHECK_TOOL(AS, as, as)
AC_CHECK_TOOL(AR, ar, ar)
AC_CHECK_TOOL(RANLIB, ranlib, ranlib)
AC_CHECK_TOOL(CC, gcc, gcc)
case "${CC}" in
*avr-gcc*) ;;
*) AC_MSG_ERROR(Wrong C compiler found; check the PATH!) ;;
esac
case "${AS}" in
*avr-as*) ;;
*) AC_MSG_ERROR(Wrong assembler found; check the PATH!) ;;
esac
case "${AR}" in
*avr-ar*) ;;
*) AC_MSG_ERROR(Wrong archiver found; check the PATH!) ;;
esac
case "${RANLIB}" in
*avr-ranlib*) ;;
*) AC_MSG_ERROR(Wrong ranlib found; check the PATH!) ;;
esac
AC_PROG_INSTALL
dnl troth/2002-07-12: The CHECK_DOXYGEN macro should be moved to a config
dnl dir. I put it here until I figure out how to integrate the config dir.
dnl
dnl @synopsis CHECK_DOXYGEN
dnl
dnl This macro checks if doxygen is installed on the build system
dnl
dnl @version Id: check_doxygen.m4,v 1.2 2002/02/10 23:22:40 troth Exp
dnl @author Theodore A. Roth <troth@openavr.org>
dnl
AC_DEFUN(CHECK_DOXYGEN,[dnl
dnl
AC_MSG_CHECKING(for doxygen)
dox_ver=`doxygen --version 2>/dev/null`
if test "x$dox_ver" = "x"; then
AC_MSG_RESULT(no)
else
# FIXME: should also check for dox_ver >= 1.2.16
AC_MSG_RESULT(yes)
if test "$ps_doc" = "yes"; then
TARGET_DOX_PS=dox-ps
INSTALL_DOX_PS=install-dox-ps
fi
if test "$pdf_doc" = "yes"; then
TARGET_DOX_PDF=dox-pdf
INSTALL_DOX_PDF=install-dox-pdf
fi
if test "$html_doc" = "yes"; then
TARGET_DOX_HTML=dox-html
INSTALL_DOX_HTML=install-dox-html
fi
dnl The creation of man pages is a side-effect of the HTML
dnl generation, so a different target is only needed for installation.
if test "$man_doc" = "yes"; then
TARGET_DOX_HTML=dox-html
INSTALL_DOX_MAN=install-dox-man
fi
fi
dnl
AC_SUBST(TARGET_DOX_PS)
AC_SUBST(TARGET_DOX_PDF)
AC_SUBST(TARGET_DOX_HTML)
AC_SUBST(INSTALL_DOX_PS)
AC_SUBST(INSTALL_DOX_PDF)
AC_SUBST(INSTALL_DOX_HTML)
AC_SUBST(INSTALL_DOX_MAN)
])dnl
CHECK_DOXYGEN
dnl
dnl @synopsis CHECK_PNG_UTILS
dnl
dnl This macro checks if pngtopnm and pnmtopng are installed. If they are not
dnl installed we just fake it with "cat".
dnl
dnl We use these in the dox to insert transparency into the png images as such:
dnl
dnl $ pngtopnm foo.png > tmp.pnm
dnl $ pnmtopng -transparent white tmp.pnm > foo.png
dnl
dnl @version Id: check_doxygen.m4,v 1.2 2002/02/10 23:22:40 troth Exp
dnl @author Theodore A. Roth <troth@openavr.org>
dnl
AC_DEFUN(CHECK_PNG_UTILS,[dnl
dnl
AC_MSG_CHECKING(for pngtopnm)
has_pngtopnm=`pngtopnm --version 2>&1 | grep -c Version`
if test "$has_pngtopnm" = "1"; then
AC_MSG_RESULT(yes)
PNGTOPNM="pngtopnm"
else
AC_MSG_RESULT(no)
PNGTOPNM="cat"
fi
dnl
AC_MSG_CHECKING(for pngtopnm)
has_pnmtopng=`pnmtopng --version 2>&1 | grep -c Version`
if test "$has_pnmtopng" = "1"; then
AC_MSG_RESULT(yes)
PNMTOPNG="pnmtopng"
else
AC_MSG_RESULT(no)
PNMTOPNG="cat"
fi
dnl
dnl pnmtopng will fail if the input file is a png instead of a pnm.
dnl
if test "$PNMTOPNG" = "cat"; then
PNGTOPNM="cat"
fi
dnl
AC_SUBST(PNGTOPNM)
AC_SUBST(PNMTOPNG)
])dnl
CHECK_PNG_UTILS
if test "$versioned_doc" = "yes"; then
DOC_INST_DIR='${DESTDIR}${datadir}/doc/avr-libc-$(VERSION)'
AVR_LIBC_USER_MANUAL="avr-libc-user-manual-${VERSION}"
else
DOC_INST_DIR='${DESTDIR}${datadir}/doc/avr-libc'
AVR_LIBC_USER_MANUAL="avr-libc-user-manual"
fi
dnl Define this here so all files agree on the name of the manual.
dnl This also centralizes the name so it's easier to change.
AC_SUBST(AVR_LIBC_USER_MANUAL)
AC_SUBST(DOC_INST_DIR)
dnl Some devices are only handled by newer version of gcc. This macro lets us
dnl probe to see if the installed avr-gcc supports a questionable device.
AC_DEFUN(
CHECK_AVR_DEVICE,
[
old_CC=${CC}
old_CFLAGS=${CFLAGS}
CFLAGS="-mmcu=$1"
CC=`echo "${CC}" | sed 's/-mmcu=avr.//'`
AC_MSG_CHECKING(if ${CC} has support for $1)
AC_TRY_COMPILE(
[],
[],
[has_dev_support=yes],
[has_dev_support=no]
)
if test "x$has_dev_support" = "xyes"
then
HAS_$1=yes
fi
AC_MSG_RESULT($has_dev_support)
CC=${old_CC}
CFLAGS=${old_CFLAGS}
]
)
dnl we need to set some compiler switches according to the current
dnl avr library configuration
dnl FIXME: I am sure it is possible to use the original several -O, -mmcu and -g
dnl switches, because the latest one is the one gcc will use.
dnl If this is not true, we must change the content of CFLAGS and several
dnl other variables.
dnl Maybe some else has more experience than I to check this.
dnl I think also the -x option for the assembler is not necessary.
dnl
dnl I have tried to find why objdump -x shows different outputs for files
dnl compiled / assembled with the old Makefile and with this procedures.
dnl Sorry, but I couldn't find the reason.
dnl special flags for different sub-targets
dnl optimize for speed on ATmega (lots of flash, but slower)
dnl optimize for size on <=8K MCUs (not clear what is better: -O3 or -Os)
avrlib_opt_space='-mcall-prologues -Os'
avrlib_opt_speed='-O3'
AVR_CRT_AT90=''
AVR_CRT_TINY=''
AVR_CRT_MEGA=''
AVR_CRT_OTHER=''
avrlib_defines='-D__COMPILING_AVR_LIBC__'
avrlib_cflags=''
avrlib_asflags=''
DOCSDIR=''
if test -z "${with_multisubdir}"; then
dnl default build directory -> avr1 and avr2
avrlib_cflags="-mmcu=avr2 ${avrlib_opt_space}"
avrlib_asflags='-mmcu=avr2'
CHECK_AVR_DEVICE(attiny13)
CHECK_AVR_DEVICE(attiny2313)
AVR_CRT_AT90='crts1200.o crts2313.o crts2323.o crts2333.o crts2343.o \\\
crts4414.o crts4433.o crts4434.o crts8515.o crts8535.o \\\
crtc8534.o'
AVR_CRT_TINY='crttn11.o crttn12.o crttn15.o crttn28.o crttn22.o crttn26.o'
AVR_CRT_OTHER='crt86401.o'
if test "x$HAS_attiny13" = "xyes"; then
AVR_CRT_TINY="$AVR_CRT_TINY crttn13.o"
fi
if test "x$HAS_attiny2313" = "xyes"; then
AVR_CRT_TINY="$AVR_CRT_TINY crttn2313.o"
fi
dnl We only want to build the docs for the default target case and only
dnl if the user has passed "--enable-doc" to configure.
if test "$enable_doc" = "yes"; then
DOCSDIR='doc'
fi
else
case $with_multisubdir in
avr3) avrlib_cflags=${avrlib_opt_speed}
avrlib_asflags='-mmcu=avr3'
AVR_CRT_MEGA='crtm103.o'
AVR_CRT_OTHER='crt43320.o crt43355.o crt76711.o'
;;
avr4)
CHECK_AVR_DEVICE(atmega48)
CHECK_AVR_DEVICE(atmega88)
avrlib_cflags=${avrlib_opt_space}
avrlib_asflags='-mmcu=avr4'
AVR_CRT_MEGA='crtm8.o crtm8515.o crtm8535.o'
if test "x$HAS_atmega48" = "xyes"; then
AVR_CRT_MEGA="$AVR_CRT_MEGA crtm48.o"
fi
if test "x$HAS_atmega88" = "xyes"; then
AVR_CRT_MEGA="$AVR_CRT_MEGA crtm88.o"
fi
;;
avr5)
CHECK_AVR_DEVICE(atmega165)
CHECK_AVR_DEVICE(atmega168)
CHECK_AVR_DEVICE(atmega325)
CHECK_AVR_DEVICE(atmega3250)
CHECK_AVR_DEVICE(atmega645)
CHECK_AVR_DEVICE(atmega6450)
CHECK_AVR_DEVICE(at90can128)
avrlib_cflags=${avrlib_opt_speed}
avrlib_asflags='-mmcu=avr5'
AVR_CRT_MEGA='crtm161.o crtm162.o crtm163.o crtm169.o crtm323.o crtm128.o crtm16.o crtm32.o crtm64.o'
if test "x$HAS_atmega165" = "xyes"; then
AVR_CRT_MEGA="$AVR_CRT_MEGA crtm165.o"
fi
if test "x$HAS_atmega168" = "xyes"; then
AVR_CRT_MEGA="$AVR_CRT_MEGA crtm168.o"
fi
if test "x$HAS_atmega325" = "xyes"; then
AVR_CRT_MEGA="$AVR_CRT_MEGA crtm325.o"
fi
if test "x$HAS_atmega3250" = "xyes"; then
AVR_CRT_MEGA="$AVR_CRT_MEGA crtm3250.o"
fi
if test "x$HAS_atmega645" = "xyes"; then
AVR_CRT_MEGA="$AVR_CRT_MEGA crtm645.o"
fi
if test "x$HAS_atmega6450" = "xyes"; then
AVR_CRT_MEGA="$AVR_CRT_MEGA crtm6450.o"
fi
AVR_CRT_OTHER='crtat94k.o'
if test "x$HAS_at90can128" = "xyes"; then
AVR_CRT_OTHER="$AVR_CRT_OTHER crtcan128.o"
fi
;;
*) AC_MSG_ERROR(unexpected value '${with_multisubdir}' for with_multisubdir)
;;
esac
fi
AVRLIB_CFLAGS="-g -Wall -W -Wstrict-prototypes ${avrlib_defines} ${avrlib_cflags}"
AC_SUBST(AVRLIB_CFLAGS)
AVRLIB_ASFLAGS="-x assembler-with-cpp -Wa,-gstabs ${avrlib_defines} ${avrlib_asflags}"
AC_SUBST(AVRLIB_ASFLAGS)
AVR_CRT_ASFLAGS='-x assembler-with-cpp -Wa,-gstabs'
AC_SUBST(AVR_CRT_ASFLAGS)
AC_SUBST(AVR_CRT_AT90)
AC_SUBST(AVR_CRT_TINY)
AC_SUBST(AVR_CRT_MEGA)
AC_SUBST(AVR_CRT_OTHER)
dnl the includes for the avr libc
INCLUDES='-I$(top_srcdir)/include -I$(top_srcdir)/common'
AC_SUBST(INCLUDES)
AC_SUBST(DOCSDIR)
if test "${multilib}" = "yes"; then
multilib_arg="--enable-multilib"
else
multilib_arg=
fi
dnl the top Makefile must be the last of the list
AC_OUTPUT(crt1/Makefile libc/Makefile libc/stdlib/Makefile
libc/pmstring/Makefile libc/string/Makefile libc/misc/Makefile
libc/stdio/Makefile
libm/Makefile libm/fplib/Makefile avr-libc.spec
doc/Makefile doc/examples/Makefile
doc/api/Makefile doc/api/doxygen.config
scripts/Makefile scripts/avr-man
Makefile,
[if test -n "$CONFIG_FILES"; then
. ${avrlib_basedir}/config-ml.in
fi],
srcdir=${srcdir}
host=${host}
target=${target}
with_multisubdir=${with_multisubdir}
ac_configure_args="${multilib_arg} ${ac_configure_args}"
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
avrlib_basedir=${avrlib_basedir}
CC="${CC}"
)
|