forked from codetricity/libptp2-theta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
179 lines (162 loc) · 5.13 KB
/
configure.ac
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
# Process this file with autoconf to produce a configure script.
AC_INIT([libptp2],[1.2.0],[[email protected]])
#AM_INIT_AUTOMAKE([1.15 -Wall -Werror foreign])
AM_INIT_AUTOMAKE(1.15)
AM_PROG_AR
AC_PROG_LIBTOOL
AC_PREREQ(2.69)
AM_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIRS([m4])
# library versioning
# (quoted from libtool doc)
# 1. Update the version information only immediately before a public release
# 2. If the library source code has changed at all since the last update,
# then increment revision (`c:r:a' becomes `c:r+1:a').
# 3. If any interfaces have been added, removed, or changed since the last
# update, increment current, and set revision to 0.
# 4. If any interfaces have been added since the last public release,
# then increment age.
# 5. If any interfaces have been removed since the last public release,
# then set age to 0.
LIBPTP2_VERSION_CURRENT=2
LIBPTP2_VERSION_REVISION=5
LIBPTP2_VERSION_AGE=1
LIBPTP2_VERSION_INFO=$LIBPTP2_VERSION_CURRENT:$LIBPTP2_VERSION_REVISION:$LIBPTP2_VERSION_AGE
AC_SUBST(LIBPTP2_VERSION_INFO)
# Checks for programs.
AC_PROG_CC
# turn on warnings for gcc
if test "$ac_cv_prog_gcc" = "yes"; then
CFLAGS="$CFLAGS -Wall -Wmissing-declarations -Wmissing-prototypes"
LDFLAGS="$LDFLAGS -Wall"
fi
# Checks for libraries.
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([libintl.h stdlib.h string.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_STRUCT_TM
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([memset strchr strdup strtol getopt_long])
hostos=any
case $host in
*-linux*)
hostos=Linux
AC_DEFINE([LINUX_OS], [], [Linux OS])
;;
*)
AC_DEFINE([UNKNOWN_OS], [], [Unknown OS])
;;
esac
AM_CONDITIONAL(LINUX_OS, test "x$hostos" = "xLinux")
build_ptpcam=yes
#check for --disable-ptpcam
AC_ARG_ENABLE([ptpcam],
AC_HELP_STRING([--disable-ptpcam],
[do not build ptpcam (default is to build ptpcam)])
)
if test "x$enable_ptpcam" = "xno"; then
build_ptpcam=no
fi
AM_CONDITIONAL(PTPCAM, test "x$build_ptpcam" = "xyes")
# Check for libusb
if test "x$build_ptpcam" = "xyes"
then
AC_ARG_WITH([libusbdir],
AC_HELP_STRING([--with-libusbdir=<path>],
[libusb installation prefix path])
,[
PTPCAM_CFLAGS="-I$withval/include"
PTPCAM_LDFLAGS="-L$withval/lib -lusb"
AC_SUBST(PTPCAM_CFLAGS)
AC_SUBST(PTPCAM_LDFLAGS)
CFLAGS_save="$CFLAGS"
LDFLAGS_save="$LDFLAGS"
CFLAGS="$CFLAGS $PTPCAM_CFLAGS"
LDFLAGS="$LDFLAGS $PTPCAM_LDFLAGS"
AC_CHECK_LIB(usb,usb_busses,
[CFLAGS="$CFLAGS_save";LDFLAGS="$LDFLAGS_save"],
[AC_ERROR([
*** You need at least version 0.1.8 of the libusb library to build ptpcam.
*** Download and istall it from http://sourceforge.net/projects/libusb/ or
*** use --disable-ptpcam option to build without ptpcam tool.
])])
],[
AC_PATH_PROG(LIBUSB_CONFIG,libusb-config)
if test -n "${LIBUSB_CONFIG}"; then
PTPCAM_CFLAGS="`$LIBUSB_CONFIG --cflags`"
PTPCAM_LDFLAGS="`$LIBUSB_CONFIG --libs`"
AC_SUBST(PTPCAM_CFLAGS)
AC_SUBST(PTPCAM_LDFLAGS)
CFLAGS_save="$CFLAGS"
LDFLAGS_save="$LDFLAGS"
CFLAGS="$CFLAGS $PTPCAM_CFLAGS"
LDFLAGS="$LDFLAGS $PTPCAM_LDFLAGS"
AC_CHECK_LIB(usb,usb_busses,
[LIBUSB_VER="`$LIBUSB_CONFIG --version`"],
[AC_ERROR([
*** You need at least version 0.1.8 of the libusb library to build ptpcam.
*** Download and istall it from http://sourceforge.net/projects/libusb/ or
*** use --disable-ptpcam option to build without ptpcam tool.
])])
CFLAGS="$CFLAGS_save"
LDFLAGS="$LDFLAGS_save"
fi
LUSBMAJOR=${LIBUSB_VER%%.*}
LIBUSB_VER=${LIBUSB_VER#${LUSBMAJOR}.}
LUSBMINOR=${LIBUSB_VER%.*}
LUSBPLEVL=${LIBUSB_VER#${LUSBMINOR}.}
#We require exactly 0 major version here
if test "$LUSBMAJOR" -eq "0"; then
#We require at least 1 minor version number
if test "$LUSBMINOR" -eq "1"; then
#We requite at least patchlevel 8 and not 10
case "$LUSBPLEVL" in
[0-7])
AC_ERROR([
*** You need at least version 0.1.8 of the libusb library to build ptpcam.
*** Download and istall it from http://sourceforge.net/projects/libusb/ or
*** use --disable-ptpcam option to build without ptpcam tool.
])
;;
10)
AC_MSG_WARN([
*** WARNING!!!
*** libusb-0.1.10 is known to be broken!
*** Pleasae use older or more recent version or procede at YOUR OWN RISK!
])
;;
esac
elif test "$LUSBMINOR" -lt "1"; then
AC_ERROR([
*** You need at least version 0.1.8 of the libusb library to build ptpcam.
*** Download and istall it from http://sourceforge.net/projects/libusb/ or
*** use --disable-ptpcam option to build without ptpcam tool.
])
fi
else
AC_ERROR([
*** You need the 0 line of libusb which is at least 0.1.8.
*** Higher versions might not be compatible! Download and istall
*** libusb version 0.X.X from http://sourceforge.net/projects/libusb/ or
*** use --disable-ptpcam option to build without ptpcam tool.
])
fi
fi
])
dnl Create a header file containing NetBSD-style byte swapping macros
AC_NEED_BYTEORDER_H(src/libptp-endian.h)
dnl Create a stdint.h-like file containing size-specific integer definitions
dnl that will always be available
AC_NEED_STDINT_H(src/libptp-stdint.h)
AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT