File: configure.in

package info (click to toggle)
libifp 1.0.0.2-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 1,680 kB
  • ctags: 522
  • sloc: sh: 8,449; ansic: 5,783; makefile: 138
file content (153 lines) | stat: -rw-r--r-- 5,221 bytes parent folder | download | duplicates (3)
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
AC_INIT(configure.in)

#The automake documentation says this is a no-no, but I don't understand
#what the alternative is.
#Commented out until I can find out what the portable alternative is.
CFLAGS="-g -O2 -Wall -W -Wno-unused-parameter"
##CFLAGS="-g -O2 -Wall -W"

AM_INIT_AUTOMAKE(libifp, 1.0.0.2)
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_C_BIGENDIAN
AC_SUBST(LIBTOOL_DEPS)

dnl AC_DEFINE(IFP_AUTOCONF)

#-----------------------------------------------------------------------
build_userland=no
dnl --with-libusb=PATH
LIBUSB=""
AC_MSG_CHECKING([libusb])
AC_ARG_WITH(libusb,
	AC_HELP_STRING([--with-libusb=PATH],[libusb path (default /usr)]),
	ac_libusb=$enableval, ac_libusb=no)
if test "x${ac_libusb}" != "xno" ; then
		case ${with_libusb} in
			"" | "yes" | "YES")
				;;
			"no" | "NO")
				use_libusb=false
				;;
			*)
				CFLAGS="$CFLAGS -I${with_libusb}/include"
				CPPFLAGS="$CPPFLAGS -I${with_libusb}/include"
				LDFLAGS="$LDFLAGS -L${with_libusb}/lib"
				;;
		esac
fi
AC_MSG_RESULT(done)

dnl check if libusb is available
if test "x${ac_libusb}" != "xno" ; then
	build_userland=yes
	AC_CHECK_HEADERS(usb.h, [],
		[ AC_MSG_WARN([usb.h not found, use --with-libusb=PATH]) ]; 
		build_userland=no )

	ac_save_LIBS="$LIBS"
	AC_CHECK_LIB(usb, usb_init, [LIBUSB="$LIBUSB -lusb"],
		[ AC_MSG_WARN([libusb not found]) ]; build_userland=no )

dnl misc headers needed by the userland library

	AC_CHECK_FUNC(strncasecmp, [], [ AC_MSG_WARN([strncasecmp not found, not building userland library]) ];
		build_userland=no )

	AC_CHECK_HEADERS(inttypes.h stdio.h sys/types.h wchar.h string.h time.h fts.h iconv.h,
		[], [ AC_MSG_WARN([missing header, not building useland library]) ]; build_userland=no)
dnl AC_SUBST(LIBUSB)
	AC_C_INLINE
	
	LIBS="$ac_save_LIBS $LIBUSB"
fi
AM_CONDITIONAL(WANT_USERLAND, test x$build_userland = xyes)

#-----------------------------------------------------------------------
dnl --enable-examples
AC_MSG_CHECKING(if we should build the examples)
AC_ARG_ENABLE(examples,
    AC_HELP_STRING([--enable-examples], [compile the examples [[default=no]]]),
    [case "${enableval}" in
      yes) examples=yes ;;
      no) examples=no ;;
      *) AC_MSG_ERROR(bad value ${enableval} for --enable-examples) ;;
    esac], [examples=no])
if test x$examples = xyes && test "${build_userland}" = "no" ; then
	examples=no
	AC_MSG_WARN([libifp will not be build, so the examples will be also skipped.])
fi
AM_CONDITIONAL(WANT_EXAMPLES, test x$examples = xyes)
AC_MSG_RESULT($examples)

AC_ARG_ENABLE(usbdebug, AC_HELP_STRING([--enable-usbdebug], [enable protocol debugging]), AC_DEFINE(AMM_USBDBG))
AC_ARG_ENABLE(usbverbose, AC_HELP_STRING([--enable-usbverbose], [enable verbose protocol debugging]), AC_DEFINE(AMM_USBVERBOSE))

#-----------------------------------------------------------------------
AC_CHECK_PROG(have_doxygen, doxygen, yes, no)
AM_CONDITIONAL(HAVE_DOXYGEN, test "$have_doxygen" = "yes")

#-----------------------------------------------------------------------
dnl --with-kmodule[=to/kernel/src]
AC_MSG_CHECKING([kernel source code])
AC_ARG_WITH(kmodule,
    AC_HELP_STRING([--with-kmodule=to/kernel/src], [build as linux kernel module [[default=no]]]),
    ac_kmodule=$enableval, ac_kmodule=no)
if test "x$ac_kmodule" != "xno" ; then
	#echo "enableval is $enableval, with_kmodule is $with_kmodule"
	if test "x$with_kmodule" = "xyes" ; then
		KERNEL_SOURCE=/usr/src/linux
		#echo "Looking for kernel source in default place."
	else
		KERNEL_SOURCE=$with_kmodule
		#echo "Looking for kernel source in $ac_kmodule."
	fi
	AC_MSG_RESULT($KERNEL_SOURCE)

	#AC_MSG_CHECKING(kernel source contents)
	AC_CHECK_FILE($KERNEL_SOURCE/Makefile, , [AC_MSG_WARN([*** linux source tree doesn't appear valid.  Note that I need the whole source tree, not just the headers. ])]; ac_kmodule="no" )
	AC_CHECK_FILE($KERNEL_SOURCE/.config, , [AC_MSG_WARN([*** kernel configuration file not found.  Either this isn't a kernel tree, or it hasn't been configured. ])]; ac_kmodule="no" )
	#AC_MSG_RESULT($ac_kmodule)

	AC_MSG_CHECKING(kernel is version 2.6.0+)
	AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
	#include <$KERNEL_SOURCE/include/linux/version.h> 
	#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) 
	#error unsupported kernel version 
	#endif
	]])], , [AC_MSG_WARN([*** unsupported kernel version source])]; ac_kmodule="no" )
	AC_MSG_RESULT($ac_kmodule)

	#echo "Linux kernel module selected.  Using source tree $KERNEL_SOURCE"
else
	AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(COND_KBUILD, test "x$ac_kmodule" != "xno" )

simple=""

AC_SUBST(LIBUSB)
AC_SUBST(CCFLAGS)
AC_SUBST(KERNEL_SOURCE)
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(docs/Makefile)
AC_CONFIG_FILES(dpkg/Makefile)
AC_CONFIG_FILES([docs/doxygen.cfg:docs/doxygen.in])
AC_CONFIG_FILES(examples/Makefile)
AC_CONFIG_FILES(kbuild/Makefile)
AC_CONFIG_FILES(src/Makefile)
AC_OUTPUT

echo ""
echo "-----------------------------------------------------"
echo "configuration complete"
echo "	libifp:               $build_userland"
echo "	linux kernel module:  $ac_kmodule"
echo "	examples:             $examples"
echo "	documentation:        $have_doxygen"
echo "-----------------------------------------------------"
echo "type 'make' to build"
echo ""