celestia/configure.in

237 lines
6.7 KiB
Plaintext

dnl
dnl Celestia autoconf file
dnl Process this file with autoconf to make a configure script
dnl
AC_INIT(configure.in)
AM_INIT_AUTOMAKE(celestia, 1.1.5)
AM_CONFIG_HEADER(config.h)
AM_ACLOCAL_INCLUDE(macros)
dnl Check system type
AC_CANONICAL_HOST
dnl Check for compilers. Set CFLAGS and CXXFLAGS to null if unset, so
dnl that these macros won't set the to default values that we don't want.
if test "x${CFLAGS-notset}" = "xnotset" ; then
export CFLAGS
CFLAGS=""
fi
AC_PROG_CC
if test "x${CXXFLAGS-notset}" = "xnotset" ; then
export CXXFLAGS
CXXFLAGS=""
fi
AC_PROG_CXX
dnl Checks for programs.
AC_PROG_CPP
AC_PROG_CXXCPP
AC_PROG_INSTALL
AC_PROG_RANLIB
dnl
dnl Compilation options
dnl
CELESTIA_CPPFLAGS=""
CELESTIA_CFLAGS="-O2 -Wall -ffast-math -fexpensive-optimizations"
CELESTIA_CXXFLAGS="-O2 -Wall -ffast-math -fexpensive-optimizations"
dnl CELESTIA_CFLAGS="-O2 -g -Wall"
dnl CELESTIA_CXXFLAGS="-O2 -g -Wall"
dnl case "$host" in
dnl i*86-*-*) CELESTIA_CFLAGS="$CELESTIA_CFLAGS -malign-loops=2 -malign-jumps=2 -malign-functions=2";
dnl CELESTIA_CXXFLAGS="$CELESTIA_CXXFLAGS -malign-loops=2 -malign-jumps=2 -malign-functions=2";;
dnl alpha*-*-linux-*) CELESTIA_CFLAGS="$CELESTIA_CFLAGS -mieee";;
dnl esac
AC_MSG_CHECKING([wether to include debugging code])
AC_ARG_ENABLE(debug, [ --enable-debug Produce an executable with debugging symbols], , enable_debug="no")
if test "$enable_debug" == "yes" ; then
CELESTIA_CFLAGS="-g -Wall"; CELESTIA_CXXFLAGS="-g -Wall"
AC_DEFINE(DEBUG)
fi
AC_MSG_RESULT($enable_debug)
AC_MSG_CHECKING([wether to be pedantic])
AC_ARG_ENABLE(pedantic, [ --enable-pedantic Enable -pedantic (and -ansi for C) when compiling], , enable_pedantic="no")
if test "$enable_pedantic" == "yes" ; then
CELESTIA_CFLAGS="$CELESTIA_CFLAGS -ansi -pedantic"; CELESTIA_CXXFLAGS="$CELESTIA_CXXFLAGS -pedantic"
fi
AC_MSG_RESULT($enable_pedantic)
AC_MSG_CHECKING([wether to do profiling])
AC_ARG_ENABLE(profile,[ --enable-profile Produce a profiled executable[default=no]], , enable_profile="no")
if test "$enable_profile" == "yes" ; then
CELESTIA_CFLAGS="$CELESTIA_CFLAGS -pg"; CELESTIA_CXXFLAGS="$CELESTIA_CXXFLAGS -pg"
else
if test "$enable_debug" != "yes" ; then
dnl must be set here instead of above because -pg and
dnl -fomit-frame-pointer are incompatible
CELESTIA_CFLAGS="$CELESTIA_CFLAGS -fomit-frame-pointer"; CELESTIA_CXXFLAGS="$CELESTIA_CXXFLAGS -fomit-frame-pointer"
fi
fi
AC_MSG_RESULT($enable_profile)
dnl
dnl GL and GLUT libs
dnl
AC_ARG_WITH(
gl-libs,
[ --with-gl-libs=DIR Specify OpenGL library location],
CELESTIALIBS="$CELESTIALIBS -L$withval")
AC_ARG_WITH(
gl-inc,
[ --with-gl-inc=DIR Specify OpenGL header file location],
CELESTIAFLAGS="$CELESTIAFLAGS -I$withval")
AC_ARG_WITH(
glut-libs,
[ --with-glut-libs=DIR Specify GLUT library location],
CELESTIALIBS="$CELESTIALIBS -L$withval")
AC_ARG_WITH(
glut-inc,
[ --with-glut-inc=DIR Specify GLUT header file location],
CELESTIAFLAGS="$CELESTIAFLAGS -I$withval")
LIBS="$LIBS -lm"
dnl Check for OpenGL. Taken partly from the plib sources.
AC_CHECK_LIB(GL,glNewList)
if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
dnl Check for MesaGL.
AC_CHECK_LIB(MesaGL, glNewList,,
AC_MSG_ERROR(GL library was not found))
fi
AC_CHECK_LIB(GLU,gluLookAt)
if test "x$ac_cv_lib_GLU_gluLookAt" = "xno"; then
dnl Check for MesaGLU.
AC_CHECK_LIB(MesaGLU, gluLookAt,,
AC_MSG_ERROR(GLU library was not found))
fi
dnl Check for GLUT.
AC_CHECK_LIB(glut, glutKeyboardUpFunc,,
AC_MSG_ERROR(GLUT library version >= 3.7 not found))
dnl Use Gtk if requested
GTK_LIBS=""
GTKGL_LIBS=""
GTK_CFLAGS=""
AM_PATH_GTK(1.2.0,enable_gtk_default="yes",enable_gtk_default="no")
if test "$enable_gtk_default" == "yes" ; then
OLD_LIBS="$LIBS"
LIBS="$LIBS $GTK_LIBS -lGL"
AC_CHECK_LIB(gtkgl,gdk_gl_query,,enable_gtk_default="no")
LIBS="$OLD_LIBS"
fi
AC_MSG_CHECKING([wether to use GTK.])
AC_ARG_WITH(gtk, [ --with-gtk Use Gtk for an enhanced GUI],
enable_gtk="$withval", enable_gtk="$enable_gtk_default")
AC_MSG_RESULT($enable_gtk)
if test "$enable_gtk" == "yes" ; then
GNOME_INIT
GNOME_COMPILE_WARNINGS
GNOME_X_CHECKS
GTKGL_LIBS=-lgtkgl
else
dnl Check for X11.
AC_PATH_XTRA
LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lXmu -lXi -lXext -lX11 -lm $X_EXTRA_LIBS"
CFLAGS="$CFLAGS $X_CFLAGS"
fi
AM_CONDITIONAL(ENABLE_GTK, test "$enable_gtk" == "yes")
CFLAGS="$CFLAGS $CELESTIAFLAGS $CELESTIA_CFLAGS $GTK_CFLAGS $GNOME_CFLAGS"
CXXFLAGS="$CXXFLAGS $CELESTIAFLAGS $CELESTIA_CXXFLAGS $GTK_CFLAGS $GNOME_CFLAGS $GNOME_INCLUDEDIR"
LIBS="$LIBS $CELESTIALIBS $GTK_LIBS $GNOME_LIBS $GNOMEUI_LIBS $GTKGL_LIBS"
LDFLAGS="$LDFLAGS $GNOME_LIBDIR"
dnl Check for JPEG library.
AC_CHECK_LIB(jpeg, jpeg_start_decompress,,
AC_MSG_ERROR(jpeg library not found))
dnl Check for PNG library.
AC_CHECK_LIB(png, png_create_info_struct,,
AC_MSG_ERROR(png library not found))
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(GL/gl.h GL/glut.h)
# AC_DEFINE(TEXTURE_DIR,"textures")
# AC_DEFINE(FONT_DIR,"fonts")
# AC_DEFINE(MODEL_DIR,"models")
# AC_DEFINE(DATA_DIR,"data")
AC_CHECK_HEADERS(byteswap.h)
AC_C_BIGENDIAN
if test "$prefix" = "NONE" ; then
prefix=$ac_default_prefix
fi
PKGDATADIR=`eval echo "${datadir}/$PACKAGE"`
AC_DEFINE_UNQUOTED(CONFIG_DATA_DIR, "$PKGDATADIR")
AC_DEFINE_UNQUOTED(G_LOG_DOMAIN,"Celestia")
AC_DEFINE_UNQUOTED(GNOMELOCALEDIR,"$PKGDATADIR/locale")
enable_hipparcos="no"
AC_ARG_ENABLE(hipparcos-dir,
[ --enable-hipparcos-dir=DIR Specify location of HIPPARCOS/TYCHO stardata],
HIPDIR="$enableval",HIPDIR="$PKGDATADIR")
AC_DEFINE_UNQUOTED(HIP_DATA_DIR, "$HIPDIR")
AC_SUBST(HIPDIR)
AC_MSG_CHECKING([wether we can create a new star database])
if test -f "$HIPDIR/hip_main.dat" ; then
enable_hipparcos="yes"
fi
AC_MSG_RESULT($enable_hipparcos)
AM_CONDITIONAL(ENABLE_HIPPARCOS, test "x$enable_hipparcos" = "xyes")
AC_OUTPUT( Makefile \
src/Makefile \
src/celutil/Makefile \
src/celmath/Makefile \
src/cel3ds/Makefile \
src/celtxf/Makefile \
src/celengine/Makefile \
src/celestia/Makefile \
data/Makefile \
textures/Makefile \
models/Makefile \
shaders/Makefile \
fonts/Makefile \
src/celestia/res/Makefile \
macros/Makefile \
manual/Makefile \
)
AC_MSG_RESULT()
AC_MSG_RESULT()
AC_MSG_RESULT(********************************************************************)
AC_MSG_RESULT(*** Celestia configuration complete. Now do a 'make' followed ***)
AC_MSG_RESULT(*** by 'make install' ***)
AC_MSG_RESULT(********************************************************************)
AC_MSG_RESULT()
AC_MSG_RESULT()