File: configure.in

package info (click to toggle)
libusb 2%3A0.1.12-25
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,312 kB
  • ctags: 1,345
  • sloc: sh: 8,374; ansic: 3,271; cpp: 960; makefile: 226
file content (277 lines) | stat: -rw-r--r-- 7,085 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# This configure.in is based off of the one that glib uses

# require atleast autoconf 2.59
AC_PREREQ(2.59)

# init autoconf (and check for presence of usb.c)
AC_INIT([libusb],[0.1.12])
AC_CONFIG_SRCDIR([usb.c])

AH_TOP(
#undef LINUX_API
#undef BSD_API
#undef DARWIN_API
#undef DUMMY_API

#undef HAVE_OLD_DEV_USB_USB_H

#undef HAVE_LIMITS_H
#undef HAVE_UNISTD_H
#undef HAVE_VALUES_H

#undef LIBUSB_MAJOR_VERSION
#undef LIBUSB_MINOR_VERSION
#undef LIBUSB_MICRO_VERSION
#undef LIBUSB_INTERFACE_AGE
#undef LIBUSB_BINARY_AGE
)

# Save this value here, since automake will set cflags later
cflags_set=${CFLAGS+set}

AM_INIT_AUTOMAKE([gnu nostdinc subdir-objects 1.7.6 --warnings=all])

LIBUSB_VERSION=$VERSION

#
# The following version number definitions apply to libusb
# as a whole, so if changes occoured in any of them, they are all
# treated with the same interface and binary age.
#
# Making releases:
#   LIBUSB_MICRO_VERSION += 1;
#   LIBUSB_INTERFACE_AGE += 1;
#   LIBUSB_BINARY_AGE += 1;
# if any functions have been added, set LIBUSB_INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set LIBUSB_BINARY_AGE _and_ LIBUSB_INTERFACE_AGE to 0.
#
LIBUSB_MAJOR_VERSION=0
LIBUSB_MINOR_VERSION=1
LIBUSB_MICRO_VERSION=12
LIBUSB_INTERFACE_AGE=4
LIBUSB_BINARY_AGE=8

AC_SUBST(LIBUSB_MAJOR_VERSION)
AC_SUBST(LIBUSB_MINOR_VERSION)
AC_SUBST(LIBUSB_MICRO_VERSION)
AC_SUBST(LIBUSB_VERSION)
AC_SUBST(LIBUSB_INTERFACE_AGE)
AC_SUBST(LIBUSB_BINARY_AGE)

AC_DEFINE_UNQUOTED(LIBUSB_MAJOR_VERSION, $LIBUSB_MAJOR_VERSION)
AC_DEFINE_UNQUOTED(LIBUSB_MINOR_VERSION, $LIBUSB_MINOR_VERSION)
AC_DEFINE_UNQUOTED(LIBUSB_MICRO_VERSION, $LIBUSB_MICRO_VERSION)
AC_DEFINE_UNQUOTED(LIBUSB_INTERFACE_AGE, $LIBUSB_INTERFACE_AGE)
AC_DEFINE_UNQUOTED(LIBUSB_BINARY_AGE, $LIBUSB_BINARY_AGE)

# libtool versioning
# JR: Add support for MICRO_VERSION to be alpha-numeric. This will make
# lt_current use the numeric part of MICRO_VERSION

LIBUSB_MICRO_VERSION_NUM=`echo $LIBUSB_MICRO_VERSION | sed 's/[[a-zA-Z]]//g'`
LT_RELEASE=$LIBUSB_MAJOR_VERSION.$LIBUSB_MINOR_VERSION
LT_CURRENT=`expr $LIBUSB_MICRO_VERSION_NUM - $LIBUSB_INTERFACE_AGE`
LT_REVISION=$LIBUSB_INTERFACE_AGE
LT_AGE=`expr $LIBUSB_BINARY_AGE - $LIBUSB_INTERFACE_AGE`
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)

AC_CONFIG_HEADERS([config.h])

dnl Initialize libtool
AM_PROG_LIBTOOL

dnl This has already been dragged in by AM_PROG_LIBTOOL
dnl AC_CANONICAL_HOST

LINUX_API=0
DARWIN_API=0
BSD_API=0
DUMMY_API=0

AC_MSG_CHECKING(for what USB OS support)
case $host in
  *-linux*)
    AC_DEFINE(LINUX_API, 1)
    AC_DEFINE(BSD_API, 0)
    AC_DEFINE(DARWIN_API, 0)
    AC_DEFINE(DUMMY_API, 0)
    LINUX_API=1
    os_support=linux
    AC_MSG_RESULT(Linux)
    OSLIBS=""
    ;;
  *-freebsd*|*-kfreebsd*-gnu|*-openbsd*|*-netbsd*)
    AC_DEFINE(BSD_API, 1)
    AC_DEFINE(LINUX_API, 0)
    AC_DEFINE(DARWIN_API, 0)
    AC_DEFINE(DUMMY_API, 0)
    BSD_API=1
    os_support=bsd
    AC_MSG_RESULT(FreeBSD, OpenBSD and/or NetBSD)
    OSLIBS=""
    ;;
  *-darwin*)
    AC_DEFINE(DARWIN_API, 1) 
    AC_DEFINE(LINUX_API, 0)
    AC_DEFINE(BSD_API, 0)
    AC_DEFINE(DUMMY_API, 0)
    DARWIN_API=1
    os_support=darwin
    AC_MSG_RESULT(Darwin and/or MacOS 10)
    OSLIBS="-Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation -Wl,-prebind"
    ;;
  *)
    AC_DEFINE(DARWIN_API, 0) 
    AC_DEFINE(LINUX_API, 0)
    AC_DEFINE(BSD_API, 0)
    AC_DEFINE(DUMMY_API, 1)
    DUMMY_API=1
    os_support=dummy
    AC_MSG_RESULT(unknown operating system $host)
    OSLIBS=""
    ;;
esac

AC_SUBST(DARWIN_API)
AC_SUBST(LINUX_API)
AC_SUBST(BSD_API)
AC_SUBST(DUMMY_API)

AM_CONDITIONAL(LINUX_API, test "$os_support" = "linux")
AM_CONDITIONAL(BSD_API, test "$os_support" = "bsd")
AM_CONDITIONAL(DARWIN_API, test "$os_support" = "darwin")
AM_CONDITIONAL(DUMMY_API, test "$os_support" = "dummy")

AC_SUBST(OSLIBS)

if test `expr $LIBUSB_MINOR_VERSION \% 2` = 1 ; then
  debug_default=yes
else
  debug_default=minimum
fi

dnl declare --enable-* args and collect ac_help strings
AC_ARG_ENABLE(debug, [  --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,enable_debug=$debug_default)

if test "x$enable_debug" = "xyes"; then
  test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
fi

# Checks for programs.
AC_PROG_CXX
AC_LANG_CPLUSPLUS
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL

changequote(,)dnl
if test "x$GCC" = "xyes"; then
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac
fi
changequote([,])dnl

# Checks for header files.
AC_HEADER_STDC

# Checks for library functions.
AC_FUNC_VPRINTF

AC_C_CONST

dnl for bytesex stuff
AC_C_BIGENDIAN

if test "$ac_cv_c_bigendian" = "yes"; then
  BIGENDIAN="1"
else
  BIGENDIAN="0"
fi
AC_SUBST(BIGENDIAN)

dnl header file checks
AC_CHECK_HEADERS(limits.h, AC_DEFINE_UNQUOTED(HAVE_LIMITS_H))
AC_CHECK_HEADERS(unistd.h, AC_DEFINE_UNQUOTED(HAVE_UNISTD_H))
AC_CHECK_HEADERS(values.h, AC_DEFINE_UNQUOTED(HAVE_VALUES_H))

# Check for some functions
AC_CHECK_FUNCS(memmove)

if test "$os_support" = "bsd"; then
  AC_MSG_CHECKING(if dev/usb/usb.h uses new naming convention)
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <dev/usb/usb.h>]], [[
       int a = ((struct usb_ctl_request *)0L)->ucr_addr
     ]])],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
    AC_DEFINE_UNQUOTED(HAVE_OLD_DEV_USB_USB_H)])
fi

#pkg-config: pkg-config is a tool to simplify checks for libraries and versions.
pkgconfig_msg="no (http://www.freedesktop.org/software/pkgconfig)"
try_pkgconfig=true
have_pkgconfig=false
AC_ARG_WITH(pkgconfig, [  --without-pkgconfig     don"t use pkg-config],[
  if test x$withval = xno; then
    try_pkgconfig=false
    pkgconfig_msg="no (not requested)"
  fi])
if $try_pkgconfig; then
  AC_PATH_PROG(PKG_CONFIG,pkg-config)
  if test -n "${PKG_CONFIG}"; then
    have_pkgconfig=true
    pkgconfig_msg="yes"
  fi
fi
# guessing directory to install *.pc into
pkgconfigdir="${libdir}/pkgconfig"
AC_SUBST(pkgconfigdir)

# Check if the user wants to enable documentation
AC_MSG_CHECKING(if we should build the documentation)
AC_ARG_ENABLE(build-docs, [  --disable-build-docs    turn off building documentation],
	[ test "$enableval" != no && build_docs=yes || build_docs=no ],
	build_docs=auto)
AC_MSG_RESULT($build_docs)

if test "$build_docs" != "no"; then
  AC_CHECK_PROG(JADE, jade, jade)
  if test  -z "$JADE"; then
    AC_CHECK_PROG(JADE, openjade, openjade)
  fi
fi

LIBUSB_INIT_DOXYGEN([LIBUSB C++ API Reference], [Version $VERSION])

dnl Not quite ready for primetime --jerdfelt
dnl AC_CHECK_PROG(DVIPS, dvips, dvips, false)
dnl if test "$DVIPS" = "false"; then
dnl   unset BUILD_DOCS
dnl fi

if test "$build_docs" != "no" -a -z "$JADE"; then
  AC_MSG_WARN(Documentation build components not installed. sgml docs will not be built)
  build_docs="no"
fi

AM_CONDITIONAL(BUILD_DOCS, test "$build_docs" != "no")

AC_CONFIG_FILES([
  Makefile
  doc/Makefile
  libusb.spec
  libusb-config
  libusb.pc
  tests/Makefile
  README
  INSTALL.libusb
  usb.h
  Doxyfile
])
AC_CONFIG_COMMANDS([default],[[chmod +x libusb-config]],[[]])
AC_OUTPUT