-
Notifications
You must be signed in to change notification settings - Fork 17
/
configure.ac
146 lines (116 loc) · 3.86 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
dnl Process this file with autoconf to produce a configure script.
dnl Created by Anjuta application wizard.
AC_INIT(imedia, 0.1.00)
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.11])
AM_SILENT_RULES([yes])
AC_PROG_CC
LT_INIT
PKG_CHECK_MODULES(IMEDIA, [libzmq json-glib-1.0 glib-2.0 gobject-2.0 libipcam_base-0.1.0 freetype2 SDL2_ttf])
AC_ARG_ENABLE([hi3518],
AS_HELP_STRING([--enable-hi3518],[Build with hi3518 support (default: disabled)]),
[enable_hi3518=$enableval],
[enable_hi3518=no])
AC_ARG_ENABLE([hi3516],
AS_HELP_STRING([--enable-hi3516],[Build with hi3516 support (default: disabled)]),
[enable_hi3516=$enableval],
[enable_hi3516=no])
if test "x$enable_hi3518" = "xyes" && test "x$enable_hi3516" = "xyes"; then
AC_MSG_ERROR([Can not enable hi3518 and hi3516 at same time.])
fi
if test "x$enable_hi3518" = "xno" && test "x$enable_hi3516" = "xno"; then
AC_MSG_ERROR([Can not continue if there is not select any chip.])
fi
AM_CONDITIONAL([HI3518], [test x"$enable_hi3518" = "xyes"])
AM_CONDITIONAL([HI3516], [test x"$enable_hi3516" = "xyes"])
if test "x$enable_hi3518" = "xyes" || test "x$enable_hi3516" = "xyes"; then
trymppdir=""
AC_ARG_WITH(hisimpp,
[ --with-hisimpp=PATH Specify path to hisi mpp installation ],
[
if test "x$withval" != "xno" ; then
trymppdir=$withval
fi
]
)
dnl ------------------------------------------------------
dnl hisimpp detection. swiped from Tor. modified a bit.
AC_CACHE_CHECK([for hisimpp directory], ac_cv_hisimpp_dir, [
saved_LIBS="$LIBS"
saved_LDFLAGS="$LDFLAGS"
saved_CFLAGS="$CFLAGS"
mpp_found=no
for mppdir in $trymppdir "" $prefix /usr/local ; do
LDFLAGS="$saved_LDFLAGS"
LIBS="$saved_LIBS $mppdir/lib/libmpi.a $mppdir/lib/lib_hiae.a $mppdir/lib/libanr.a $mppdir/lib/libaec.a $mppdir/lib/lib_hiaf.a $mppdir/lib/lib_hiawb.a $mppdir/lib/libmem.a $mppdir/lib/libtde.a $mppdir/lib/libVoiceEngine.a $mppdir/lib/libresampler.a $mppdir/lib/libisp.a -lpthread"
# Skip the directory if it isn't there.
if test ! -z "$mppdir" -a ! -d "$mppdir" ; then
continue;
fi
if test ! -z "$mppdir" ; then
if test -d "$mppdir/lib" ; then
LDFLAGS="-L$mppdir/lib $LDFLAGS"
else
LDFLAGS="-L$mppdir $LDFLAGS"
fi
if test -d "$mppdir/include" ; then
CFLAGS="-I$mppdir/include $CFLAGS"
else
CFLAGS="-I$mppdir $CFLAGS"
fi
fi
# Can I compile and link it?
AC_TRY_LINK([#include <hi_comm_sys.h>
#include <mpi_sys.h>], [ HI_MPI_SYS_Exit(); ],
[ hisimpp_linked=yes ], [ hisimpp_linked=no ])
if test $hisimpp_linked = yes; then
if test ! -z "$mppdir" ; then
ac_cv_hisimpp_dir=$mppdir
else
ac_cv_hisimpp_dir="(system)"
fi
mpp_found=yes
break
fi
done
LIBS="$saved_LIBS"
LDFLAGS="$saved_LDFLAGS"
CFLAGS="$saved_CFLAGS"
dnl if test $mpp_found = no ; then
dnl AC_MSG_ERROR([hisimpp is required.
dnl If it's already installed, specify its path using --with-hisimpp=/dir/
dnl ])
dnl fi
])
dnl LIBS="$LIBS"
if test $mpp_found = yes ; then
if test $ac_cv_hisimpp_dir != "(system)"; then
if test -d "$ac_cv_hisimpp_dir/lib" ; then
dnl LDFLAGS="-L$ac_cv_hisimpp_dir/lib $LDFLAGS"
MPPLIBDIR="$ac_cv_hisimpp_dir/lib"
else
dnl LDFLAGS="-L$ac_cv_hisimpp_dir $LDFLAGS"
MPPLIBDIR="$ac_cv_hisimpp_dir"
fi
AC_SUBST(MPPLIBDIR)
if test -d "$ac_cv_hisimpp_dir/include" ; then
MPPCFLAGS="-I$ac_cv_hisimpp_dir/include"
else
MPPCFLAGS="-I$ac_cv_hisimpp_dir"
fi
AC_SUBST(MPPCFLAGS)
fi
fi
AM_CONDITIONAL([INTERNAL_MPP], [test $mpp_found = no])
if test "x$enable_hi3518" = "xyes"; then
CFLAGS="-DHI3518 $CFLAGS"
fi
if test "x$enable_hi3516" = "xyes"; then
CFLAGS="-DHI3516 $CFLAGS"
fi
fi
AC_OUTPUT([
Makefile
src/Makefile
src/config/Makefile
])