-
Notifications
You must be signed in to change notification settings - Fork 49
/
configure.ac
127 lines (110 loc) · 3.66 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.64)
AC_INIT([usbfluxd], [1.2.1], [https://corellium.com],, [https://corellium.com])
AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip check-news])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AC_CONFIG_SRCDIR([usbfluxd/])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
# Checks for libraries.
PKG_CHECK_MODULES(libplist, libplist >= 2.2.0,
[
AC_DEFINE([HAVE_LIBPLIST], [1], [Use libplist])
LIBPLIST=libplist
], [
PKG_CHECK_MODULES(libplist, libplist-2.0 >= 2.2.0, [
LIBPLIST=libplist-2.0
AC_DEFINE([HAVE_LIBPLIST_2_0], [1], [Use libplist-2.0])
])],
)
if test "x$LIBPLIST" != "x"; then
CFLAGS_save="${CFLAGS}"
CFLAGS="${CFLAGS} ${libplist_CFLAGS}"
AC_CHECK_DECLS([plist_format_typedef], [], [], [
#include <plist/plist.h>
plist_format_t plist_format_typedef;
])
CFLAGS="${CFLAGS_save}"
fi
AC_CHECK_LIB(pthread, [pthread_create, pthread_mutex_lock], [AC_SUBST(libpthread_LIBS,[-lpthread])], [AC_MSG_ERROR([libpthread is required to build usbfluxd])])
AC_SEARCH_LIBS([fmin], [m])
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdint.h stdlib.h string.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([strcasecmp strdup strerror strndup stpcpy localtime_r])
AC_CHECK_FUNCS([ppoll clock_gettime])
# Check for operating system
AC_MSG_CHECKING([whether to enable WIN32 build settings])
AC_LDADD=
case ${host_os} in
*mingw32*|*cygwin*)
win32=true
AC_MSG_RESULT([yes])
AC_CHECK_TOOL([WINDRES], [windres], AC_MSG_ERROR([windres not found]))
AC_SUBST(WINDRES)
;;
darwin*)
win32=false
AC_MSG_RESULT([no])
# No support for launchd yet
AC_DEFINE(HAVE_CFNETWORK, 1, [Define to enable CFNetwork support])
AC_LDADD="-framework CoreFoundation -framework CFNetwork"
;;
*)
win32=false
AC_MSG_RESULT([no])
PKG_CHECK_MODULES(avahi_client, avahi-client >= 0.6.32, have_avahi=yes, have_avahi=no)
if test "x$have_avahi" = "xyes"; then
AC_DEFINE(HAVE_AVAHI_CLIENT, 1, [Define to enable avahi-client support])
fi
;;
esac
AC_SUBST(AC_LDADD)
AM_CONDITIONAL(WIN32, test x$win32 = xtrue)
AC_ARG_WITH([static-libplist],
[AS_HELP_STRING(["--with-static-libplist[=/path/to/static/libplist"]],
[link against a static libplist])],
[with_static_libplist=$withval],
[with_static_libplist=yes])
if test "x$with_static_libplist" != "xno"; then
if test "x$with_static_libplist" = "xyes"; then
STATIC_LIBPLIST="`pkg-config --libs-only-L ${LIBPLIST} |sed "s/^..//; s/[ ]*$/\/${LIBPLIST}.a/"`"
else
STATIC_LIBPLIST="$with_static_libplist"
fi
if ! test -f "$STATIC_LIBPLIST"; then
AC_MSG_ERROR([The file ${STATIC_LIBPLIST} passed to --with-static-libplist does not exist])
fi
AC_SUBST(libplist_LIBS, [$STATIC_LIBPLIST])
fi
AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-g -Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter")
AC_SUBST(GLOBAL_CFLAGS)
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_OUTPUT([
Makefile
usbfluxd/Makefile
tools/Makefile
])
echo "
Configuration for $PACKAGE $VERSION:
-------------------------------------------
install prefix ............: $prefix
Now type 'make' to build $PACKAGE $VERSION,
and then 'make install' for installation.
"