# GLTT configure.in

AC_INIT(FTBitmapFont.C)

AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM

dnl make $GLTT_DIR the default for the installation
AC_PREFIX_DEFAULT(${GLTT_DIR:-/usr/local})

dnl generate the config header
AC_CONFIG_HEADER(config.h) dnl at the distribution this done

dnl Checks for programs.
AC_CHECK_COMPILERS
AC_PROG_RANLIB
AC_PROG_INSTALL

GLTT_PROG_LIBTOOL

# # Turn around -rpath problem with libtool 1.0c
# # This define should be improbable enough to not conflict with anything
# case ${host} in
#   *-pc-linux-gnu)
#     AC_MSG_RESULT([Fixing libtool for -rpath problems.])
#     sed < libtool > libtool-2 \
#     's/^hardcode_libdir_flag_spec.*$/hardcode_libdir_flag_spec="-D__LIBTOOL_IS_A_FOOL__ "/'
#     mv libtool-2 libtool
#     chmod 755 libtool
#   ;;
# esac

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/time.h unistd.h)

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

dnl Checks for library functions.
AC_CHECK_FUNCS(gettimeofday select usleep)

AC_PATH_TTF

dnl I need to check for libsocket before testing X
AC_CHECK_LIB(socket, socket, [LIBSOCKET="-lsocket -lnsl"]) dnl for Solaris
AC_SUBST(LIBSOCKET)
AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
AC_SUBST(LIBUCB)

AC_PATH_X
AC_PATH_XTRA

GLTT_PATH_X

dnl Checks for libraries.

dnl Replace `main' with a function in -lm:
AC_CHECK_LIB(m, sin)
dnl Replace `main' with a function in -lX11:
AC_CHECK_LIB(X11, XOpenDisplay)
dnl Replace `main' with a function in -lXext:
AC_CHECK_LIB(Xext, XShmCreateImage)
dnl Replace `main' with a function in -lICE:
AC_CHECK_LIB(ICE, IceSetIOErrorHandler)
#dnl Replace `main' with a function in -lMesaGL:
#AC_CHECK_LIB(MesaGL, glEnd)
#dnl Replace `main' with a function in -lMesaGLU:
#AC_CHECK_LIB(MesaGLU, gluNewNurbsRenderer)
dnl Replace `main' with a function in -lSM:
AC_CHECK_LIB(SM, SmsSetErrorHandler)
dnl Replace `main' with a function in -lXt:
AC_CHECK_LIB(Xt, XtDisplay)
dnl Replace `main' with a function in -lXi:
AC_CHECK_LIB(Xi, XOpenDevice)
dnl Replace `main' with a function in -lXmu:
AC_CHECK_LIB(Xmu, XmuSimpleErrorHandler,,,-lXt)

dnl Replace `main' with a function in -lglut:
dnl AC_CHECK_LIB(glut, glutInit,,,$GL_INCLUDES $GL_LDFLAGS -l${GL_LIBNAME}GL -l${GL_LIBNAME}GLU $LIBSOCKET)

AC_HAVE_GL

AC_PATH_GLUT

#dnl Replace `main' with a function in -lttf:
#AC_CHECK_LIB(ttf, TT_Init_FreeType,,,$GLLIB $GLULIB $LIBSOCKET)

dnl output files
topdir=`pwd`
AC_SUBST(topdir)

AC_OUTPUT(Makefile)
