Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Autotools improvements #20

Merged
merged 3 commits into from

2 participants

@Flameeyes

Some not-too-smallish changes to configure.ac — the end result is a visibly faster run of ./configure.

Flameeyes added some commits
@Flameeyes Flameeyes build: fix out-of-tree build/installs.
When doing an out-of-tree install, gource.1 is not on the work
directory so make sure to use $(srcdir) there.
b3988fd
@Flameeyes Flameeyes build: use pkg-config to find dependencies.
pkg-config is friendlier to cross-compilation, and all these libraries
nowadays use it natively.

This also allows to drop the m4 files for freetype and sdl.
639c3f2
@Flameeyes Flameeyes build: use a single call to AC_CHECK_FUNCS.
This simplifies the configure with no difference in final output.
efd434a
@acaudwell acaudwell merged commit 4408db1 into acaudwell:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 4, 2013
  1. @Flameeyes

    build: fix out-of-tree build/installs.

    Flameeyes authored
    When doing an out-of-tree install, gource.1 is not on the work
    directory so make sure to use $(srcdir) there.
  2. @Flameeyes

    build: use pkg-config to find dependencies.

    Flameeyes authored
    pkg-config is friendlier to cross-compilation, and all these libraries
    nowadays use it natively.
    
    This also allows to drop the m4 files for freetype and sdl.
  3. @Flameeyes

    build: use a single call to AC_CHECK_FUNCS.

    Flameeyes authored
    This simplifies the configure with no difference in final output.
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 414 deletions.
  1. +2 −2 Makefile.am
  2. +9 −38 configure.ac
  3. +0 −193 m4/freetype2.m4
  4. +0 −181 m4/sdl.m4
View
4 Makefile.am
@@ -65,8 +65,8 @@ shadersdir = $(pkgdatadir)/shaders
dist_shaders_DATA = data/shaders/shadow.vert data/shaders/shadow.frag data/shaders/bloom.vert data/shaders/bloom.frag data/shaders/text.vert data/shaders/text.frag
install-data-hook:
- mkdir -p -m 755 ${DESTDIR}/$(mandir)/man1
- gzip -cf9 data/gource.1 > $(DESTDIR)$(mandir)/man1/gource.1.gz
+ $(MKDIR_P) $(DESTDIR)$(mandir)/man1
+ gzip -cf9 $(srcdir)/data/gource.1 > $(DESTDIR)$(mandir)/man1/gource.1.gz
uninstall-hook:
rm -f $(DESTDIR)$(mandir)/man1/gource.1.gz
View
47 configure.ac
@@ -14,11 +14,7 @@ AC_CANONICAL_HOST
AC_PROG_CXX
AC_LANG(C++)
-AC_CHECK_FUNC(timegm,AC_DEFINE(HAVE_TIMEGM))
-AC_SUBST(HAVE_TIMEGM)
-
-AC_CHECK_FUNC(unsetenv,AC_DEFINE(HAVE_UNSETENV))
-AC_SUBST(HAVE_UNSETENV)
+AC_CHECK_FUNCS([timegm unsetenv])
#Disable X11 on Macs unless required
AS_IF([test "$with_x" != yes], [
@@ -36,35 +32,16 @@ CXXFLAGS="$CXXFLAGS $GL_CFLAGS $GLU_CFLAGS"
CPPFLAGS="$CPPFLAGS $GL_CFLAGS $GLU_CFLAGS"
LIBS="$LIBS $GL_LIBS $GLU_LIBS"
-#SDL
-SDL_VERSION=1.2.10
-AM_PATH_SDL($SDL_VERSION,
- :,
- AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
-)
-CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
-CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
-LIBS="$LIBS $SDL_LIBS"
-
-#Freetype2
-AC_CHECK_FT2([9.0.3],[],[AC_MSG_ERROR([FreeType2 is required. Please see INSTALL])])
-CXXFLAGS="$CXXFLAGS $FT2_CFLAGS"
-CPPFLAGS="$CPPFLAGS $FT2_CFLAGS"
-LIBS="$LIBS $FT2_LIBS"
-
-#SDL_image library with PNG support
-AC_CHECK_LIB(SDL_image, IMG_LoadPNG_RW, LIBS="$LIBS", AC_MSG_ERROR([SDL_image with PNG support required. Please see INSTALL]))
+PKG_CHECK_MODULES([FT2], [freetype2 >= 9.0.3])
+PKG_CHECK_MODULES([PCRE], [libpcre])
+PKG_CHECK_MODULES([GLEW], [glew])
+PKG_CHECK_MODULES([SDL], [sdl >= 1.2.10 SDL_image])
-#SDL_image library with JPG support
-AC_CHECK_LIB(SDL_image, IMG_LoadJPG_RW, LIBS="$LIBS", AC_MSG_ERROR([SDL_image with JPG support required. Please see INSTALL]))
+CPPFLAGS="${CPPFLAGS} ${FT2_CFLAGS} ${PCRE_CFLAGS} ${GLEW_CFLAGS} ${SDL_CFLAGS}"
+LIBS="${LIBS} ${FT2_LIBS} ${PCRE_LIBS} ${GLEW_LIBS} ${SDL_LIBS}"
-LIBS="$LIBS -lSDL_image"
-
-#PCRE
-AC_CHECK_LIB([pcre], [pcre_compile],, AC_MSG_ERROR(PCRE is required. Please see INSTALL))
-
-#GLEW
-AC_CHECK_LIB(GLEW, glewInit, LIBS="$LIBS -lGLEW", AC_MSG_ERROR([GLEW is required. Please see INSTALL]))
+AC_CHECK_FUNCS([IMG_LoadPNG_RW], , AC_MSG_ERROR([SDL_image with PNG support required. Please see INSTALL]))
+AC_CHECK_FUNCS([IMG_LoadJPG_RW], , AC_MSG_ERROR([SDL_image with JPEG support required. Please see INSTALL]))
#BOOST
AX_BOOST_BASE([1.46], , AC_MSG_ERROR(Boost Filesystem >= 1.46 is required. Please see INSTALL))
@@ -77,12 +54,6 @@ LIBS="$LIBS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB"
#GLM
AC_CHECK_HEADER([glm/glm.hpp],, AC_MSG_ERROR(GLM headers are required. Please see INSTALL))
-#Check for required headers
-AC_CHECK_HEADER([SDL.h],, AC_MSG_ERROR(SDL headers are required. Please see INSTALL))
-AC_CHECK_HEADER([SDL_image.h],, AC_MSG_ERROR(SDL_image headers are required. Please see INSTALL))
-AC_CHECK_HEADER([pcre.h],, AC_MSG_ERROR(PCRE headers are required. Please see INSTALL))
-AC_CHECK_HEADER([GL/glew.h],, AC_MSG_ERROR(GLEW headers are required. Please see INSTALL))
-
#see if ttf-font-dir option is enabled
AC_ARG_ENABLE(ttf-font-dir,[AS_HELP_STRING([--enable-ttf-font-dir=DIR],[directory containing GNU FreeFont TTF fonts])],[gourcefontdir="$enableval"],[gourcefontdir=""])
AM_CONDITIONAL([FONTDIR], [test "x$gourcefontdir" != "x"])
View
193 m4/freetype2.m4
@@ -1,193 +0,0 @@
-# Configure paths for FreeType2
-# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
-#
-# Copyright 2001, 2003, 2007 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-#
-# As a special exception to the FreeType project license, this file may be
-# distributed as part of a program that contains a configuration script
-# generated by Autoconf, under the same distribution terms as the rest of
-# that program.
-#
-# serial 2
-
-# AC_CHECK_FT2([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
-# Test for FreeType 2, and define FT2_CFLAGS and FT2_LIBS.
-# MINIMUM-VERSION is what libtool reports; the default is `7.0.1' (this is
-# FreeType 2.0.4).
-#
-AC_DEFUN([AC_CHECK_FT2],
- [# Get the cflags and libraries from the freetype-config script
- #
- AC_ARG_WITH([ft-prefix],
- dnl don't quote AS_HELP_STRING!
- AS_HELP_STRING([--with-ft-prefix=PREFIX],
- [Prefix where FreeType is installed (optional)]),
- [ft_config_prefix="$withval"],
- [ft_config_prefix=""])
-
- AC_ARG_WITH([ft-exec-prefix],
- dnl don't quote AS_HELP_STRING!
- AS_HELP_STRING([--with-ft-exec-prefix=PREFIX],
- [Exec prefix where FreeType is installed (optional)]),
- [ft_config_exec_prefix="$withval"],
- [ft_config_exec_prefix=""])
-
- AC_ARG_ENABLE([freetypetest],
- dnl don't quote AS_HELP_STRING!
- AS_HELP_STRING([--disable-freetypetest],
- [Do not try to compile and run a test FreeType program]),
- [],
- [enable_fttest=yes])
-
- if test x$ft_config_exec_prefix != x ; then
- ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
- if test x${FT2_CONFIG+set} != xset ; then
- FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
- fi
- fi
-
- if test x$ft_config_prefix != x ; then
- ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
- if test x${FT2_CONFIG+set} != xset ; then
- FT2_CONFIG=$ft_config_prefix/bin/freetype-config
- fi
- fi
-
- AC_PATH_PROG([FT2_CONFIG], [freetype-config], [no])
-
- min_ft_version=m4_if([$1], [], [7.0.1], [$1])
- AC_MSG_CHECKING([for FreeType -- version >= $min_ft_version])
- no_ft=""
- if test "$FT2_CONFIG" = "no" ; then
- no_ft=yes
- else
- FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
- FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
- ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
- ft_min_major_version=`echo $min_ft_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- ft_min_minor_version=`echo $min_ft_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- ft_min_micro_version=`echo $min_ft_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
- if test x$enable_fttest = xyes ; then
- ft_config_is_lt=""
- if test $ft_config_major_version -lt $ft_min_major_version ; then
- ft_config_is_lt=yes
- else
- if test $ft_config_major_version -eq $ft_min_major_version ; then
- if test $ft_config_minor_version -lt $ft_min_minor_version ; then
- ft_config_is_lt=yes
- else
- if test $ft_config_minor_version -eq $ft_min_minor_version ; then
- if test $ft_config_micro_version -lt $ft_min_micro_version ; then
- ft_config_is_lt=yes
- fi
- fi
- fi
- fi
- fi
- if test x$ft_config_is_lt = xyes ; then
- no_ft=yes
- else
- ac_save_CPPFLAGS="$CPPFLAGS"
- ac_save_LIBS="$LIBS"
- CPPFLAGS="$CPPFLAGS $FT2_CFLAGS"
- LIBS="$FT2_LIBS $LIBS"
-
- #
- # Sanity checks for the results of freetype-config to some extent.
- #
- AC_RUN_IFELSE([
- AC_LANG_SOURCE([[
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include <stdio.h>
-#include <stdlib.h>
-
-int
-main()
-{
- FT_Library library;
- FT_Error error;
-
- error = FT_Init_FreeType(&library);
-
- if (error)
- return 1;
- else
- {
- FT_Done_FreeType(library);
- return 0;
- }
-}
-
- ]])
- ],
- [],
- [no_ft=yes],
- [echo $ECHO_N "cross compiling; assuming OK... $ECHO_C"])
-
- CPPFLAGS="$ac_save_CPPFLAGS"
- LIBS="$ac_save_LIBS"
- fi # test $ft_config_version -lt $ft_min_version
- fi # test x$enable_fttest = xyes
- fi # test "$FT2_CONFIG" = "no"
-
- if test x$no_ft = x ; then
- AC_MSG_RESULT([yes])
- m4_if([$2], [], [:], [$2])
- else
- AC_MSG_RESULT([no])
- if test "$FT2_CONFIG" = "no" ; then
-# AC_MSG_WARN([
-
-# The freetype-config script installed by FreeType 2 could not be found.
-# If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in
-# your path, or set the FT2_CONFIG environment variable to the
-# full path to freetype-config.
-# ])
- :
- else
- if test x$ft_config_is_lt = xyes ; then
- AC_MSG_WARN([
-
- Your installed version of the FreeType 2 library is too old.
- If you have different versions of FreeType 2, make sure that
- correct values for --with-ft-prefix or --with-ft-exec-prefix
- are used, or set the FT2_CONFIG environment variable to the
- full path to freetype-config.
- ])
- else
- AC_MSG_WARN([
-
- The FreeType test program failed to run. If your system uses
- shared libraries and they are installed outside the normal
- system library path, make sure the variable LD_LIBRARY_PATH
- (or whatever is appropriate for your system) is correctly set.
- ])
- fi
- fi
-
- FT2_CFLAGS=""
- FT2_LIBS=""
- m4_if([$3], [], [:], [$3])
- fi
-
- AC_SUBST([FT2_CFLAGS])
- AC_SUBST([FT2_LIBS])])
-
-# end of freetype2.m4
View
181 m4/sdl.m4
@@ -1,181 +0,0 @@
-# Configure paths for SDL
-# Sam Lantinga 9/21/99
-# stolen from Manish Singh
-# stolen back from Frank Belew
-# stolen from Manish Singh
-# Shamelessly stolen from Owen Taylor
-
-dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
-dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
-dnl
-AC_DEFUN([AM_PATH_SDL],
-[dnl
-dnl Get the cflags and libraries from the sdl-config script
-dnl
-AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
- sdl_prefix="$withval", sdl_prefix="")
-AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
- sdl_exec_prefix="$withval", sdl_exec_prefix="")
-AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
- , enable_sdltest=yes)
-
- if test x$sdl_exec_prefix != x ; then
- sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
- if test x${SDL_CONFIG+set} != xset ; then
- SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
- fi
- fi
- if test x$sdl_prefix != x ; then
- sdl_args="$sdl_args --prefix=$sdl_prefix"
- if test x${SDL_CONFIG+set} != xset ; then
- SDL_CONFIG=$sdl_prefix/bin/sdl-config
- fi
- fi
-
- if test "x$prefix" != xNONE; then
- PATH="$prefix/bin:$prefix/usr/bin:$PATH"
- fi
- AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
- min_sdl_version=ifelse([$1], ,0.11.0,$1)
- AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
- no_sdl=""
- if test "$SDL_CONFIG" = "no" ; then
- no_sdl=yes
- else
- SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
- SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
-
- sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
- if test "x$enable_sdltest" = "xyes" ; then
- ac_save_CFLAGS="$CFLAGS"
- ac_save_CXXFLAGS="$CXXFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $SDL_CFLAGS"
- CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
- LIBS="$LIBS $SDL_LIBS"
-dnl
-dnl Now check if the installed SDL is sufficiently new. (Also sanity
-dnl checks the results of sdl-config to some extent
-dnl
- rm -f conf.sdltest
- AC_TRY_RUN([
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "SDL.h"
-
-char*
-my_strdup (char *str)
-{
- char *new_str;
-
- if (str)
- {
- new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
- strcpy (new_str, str);
- }
- else
- new_str = NULL;
-
- return new_str;
-}
-
-int main (int argc, char *argv[])
-{
- int major, minor, micro;
- char *tmp_version;
-
- /* This hangs on some systems (?)
- system ("touch conf.sdltest");
- */
- { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
-
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = my_strdup("$min_sdl_version");
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
- printf("%s, bad version string\n", "$min_sdl_version");
- exit(1);
- }
-
- if (($sdl_major_version > major) ||
- (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
- (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
- {
- return 0;
- }
- else
- {
- printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
- printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
- printf("*** best to upgrade to the required version.\n");
- printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
- printf("*** to point to the correct copy of sdl-config, and remove the file\n");
- printf("*** config.cache before re-running configure\n");
- return 1;
- }
-}
-
-],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
- CFLAGS="$ac_save_CFLAGS"
- CXXFLAGS="$ac_save_CXXFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- if test "x$no_sdl" = x ; then
- AC_MSG_RESULT(yes)
- ifelse([$2], , :, [$2])
- else
- AC_MSG_RESULT(no)
- if test "$SDL_CONFIG" = "no" ; then
- echo "*** The sdl-config script installed by SDL could not be found"
- echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
- echo "*** your path, or set the SDL_CONFIG environment variable to the"
- echo "*** full path to sdl-config."
- else
- if test -f conf.sdltest ; then
- :
- else
- echo "*** Could not run SDL test program, checking why..."
- CFLAGS="$CFLAGS $SDL_CFLAGS"
- CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
- LIBS="$LIBS $SDL_LIBS"
- AC_TRY_LINK([
-#include <stdio.h>
-#include "SDL.h"
-
-int main(int argc, char *argv[])
-{ return 0; }
-#undef main
-#define main K_and_R_C_main
-], [ return 0; ],
- [ echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding SDL or finding the wrong"
- echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
- echo "*** to the installed location Also, make sure you have run ldconfig if that"
- echo "*** is required on your system"
- echo "***"
- echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
- [ echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means SDL was incorrectly installed"
- echo "*** or that you have moved SDL since it was installed. In the latter case, you"
- echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
- CFLAGS="$ac_save_CFLAGS"
- CXXFLAGS="$ac_save_CXXFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- SDL_CFLAGS=""
- SDL_LIBS=""
- ifelse([$3], , :, [$3])
- fi
- AC_SUBST(SDL_CFLAGS)
- AC_SUBST(SDL_LIBS)
- rm -f conf.sdltest
-])
Something went wrong with that request. Please try again.