celestia/configure.in

441 lines
12 KiB
Plaintext

dnl
dnl Celestia autoconf file
dnl Process this file with autoconf to make a configure script
dnl
AC_PREREQ(2.57)
AC_INIT([celestia], [1.4.0], [celestia-developers@lists.sf.net])
AC_CONFIG_SRCDIR(acinclude.m4)
dnl The following section confirms that the user provided necessary option
dnl BEFORE anything is checked.
AC_ARG_WITH([glut],
AC_HELP_STRING([--with-glut], [Use Glut for the UI]),
ui_glut="yes"; ui_gtk="no"; ui_gnome="no"; ui_kde="no",
ui_glut="no")
AC_ARG_WITH([gtk],
AC_HELP_STRING([--with-gtk], [Use Gtk for an enhanced GUI]),
ui_gtk="yes"; ui_glut="no"; ui_gnome="no"; ui_kde="no",
ui_gtk="no")
AC_ARG_WITH([gnome],
AC_HELP_STRING([--with-gnome], [Use Gnome for an enhanced GUI]),
ui_gnome="yes"; ui_gtk="yes"; ui_glut="no"; ui_kde="no",
ui_gnome="no")
AC_ARG_WITH([kde],
AC_HELP_STRING([--with-kde], [Use KDE for an enhanced GUI]),
ui_kde="yes"; ui_glut="no"; ui_gtk="no"; ui_gnome="no",
ui_kde="no")
dnl Following line left in: great for debugging.
dnl AC_MSG_ERROR([$ui_glut $ui_gtk $ui_gnome $ui_kde])
dnl Check that an interface was provided
if (test "$ui_glut" != "yes" -a "$ui_gtk" != "yes" -a "$ui_gnome" != "yes" -a "$ui_kde" != "yes"); then
AC_MSG_ERROR([You must select an interface to build.
Possible options are:
--with-glut GLUT front-end
--with-gtk Enhanced GTK GUI
--with-gnome GTK GUI with Gnome features
--with-kde Enhanced KDE GUI]);
fi
dnl For KDE interface
AC_CONFIG_AUX_DIR(admin)
dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
unset CDPATH
dnl Check system type
AC_CANONICAL_HOST
dnl Checking host/target/build systems, for make, install etc.
AC_CANONICAL_SYSTEM
dnl Perform program name transformation
AC_ARG_PROGRAM
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
AM_PO_SUBDIRS
AM_GNU_GETTEXT([external])
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"
AC_MSG_CHECKING([whether to include debugging code])
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--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, 1, [Are we debugging ?])
fi
AC_MSG_RESULT($enable_debug)
AC_MSG_CHECKING([whether to be pedantic])
AC_ARG_ENABLE([pedantic],
AC_HELP_STRING([--enable-pedantic],
[Enable -pedantic 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],
AC_HELP_STRING([--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],
AC_HELP_STRING([--with-gl-libs=DIR],
[Specify OpenGL library location]),
CELESTIALIBS="$CELESTIALIBS -L$withval")
AC_ARG_WITH([gl-inc],
AC_HELP_STRING([--with-gl-inc=DIR],
[Specify OpenGL header file location]),
CELESTIAFLAGS="$CELESTIAFLAGS -I$withval")
AC_ARG_WITH([glut-libs],
AC_HELP_STRING([--with-glut-libs=DIR],
[Specify GLUT library location]),
CELESTIALIBS="$CELESTIALIBS -L$withval")
AC_ARG_WITH([glut-inc],
AC_HELP_STRING([--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 enable GLUT])
if (test "$ui_glut" != "no"); then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([whether to enable GTK])
if (test "$ui_gtk" != "no"); then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([whether to enable Gnome])
if (test "$ui_gnome" != "no"); then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([whether to enable KDE])
if (test "$ui_kde" != "no"); then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_CHECK_COMPILERS
AC_PATH_XTRA
CFLAGS="$CFLAGS $X_CFLAGS"
CFLAGS="$CFLAGS $CELESTIAFLAGS $CELESTIA_CFLAGS"
CXXFLAGS="$CXXFLAGS $CELESTIAFLAGS $CELESTIA_CXXFLAGS"
LIBS="$LIBS $CELESTIALIBS"
LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lXmu -lXi -lXext -lX11 -lm -lz $X_EXTRA_LIBS"
dnl Check for zlib -- libGL requires it.
AC_CHECK_LIB(z, deflate, ,
[AC_MSG_ERROR([zlib not found.])])
dnl Check for OpenGL headers first.
AC_CHECK_HEADERS(GL/gl.h, ,
[AC_MSG_ERROR([No gl.h found. See INSTALL file for help.])])
LIBS="$LIBS -lGL"
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 help.])])
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
if ("$ui_glut" = "yes"); then
dnl Check for GLUT headers first.
AC_CHECK_HEADERS(GL/glut.h, ,
[AC_MSG_ERROR([No glut.h found. See INSTALL file for help.])])
dnl Check for GLUT.
AC_CHECK_LIB(glut, glutKeyboardUpFunc, ,
[AC_MSG_ERROR([GLUT library version >= 3.7 not found])])
fi
AM_CONDITIONAL(ENABLE_GLUT, test "$ui_glut" = "yes")
dnl Default GConf to FALSE
dnl (this is a silly trick to make configure behave)
AM_CONDITIONAL(GCONF_SCHEMAS_INSTALL, test "x" = "y")
if (test "$ui_gtk" != "no"); then
dnl GNOME is an extension to the GTK options
if (test "$ui_gnome" = "yes"); then
PKG_CHECK_MODULES(GTK, libgnomeui-2.0 gtk+-2.0 >= 2.6 gtkglext-1.0)
AM_GCONF_SOURCE_2
AC_DEFINE(GNOME, 1, [Use Gnome Flag])
else
dnl Otherwise, vanilla GTK
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6 gtkglext-1.0)
fi
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
CFLAGS="$CFLAGS $GTK_CFLAGS"
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
fi
dnl If all the GTK tests succeeded, safe to enable GTK
AM_CONDITIONAL(ENABLE_GTK, test "$ui_gtk" = "yes")
AM_CONDITIONAL(ENABLE_GNOME, test "$ui_gnome" = "yes")
dnl
dnl KDE
dnl
dnl Make certain ARTS is not conditionally defined, like GConf for Gnome
AM_CONDITIONAL(include_ARTS, test "x" = "y")
if (test "$ui_kde" != "no"); then
dnl KDE_SET_PREFIX
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
KDE_PROG_LIBTOOL
AM_KDE_WITH_NLS
dnl KDE_USE_QT(3)
AC_PATH_KDE
fi
AM_CONDITIONAL(ENABLE_KDE, test "$ui_kde" = "yes")
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(byteswap.h)
AC_C_BIGENDIAN
if (test "$prefix" = "NONE"); then
prefix=$ac_default_prefix
fi
PKGDATADIR=`eval echo "${datadir}/$PACKAGE"`
AC_SUBST(PKGDATADIR)
AC_DEFINE_UNQUOTED(CONFIG_DATA_DIR, "$PKGDATADIR",
[The directory where our data will be installed])
AC_DEFINE_UNQUOTED(GNOMELOCALEDIR, "$PKGDATADIR/locale",
[Locale Directory for Gnome (Currently unused])
enable_hipparcos="no"
AC_ARG_ENABLE([hipparcos-dir],
AC_HELP_STRING([--enable-hipparcos-dir=DIR],
[Specify location of HIPPARCOS/TYCHO stardata]),
HIPDIR="$enableval",HIPDIR="$PKGDATADIR")
AC_DEFINE_UNQUOTED(HIP_DATA_DIR, "$HIPDIR",
[The directory where the HIPPARCOS/TYCHO data resides])
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_ARG_WITH([lua],
AC_HELP_STRING([--with-lua[=DIR]],
[Use Lua for Celestia Extension Language support]),
enable_lua="$withval",
enable_lua="no")
AC_ARG_WITH([lua-inc],
AC_HELP_STRING([--with-lua-includes[=DIR]],
[Specify location of Lua headers]),
lua_includes="$withval",
lua_includes="no")
AC_ARG_WITH([lua-lib],
AC_HELP_STRING([--with-lua-libs[=DIR]],
[Specify location of Lua libs]),
lua_libs="$withval",
lua_libs="no")
AC_MSG_CHECKING([whether to enable Celestia Extension Language])
if (test "$enable_lua" != "no"); then
CXXFLAGS="$CXXFLAGS -DCELX"
LDFLAGS="$LDFLAGS -llualib -llua"
if (test "$lua_includes" != "no"); then
CXXFLAGS="$CXXFLAGS -I$lua_includes"
fi
if (test "$lua_libs" != "no"); then
LIBS="$LIBS -L$lua_libs"
fi
AC_MSG_RESULT(yes)
if (test "$enable_lua" != "yes"); then
CXXFLAGS="$CXXFLAGS -I$enable_lua/include"
LIBS="$LIBS -L$enable_lua/lib"
fi
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(ENABLE_CELX, test "$enable_lua" != "no")
AC_CONFIG_FILES([ Makefile ])
AC_CONFIG_FILES([ src/Makefile ])
AC_CONFIG_FILES([ src/celutil/Makefile ])
AC_CONFIG_FILES([ src/celmath/Makefile ])
AC_CONFIG_FILES([ src/cel3ds/Makefile ])
AC_CONFIG_FILES([ src/celtxf/Makefile ])
AC_CONFIG_FILES([ src/celengine/Makefile ])
AC_CONFIG_FILES([ src/celestia/Makefile ])
AC_CONFIG_FILES([ data/Makefile ])
AC_CONFIG_FILES([ extras/Makefile ])
AC_CONFIG_FILES([ textures/Makefile ])
AC_CONFIG_FILES([ textures/lores/Makefile ])
AC_CONFIG_FILES([ textures/medres/Makefile ])
AC_CONFIG_FILES([ textures/hires/Makefile ])
AC_CONFIG_FILES([ models/Makefile ])
AC_CONFIG_FILES([ shaders/Makefile ])
AC_CONFIG_FILES([ fonts/Makefile ])
AC_CONFIG_FILES([ src/celestia/res/Makefile ])
AC_CONFIG_FILES([ manual/Makefile ])
AC_CONFIG_FILES([ src/celestia/kde/Makefile ])
AC_CONFIG_FILES([ src/celestia/kde/data/Makefile ])
AC_CONFIG_FILES([ src/celestia/kde/doc/Makefile ])
AC_CONFIG_FILES([ src/celestia/kde/doc/celestia/Makefile ])
AC_CONFIG_FILES([ src/celestia/gtk/Makefile ])
AC_CONFIG_FILES([ src/celestia/gtk/data/Makefile ])
AC_CONFIG_FILES([ po/Makefile.in ])
AC_OUTPUT()
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()
if (test "$ui_glut" = "yes"); then
AC_MSG_RESULT([Front-End: GLUT]);
fi
if (test "$ui_gtk" = "yes" -a "$ui_gnome" = "no"); then
AC_MSG_RESULT([Front-End: GTK]);
fi
if (test "$ui_gnome" = "yes"); then
AC_MSG_RESULT([Front-End: Gnome]);
fi
if (test "$ui_kde" = "yes"); then
AC_MSG_RESULT([Front-End: KDE]);
fi
AC_MSG_RESULT()