Skip to content
Snippets Groups Projects
configure.in 6.5 KiB
Newer Older
teuben's avatar
teuben committed
dnl configuure.in file for "partiview"
dnl == Process this file with autoconf to produce a configure script ==
dnl ---------------------------------------------------------------------------------

AC_MSG_CHECKING([partiview])

AC_INIT(partibrains.c)

AC_CONFIG_HEADER(config.h)

dnl -- checks for programs
dnl -- checks for libraries
dnl -- checks for header files
dnl -- checks for typedefs
dnl -- checks for structures
dnl -- checks for compiler characteristics
dnl -- checks for library functions
dnl -- checks for system services


AC_HEADER_STDC
AC_CHECK_FUNCS(strchr memcpy)

AC_PROG_CPP
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_RANLIB

AC_ARG_PROGRAM



AC_ARG_ENABLE(debug, [  --enable-debug          compile for debugging], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
        CFLAGS="-g"
        LDFLAGS="-g"
        # should we define DEBUG too?
fi


AC_ARG_WITH(mesa, [  --with-mesa        force the use of Mesa instead of other graphics libs], with_mesa=$withval, with_mesa=maybe)

AC_ARG_WITH(cave, [  --enable-cave      compile for CAVE], with_cave=$enableval, with_cave=no)

dnl ---------------------------------------------------------------------
dnl             Check for basic X windows stuff
AC_PATH_X
AC_PATH_XTRA
CFLAGS="$CFLAGS $X_CFLAGS"
XLIBS="$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS"
AC_SUBST(XLIBS)


teuben's avatar
teuben committed
dnl ---------------------------------------------------------------------
dnl             Check for FLTK
AC_ARG_WITH(fltk, [ --with-fltk=<d>    find FLTK in -I<d>/include/FL -L<d>/lib ], with_fltk=$withval, with_fltk=/usr/local)

if test -n "$with_fltk" -a -d "$with_fltk"; then
	# maybe should test both $with_fltk and the include directory therein??
	if test -f "$with_fltk/include/FL/Fl.H"; then
	   FLTK_INC=-I$with_fltk/include
 	elif test -f "$with_fltk/FL/Fl.H"; then
	   FLTK_INC=-I$with_fltk
	else
	   AC_MSG_ERROR("Could not find FL/Fl.H for the fltk library")
	fi
	FLTK_LIB="-L$with_fltk/lib -lfltk"
else
	# assume the compile does -L/usr/local/lib (they don't do all....)
	FLTK_INC=-I/usr/local/include
	FLTK_LIB=-lfltk
	AC_CHECK_LIB(fltk, fl_display,
                :, AC_MSG_ERROR([couldn't find fltk library]))
fi

AC_SUBST(FLTK_INC)
AC_SUBST(FLTK_LIB)

teuben's avatar
teuben committed
dnl ---------------------------------------------------------------------
dnl 3D Graphics Libraries (see also vis5d's configure.in)

GLLIBS=""

# First, look for OpenGL or Mesa:
if test "$with_mesa" != "yes"; then
        AC_CHECK_LIB(GL, glBegin,
            AC_CHECK_LIB(GLU, gluProject, GLLIBS="-lGLU -lGL",
slevy's avatar
 
slevy committed
                         :, -lGL $XLIBS -lm), :, $XLIBS -lm)
teuben's avatar
teuben committed
fi
if test -z "$GLLIBS" -a "$with_mesa" != "no"; then
        AC_CHECK_LIB(MesaGL, glBegin,
            AC_CHECK_LIB(MesaGLU, gluProject, GLLIBS="-lMesaGLU -lMesaGL",
slevy's avatar
 
slevy committed
                         :, -lMesaGL $XLIBS -lm), :, $XLIBS -lm)
teuben's avatar
teuben committed
fi
if test "$with_mesa" = "yes"; then
        AC_CHECK_LIB(GL, glBegin,
            AC_CHECK_LIB(GLU, gluProject, GLLIBS="-lGLU -lGL",
slevy's avatar
 
slevy committed
                         :, -lGL $XLIBS -lm), :, $XLIBS -lm)
teuben's avatar
teuben committed
fi
if test -n "$GLLIBS"; then
        AC_DEFINE(HAVE_OPENGL)
else
        echo "couldn't find OpenGL libraries!"
        if test "$with_mesa" = "yes"; then
                AC_MSG_ERROR([couldn't find Mesa library])
        fi
fi

if test -z "$GLLIBS"; then
        echo "****************************************************"
        echo "You need to install a 3D graphics library, preferably"
        echo "the free OpenGL replacement, Mesa.  You can download"
        echo "Mesa from the Mesa home page:"
        echo "              http://www.mesa3d.org/"
        echo "and install it by running:"
        echo "       ./configure && make && su -c 'make install'"
        echo "in the Mesa directory."

        if test -r /sbin/ldconfig; then
                echo "You may also need to run /sbin/ldconfig as root"
                echo "to update the system after installing Mesa."
                if test -r /etc/ld.so.conf; then
                if test -z "`grep /usr/local/lib /etc/ld.so.conf`"; then
                echo "(First, add '/usr/local/lib' to /etc/ld.so.conf if"
                echo "you installed Mesa under /usr/local, the default.)"
                fi
                fi
        fi
        echo "****************************************************"
dnl        AC_MSG_ERROR([couldn't find 3D graphics library])
fi
AC_SUBST(GLLIBS)

dnl -- Check for any particular functions in the GL libs:
save_LIBS="$LIBS"
LIBS="$GLLIBS $XLIBS $LIBS"
AC_CHECK_FUNCS(XMesaGetBackBuffer)
LIBS="$save_LIBS"
  

dnl AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF))
dnl if test "$ac_cv_func_vprintf" != yes; then


dnl AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT))
dnl fi
dnl ---------------------------------------------------------------------


dnl Checks for libraries.

dnl Checks for header files.


AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sgtty.h strings.h sys/file.h sys/ioctl.h sys/time.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM

dnl Checks for library functions.
AC_TYPE_GETGROUPS
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_TYPE_SIGNAL
AC_FUNC_VFORK
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(ftime gethostname gettimeofday getwd mkdir select strdup strtod strtol strtoul)

AC_C_BIGENDIAN


teuben's avatar
teuben committed
dnl -- starlab stuff

AC_ARG_WITH(kira, [  --with-kira   force the use of KIRA], with_kira=$withval, with_kira=maybe)

AC_SUBST(KIRA_INC)
AC_SUBST(KIRA_LIB)
AC_SUBST(PV_FLAGS)

AC_SUBST(CC)
AC_SUBST(CXX)

starlab_path="$with_kira"
if test "$with_kira" = "maybe" -o "$with_kira" = "yes"; then
   if test -d "$STARLAB_PATH"; then
      starlab_path="$STARLAB_PATH"
   else
      echo No STARLAB_PATH found, KIRA support not selected
   fi
fi

if test -n "$starlab_path" -a -d "$starlab_path"; then
      echo "Configuring with starlab=$starlab_path" 
slevy's avatar
 
slevy committed
      KIRA_INC=-I$starlab_path/inc
teuben's avatar
teuben committed
      KIRA_LIB="-L$starlab_path/lib -ltdyn -ldyn -lnode -lstd"
      PV_FLAGS="$PV_FLAGS -DUSE_KIRA"
	# darn, we can't check in non-standard PATH's???? - next line won't work
dnl      AC_CHECK_LIB(tdyn, open_parti,:, AC_MSG_ERROR([could not find StarLab's tdyn library]))
else
   echo NOTE: No Starlab selected
fi

dnl -- test for NEMO

if test -f "$NEMOBIN/cc"; then
  echo "Warning, old \$NEMOBIN/cc present, it may conflict with your install"
teuben's avatar
teuben committed
fi


teuben's avatar
teuben committed
AC_OUTPUT(Makefile)

slevy's avatar
 
slevy committed
dnl ensure that "Makedepend" exists but don't put anything into it
dnl and force user to "make depend" to fill it in, since we're reconfiguring.

slevy's avatar
 
slevy committed
rm -f depended Makedepend
touch Makedepend