File: configure.in

package info (click to toggle)
aalib 1.4p5-51.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,592 kB
  • sloc: ansic: 10,404; sh: 7,789; makefile: 90
file content (477 lines) | stat: -rw-r--r-- 12,331 bytes parent folder | download | duplicates (9)
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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
AC_INIT(src/aalib.c)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(aalib,1.4.0)

AM_CONFIG_HEADER(src/config.h)

dnl Initialize the compiler and linker flags for AALIB applications

AALIB_CFLAGS=""
AALIB_LIBS="-laa"

dnl Output the video drivers we use
if test x$enable_video = xtrue; then
    if test "$VIDEO_SUBDIRS" = ""; then
        AC_MSG_ERROR(*** No video drivers are enabled!)
    fi
fi

dnl Checks for programs.

x_driver_test=yes
curses_driver_test=yes
linux_driver_test=yes
slang_driver_test=yes
force_curses_driver=false
x_kbddriver_test=yes
curses_kbddriver_test=yes
slang_kbddriver_test=yes
curses_mousedriver_test=yes
gpm_mousedriver_test=yes
x_mousedriver_test=yes

use_cc_g_flag=no
AC_PROG_CC
AM_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_INSTALL

dnl detect OS

AC_CHECK_PROG(system,uname,`uname`,unknown)
if test "x$system" = xLinux; then
AC_CHECK_PROG(machine,uname,`uname --machine`,unknown)
fi
AC_HEADER_STDC
AC_CHECK_LIB(m, pow)

if test "x$ac_cv_lib_m_pow" = xyes; then 
  AALIB_LIBS="$AALIB_LIBS -lm"
fi

cc_uses_g=yes
if test x$GCC = xyes; then
    if test x$ac_cv_prog_gcc_g = xyes; then
	:
    else
	cc_uses_g=no
    fi
fi
dnl command line options

AC_ARG_WITH(x11-driver,
        [  --with-x11-driver=no    Used to disable x11 driver],[
	if test x$withval = xno; then
	  x_driver_test=no
	fi
])
AC_ARG_WITH(slang-driver,
        [  --with-slang-driver=no   Used to disable slang driver],[
	if test x$withval = xno; then
	  slang_driver_test=no
	fi
])
AC_ARG_WITH(curses-driver,
        [  --with-curses-driver=no/yes Used to disable/force curses driver],[
	if test x$withval = xno; then
	  curses_driver_test=no
	fi
	if test x$withval = xyes; then
	  force_curses_driver=true
	fi
])
AC_ARG_WITH(gpm-mouse, 
	[  --with-gpm-mouse=base-dir  Specifies the base gpm directory],
	if test x$withval = xyes
	then 
		AC_MSG_WARN(Usage is: --with-gpm-mouse=base-dir)
	else
		LIBS="$LIBS -L$withval/lib -lgpm"
                AC_DEFINE(GPM_MOUSEDRIVER)
	        gpm_mousedriver=true
		CFLAGS="$CFLAGS -I$withval/include"
dnl See Debian hack below for explination.
dnl	        AALIB_LIBS="$AALIB_LIBS -L$withval/lib -lgpm"
		AC_MSG_RESULT(defining use_gpm)
	fi
)

if test  "$x_driver_test" = yes; then
AC_PATH_X
AC_PATH_XTRA
if test "x$no_x" = x; then
    x_driver=true
    AC_DEFINE(X11_DRIVER)
    LIBS="$LIBS $X_EXTRA_LIBS $X_LIBS -lX11"
    AALIB_LIBS="$AALIB_LIBS $X_EXTRA_LIBS $X_LIBS -lX11"
    CFLAGS="$CFLAGS $X_CFLAGS"
fi

fi
if test  "$gpm_mousedriver_test" = yes; then
  AC_CHECK_LIB(gpm, Gpm_Repeat,[
          AC_DEFINE(GPM_MOUSEDRIVER)
	  gpm_mousedriver=true
dnl Debian hack: Don't bother putting gpm on the libs list, so aalib-config
dnl will not require programs link with gpm. Since aalib itself links to
dnl gpm, gpm support is still pulled in for client programs, but they need
dnl not build-depend on it. This means that the -dev package need not
dnl depend on libgpm1g-dev, which is a good thing since gpm support is not
dnl available at all on some platforms like the hurd.
dnl	  AALIB_LIBS="$AALIB_LIBS -lgpm"
          LIBS="$LIBS -lgpm"])
fi

dnl
dnl This part supplies reasonable defaults for CFLAGS, if they weren't
dnl specified by ''CFLAGS=flags ./configure''
dnl




search_ncurses=true
AC_DEFUN(AC_USE_SUNOS_CURSES, [
	search_ncurses=false
	curses_driver=true
	screen_manager="SunOS 4.x /usr/5include curses"
	AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
	AC_DEFINE(SUNOS_CURSES)
	AC_DEFINE(NO_COLOR_SUPPORT)
	AC_DEFINE(USE_SYSV_CURSES)
	CFLAGS="$CFLAGS -I/usr/5include"
	XCURSES="xcurses.o /usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
	AC_MSG_RESULT(Please note that some screen refreshs may fail)
	AC_WARN(Reconsider using Slang)
])

AC_DEFUN(AC_USE_OSF1_CURSES, [
       AC_MSG_RESULT(Using OSF1 curses)
       search_ncurses=false
       curses_driver=true
       screen_manager="OSF1 curses"
       AC_DEFINE(NO_COLOR_SUPPORT)
       AC_DEFINE(USE_SYSV_CURSES)
       XCURSES="xcurses.o"
       LIBS="$LIBS -lcurses"
       AALIB_LIBS="$AALIB_LIBS -lcurses"
])

AC_DEFUN(AC_USE_SYSV_CURSES, [
	AC_MSG_RESULT(Using SysV curses)
        curses_driver=true
	AC_DEFINE(USE_SYSV_CURSES)
	XCURSES=""
	search_ncurses=false
	screen_manager="SysV/curses"
	LIBS="$LIBS -lcurses"
        AALIB_LIBS="$AALIB_LIBS -lcurses"
])

XCURSES=""



AC_ARG_WITH(sunos-curses,
	[  --with-sunos-curses     Used to force SunOS 4.x curses],[
	if test x$withval = xyes; then
		AC_USE_SUNOS_CURSES
	fi
])

AC_ARG_WITH(osf1-curses,
	[  --with-osf1-curses	Used to force OSF/1 curses],[
	if test x$withval = xyes; then
		AC_USE_OSF1_CURSES
	fi
])

AC_ARG_WITH(vcurses,
	[  --with-vcurses[=incdir] Used to force SysV curses],
	if test x$withval = xyes; then
		CFLAGS="$CFLAGS"
        else
		CFLAGS="$CFLAGS -I$withval"
	fi
	AC_USE_SYSV_CURSES
)
        	
AC_ARG_WITH(ncurses,
	[  --with-ncurses[=base-dir] Compile with ncurses/locate base dir],
	if test x$withval = xyes
	then
		search_ncurses=true
	else
		LIBS="$LIBS -L$withval/lib -lncurses"
		AALIB_LIBS="$AALIB_LIBS -L$withval/lib -lncurses"
		CFLAGS="$CFLAGS -I$withval/include"
		search_ncurses=false
                curses_driver=true
		screen_manager="ncurses"
		AC_DEFINE(USE_NCURSES)
	fi
)

if test  "$slang_driver_test" = yes; then
  AC_DEFUN(AC_SLANG, [
    if $search_slang
    then
        if test -f $1/$2
	then
	    LIBS1="$LIBS"
 	    LIBS="$LIBS $3"
            AC_CHECK_LIB(slang, SLsmg_init_smg)
            if test "x$ac_cv_lib_slang_SLsmg_init_smg" = xyes; then 
	      AC_MSG_RESULT(Found slang on $1/$2)
	      AALIB_LIBS="$AALIB_LIBS $3 -lslang"
 	      LIBS="$LIBS $3"
	      CFLAGS="$CFLAGS $4"
              slang_driver=true
	      search_slang=false
	      AC_DEFINE(SLANG_DRIVER)
	    else
             unset ac_cv_lib_slang_SLsmg_init_smg
	     LIBS="$LIBS1"
	    fi
	fi
     fi
  ])
  AC_SLANG(/usr/include, slang.h, , -I/usr/include , "slang on /usr/include")
  AC_SLANG(/usr/include/slang, slang.h, , -I/usr/include/slang , "slang on /usr/include/slang")
  AC_SLANG(/usr/local/include, slang.h, , -I/usr/local/include/slang , "slang on /usr/local/include")
  AC_SLANG(/usr/local/include/slang, slang.h, , -I/usr/local/include/slang , "slang on /usr/local/include/slang")
  if test "$slang_driver" = true; then
    if test "$force_curses_driver" = false; then
      echo "Disabling curses driver since slang is available"
      curses_driver_test=no
    fi
  fi
fi

dnl
dnl Parameters: directory filename LIBS_append CFLAGS_append nicename
dnl
AC_DEFUN(AC_NCURSES, [
    if $search_ncurses
    then
        if test -f $1/$2
	then
	    LIBS1="$LIBS"
 	    LIBS="$LIBS $3"
            AC_CHECK_LIB(ncurses, initscr)
            if test "x$ac_cv_lib_ncurses_initscr" = xyes; then 
	      AC_MSG_RESULT(Found ncurses on $1/$2)
	      AALIB_LIBS="$AALIB_LIBS $3 -lncurses"
 	      LIBS="$LIBS $3"
	      CFLAGS="$CFLAGS $4"
	      search_ncurses=false
              curses_driver=true
	      screen_manager=$5
	      AC_DEFINE(USE_NCURSES)
	    else
             unset ac_cv_lib_ncurses_initscr
	     LIBS="$LIBS1"
	    fi
	fi
    fi
])

dnl
dnl Parameters: directory filename LIBS_append CFLAGS_append nicename
dnl
AC_DEFUN(AC_CURSES, [
    if $search_ncurses
    then
        if test -f $1/$2
	then
	    LIBS1="$LIBS"
 	    LIBS="$LIBS $3"
            AC_CHECK_LIB(curses, initscr)
            if test "x$ac_cv_lib_curses_initscr" = xyes; then 
	      AC_MSG_RESULT(Found generic curses on $1/$2)
	      CFLAGS="$CFLAGS $4"
	      search_ncurses=false
              curses_driver=true
	      AALIB_LIBS="$AALIB_LIBS $3 -lcurses"
	      AC_DEFINE(CURSES_DRIVER)
	      screen_manager=$5
	      AC_DEFINE(USE_CURSES)
	    else
             unset ac_cv_lib_curses_initscr
	     LIBS="$LIBS1"
	    fi
	fi
    fi
])

if test  "$curses_driver_test" = yes; then
if $search_ncurses
then
    AC_CHECKING("location of curses")

    AC_NCURSES(/usr/include, ncurses.h, , -I/usr/include/ncurses , "ncurses on /usr/include")
    AC_NCURSES(/usr/include/ncurses, ncurses.h, , -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
    AC_NCURSES(/usr/local/include, ncurses.h, ,-L/usr/local/lib, -I/usr/local/include, "ncurses on /usr/local")
    AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")

    AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")

    AC_NCURSES(/usr/include/ncurses, curses.h, , -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
    AC_CURSES(/usr/include, curses.h, , , "curses on /usr/include")

    dnl
    dnl We couldn't find ncurses, try SysV curses
    dnl
    if $search_ncurses 
    then
        AC_EGREP_HEADER(init_color, /usr/include/curses.h,
	    AC_USE_SYSV_CURSES)
    fi

    dnl
    dnl Try SunOS 4.x /usr/5{lib,include} ncurses
    dnl The flags SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
    dnl should be replaced by a more fine grained selection routine
    dnl
    if $search_ncurses
    then
	if test -f /usr/5include/curses.h
	then
	    AC_USE_SUNOS_CURSES
        fi
    fi
fi
AC_CHECK_FUNCS(mousemask termattrs wredrawln redrawwin curs_set)
fi


dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/ioctl.h sys/time.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_STRUCT_ST_RDEV
AC_HEADER_TIME

dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(strdup)

case "$target" in
    *-*-linux*)
        ARCH=linux
	;;
    *-*-bsdi*)
        ARCH=bsdi
	;;
    *-*-freebsd*)
        ARCH=freebsd
	;;
    *-*-solaris*)
        ARCH=solaris
	;;
    *)
        ARCH=other
	;;
esac

# Set runtime shared library paths as needed

#if test $ARCH = linux -o $ARCH = freebsd -o $ARCH = bsdi; then
#  AALIB_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
#fi

if test $ARCH = solaris; then
  AALIB_RLD_FLAGS="-R\${exec_prefix}/lib"
fi


dnl Expand the cflags and libraries needed by apps using AALIB
AC_SUBST(AALIB_CFLAGS)
AC_SUBST(AALIB_LIBS)
AC_SUBST(AALIB_RLD_FLAGS)
AC_SUBST(XCURSES)

# Set conditional variables for shared and static library selection.
# These are not used in any Makefile.am but in sdl-config.in.
AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = yes])
AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = yes])

echo "-----------------------------------------------------"
echo "CFLAGS  $CFLAGS"
echo "LDFLAGS $LIBS"
echo "AA-LIBD $AALIB_LIBS"
echo "CC      $CC"
echo "-----------------------------------------------------"
echo "Display drivers:"
if test  "$slang_driver" = true; then
  echo " slang"
  if test  "$slang_kbddriver_test" = yes; then
     AC_DEFINE(SLANG_KBDDRIVER)
     slang_kbddriver=true
  fi
fi
if test  "$curses_driver" = true; then
  AC_DEFINE(CURSES_DRIVER)
  echo " curses"
  if test  "$curses_kbddriver_test" = yes; then
     AC_DEFINE(CURSES_KBDDRIVER)
     curses_kbddriver=true
  fi
  if test  "$curses_kbddriver_test" = yes; then
    if test "x$ac_cv_func_mousemask" = xyes; then
     AC_DEFINE(CURSES_MOUSEDRIVER)
     curses_mousedriver=true
    fi
  fi
fi
if test  "$linux_driver_test" = yes; then
 if test "x$system" = xLinux; then
   echo " Linux console"
   AC_DEFINE(LINUX_DRIVER)
   AC_DEFINE(LINUX_KBDDRIVER)
 fi
fi
if test  "$x_driver" = true; then
  echo " x11"
  if test  "$x_kbddriver_test" = yes; then
     AC_DEFINE(X11_KBDDRIVER)
     x_kbddriver=true
  fi
  if test  "$x_mousedriver_test" = yes; then
     AC_DEFINE(X11_MOUSEDRIVER)
     x_mousedriver=true
  fi
fi
echo "Keyboard drivers:"
if test  "$linux_driver_test" = yes; then
 if test "x$system" = xLinux; then
   echo " Linux console"
 fi
fi
if test  "$slang_kbddriver" = true; then
  echo " slang"
fi
if test  "$curses_kbddriver" = true; then
  echo " curses"
fi
if test  "$x_kbddriver" = true; then
  echo " X11"
fi
echo "Mouse drivers:"
if test  "$curses_mousedriver" = true; then
  echo " curses"
fi
if test  "$gpm_mousedriver" = true; then
  echo " gpm"
fi
if test  "$x_mousedriver" = true; then
  echo " X11"
fi
echo "-----------------------------------------------------"


AC_OUTPUT([Makefile man/Makefile doc/Makefile src/Makefile aalib-config],
	  [chmod +x aalib-config])