dnl dnl Celestia autoconf file dnl Process this file with autoconf to make a configure script dnl AC_INIT(configure.in) dnl For KDE interface AC_CONFIG_AUX_DIR(admin) AM_INIT_AUTOMAKE(celestia, 1.2.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_LIBTOOL_DLOPEN AC_PROG_LIBTOOL dnl 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([whether 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([whether 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([whether 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 Use Gtk if requested GTK_LIBS="" GTKGL_LIBS="" GTK_CFLAGS="" AC_MSG_CHECKING([whether to disable GTK.]) AC_ARG_WITH(gtk, [ --with-gtk Use Gtk for an enhanced GUI], enable_gtk="$withval";enable_gtk_by_default="no", enable_gtk="yes";enable_gtk_by_default="yes") AC_ARG_WITH(kde, [ --with-kde Use KDE for an enhanced GUI], enable_kde="$withval";enable_kde_by_default="no", enable_kde="yes";enable_kde_by_default="yes") dnl disables the one that was not explicitly enabled. dnl enables gtk by default if test "$enable_kde_by_default" == "yes" -a "$enable_gtk" == "yes" ; then enable_kde="no" enable_kde_by_default="no" else if test "$enable_gtk_by_default" == "yes" -a "$enable_kde" == "yes" ; then enable_gtk="no" enable_gtk_by_default="no" fi fi dnl dnl GTK dnl if test "$enable_gtk" == "yes" ; then enable_kde="no" AC_MSG_RESULT(no, so try to find GTK) AM_PATH_GTK(1.2.0,enable_gtk="yes",enable_gtk="no") dnl Complain only if the user insisted we do GTK if test "$enable_gtk_by_default" == "no" -a "$enable_gtk" == "no"; then AC_MSG_ERROR(Unable to find GTK) fi else AC_MSG_RESULT(yes) fi if test "$enable_gtk" == "yes" ; then OLD_LIBS="$LIBS" LIBS="$LIBS $GTK_LIBS -lGL" AC_CHECK_LIB(gtkgl,gdk_gl_query,,enable_gtk="no") dnl Complain only if the user insisted we do GTK if test "$enable_gtk_by_default" == "no" -a "$enable_gtk" == "no"; then AC_MSG_ERROR(Unable to find gtkglarea) fi fi if test "$enable_gtk" == "yes" ; then LIBS="$OLD_LIBS" GNOME_INIT GNOME_COMPILE_WARNINGS GNOME_X_CHECKS GTKGL_LIBS=-lgtkgl else if test "$enable_gtk_by_default" == "yes" ; then AC_MSG_WARN(Disabled GTK GUI because of missing necessary packages) fi 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") dnl dnl KDE dnl if test "$enable_kde" == "yes" ; then dnl KDE_SET_PREFIX AC_CHECK_COMPILERS AC_ENABLE_SHARED(yes) AC_ENABLE_STATIC(no) KDE_PROG_LIBTOOL dnl AM_KDE_WITH_NLS KDE_USE_QT(3) AC_PATH_KDE fi AM_CONDITIONAL(ENABLE_KDE, test "$enable_kde" == "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 OpenGL headers first. AC_CHECK_HEADERS(GL/gl.h,,AC_MSG_ERROR([[No gl.h found. See INSTALL file for ddetails about how to correct this problem.]])) 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 dnl Check for GLU headers. AC_CHECK_HEADERS(GL/glu.h,,AC_MSG_ERROR([[No glu.h found. See INSTALL file for details on how to correct this problem.]])) 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 headers first. AC_CHECK_HEADERS(GL/glut.h,,AC_MSG_ERROR([[No glut.h found. See INSTALL file for details on correcting this problem.]])) dnl Check for GLUT. AC_CHECK_LIB(glut, glutKeyboardUpFunc,, AC_MSG_ERROR(GLUT library version >= 3.7 not found)) 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 if test "$enable_kde" == "yes" ; then PKGDATADIR=`eval echo "${kde_datadir}/$PACKAGE"` datadir=${kde_datadir} else PKGDATADIR=`eval echo "${datadir}/$PACKAGE"` fi AC_SUBST(PKGDATADIR) 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([whether 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 \ extras/Makefile \ textures/Makefile \ textures/lores/Makefile \ textures/medres/Makefile \ textures/hires/Makefile \ models/Makefile \ shaders/Makefile \ fonts/Makefile \ src/celestia/res/Makefile \ macros/Makefile \ manual/Makefile \ src/celestia/kde/Makefile \ src/celestia/kde/data/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()