6182d71cfab7446bf73c55891b075a2a9eded19f
[fw/altos] / configure.ac
1 dnl 
2 dnl  Copyright © 2008 Keith Packard <keithp@keithp.com>
3 dnl 
4 dnl  This program is free software; you can redistribute it and/or modify
5 dnl  it under the terms of the GNU General Public License as published by
6 dnl  the Free Software Foundation; either version 2 of the License, or
7 dnl  (at your option) any later version.
8 dnl 
9 dnl  This program is distributed in the hope that it will be useful, but
10 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 dnl  General Public License for more details.
13 dnl 
14 dnl  You should have received a copy of the GNU General Public License along
15 dnl  with this program; if not, write to the Free Software Foundation, Inc.,
16 dnl  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 dnl
18 dnl Process this file with autoconf to create configure.
19
20 AC_INIT(COPYING)
21
22 AM_INIT_AUTOMAKE(cctools, 0.1)
23 AM_MAINTAINER_MODE
24
25 dnl ==========================================================================
26
27 AM_CONFIG_HEADER(config.h)
28
29 AC_PROG_CC
30 AC_PROG_INSTALL
31 AC_PROG_LN_S
32 AC_PROG_RANLIB
33
34 WARN_CFLAGS=""
35 if test "x$GCC" = "xyes"; then
36         WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
37         -Wmissing-prototypes -Wmissing-declarations \
38         -Wnested-externs -fno-strict-aliasing"
39         AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
40         [Can use #warning in C files])
41 fi
42 AC_SUBST(WARN_CFLAGS)
43
44 dnl ==========================================================================
45
46 AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
47
48 dnl ==========================================================================
49
50 # Setup for compiling build tools (fc-glyphname, etc)
51 AC_MSG_CHECKING([for a C compiler for build tools])
52 if test $cross_compiling = yes; then
53   AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
54 else
55   CC_FOR_BUILD=$CC
56 fi
57 AC_MSG_RESULT([$CC_FOR_BUILD])
58 AC_SUBST(CC_FOR_BUILD)
59
60 AC_MSG_CHECKING([for suffix of executable build tools])
61 if test $cross_compiling = yes; then
62   cat >conftest.c <<\_______EOF
63 int
64 main ()
65 {
66   exit (0);
67 }
68 _______EOF
69   for i in .exe ""; do
70     compile="$CC_FOR_BUILD conftest.c -o conftest$i"
71     if AC_TRY_EVAL(compile); then
72       if (./conftest) 2>&AC_FD_CC; then
73         EXEEXT_FOR_BUILD=$i
74         break
75       fi
76     fi
77   done
78   rm -f conftest*
79   if test "${EXEEXT_FOR_BUILD+set}" != set; then
80     AC_MSG_ERROR([Cannot determine suffix of executable build tools])
81   fi
82 else
83   EXEEXT_FOR_BUILD=$EXEEXT
84 fi
85 AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
86 AC_SUBST(EXEEXT_FOR_BUILD)
87
88 USB_LIBS="-lusb"
89 AC_SUBST(USB_LIBS)
90
91 AC_OUTPUT([
92 Makefile 
93 lib/Makefile
94 ccload/Makefile
95 ])