* device/lib/pic16/**: build pic16 library using autotools for
[fw/sdcc] / device / lib / pic16 / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 #
5 # The (generated) configure script should be called with
6 #     --build=<your-build-system> --target=pic16
7 # to force cross-compilation mode; rather use the wrapper
8 # ./configure.gnu instead of ./configure directly.
9 #
10
11 AC_PREREQ(2.61)
12 AC_INIT([pic16lib], [0.3], [tecodev AT users sourceforge net])
13 AM_INIT_AUTOMAKE
14 AC_CONFIG_SRCDIR([debug/gstack/gstack.c])
15 AC_CONFIG_HEADER([config.h])
16
17
18 # SDCC setup
19 case $srcdir in
20     [\\/]*|?:[\\/]*) abs_srcdir="$srcdir";
21         ;;
22     *) abs_srcdir="$ac_pwd/$srcdir";
23         ;;
24 esac
25 case $ac_top_build_prefix in
26     [\\/]*|?:[\\/]*)
27         abs_top_builddir="$ac_top_build_prefix";
28         ;;
29     *) abs_top_builddir="$ac_pwd/$ac_top_build_prefix";
30         ;;
31 esac
32
33 libdir=$libdir/pic16
34
35 # Checks for programs.
36
37 # The default architecture can be selected at configure time by setting the
38 # environment variable ARCH to the desired device (18fxxx).
39 AC_SUBST(ARCH, [${ARCH-18f452}])
40
41 # We cannot use AC_PROG_CC(sdcc) as sdcc might not be built at configure-time...
42 AC_SUBST(CC, [${CC-$abs_top_builddir/../../../bin/sdcc}])
43 AC_SUBST(CFLAGS, ["-mpic16 -p$ARCH"])
44 AC_PATH_PROG(CCAS, gpasm, :)
45 AC_SUBST(CCASFLAGS, ["-p$ARCH"])
46 AC_PATH_PROG(LD, gplink, :)
47 AC_PATH_PROG(AR, gplib, :)
48 AC_SUBST(ARFLAGS, [-c])
49
50 # $RANLIB is called by the autotools but not provided nor required
51 AC_SUBST(RANLIB, [:])
52 AC_SUBST(OBJEXT, [o])
53
54 _AM_DEPENDENCIES(CC)
55 _AM_DEPENDENCIES(CCAS)
56
57 # Checks for libraries.
58
59 # Checks for header files.
60
61 # Checks for typedefs, structures, and compiler characteristics.
62
63 # Checks for library functions.
64
65 case "$CCAS:$LD:$AR" in
66     *::*)
67         AC_MSG_ERROR([gputils (gpasm, gplink, and gplib) are required but not found.])
68         ;;
69 esac
70
71 AC_CONFIG_FILES([Makefile
72                  debug/Makefile
73                  libc/Makefile
74                  libdev/Makefile
75                  libio/Makefile
76                  libm/Makefile
77                  libsdcc/Makefile
78                  startup/Makefile])
79 AC_OUTPUT
80