summaryrefslogtreecommitdiff
path: root/configure.in
blob: 2dd686d6ef771f4fc51dac9c06888cf6c786e3b5 (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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# Filename: configure.in
AC_INIT(src/miav.cc)
AM_INIT_AUTOMAKE( miav, 0.4.0 )

AC_PROG_CXX

AC_PROG_LIBTOOL
AM_PROG_LIBTOOL

AM_CONFIG_HEADER(config.h)
AC_STDC_HEADERS

####################
# Setup debug flags
AC_ARG_WITH(debug,  [  --with-debug            build with debug support])
if test x$with_debug == xyes; then
  AC_MSG_WARN([*** Building with debug support!])
  CXXFLAGS="$CXXFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector -Wall -Werror -g"
  AC_DEFINE_UNQUOTED(WITH_DEBUG, ,
    [The project is configured to use debug output])
fi 

dnl ======================
dnl Init pkg-config
dnl ======================
PKG_PROG_PKG_CONFIG(0.23)

AC_ARG_WITH(gui,  [  --without-gui           build without GUI support])
if test x$with_gui != xno && test -z "$GUI"; then
    dnl ======================
    dnl Check for Qt
    dnl ======================
    PKG_CHECK_MODULES(QT, QtCore QtGui QtNetwork >= 4.5)
    AC_CHECK_PROGS(QT_MOC, [moc4 moc-qt4 moc], [])
    AC_CHECK_PROGS(QT_RCC, [rcc4 rcc-qt4 rcc], [])
    AC_CHECK_PROGS(QT_UIC, [uic4 uic-qt4 uic], [])
    if (test "$QT_MOC" = ""); then
      AC_MSG_ERROR([QT4 moc is required.])
    fi
    if (test "$QT_RCC" = ""); then
      AC_MSG_ERROR([QT4 rcc is required.])
    fi
    if (test "$QT_UIC" = ""); then
      AC_MSG_ERROR([QT4 uic is required.])
    fi
    
    dnl =====================
    dnl Check for SDL library
    dnl =====================
    SDL_VERSION=1.2.0
    AM_PATH_SDL($SDL_VERSION,:,AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
    AC_SUBST(SDL_CFLAGS)
    AC_SUBST(SDL_LIBS)
    
    dnl ======================
    dnl Check for iec61883 library
    dnl ======================
    PKG_CHECK_MODULES(IEC61883, libiec61883 >= 1.2)

    dnl ======================
    dnl Check for dv library
    dnl ======================
    PKG_CHECK_MODULES(DV, libdv >= 1.0)
else
    AC_MSG_WARN([*** Building without GUI support!])
fi 

AC_ARG_WITH(server,  [  --without-server        build without server support])
if test x$with_server != xno && test -z "$SERVER"; then
    dnl ======================
    dnl Check for pthread library
    dnl ======================
    tmp_CXXFLAGS="$CXXFLAGS"
    tmp_CPPFLAGS="$CPPFLAGS"
    tmp_CFLAGS="$CFLAGS"
    tmp_LDFLAGS="$LDFLAGS"
    tmp_LIBS="$LIBS"
    CXXFLAGS=""
    CPPFLAGS=""
    CFLAGS=""
    LDFLAGS=""
    LIBS=""
    AC_CHECK_HEADER(pthread.h, , AC_MSG_ERROR([*** pthread headers not found!]))
    AC_CHECK_LIB(pthread, sem_init, ,  AC_MSG_ERROR([*** libpthread not found!]))
    PTHREAD_CFLAGS="$CXXFLAGS $CPPFLAGS $CFLAGS"
    PTHREAD_LIBS="$LDFLAGS $LIBS"
    CXXFLAGS="$tmp_CXXFLAGS"
    CPPFLAGS="$tmp_CPPFLAGS"
    CFLAGS="$tmp_CFLAGS"
    LDFLAGS="$tmp_LDFLAGS"
    LIBS="$tmp_LIBS"
    AC_SUBST(PTHREAD_CFLAGS)
    AC_SUBST(PTHREAD_LIBS)
    
    dnl ======================
    dnl Check for dv library
    dnl ======================
    PKG_CHECK_MODULES(DV, libdv >= 1.0)
    
    dnl ======================
    dnl Check for Jpeg library
    dnl ======================
    tmp_CXXFLAGS="$CXXFLAGS"
    tmp_CPPFLAGS="$CPPFLAGS"
    tmp_CFLAGS="$CFLAGS"
    tmp_LDFLAGS="$LDFLAGS"
    tmp_LIBS="$LIBS"
    CXXFLAGS=""
    CPPFLAGS=""
    CFLAGS=""
    LDFLAGS=""
    LIBS=""
    AC_CHECK_HEADER(jpeglib.h, , AC_MSG_ERROR([*** libJpeg not found!]))
    AC_CHECK_LIB(jpeg, jpeg_start_compress, ,  AC_MSG_ERROR([*** libJpeg not found!]))
    JPEG_CFLAGS="$CXXFLAGS $CPPFLAGS $CFLAGS"
    JPEG_LIBS="$LDFLAGS $LIBS"
    CXXFLAGS="$tmp_CXXFLAGS"
    CPPFLAGS="$tmp_CPPFLAGS"
    CFLAGS="$tmp_CFLAGS"
    LDFLAGS="$tmp_LDFLAGS"
    LIBS="$tmp_LIBS"
    AC_SUBST(JPEG_CFLAGS)
    AC_SUBST(JPEG_LIBS)
    
    dnl ======================
    dnl Check for Fame library
    dnl ======================
    tmp_CXXFLAGS="$CXXFLAGS"
    tmp_CPPFLAGS="$CPPFLAGS"
    tmp_CFLAGS="$CFLAGS"
    tmp_LDFLAGS="$LDFLAGS"
    tmp_LIBS="$LIBS"
    CXXFLAGS=""
    CPPFLAGS=""
    CFLAGS=""
    LDFLAGS=""
    LIBS=""
    AC_CHECK_HEADER(fame.h, , AC_MSG_ERROR([*** libFAME include files not found!]))
    AC_CHECK_LIB(fame, fame_init, ,  AC_MSG_ERROR([*** libFAME not found!]))
    FAME_CFLAGS="$CXXFLAGS $CPPFLAGS $CFLAGS"
    FAME_LIBS="$LDFLAGS $LIBS"
    CXXFLAGS="$tmp_CXXFLAGS"
    CPPFLAGS="$tmp_CPPFLAGS"
    CFLAGS="$tmp_CFLAGS"
    LDFLAGS="$tmp_LDFLAGS"
    LIBS="$tmp_LIBS"
    AC_SUBST(FAME_CFLAGS)
    AC_SUBST(FAME_LIBS)
    
    dnl ======================
    dnl Check for Lame library
    dnl ======================
    tmp_CXXFLAGS="$CXXFLAGS"
    tmp_CPPFLAGS="$CPPFLAGS"
    tmp_CFLAGS="$CFLAGS"
    tmp_LDFLAGS="$LDFLAGS"
    tmp_LIBS="$LIBS"
    CXXFLAGS=""
    CPPFLAGS=""
    CFLAGS=""
    LDFLAGS=""
    LIBS=""
    AC_CHECK_HEADER(lame/lame.h, , AC_MSG_ERROR([*** libLAME (libmp3lame) include files not found!]))
    AC_CHECK_LIB(mp3lame, lame_init, ,  AC_MSG_ERROR([*** libLAME (libmp3lame) not found!]))
    LAME_CFLAGS="$CXXFLAGS $CPPFLAGS $CFLAGS"
    LAME_LIBS="$LDFLAGS $LIBS"
    CXXFLAGS="$tmp_CXXFLAGS"
    CPPFLAGS="$tmp_CPPFLAGS"
    CFLAGS="$tmp_CFLAGS"
    LDFLAGS="$tmp_LDFLAGS"
    LIBS="$tmp_LIBS"
    AC_SUBST(LAME_CFLAGS)
    AC_SUBST(LAME_LIBS)
else
    AC_MSG_WARN([*** Building without server support!])
fi 


##################################
# Check if tests should be built.
AC_ARG_WITH(test,
        [  --with-test             build tests (default=no)],
        [],
        [with_test=no])
if test x$with_test == xyes; then
  AM_PATH_CPPUNIT(1.9.6)
  AC_CONFIG_FILES(test/Makefile)
fi 

AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(LDFLAGS)

AM_CONDITIONAL([WITH_GUI], [test "x$with_gui" = "xyes"])
AM_CONDITIONAL([WITH_SERVER], [test "x$with_server" = "xyes"])

AC_OUTPUT(
	Makefile 
	src/Makefile
	tools/Makefile
	etc/Makefile
	pixmaps/Makefile
	man/Makefile)