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