Switch to libusb-1.0 and use async interface.
[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 PKG_PROG_PKG_CONFIG
34
35 CFLAGS="-g"
36 WARN_CFLAGS=""
37 if test "x$GCC" = "xyes"; then
38         WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
39         -Wmissing-prototypes -Wmissing-declarations \
40         -Wnested-externs -fno-strict-aliasing"
41         AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
42         [Can use #warning in C files])
43 fi
44 AC_SUBST(WARN_CFLAGS)
45
46 dnl ==========================================================================
47
48 AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
49
50 dnl ==========================================================================
51
52 # Setup for compiling build tools (fc-glyphname, etc)
53 AC_MSG_CHECKING([for a C compiler for build tools])
54 if test $cross_compiling = yes; then
55   AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
56 else
57   CC_FOR_BUILD=$CC
58 fi
59 AC_MSG_RESULT([$CC_FOR_BUILD])
60 AC_SUBST(CC_FOR_BUILD)
61
62 PKG_CHECK_MODULES([LIBUSB], [libusb-1.0])
63
64 AC_MSG_CHECKING([for suffix of executable build tools])
65 if test $cross_compiling = yes; then
66   cat >conftest.c <<\_______EOF
67 int
68 main ()
69 {
70   exit (0);
71 }
72 _______EOF
73   for i in .exe ""; do
74     compile="$CC_FOR_BUILD conftest.c -o conftest$i"
75     if AC_TRY_EVAL(compile); then
76       if (./conftest) 2>&AC_FD_CC; then
77         EXEEXT_FOR_BUILD=$i
78         break
79       fi
80     fi
81   done
82   rm -f conftest*
83   if test "${EXEEXT_FOR_BUILD+set}" != set; then
84     AC_MSG_ERROR([Cannot determine suffix of executable build tools])
85   fi
86 else
87   EXEEXT_FOR_BUILD=$EXEEXT
88 fi
89 AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
90 AC_SUBST(EXEEXT_FOR_BUILD)
91
92 USB_LIBS="-lusb"
93 AC_SUBST(USB_LIBS)
94
95 AC_OUTPUT([
96 Makefile 
97 lib/Makefile
98 ccload/Makefile
99 s51/Makefile
100 ])