File: configure.in

package info (click to toggle)
nvtv 0.4.7-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,328 kB
  • ctags: 4,303
  • sloc: ansic: 30,302; sh: 6,614; makefile: 159
file content (359 lines) | stat: -rwxr-xr-x 8,662 bytes parent folder | download | duplicates (5)
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
dnl Process this file with autoconf to produce a configure script.
dnl Used autoconf 2.53-5.
dnl Process it with aclocal to create aclocal.m4.

dnl Package, Version, Bugreport, Tarname
AC_INIT(nvtv,0.4.7,,nvtv-0.4.7)
AC_PREREQ(2.53)

dnl FIXME:
dnl AC_CONFIG_AUX_DIR(config)

dnl
dnl Check system type
dnl

AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)

dnl 
dnl Configuration defaults
dnl

AC_SUBST(PROGRAM)

PROGRAM="nvtv nvtvd"

dnl
dnl Defaults and host matching
dnl

withdef_x=yes
withdef_gtk=yes
host_flag=unix
withdef_client_backend=yes
withdef_winio=no

case $host in
  *-*-mingw32* | *-*-cygwin* | *-*-windows*)
    AC_MSG_RESULT(Setting defaults for Windows)
    PROGRAM="nvtv"
    host_flag=windows
    withdef_gtk=no
    withdef_x=no
    with_client_backend=no 
  ;;
esac

dnl
dnl Checks for programs.
dnl

AM_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_MAKE_SET

dnl
dnl Debugging enables, CFLAGS
dnl

dnl Clear -g -O2 from CFLAGS
CFLAGS=""

AC_MSG_CHECKING(for debugging info)

AC_ARG_ENABLE(debug,
[  --disable-debug         disable debugging info
],,enable_debug=yes)

if test "$enable_debug" = yes; then
  CFLAGS="$CFLAGS -g"
  AC_MSG_RESULT(enabled)
else
  CFLAGS="$CFLAGS -O2"
  AC_MSG_RESULT(disabled (optimizing on))
fi

dnl
dnl Check for X
dnl

AC_PATH_XTRA

dnl Add X include dir to preprocessor flags (not done automatically), so
dnl the extra X include checks down below work. This seems to be required
dnl for some systems, though it shouldn't. Also add /usr/local/include
dnl for libpci under FreeBSD.

CPPFLAGS="$CPPFLAGS $X_CFLAGS -I/usr/local/include" 

if test "${with_x+set}" != set; then
  with_x="$withdef_x"
fi

dnl
dnl Checks for GTK 1.2 or 2.0
dnl

AC_ARG_WITH(gtk,
[  --with-gtk              use GTK 1.2 or 2.0 (force one with 'gtk1' or 'gtk2')],
  ,with_gtk="$withdef_gtk")

have_gtk=no

if test ${with_x} = no ; then
dnl  with_gtk=no
  AC_MSG_RESULT(X disabled as requested.)
fi
if test ${with_gtk} = no ; then
  AC_MSG_RESULT(GTK disabled as requested.)
fi

if test ${have_gtk} = no ; then
  if test ${with_gtk} = yes -o ${with_gtk} = gtk1 ; then
    AM_PATH_GTK(1.2.0, have_gtk=gtk1)
  fi
fi
if test ${have_gtk} = no ; then
  if test ${with_gtk} = yes -o ${with_gtk} = gtk2 ; then
    AM_PATH_GTK_2_0(2.0.0, have_gtk=gtk2)
  fi
fi

if test ${have_gtk} = no ; then
  if test ${with_gtk} = yes -o ${with_gtk} = gtk1 ; then
    AC_MSG_WARN(Cannot find GTK 1.2.0 or higher (Is gtk-config in path?))
  fi
  if test ${with_gtk} = yes -o ${with_gtk} = gtk2 ; then
    AC_MSG_WARN(Cannot find GTK 2.0.0 or higher (Is pkg-config in path?))
  fi
  if test ${with_gtk} != no ; then
    AC_MSG_WARN(GTK disabled.)
    with_gtk=no
  fi
else
  LIBS="$LIBS $GTK_LIBS" 
  CFLAGS="$CFLAGS $GTK_CFLAGS"
fi 

dnl
dnl Check for wxWindows 2.3 or higher
dnl

have_wxwin=no
with_wxwin=no

if test ${with_gtk} = no ; then
  AM_OPTIONS_WXCONFIG
  AM_PATH_WXCONFIG(2.3.0, have_wxwin=yes)
  if test ${have_wxwin} = no ; then
    if test ${with_wxwin} = yes ; then
      AC_MSG_WARN(Cannot find wxWindows 2.3.0 or higher)
    fi
  else
    CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
    CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
    CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
    LDFLAGS="$LDFLAGS $WX_LIBS"
  fi
fi

dnl
dnl Adjust sources
dnl

AC_SUBST(OBJS_GUI)
AC_SUBST(OBJS_EXTRA)
AC_SUBST(OBJS_BACKEND)

OBJS_GUI=""
OBJS_EXTRA=""
OBJS_BACKEND=""

dnl Use sed instead of expr for for increased portability ("expr substr" 
dnl does not exist on some versions of "expr", including the FreeBSD one).
dnl    have_gtk_version=`expr ${have_gtk} : 'gtk\([[12]]\)'`


if test ${with_x} = yes ; then
  AC_DEFINE(HAVE_X,1,[Define to 1 if X is available and used.])
  OBJS_EXTRA="$OBJS_EXTRA actions.o"
  if test ${have_gtk} != no ; then
    have_gtk_version=`echo ${have_gtk} | sed -e 's/^gtk\(.\).*/\1/'`
    AC_DEFINE(HAVE_GTK,1,[Define to 1 if GTK is available and used.])
    AC_DEFINE_UNQUOTED(HAVE_GTK_VERSION,${have_gtk_version},[Define to 1/2 for GTK major version.])
    OBJS_GUI="gui.o gui_bt.o gui_cx.o gui_ch.o gui_ph.o gui_nx.o gui_nv.o gui_tdfx.o gui_i810.o"
  fi
  if test ${have_gtk} != gtk1 ; then
    LIBS="$LIBS $X_LIBS"
    AC_CHECK_LIB(X11,XOpenDisplay,LIBS="$LIBS -lX11",
      AC_MSG_ERROR(X11 library required))
    AC_CHECK_LIB(Xext,XMissingExtension,LIBS="$LIBS -lXext",
      AC_MSG_ERROR(Xext library required))
  fi
fi

dnl
dnl Check for backend usage
dnl

AC_MSG_CHECKING(for main (direct) backend)

AC_ARG_WITH(winio,
[  --with-winio            Use WinIo],
  ,with_winio="$withdef_winio")

dnl FIXME check for WinIo availability

case ${host_flag} in
  unix)
    AC_MSG_RESULT(unix)
    AC_DEFINE(USE_UNIX_BACKEND,1,[Define to 1 if Unix backend is used.])
    OBJS_BACKEND="$OBJS_BACKEND card_direct.o back_unix.o"
  ;;
  windows)
    if test ${with_winio} = yes ; then
      AC_MSG_RESULT(windows/winio)
      OBJS_BACKEND="$OBJS_BACKEND card_direct.o back_winio.o"
      AC_DEFINE(HAVE_WINIO,1,[Define to 1 if WinIo is used.])
    else
      AC_MSG_RESULT(windows/nvdll)
      OBJS_BACKEND="$OBJS_BACKEND back_mswin.o"
    fi
    AC_DEFINE(USE_MSWIN_BACKEND,1,[Define to 1 if MS-Windows backend is used.])
  ;;
esac

AC_MSG_CHECKING(for client backend)

AC_ARG_WITH(client-backend,
[  --with-client-backend   Use client backend (default)],
  ,with_client_backend="$withdef_client_backend")

if test ${with_client_backend} = yes ; then
  AC_MSG_RESULT(enabled)
  AC_DEFINE(USE_CLIENT_BACKEND,1,[Define to 1 if client backend is used.])
  OBJS_BACKEND="$OBJS_BACKEND back_client.o"
else
  AC_MSG_RESULT(disabled)
fi

dnl
dnl Check for other libraries
dnl
dnl (must check for winio before pci)
dnl 

AC_CHECK_LIB(m,sin,LIBS="$LIBS -lm",
  AC_MSG_ERROR(math library required))

case ${host} in
  *-*-netbsd*)
    AC_CHECK_LIB(i386,i386_iopl,LIBS="$LIBS -li386",
      AC_MSG_ERROR(NetBSD i386 library required))
    AC_CHECK_LIB(pci,pcibus_conf_read,LIBS="$LIBS -lpci",
      AC_MSG_ERROR(NetBSD pci library required))
  ;;
  *-*-freebsd*)
    AC_CHECK_LIB(gnugetopt,getopt_long,LIBS="$LIBS -lgnugetopt",
      AC_MSG_ERROR(FreeBSD gnugetopt library required))
  ;;
esac

if test ${with_winio} = yes ; then
  AC_CHECK_LIB(winio,winio_init,LIBS="$LIBS -lwinio",
    AC_MSG_ERROR(winio wrapper library required))
fi

if test ${host_flag} = unix -o ${with_winio} = yes ; then
  AC_CHECK_LIB(pci,pci_init,LIBS="$LIBS -lpci" pciutils_libname="pci",
    AC_CHECK_LIB(pciutils,pci_init,LIBS="$LIBS -lpciutils" pciutils_libname="pciutils",
      AC_MSG_ERROR(pci library required)))
fi

dnl
dnl Check for other X libraries
dnl

if test ${with_x} = yes ; then
  AC_CHECK_LIB(Xxf86vm,XF86VidModeQueryVersion,LIBS="$LIBS -lXxf86vm",
    AC_MSG_ERROR(Xxf86vm video mode extension library required))
  AC_CHECK_LIB(Xmu,XmuClientWindow,LIBS="$LIBS -lXmu",
    AC_MSG_ERROR(Xmu library required))
fi

dnl
dnl Check for header files
dnl

AM_CONFIG_HEADER(src/config.h)

AC_HEADER_STDC

AC_CHECK_HEADERS(sys/io.h)

if test ${host_flag} = unix -o ${with_winio} = yes ; then
  AC_CHECK_HEADER(${pciutils_libname}/pci.h,,
    AC_MSG_WARN(pci library header \'${pciutils_libname}/pci.h\' required))
  AC_DEFINE(HAVE_PCI,1,[Define to 1 if pciutils available and used.])
  if test ${pciutils_libname} = pciutils ; then
    AC_DEFINE(HAVE_PCIUTILS,1,[Define to 1 if pciutils library is named 'pciutils'.])
  fi
fi

if test ${with_winio} = yes ; then
  AC_CHECK_HEADER(winio.h,,
    AC_MSG_ERROR(winio wrapper library header 'winio.h' required))
fi

dnl
dnl Check for X header files
dnl

if test ${with_x} = yes ; then
  AC_CHECK_HEADER(X11/Xmu/WinUtil.h,,
    AC_MSG_ERROR(X11 header 'X11/Xmu/WinUtil.h' required))

  AC_MSG_CHECKING(for X11/extensions/xf86vmode.h presence)
  AC_TRY_CPP([#include <X11/extensions/xf86vmode.h>],[
      AC_MSG_RESULT(yes)
    ],[
      AC_MSG_RESULT(no)
      AC_MSG_ERROR(X11 header 'X11/extensions/xf86vmode.h' required)])
fi

dnl
dnl Check for XBox option
dnl

AC_MSG_CHECKING(for XBox support)

AC_ARG_WITH(xbox,
[  --with-xbox             compile for XBox],,with_xbox=no)

if test ${with_xbox} = yes ; then
  AC_MSG_RESULT(enabled)
  AC_DEFINE(XBOX_SUPPORT,1,[Define to 1 if XBox support is used.])
  OBJS_EXTRA="$OBJS_EXTRA xbox.o"
else
  AC_MSG_RESULT(disabled)
fi

dnl 
dnl Process other options
dnl

AC_ARG_WITH(fifo-path,
[  --with-fifo-path=PATH   path for the server/client fifo pipes (/var/run)],
  with_fifo_path="$withval", with_fifo_path="/var/run")

AC_DEFINE_UNQUOTED(CONFIG_PIPE_PATH, "${with_fifo_path}",
  [Path to client/server fifo pipes])
AC_MSG_RESULT(path to use for fifo pipes... ${with_fifo_path})

dnl 
dnl Create files
dnl

AC_OUTPUT([Makefile src/Makefile man/Makefile test/Makefile])