1 dnl Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([console.c])
4 AC_CONFIG_HEADERS([config.h])
6 dnl Checks for programs.
10 AC_CACHE_CHECK([for EMX], ac_cv_have_emx,
11 AC_TRY_COMPILE(, [#ifndef __EMX__
13 #endif ], ac_cv_have_emx=yes, ac_cv_have_emx=no)
15 if test "$ac_cv_have_emx" = yes; then
16 LDFLAGS="`echo "$LDFLAGS -Zsysv-signals -Zbin-files" | sed "s/-Zexe//g" | sed "s/-Zmt//g"`"
17 CFLAGS="`echo "$CFLAGS" | sed "s/-Zmt//g"`"
20 dnl Checks for libraries.
21 dnl Replace `main' with a function in -lm:
24 dnl Checks for header files.
26 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h linux/vt.h linux/kd.h siginfo.h float.h sys/select.h)
28 dnl Checks for typedefs, structures, and compiler characteristics.
34 dnl Checks for library functions.
35 AC_PROG_GCC_TRADITIONAL
37 AC_CHECK_FUNCS(gettimeofday select strtol strtoul getopt psignal access)
39 AC_CHECK_FUNC(random, cf_result=yes, cf_result=no)
40 if test "$cf_result" = no; then
41 AC_CHECK_LIB(bsd, random)
44 AC_CHECK_FUNC(srandom, cf_result=yes, cf_result=no)
45 if test "$cf_result" = no; then
46 AC_CHECK_LIB(bsd, srandom)
49 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
50 if test "$cf_result" = no; then
51 AC_CHECK_LIB(socket, socket)
54 AH_TEMPLATE([HAVE_LIBX11], [Define if you have the X11 library (-lX11).])
55 AH_TEMPLATE([HAVE_LIBXPM], [Define if you have the Xpm library (-lXpm).])
56 AH_TEMPLATE([HAVE_TYPEOF], [Define if you have the typeof function.])
58 AC_CACHE_CHECK([for typeof], ac_cv_have_typeof,
59 AC_TRY_COMPILE(, [int a;
60 typeof(a) b;], ac_cv_have_typeof=yes, ac_cv_have_typeof=no)
62 test "$ac_cv_have_typeof" = yes && AC_DEFINE(HAVE_TYPEOF)
64 #AC_MSG_CHECKING([for gethostbyname])
65 #AC_TRY_LINK([#include <netdb.h>], [gethostbyname("")], cf_result=yes, cf_result=no)
66 #AC_MSG_RESULT($cf_result)
67 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
68 if test "$cf_result" = no; then
69 AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
70 if test "$cf_result" = no; then
71 AC_CHECK_LIB(nsl, gethostbyname)
73 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
77 AC_CHECK_HEADERS(pthread.h)
78 AC_CHECK_FUNC(pthread_create, cf_result=yes, cf_result=no)
79 if test "$cf_result" = no; then
80 AC_CHECK_LIB(pthread, pthread_create, cf_result=yes, cf_result=no)
81 if test "$cf_result" = no; then
82 AC_CHECK_LIB(pthread, pthread_create)
84 test -z "`echo $LIBS | grep -- -lpthread`" && LIBS="$LIBS -lpthread"
85 AC_DEFINE(HAVE_LIBPTHREAD)
89 if test "$with_x" = yes ; then
90 if test "$ac_cv_have_emx" = yes && test -n "$X11ROOT"; then
91 CFLAGS="$CFLAGS -I$X11ROOT/XFree86/include"
92 LDFLAGS="$LDFLAGS -L$X11ROOT/XFree86/lib"
95 dnl Replace `main' with a function in -lX11:
96 AC_CHECK_LIB(X11, main,AC_DEFINE(HAVE_LIBXPM) X_LIBS="$X_LIBS -lX11",,-L$x_libraries)
97 dnl Replace `main' with a function in -lXpm:
98 AC_CHECK_LIB(Xpm, main,AC_DEFINE(HAVE_LIBX11) X_LIBS="$X_LIBS -lXpm",,-L$x_libraries -lX11)
107 if test "$ac_cv_have_emx" = yes; then
108 LDFLAGS="$LDFLAGS -Zexe"
109 OVERKILL_SPECIAL="emxbind -e -f -q 0verkill.exe"
111 AC_SUBST(OVERKILL_SPECIAL)
113 AC_CONFIG_FILES([Makefile])