-
Notifications
You must be signed in to change notification settings - Fork 6
/
configure.ac
145 lines (128 loc) · 3.91 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
AC_INIT([gst123],[0.4.1])
AC_CONFIG_SRCDIR([src/gst123.cc])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign])
dnl ----------------------------- from acbirnet.m4 -------------------------------
dnl Check whether cc accepts a certain option
dnl MC_PROG_CC_SUPPORTS_OPTION(OPTIONS, ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND])
AC_DEFUN([MC_PROG_CC_SUPPORTS_OPTION], [
AC_MSG_CHECKING([whether ${CC-cc} supports $1])
echo >conftest.c;
if ${CC-cc} [$1] -c $CFLAGS conftest.c >/dev/null 2>&1 ; then
AC_MSG_RESULT(yes)
[$2]
else
AC_MSG_RESULT(no)
[$3]
fi
rm -fr conftest*
])dnl
# debug builds
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [enable debugging (default=no)]), ENABLE_DEBUG=$enableval)
DEBUG_FLAGS=""
if test "$ENABLE_DEBUG" = "yes"; then
MC_PROG_CC_SUPPORTS_OPTION([-g], [ DEBUG_FLAGS="-g" ])
fi
if test -z "$CFLAGS"; then
CFLAGS="$DEBUG_FLAGS"
else
CFLAGS="$CFLAGS $DEBUG_FLAGS"
fi
if test -z "$CXXFLAGS"; then
CXXFLAGS="$DEBUG_FLAGS"
else
CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS"
fi
# optimizer settings
MC_PROG_CC_SUPPORTS_OPTION([-O2], [
CFLAGS="$CFLAGS -O2"
CXXFLAGS="$CXXFLAGS -O2"
])
AC_PROG_CXX
AC_PROG_CC
# disable automatic maintainer mode
AM_MAINTAINER_MODE
dnl
dnl We need gstreamer-0.10 or gstreamer-1.0
dnl
AC_DEFUN([AC_GSTREAMER_REQUIREMENTS],
[
dnl gstreamer-1.0 development package installed?
PKG_CHECK_MODULES(GSTREAMER_1_0, gstreamer-1.0, GST_1_0=1, GST_1_0=0)
if test x$GST_1_0 = x1; then
AC_MSG_NOTICE([Building gst123 using gstreamer version 1.0])
PKG_CHECK_MODULES(GSTREAMER, gstreamer-1.0 gstreamer-base-1.0 gstreamer-video-1.0)
else
dnl gstreamer-0.10 development package installed?
PKG_CHECK_MODULES(GSTREAMER_0_10, gstreamer-0.10, GST_0_10=1, GST_0_10=0)
if test x$GST_0_10 = x1; then
AC_MSG_NOTICE([Building gst123 using gstreamer version 0.10])
PKG_CHECK_MODULES(GSTREAMER, gstreamer-0.10 gstreamer-base-0.10 gstreamer-interfaces-0.10 gstreamer-video-0.10)
else
AC_MSG_ERROR([Neither gstreamer-0.10 nor gstreamer-1.0 was found using pkg-config.])
fi
fi
AC_SUBST(GSTREAMER_CFLAGS)
AC_SUBST(GSTREAMER_LIBS)
])
dnl
dnl Define gstreamer interface
dnl
AC_DEFUN([AC_GSTREAMER_GTK_REQUIREMENTS],
[
dnl We need GLib with friends
PKG_CHECK_MODULES(GSTREAMER_GTK, gtk+-3.0)
AC_SUBST(GSTREAMER_GTK_CFLAGS)
AC_SUBST(GSTREAMER_GTKLIBS)
])
dnl
dnl We need libX11
dnl
AC_DEFUN([AC_X11_REQUIREMENTS],
[
AC_CHECK_LIB(X11, XOpenDisplay)
X11_LIBS='-lX11'
AC_SUBST(X11_LIBS)
])
dnl
dnl We need libncurses
dnl
AC_DEFUN([AC_NCURSES_REQUIREMENTS],
[
PKG_CHECK_MODULES(NCURSES, [ncurses >= 5], ncurses_has_pkgconfig=1, ncurses_has_pkgconfig=0)
if test x$ncurses_has_pkgconfig = x0; then
AC_PATH_PROG(NCURSES_CONFIG,ncurses6-config,false)
if test "$NCURSES_CONFIG" = false; then
AC_PATH_PROG(NCURSES_CONFIG,ncurses5-config,false)
fi
if test "$NCURSES_CONFIG" = false; then
AC_PATH_PROG(NCURSES_CONFIG,ncurses-config,false)
fi
if test "$NCURSES_CONFIG" = false; then
AC_MSG_ERROR([Neither pkgconfig(ncurses) nor ncurses-config was found.])
fi
NCURSES_CFLAGS="`$NCURSES_CONFIG --cflags`"
NCURSES_LIBS="`$NCURSES_CONFIG --libs`"
fi
AC_SUBST(NCURSES_CFLAGS)
AC_SUBST(NCURSES_LIBS)
])
# Less cluttered build output
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# Check requirement sets
AC_GSTREAMER_REQUIREMENTS
AC_GSTREAMER_GTK_REQUIREMENTS
AC_X11_REQUIREMENTS
AC_NCURSES_REQUIREMENTS
MC_PROG_CC_SUPPORTS_OPTION([-Wall], [
CFLAGS="$CFLAGS -Wall"
CXXFLAGS="$CXXFLAGS -Wall"
])
AC_ARG_ENABLE(debug-cxx,AS_HELP_STRING([--enable-debug-cxx], [setup compiler flags to do C++ STL debug checks]),
[
CFLAGS="$CFLAGS -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC"
CXXFLAGS="$CXXFLAGS -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC"
])
AC_CONFIG_FILES([Makefile src/Makefile docs/Makefile])
AC_OUTPUT