summaryrefslogtreecommitdiff
path: root/configure.ac
blob: c6070d73a92ea1b5d81b9b5d35c5114526d010c2 (plain)
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
#                                               -*- Autoconf -*-
AC_INIT(GStreamer PPStream Plug-in, 0.0.18.1,
    http://people.freedesktop.org/~jinghua,
    gst-plugins-pps)

AG_GST_INIT

dnl AM_MAINTAINER_MODE provides the option to enable maintainer mode
AM_MAINTAINER_MODE
AM_INIT_AUTOMAKE

dnl define PACKAGE_VERSION_* variables
AS_VERSION

dnl check if this is a release version
AS_NANO(GST_GIT="no", GST_GIT="yes")

dnl AC_INIT([$PACKAGE], [$VERSION])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])

dnl *** autotools stuff ****

dnl allow for different autotools
AS_AUTOTOOLS_ALTERNATE

dnl make aclocal work in maintainer mode
AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I common/m4")

dnl check for tools
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL

dnl set up gettext
dnl the version check needs to stay here because autopoint greps for it
AM_GNU_GETTEXT_VERSION([0.17])
AM_GNU_GETTEXT([external])
AG_GST_GETTEXT([gst-plugins-pps])


# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_INT64_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T

# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset select socket strerror])

dnl *** check for arguments to configure ***

AG_GST_ARG_DEBUG
AG_GST_ARG_WITH_PKG_CONFIG_PATH
AG_GST_ARG_WITH_PACKAGE_NAME
AG_GST_ARG_WITH_PACKAGE_ORIGIN

dnl Check for pkgconfig first
AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)

dnl Give error and exit if we don't have pkgconfig
if test "x$HAVE_PKGCONFIG" = "xno"; then
  AC_MSG_ERROR(you need to have pkgconfig installed !)
fi

dnl Now we're ready to ask for gstreamer libs and cflags
dnl And we can also ask for the right version of gstreamer

dnl versions of gstreamer and plugins-base
GST_MAJORMINOR=0.10
GST_REQ=0.10.0

dnl checks for gstreamer
dnl uninstalled is selected preferentially -- see pkg-config(1)
AG_GST_CHECK_GST($GST_MAJORMINOR, [$GST_REQ], yes)
AG_GST_CHECK_GST_BASE($GST_MAJORMINOR, [$GST_REQ], yes)

AC_MSG_NOTICE(Using GStreamer Core Plugins in $GST_PLUGINS_DIR)
AC_MSG_NOTICE(Using GStreamer Base Plugins in $GSTPB_PLUGINS_DIR)

dnl set license and copyright notice
GST_LICENSE="LGPL"
AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer PPStream license])
AC_SUBST(GST_LICENSE)

dnl set location of plugin directory
AG_GST_SET_PLUGINDIR

saved_CFLAGS="$CFLAGS"
saved_LIBS="$LIBS"
CFLAGS="$CFLAGS $GST_BASE_CFLAGS"
LIBS="$LIBS $GST_BASE_LIBS"

AC_CHECK_FUNCS([gst_type_find_helper_for_extension])

CFLAGS=$saved_CFLAGS
LIBS=$saved_LIBS

dnl set proper LDFLAGS for plugins
GST_PPS_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*'
AC_SUBST(GST_PPS_LDFLAGS)

AC_ARG_ENABLE(wrapper,
  AS_HELP_STRING([--enable-wrapper],
                 [Use pps wrapper]),
		 [use_wrapper=$enableval],
		 [use_wrapper=auto])

savedLDFLAGS=$LDFLAGS
savedLIB=$LIBS

AC_LANG(C++)

PPS_DEP_LIBS='-lppsbase -lppssg -lppsvodres -lppsfds -lppsvodnet'
LIBS="-lppsapi $PPS_DEP_LIBS $LIBS"
PPS_LIBS=

AC_MSG_CHECKING([whether pps libraris is available])
AC_LINK_IFELSE(AC_LANG_CALL([], ppsvod_create),
               [AC_MSG_RESULT(yes)
	        HAVE_PPS="yes"],
                [AC_MSG_RESULT(no)
		 HAVE_PPS="no"])
LDFLAGS=$savedLDFLAGS
LIBS=$savedLIB

savedLDFLAGS=$LDFLAGS
savedLIB=$LIBS
LIBS="-lppswrapper"
AC_MSG_CHECKING([whether ppswrapper libraris is available])
AC_LINK_IFELSE(AC_LANG_CALL([], ppsvod_create),
               [AC_MSG_RESULT(yes)
	        HAVE_PPSWRAPPER="yes"],
                [AC_MSG_RESULT(no)
		 HAVE_PPSWRAPPER="no"])
LDFLAGS=$savedLDFLAGS
LIBS=$savedLIB

if test "x$HAVE_PPS" = "xno"; then
  if test "x$HAVE_PPSWRAPPER" = "xno" -o "x$use_wrapper" = "xno";then
     AC_MSG_ERROR("libpps and libppswrapper aren't available")
  else
     use_wrapper=yes
  fi
fi

if test "x$HAVE_PPSWRAPPER" = "xno";then
   use_wrapper=no
   PPS_LIBS="-lppsapi $PPS_DEP_LIBS"
else
   if test "x$use_wrapper" != "xno"; then
     PPS_LIBS="-lppswrapper"
     use_wrapper=yes
   fi
fi

AC_LANG(C)

AC_SUBST(PPS_LIBS)

AC_OUTPUT(Makefile
	  common/Makefile
	  common/m4/Makefile
	  m4/Makefile
	  po/Makefile.in
	  src/Makefile
	  wrapper/Makefile)

if test x$use_wrapper = xyes;then
   AC_MSG_NOTICE([** Using pps wrapper])
else
   AC_MSG_NOTICE([** Not using pps wrapper, ppssrc may can only be used by root])
fi