dnl Process this file with autoconf to produce a configure script. dnl deprecated form dnl AC_INIT(crossfire-client.spec) AC_INIT(crossfire-client, 1.8.0) AC_CONFIG_SRCDIR(crossfire-client.spec) AC_CONFIG_AUX_DIR(utils/) AC_CONFIG_SRCDIR(crossfire-client.spec) AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE AM_CONFIG_HEADER(common/config.h) dnl AM_ACLOCAL_INCLUDE(macros) dnl these are subdirectories that have make files in them CF_SUBDIRS="common x11" dnl Check for some neeed programs AC_PATH_PROG(MKDIR, mkdir) AC_PATH_PROG(TAR, tar) AC_PATH_PROG(DEPEND, makedepend) AC_PATH_PROG(CP, cp) AC_PATH_PROG(RM, rm) AC_PATH_PROG(PERL, perl) AC_PATH_PROG(AR, ar) dnl for gtk-v2 client pkg_modules="gtk+-2.0 >= 2.0.0" PKG_CHECK_MODULES(PACKAGE, [$pkg_modules], CF_SUBDIRS="$CF_SUBDIRS gtk-v2", AC_MSG_WARN(GTK v2 libraries not found - will not build gtkv2 client) ) AM_MAINTAINER_MODE AC_SUBST(PACKAGE_LIBS) AC_SUBST(INTLLIBS) AC_CHECK_LIB(glut, main, OPENGL_LIBS="-lglut") AC_SUBST(OPENGL_LIBS) if eval "test x$OPENGL_LIBS != x"; then AC_DEFINE(HAVE_OPENGL) fi dnl end of gtk-v2 stuff SOUNDDIR="${datadir}/crossfire-client/sounds" dnl Add some options to 'configure'. AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]], if eval "test x$enable_debug = xyes"; then DEBUGFLAG="-g" fi) AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]], , enable_ansi=$enableval) AC_ARG_ENABLE(sound, [ --disable-sound disable sound support [default=implement sound support if supported libraries exist]], sound=$enableval, sound=yes ) dnl These are because some of us use OSS sound, even with ALSA or ALSA9 libs installed AC_ARG_ENABLE(alsa9, [ --disable-alsa9 disable ALSA9 sound support [default=use alsa9 sound support if alsa9 libraries exist]], alsa9=$enableval, alsa9=yes ) AC_ARG_ENABLE(alsa, [ --disable-alsa disable ALSA sound support [default=use alsa sound support if alsa libraries exist]], alsa=$enableval, alsa=yes ) AC_ARG_WITH(sound-dir, [ --with-sound-dir=dir Directory where the sounds are located (default=/usr/local/lib/sounds) ], SOUNDDIR="$withval") dnl The follow two are really just a way to specify where the xpm information dnl resides if not with the normal X11 stuff (ie, in /usr/local and not /usr dnl /usr/X11 AC_ARG_WITH(ldflags, [ --with-ldflags=dir provide addition linker directives to find libraries ], EXTRA_LIB="$withval") AC_ARG_WITH(includes, [ --with-includes=dir provide different compiler options to find headers with ], EXTRA_INC="$withval") AC_ARG_ENABLE(gtk, [ --disable-gtk make x11 client [default=make gtk client if available]], gtk=$enableval, gtk=yes ) AC_ARG_ENABLE(sdl, [ --disable-sdl Disable linking with the SDL library, default is to use it if available ], use_sdl=$enableval, use_sdl=yes) AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc Enable checking for dmalloc library, default is to use it if available ], use_dmalloc=$enableval, use_dmalloc=no) AC_PROG_CC AC_C_BIGENDIAN networklibs="yes" case "$target" in alpha-dec-osf*) # If we are not using gcc, we want the ansi version of cc. if test -z "$GCC"; then # CFLAGS="$CFLAGS -std1 -warnprotos" # Not yet ready for warnprotos... CFLAGS="$CFLAGS -std1" fi ;; dnl SGI systems don't need -lnsl -lsocket mips*-sgi-irix*) networklibs="no" ;; dnl linux systems don't appear to need -lnsl *-linux-*) networklibs="no" ;; *-*-solaris2*) need_r_flag="yes" ;; *) ;; esac dnl Checks for programs. AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_CPP AC_PROG_RANLIB dnl Check for GTK >= 1.0.0. dnl The XLib client (without GTK) should use AC_PATH_X instead of this. dnl Simple hack - if we want standard x11 client, don't check for the gtk dnl libraries. Then we fall through below if eval "test x$gtk = xyes"; then AM_PATH_GTK(1.0.0,CFGTK="yes",CFGTK="no") fi AC_SUBST(CFGTK) AC_PATH_XTRA if eval "test x$CFGTK = xyes"; then AC_MSG_RESULT(GTK found - building both gtk and x11 client) GTK_LIBS=$GTK_LIBS GTK_CFLAGS="$GTK_CFLAGS" AC_SUBST(GTK_LIBS) AC_SUBST(GTK_CFLAGS) CF_SUBDIRS="$CF_SUBDIRS gtk" dnl AC_DEFINE(GTK_CLIENT) else AC_MSG_RESULT(GTK not found - building xlib client) fi dnl common to everything X_LIBS="$X_LIBS -lX11" AC_SUBST(X_LIBS) AC_SUBST(X_CFLAGS) echo Xlibs: $X_LIBS echo Extras: $X_EXTRA_LIBS echo Xpre: $X_PRE_LIBS CPPFLAGS="$CPPFLAGS $EXTRA_INC" LDFLAGS="$LDFLAGS $EXTRA_LIB" if eval "test x$need_r_flag = xyes"; then LDFLAGS="$LDFLAGS" fi if eval "test x$sound = xyes"; then if eval "test x$alsa = xyes"; then AC_CHECK_LIB(asound, main, alsa_sound=yes, , -lm) fi AC_CHECK_LIB(audio, alNewConfig, sgi_sound=yes, ) if eval "test x$alsa9 = xyes"; then AC_CHECK_HEADER(alsa/asoundlib.h, alsa9_sound=yes, alsa_sound=no) fi AC_CHECK_HEADER(sys/soundcard.h, oss_sound=yes, oss_sound=no) AC_CHECK_HEADER(sys/audioio.h, sun_sound=yes, sun_sound=no) dnl alsa9 sound support is now independent of other sound systems, dnl so don't preclude compilation of others just because dnl we find it. if eval "test x$alsa9_sound = xyes"; then echo "Using ALSA sound system (0.9.x)" CFLAGS="$CFLAGS -DALSA9_SOUND" SOUND_TARGETS="$SOUND_TARGETS cfsndserv-alsa9" ALSA9_LIBS="-lasound -lm" SOUND_SRC="sound-src"; dnl It appears that alsa9 sound while having the same headers, is dnl not backwards compatible, so if you have alsa 0.9 or later, you dnl can't compile the old old sound daemon, so if we find alsa9, dnl disable old alsa. alsa_sound="no"; fi if eval "test x$alsa_sound = xyes"; then echo "Using ALSA sound system" CFLAGS="$CFLAGS -DALSA_SOUND" SND_LIBS="-lasound -lm" SOUND_SRC="sound-src"; else if eval "test x$sgi_sound = xyes"; then echo "Using SGI sound system" CFLAGS="$CFLAGS -DSGI_SOUND" SND_LIBS="-laudio" SOUND_SRC="sound-src"; else if eval "test x$oss_sound = xyes"; then echo "Using OSS sound system" CFLAGS="$CFLAGS -DOSS_SOUND" SND_LIBS="-lm" AC_CHECK_LIB(ossaudio, main, SND_LIBS="$LIBS -lossaudio") SOUND_SRC="sound-src"; else if eval "test x$sun_sound = xyes"; then echo "Using solaris sound system" CFLAGS="$CFLAGS -DSUN_SOUND" SND_LIBS="-lm" SOUND_SRC="sound-src"; else echo "No suitable sound system found." fi fi fi fi # this fi is for the sound == yes check above fi dnl basically, only want to put sound-src once in the dnl subdirs listing. if eval "test x$SOUND_SRC != x"; then CF_SUBDIRS="$CF_SUBDIRS $SOUND_SRC"; fi dnl AC_PATH_PROG(GNOMECONFIG, gnome-config) dnl dnl if test -z "$GNOMECONFIG" ; then dnl gnome=no dnl echo "Can't find gnome-config, not building Gnome client." dnl fi dnl dnl if eval "test x$gnome = xyes"; then dnl GNOME_INIT dnl GNOME_COMPILE_WARNINGS dnl GNOME_X_CHECKS dnl AM_PATH_GDK_PIXBUF(0.11.0, , echo "gdk-pixbuf 0.11.0 or higher is needed for the Gnome client so I'm not building it." ; gnome=no) dnl if eval "test x$gnome = xyes"; then dnl CF_SUBDIRS="$CF_SUBDIRS gnome" dnl fi dnl fi AC_SUBST(GUI_OBJS) AC_SUBST(GUI_SRCS) AC_SUBST(SND_LIBS) AC_SUBST(LDFLAGS) AC_SUBST(TARGET) AC_SUBST(CF_SUBDIRS) AC_SUBST(SOUND_TARGETS) AC_SUBST(ALSA9_LIBS) dnl Check for SDL 1.1.3 and sdl_image dnl note SDL_image does not ship with an sdl-image-config dnl so I'll just assume it is in the same dir as SDL if eval "test x$use_sdl = xyes"; then AM_PATH_SDL(1.1.3) if eval "test x$no_sdl = x"; then AC_CHECK_LIB( SDL_image, IMG_LoadPNG_RW, have_sdlimage="yes", have_sdlimage="no", $SDL_CFLAGS) if eval "test x$have_sdlimage = xyes"; then SDL_LIBS="$SDL_LIBS -lSDL_image" fi fi if eval "test x$no_sdl = x"; then AC_DEFINE(HAVE_SDL) fi fi AC_SUBST(SDL_CFLAGS) AC_SUBST(SDL_LIBS) dnl The following hacks for modifying CFLAGS were borrowed from the GIMP. if test -n "$DEBUGFLAG"; then CFLAGS="$DEBUGFLAG $CFLAGS" fi if eval "test x$GCC = xyes"; then if echo "$CFLAGS" | grep "\-Wall" > /dev/null 2> /dev/null; then CFLAGS="$CFLAGS" else CFLAGS="$CFLAGS -Wall" fi if eval "test x$enable_ansi = xyes"; then if echo "$CFLAGS" | grep "\-ansi" > /dev/null 2> /dev/null; then CFLAGS="$CFLAGS" else CFLAGS="$CFLAGS -ansi" fi if echo "$CFLAGS" | grep "\-pedantic" > /dev/null 2> /dev/null; then CFLAGS="$CFLAGS" else CFLAGS="$CFLAGS -pedantic" fi fi fi dnl We need to check for socket/nsl here - some versions of the windowing dnl systems need these to properly link with X (I though AC_PATH_XTRA should dnl take care of this, but apparantly is doesnt). IF it isn't here, dnl the check for xpm fails, and configure quits. if eval "test x$networklibs = xyes"; then AC_CHECK_LIB(nsl, main, LIBS="$LIBS -lnsl") AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket") fi dnl Save and modify CPPFLAGS and LIBS (to include X and GTK paths temporarily). gcfc_save_CPPFLAGS="$CPPFLAGS" gcfc_save_LIBS="$LIBS" CPPFLAGS="$GTK_CFLAGS $CPPFLAGS $X_CFLAGS $EXTRA_INC" LIBS="$LIBS $GTK_LIBS $X_LIBS" dnl Put this here so we get the gdk libs dnl AC_CHECK_LIB(gdk_imlib, main,GTK_LIBS="$GTK_LIBS -lgdk_imlib") dnl Need to check for Xext while we still have X_LIBS set. AC_CHECK_LIB(Xext, main, X_LIBS="$X_LIBS -lXext") dnl AC_CHECK_LIB(Imlib, main, X_LIBS="$X_LIBS -lImlib") dnl Restore previous CPPFLAGS and LIBS. CPPFLAGS="$gcfc_save_CPPFLAGS" LIBS="$gcfc_save_LIBS" AC_SUBST(LIBS) dnl sound.c needs sqrt. So does png (on some systems) AC_CHECK_LIB(m, sqrt) dnl png on some systems need the zlib, so check for it AC_CHECK_LIB(z, main) AC_CHECK_LIB(png, main, , [AC_MSG_ERROR([You must have the png library installed to compile the client])]) dnl not strictly needed, but since the X11 client uses it, lets use it here dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h string.h sys/select.h) if eval "test x$use_dmalloc = xyes"; then AC_CHECK_LIB(dmalloc, main, DMALLOC_LIB="-ldmalloc") AC_SUBST(DMALLOC_LIB) AC_CHECK_HEADERS(dmalloc.h) fi dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_HEADER_TIME AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_FUNC_VPRINTF AC_CHECK_FUNCS(mkdir socket strcspn sysconf) AC_SUBST(XPM) AC_SUBST(SOUNDDIR) AC_SUBST(LIBXPM_LIB) dnl we need to run evals on the original variable names so that dnl they get expanded to the actual path - otherwise, the substitution dnl below will contain the unexpanded variables that don't resolve. test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' ndatadir=`eval echo ${datadir}` dnl need to do this twice to cover variables within variables nbindir=`eval echo ${bindir}` nbindir=`eval echo ${nbindir}` AC_DEFINE_UNQUOTED(DATADIR, "${ndatadir}/crossfire-client") AC_DEFINE_UNQUOTED(BINDIR, "${nbindir}") AC_SUBST(DATADIR) dnl Make all makefiles, even if CF_SUBDIRS are not set for that directory. dnl since CF_SUBDIRS won't be set in the top level makefile, we don't dnl descend into these subdirs. AC_OUTPUT([ Makefile gtk/Makefile x11/Makefile common/Makefile sound-src/Makefile gtk-v2/Makefile gtk-v2/src/Makefile ] )