1
dnl $Id: configure.in,v 1.9 2001/08/23 12:39:51 soyt Exp $
2
dnl Process this file with autoconf to produce a configure script.
6
AC_INIT(input/stdin/input.c)
8
AM_INIT_AUTOMAKE(libgii,0.8.1,-)
13
dnl ========================================================================
18
gii_conffile="libgii.conf"
36
dnl ========================================================================
37
dnl Checks for programs.
45
dnl ========================================================================
46
dnl User selectable options
48
AC_ARG_ENABLE(memdebug,
49
[ --enable-memdebug include memory usage debugging code in LibGG],
50
use_memdebug=$enableval)
52
AC_ARG_ENABLE(filter_mouse,
53
[ --disable-filter-mouse don't build the mouse filterlib],
54
build_mouse_filter=$enableval)
55
AC_ARG_ENABLE(filter_keytrans,
56
[ --disable-filter-keytrans
57
don't build the key translation filterlib],
58
build_keytrans_filter=$enableval)
59
AC_ARG_ENABLE(filter_save,
60
[ --disable-filter-save don't build the save filterlib],
61
build_save_filter=$enableval)
62
AC_ARG_ENABLE(filter_tcp,
63
[ --disable-filter-tcp don't build the tcp filterlib],
64
build_tcp_filter=$enableval)
66
[ --disable-null don't build the null inputlib (discouraged - this
67
is REQUIRED by LibGGI)],
68
build_null_input=$enableval)
70
[ --disable-file don't build the file inputlib],
71
build_file_input=$enableval)
73
[ --disable-tcp don't build the tcp inputlib],
74
build_tcp_input=$enableval)
76
[ --disable-stdin don't build the stdin inputlib],
77
build_stdin_input=$enableval)
79
[ --disable-x don't build the x inputlib],
80
build_x_input=$enableval)
82
[ --disable-xwin don't build the xwin inputlib],
83
build_xwin_input=$enableval)
85
[ --disable-mouse don't build the mouse inputlib],
86
build_mouse_input=$enableval)
87
AC_ARG_ENABLE(linux_mouse,
88
[ --disable-linux-mouse don't build the linux-mouse inputlib],
89
build_linux_mouse_input=$enableval)
90
AC_ARG_ENABLE(linux_kbd,
91
[ --disable-linux-kbd don't build the linux-kbd inputlib],
92
build_linux_kbd_input=$enableval)
93
AC_ARG_ENABLE(linux_joy,
94
[ --disable-linux-joy don't build the linux-joy inputlib],
95
build_linux_joy_input=$enableval)
96
AC_ARG_ENABLE(linux_evdev,
97
[ --disable-linux-evdev don't build the linux-evdev inputlib],
98
build_linux_evdev_input=$enableval)
99
AC_ARG_ENABLE(spaceorb,
100
[ --disable-spaceorb don't build the spaceorb inputlib],
101
build_spaceorb_input=$enableval)
103
[ --disable-vgl don't build the vgl inputlib],
104
build_vgl_input=$enableval)
105
AC_ARG_ENABLE(directx,
106
[ --disable-directx don't build the directx inputlib],
107
build_directx_input=$enableval)
109
[ --enable-pcjoy build the pcjoy inputlib],
110
build_pcjoy_input=$enableval)
112
[ --enable-lk201 build the lk201 DEC serial terminal inputlib],
113
build_lk201_input=$enableval)
115
AC_ARG_ENABLE(mutexes,
116
[ --enable-mutexes=TYPE force the kind of mutexes to use
117
(builtin, pthread or dynpthread)],
118
mutextype="$enableval")
120
[ --disable-debug build without run-time debugging (speed freaks)],
121
use_debug=$enableval)
125
dnl font-lock-mode prettyfier '
126
dnl ========================================================================
127
dnl Checks for libraries.
129
AC_CHECK_LIB(vgl, VGLInit, foo=bar, build_vgl_target="no")
132
dnl ========================================================================
133
dnl Checks for header files.
137
AC_CHECK_HEADERS(sys/time.h unistd.h fcntl.h signal.h sched.h sys/types.h \
138
sys/stat.h sys/ioctl.h pthread.h asm/io.h sys/io.h \
139
linux/keyboard.h sys/kd.h sys/vt.h linux/kd.h linux/vt.h \
140
linux/joystick.h linux/input.h linux/kdev_t.h linux/major.h \
141
sys/un.h sys/socket.h netinet/in.h arpa/inet.h netdb.h \
142
termios.h malloc.h vgl.h \
147
dnl ========================================================================
148
dnl Checks for typedefs, structures, and compiler characteristics.
154
dnl Hack for cross-compiling to win32
155
if test "$CC" = "i386-mingw32-gcc"; then
160
AC_CHECK_SIZEOF(char, 1)
161
AC_CHECK_SIZEOF(short, 2)
162
AC_CHECK_SIZEOF(int, 4)
163
AC_CHECK_SIZEOF(long, 4)
164
AC_CHECK_SIZEOF(long long, 8)
165
dnl Not supported by new libtool
166
dnl AM_SYS_SYMBOL_UNDERSCORE
168
if test "x$cross_compiling" = "xyes"; then
170
You are using a cross-compiler, please set the SIZEOF_* defines in config.h
171
properly before compiling this package. Also check that the typedefs and
172
defines in include/ggi/system.h are correct.
176
if test "$ac_cv_header_sys_time_h" = "yes"; then
177
TIMEVAL_INCLUDE='#include <sys/time.h>'
179
TIMEVAL_INCLUDE='#include <time.h>'
182
if test "$ac_cv_sizeof_int" = "1"; then
184
elif test "$ac_cv_sizeof_char" = "1"; then
186
elif test "$ac_cv_sizeof_short" = "1"; then
189
AC_MSG_ERROR(No 8-bit datatype on this system???)
192
if test "$ac_cv_sizeof_int" = "2"; then
194
elif test "$ac_cv_sizeof_char" = "2"; then
196
elif test "$ac_cv_sizeof_short" = "2"; then
198
elif test "$ac_cv_sizeof_long" = "2"; then
201
AC_MSG_ERROR(No 16-bit datatype on this system???)
204
if test "$ac_cv_sizeof_int" = "4"; then
206
elif test "$ac_cv_sizeof_long" = "4"; then
208
elif test "$ac_cv_sizeof_char" = "4"; then
210
elif test "$ac_cv_sizeof_short" = "4"; then
212
elif test "$ac_cv_sizeof_long_LONG" = "4"; then
215
AC_MSG_ERROR(No 32-bit datatype on this system???)
218
if test "x$ac_cv_c_bigendian" = "xyes"; then
219
GGI_ENDIAN="#define GGI_BIG_ENDIAN 1"
221
GGI_ENDIAN="#define GGI_LITTLE_ENDIAN 1"
224
AC_MSG_CHECKING([for TIOCMSET in termios.h or sys/ioctl.h])
225
AC_EGREP_CPP(giitiocmset,
226
[#include <sys/ioctl.h>
231
], HAVE_TIOCMSET=yes; AC_DEFINE(HAVE_TIOCMSET), HAVE_TIOCMSET=no)
232
AC_MSG_RESULT($HAVE_TIOCMSET)
237
dnl ========================================================================
238
dnl Checks for library functions.
240
dnl Must undefine select here :-(
241
unset ac_cv_func_select
242
AC_CHECK_FUNCS(select pipe dlopen fcntl signal sigaction readlink sched_yield \
245
dnl Functions of the form func(num), func(pointer) or func(pointer,pointer)
246
dnl should go here instead of above.
248
AC_CHECK_WINFUNCS(gettimeofday strdup nanosleep usleep _exit \
253
if test "x$ac_cv_func_usleep" = "xyes"; then
254
GG_USLEEP="#define ggUSleep(val) usleep((unsigned int)(val))"
255
if test "x$ac_cv_header_unistd_h" = "xyes"; then
256
USLEEP_INCLUDE1="#include <unistd.h>"
258
AC_DEFINE(GG_USLEEP_DEFINED)
259
elif test "x$ac_cv_func_Sleep" = "xyes"; then
260
GG_USLEEP="#define ggUSleep(val) Sleep((unsigned int)((val)/1000))"
261
if test "x$ac_cv_header_windows_h" = "xyes"; then
262
USLEEP_INCLUDE1="#include <windows.h>"
264
AC_DEFINE(GG_USLEEP_DEFINED)
265
elif test "x$ac_cv_func_select" = "xyes"; then
266
GG_USLEEP="#define ggUSleep(val) do {struct timeval tv; \
267
tv.tv_sec=(val)/1000000; tv.tv_usec=(val)%1000000; \
268
select(0, NULL, NULL, NULL, &tv);} while(0);"
269
if test "x$ac_cv_header_sys_types_h" = "xyes"; then
270
USLEEP_INCLUDE1="#include <sys/types.h>"
272
if test "x$ac_cv_header_unistd_h" = "xyes"; then
273
USLEEP_INCLUDE2="#include <unistd.h>"
275
AC_DEFINE(GG_USLEEP_DEFINED)
277
GG_USLEEP="void ggUSleep(unsigned int);"
280
if test "x$ac_cv_func_gettimeofday" = "xyes"; then
281
GG_CURTIME="#define ggCurTime(tv) gettimeofday((tv), NULL)"
282
AC_DEFINE(GG_CURTIME_DEFINED)
283
elif test "x$ac_cv_func_GetSystemTime" = "xyes"; then
284
GG_CURTIME="#define ggCurTime(tv) do{ SYSTEMTIME stim; \
285
GetSystemTime(&stim); \
286
(tv)->tv_sec = stim.wSecond; \
287
(tv)->tv_usec = stim.wMilliseconds*1000; }while(0)"
288
AC_DEFINE(GG_CURTIME_DEFINED)
290
GG_CURTIME="void ggCurTime(struct timeval *);"
293
if test "x$ac_cv_func_select" = "xno"; then
294
AC_MSG_CHECKING([for select in -lwsock32])
296
LIBS="$LIBS -lwsock32"
300
select(1, NULL, NULL, NULL, NULL);
302
SELECTLIBS="$SELECTLIBS -lwsock32"
303
NETLIBS="$NETLIBS -lwsock32"
304
ac_cv_func_select=yes
310
if test "x$ac_cv_func_nanosleep" = "xno"; then
311
AC_CHECK_LIB(rt, nanosleep,
312
GGDLLIBS="$GGDLLIBS -lrt"
313
AC_DEFINE(HAVE_NANOSLEEP)
315
AC_CHECK_LIB(posix4, nanosleep,
316
GGDLLIBS="$GGDLLIBS -lposix4"
317
AC_DEFINE(HAVE_NANOSLEEP)
322
if test "x$ac_cv_func_sched_yield" = "xno"; then
323
AC_CHECK_LIB(posix4, sched_yield,
324
GGDLLIBS="$GGDLLIBS -lposix4"
325
AC_DEFINE(HAVE_SCHED_YIELD))
328
if test "x$ac_cv_func_dlopen" = "xno"; then
329
AC_CHECK_LIB(dl, dlopen, GGDLLIBS="$GGDLLIBS -ldl")
332
if test "$mutextype" != "builtin"; then
333
AC_MSG_CHECKING(for pthread_mutex_init in -lpthread)
334
if test "x$ac_cv_header_pthread_h" = "xyes"; then
335
TMP_SAVE_LIBS="$LIBS"
336
LIBS="$LIBS -lpthread"
338
#define __C_ASM_H /* fix for retarded Digital Unix headers */
340
pthread_mutex_t mtex;
342
if (pthread_mutex_init(&mtex, NULL) == 0) return 0;
347
if test "$mutextype" != "dynpthread"; then
348
AC_MSG_CHECKING(if this system is known to have broken pthread mutexes)
349
if test `uname -s` = "Linux"; then
351
if test "$mutextype" != "pthread"; then
358
if test "$mutextype" != "dynpthread"; then
360
GGDLLIBS="$GGDLLIBS -lpthread"
364
AC_MSG_CHECKING(for pthread_mutex_init in -lc_r)
365
LIBS="$TMP_SAVE_LIBS -lc_r"
368
pthread_mutex_t mtex;
370
if (pthread_mutex_init(&mtex, NULL) == 0) return 0;
375
if test "$mutextype" != "dynpthread"; then
377
GGDLLIBS="$GGDLLIBS -lc_r"
390
LIBS="$TMP_SAVE_LIBS"
397
AC_MSG_CHECKING(what kind of mutexes to use)
398
AM_CONDITIONAL(PTLOCK, test "$mutextype" = "pthread")
399
AM_CONDITIONAL(DLPTLOCK, test "$mutextype" = "dynpthread")
400
AM_CONDITIONAL(BUILTINLOCK, test "$mutextype" = "builtin")
401
AC_MSG_RESULT($mutextype)
404
dnl ========================================================================
405
dnl Checks for target-specific libraries and headers
409
dnl ========================================================================
410
dnl Check for inputlibs
412
AC_MSG_CHECKING(if we should build the mhub program)
413
if test "x$ac_cv_header_unistd_h" = "xyes" \
414
-a "x$ac_cv_func_fcntl" = "xyes" \
415
-a "x$ac_cv_func_signal" = "xyes"; then
422
AC_MSG_CHECKING(if we should build the xsendbut program)
423
if test "x$no_x" != "xyes"; then
424
DEMOS="$DEMOS xsendbut"
431
AC_MSG_CHECKING(if we should build null inputlib)
432
if test "x$build_null_input" != "xno"; then
433
INPUTSUBDIRS="$INPUTSUBDIRS null"
439
AC_MSG_CHECKING(if we should build file inputlib)
440
if test "x$build_file_input" != "xno"; then
441
INPUTSUBDIRS="$INPUTSUBDIRS file"
447
AC_MSG_CHECKING(if we should build tcp inputlib)
448
if test "x$build_tcp_input" != "xno"; then
449
INPUTSUBDIRS="$INPUTSUBDIRS tcp"
455
AC_MSG_CHECKING(if we should build stdio inputlib)
456
if test "x$build_stdio_input" != "xno" -a \
457
"x$ac_cv_header_unistd_h" = "xyes"; then
458
INPUTSUBDIRS="$INPUTSUBDIRS stdin"
464
AC_MSG_CHECKING(if we should build x inputlib)
465
if test "x$build_x_input" != "xno" -a "x$no_x" != "xyes"; then
466
INPUTSUBDIRS="$INPUTSUBDIRS x"
472
AC_MSG_CHECKING(if we should build xwin inputlib)
473
if test "x$build_xwin_input" != "xno" -a "x$no_x" != "xyes"; then
474
INPUTSUBDIRS="$INPUTSUBDIRS xwin"
480
AC_MSG_CHECKING(if we should build mouse inputlib)
481
if test "x$build_mouse_input" != "xno" -a \
482
"x$ac_cv_header_unistd_h" = "xyes"; then
483
INPUTSUBDIRS="$INPUTSUBDIRS mouse"
489
AC_MSG_CHECKING(if we should build linux-mouse inputlib)
490
if test "x$build_linux_mouse_input" != "xno" -a \
491
"x$ac_cv_header_sys_ioctl_h" = "xyes" -a \
492
"x$ac_cv_header_termios_h" = "xyes"; then
493
INPUTSUBDIRS="$INPUTSUBDIRS linux_mouse"
499
AC_MSG_CHECKING(if we should build linux-kbd inputlib)
500
if test "x$build_linux_kbd_input" != "xno" -a \
501
"x$ac_cv_header_linux_keyboard_h" = "xyes"; then
502
INPUTSUBDIRS="$INPUTSUBDIRS linux_kbd"
508
AC_MSG_CHECKING(if we should build linux-joy inputlib)
509
if test "x$build_linux_joy_input" != "xno" -a \
510
"x$ac_cv_header_linux_joystick_h" = "xyes"; then
511
AC_EGREP_CPP(wonkdummy,
512
[#include <linux/joystick.h>
516
], INPUTSUBDIRS="$INPUTSUBDIRS linux_joy"
523
AC_MSG_CHECKING(if we should build linux-evdev inputlib)
524
if test "x$build_linux_evdev_input" != "xno" -a \
525
"x$ac_cv_header_linux_input_h" = "xyes"; then
526
INPUTSUBDIRS="$INPUTSUBDIRS linux_evdev"
532
AC_MSG_CHECKING(if we should build spaceorb inputlib)
533
if test "x$build_spaceorb_input" != "xno" -a \
534
"x$ac_cv_header_sys_ioctl_h" = "xyes" -a \
535
"x$ac_cv_header_termios_h" = "xyes"; then
536
INPUTSUBDIRS="$INPUTSUBDIRS spaceorb"
542
AC_MSG_CHECKING(if we should build vgl inputlib)
543
if test "x$build_vgl_input" != "xno" -a \
544
"x$ac_cv_header_vgl_h" = "xyes"; then
545
INPUTSUBDIRS="$INPUTSUBDIRS vgl"
551
AC_MSG_CHECKING(if we should build directx inputlib)
552
if test "x$build_directx_input" != "xno" -a \
553
"x$ac_cv_header_dinput_h" = "xyes"; then
554
INPUTSUBDIRS="$INPUTSUBDIRS directx"
560
AC_MSG_CHECKING(if we should build pcjoy inputlib)
561
if test "x$build_pcjoy_input" = "xyes" -a \
562
"x$ac_cv_header_unistd_h" = "xyes" -a \
563
"x$ac_cv_header_asm_io_h" = "xyes"; then
564
INPUTSUBDIRS="$INPUTSUBDIRS pcjoy"
570
AC_MSG_CHECKING(if we should build lk201 inputlib)
571
if test "x$build_lk201_input" = "xyes" -a \
572
"x$ac_cv_header_unistd_h" = "xyes" -a \
573
"x$ac_cv_header_termios_h" = "xyes"; then
574
INPUTSUBDIRS="$INPUTSUBDIRS lk201"
580
dnl ========================================================================
581
dnl Check for filterlibs
583
AC_MSG_CHECKING(if we should build mouse emulation filterlib)
584
FILTERSUBDIRS="$FILTERSUBDIRS mouse"
587
AC_MSG_CHECKING(if we should build key translation filterlib)
588
FILTERSUBDIRS="$FILTERSUBDIRS keytrans"
591
AC_MSG_CHECKING(if we should build save filterlib)
592
FILTERSUBDIRS="$FILTERSUBDIRS save"
595
AC_MSG_CHECKING(if we should build tcp filterlib)
596
if test "x$build_tcp_filter" != "xno"; then
597
FILTERSUBDIRS="$FILTERSUBDIRS tcp"
604
dnl ========================================================================
605
dnl System specific things
607
if test "x$USE_SYMBOL_UNDERSCORE" = "xyes"; then
608
AC_DEFINE(SYMBOL_UNDERSCORE)
611
AM_CONDITIONAL(MEMDEBUG, test "$use_memdebug" = "yes")
612
if test "$use_memdebug" = "yes"; then
613
AC_CHECK_LIB(c, __malloc_hook, AC_DEFINE(HAVE_MALLOC_HOOK))
617
dnl ========================================================================
618
dnl Finally add some flags
620
dnl _THREAD_SAFE is used instead of _REENTRANT on some systems
621
CFLAGS="$CFLAGS -D_REENTRANT -D_THREAD_SAFE"
623
if test "x$use_debug" = "xyes"; then
625
if test "$ac_cv_prog_gcc" = "yes"; then
626
CFLAGS="$CFLAGS -g -Wall"
630
dnl ========================================================================
633
AC_SUBST(TIMEVAL_INCLUDE)
634
AC_SUBST(USLEEP_INCLUDE1)
635
AC_SUBST(USLEEP_INCLUDE2)
643
AC_SUBST(INPUTSUBDIRS)
644
AC_SUBST(FILTERSUBDIRS)
651
dnl Bah! autoconf hasn't set prefix to it's default value yet!
652
test "x$prefix" = xNONE && prefix=$ac_default_prefix
653
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
655
dnl Use static_* to substitute into files where values shouldn't
656
dnl dynamicly change. Makefiles need to be able to dynamicly change
657
dnl paths between build and install and shouldn't use these static_*.
658
dnl Files that will be installed must always show the final location where
659
dnl they will reside and should use these static_* values.
660
dnl Ensure that all static_* are fully expanded.
662
eval static_libdir="$libdir"
664
until test "$static_libdir" = "$old_val"; do
665
old_val="$static_libdir"
666
eval static_libdir="$static_libdir"
669
eval static_sysconfdir="$sysconfdir"
671
until test "$static_sysconfdir" = "$old_val"; do
672
old_val="$static_sysconfdir"
673
eval static_sysconfdir="$static_sysconfdir"
677
AC_SUBST(static_libdir)
678
AC_SUBST(static_sysconfdir)
679
AC_DEFINE_UNQUOTED(GIITAGLEN,$TAGLEN)
680
AC_DEFINE_UNQUOTED(GIIPATHTAG,"$PATHTAG")
681
AC_DEFINE_UNQUOTED(GIICONFFILE,"$gii_conffile")
682
AC_DEFINE_UNQUOTED(GIICONFDIR,"$PATHTAG$static_sysconfdir/$ggi_subdir")
684
AM_CONFIG_HEADER(config.h)
698
input/linux_mouse/Makefile
699
input/linux_kbd/Makefile
700
input/linux_joy/Makefile
701
input/linux_evdev/Makefile
702
input/spaceorb/Makefile
704
input/directx/Makefile
705
input/fdselect/Makefile
709
filter/mouse/Makefile
710
filter/keytrans/Makefile
717
include/ggi/input/Makefile
718
include/ggi/internal/Makefile