Various fixes in build system

Originally committed to SVN as r1125.
This commit is contained in:
Niels Martin Hansen 2007-04-23 22:34:52 +00:00
parent 3e5d49d46c
commit 5ee7106920
5 changed files with 158 additions and 124 deletions

View File

@ -1,108 +0,0 @@
##### http://autoconf-archive.cryp.to/ax_check_gl.html
#
# SYNOPSIS
#
# AX_CHECK_GL
#
# DESCRIPTION
#
# Check for an OpenGL implementation. If GL is found, the required
# compiler and linker flags are included in the output variables
# "GL_CFLAGS" and "GL_LIBS", respectively. This macro adds the
# configure option "--with-apple-opengl-framework", which users can
# use to indicate that Apple's OpenGL framework should be used on Mac
# OS X. If Apple's OpenGL framework is used, the symbol
# "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GL implementation
# is found, "no_gl" is set to "yes".
#
# LAST MODIFICATION
#
# 2004-11-15
#
# COPYLEFT
#
# Copyright (c) 2004 Braden McDaniel <braden@endoframe.com>
#
# Copying and distribution of this file, with or without
# modification, are permitted in any medium without royalty provided
# the copyright notice and this notice are preserved.
AC_DEFUN([AX_CHECK_GL],
[AC_REQUIRE([AC_PATH_X])dnl
AC_REQUIRE([ACX_PTHREAD])dnl
#
# There isn't a reliable way to know we should use the Apple OpenGL framework
# without a configure option. A Mac OS X user may have installed an
# alternative GL implementation (e.g., Mesa), which may or may not depend on X.
#
AC_ARG_WITH([apple-opengl-framework],
[AC_HELP_STRING([--with-apple-opengl-framework],
[use Apple OpenGL framework (Mac OS X only)])])
if test "X$with_apple_opengl_framework" = "Xyes"; then
AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
[Use the Apple OpenGL framework.])
GL_LIBS="-framework OpenGL"
else
AC_LANG_PUSH(C)
AX_LANG_COMPILER_MS
if test X$ax_compiler_ms = Xno; then
GL_CFLAGS="${PTHREAD_CFLAGS}"
GL_LIBS="${PTHREAD_LIBS} -lm"
fi
#
# Use x_includes and x_libraries if they have been set (presumably by
# AC_PATH_X).
#
if test "X$no_x" != "Xyes"; then
if test -n "$x_includes"; then
GL_CFLAGS="-I${x_includes} ${GL_CFLAGS}"
fi
if test -n "$x_libraries"; then
GL_LIBS="-L${x_libraries} -lX11 ${GL_LIBS}"
fi
fi
AC_CHECK_HEADERS([windows.h])
AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl],
[ax_cv_check_gl_libgl="no"
ax_save_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
ax_save_LIBS="${LIBS}"
LIBS=""
ax_check_libs="-lopengl32 -lGL"
for ax_lib in ${ax_check_libs}; do
if test X$ax_compiler_ms = Xyes; then
ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
else
ax_try_lib="${ax_lib}"
fi
LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
# if HAVE_WINDOWS_H && defined(_WIN32)
# include <windows.h>
# endif
# include <GL/gl.h>]],
[[glBegin(0)]])],
[ax_cv_check_gl_libgl="${ax_try_lib}"; break])
done
LIBS=${ax_save_LIBS}
CPPFLAGS=${ax_save_CPPFLAGS}])
if test "X${ax_cv_check_gl_libgl}" = "Xno"; then
no_gl="yes"
GL_CFLAGS=""
GL_LIBS=""
else
GL_LIBS="${ax_cv_check_gl_libgl} ${GL_LIBS}"
fi
AC_LANG_POP(C)
fi
AC_SUBST([GL_CFLAGS])
AC_SUBST([GL_LIBS])
])dnl

View File

@ -278,3 +278,147 @@ else
fi
AC_LANG_RESTORE
])dnl ACX_PTHREAD
##### http://autoconf-archive.cryp.to/ax_check_gl.html
#
# SYNOPSIS
#
# AX_CHECK_GL
#
# DESCRIPTION
#
# Check for an OpenGL implementation. If GL is found, the required
# compiler and linker flags are included in the output variables
# "GL_CFLAGS" and "GL_LIBS", respectively. This macro adds the
# configure option "--with-apple-opengl-framework", which users can
# use to indicate that Apple's OpenGL framework should be used on Mac
# OS X. If Apple's OpenGL framework is used, the symbol
# "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GL implementation
# is found, "no_gl" is set to "yes".
#
# LAST MODIFICATION
#
# 2004-11-15
#
# COPYLEFT
#
# Copyright (c) 2004 Braden McDaniel <braden@endoframe.com>
#
# Copying and distribution of this file, with or without
# modification, are permitted in any medium without royalty provided
# the copyright notice and this notice are preserved.
AC_DEFUN([AX_CHECK_GL],
[AC_REQUIRE([AC_PATH_X])dnl
AC_REQUIRE([ACX_PTHREAD])dnl
#
# There isn't a reliable way to know we should use the Apple OpenGL framework
# without a configure option. A Mac OS X user may have installed an
# alternative GL implementation (e.g., Mesa), which may or may not depend on X.
#
AC_ARG_WITH([apple-opengl-framework],
[AC_HELP_STRING([--with-apple-opengl-framework],
[use Apple OpenGL framework (Mac OS X only)])])
if test "X$with_apple_opengl_framework" = "Xyes"; then
AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],
[Use the Apple OpenGL framework.])
GL_LIBS="-framework OpenGL"
else
AC_LANG_PUSH(C)
AX_LANG_COMPILER_MS
if test X$ax_compiler_ms = Xno; then
GL_CFLAGS="${PTHREAD_CFLAGS}"
GL_LIBS="${PTHREAD_LIBS} -lm"
fi
#
# Use x_includes and x_libraries if they have been set (presumably by
# AC_PATH_X).
#
if test "X$no_x" != "Xyes"; then
if test -n "$x_includes"; then
GL_CFLAGS="-I${x_includes} ${GL_CFLAGS}"
fi
if test -n "$x_libraries"; then
GL_LIBS="-L${x_libraries} -lX11 ${GL_LIBS}"
fi
fi
AC_CHECK_HEADERS([windows.h])
AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl],
[ax_cv_check_gl_libgl="no"
ax_save_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
ax_save_LIBS="${LIBS}"
LIBS=""
ax_check_libs="-lopengl32 -lGL"
for ax_lib in ${ax_check_libs}; do
if test X$ax_compiler_ms = Xyes; then
ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
else
ax_try_lib="${ax_lib}"
fi
LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
# if HAVE_WINDOWS_H && defined(_WIN32)
# include <windows.h>
# endif
# include <GL/gl.h>]],
[[glBegin(0)]])],
[ax_cv_check_gl_libgl="${ax_try_lib}"; break])
done
LIBS=${ax_save_LIBS}
CPPFLAGS=${ax_save_CPPFLAGS}])
if test "X${ax_cv_check_gl_libgl}" = "Xno"; then
no_gl="yes"
GL_CFLAGS=""
GL_LIBS=""
else
GL_LIBS="${ax_cv_check_gl_libgl} ${GL_LIBS}"
fi
AC_LANG_POP(C)
fi
AC_SUBST([GL_CFLAGS])
AC_SUBST([GL_LIBS])
])dnl
##### http://autoconf-archive.cryp.to/ax_lang_compiler_ms.html
#
# SYNOPSIS
#
# AX_LANG_COMPILER_MS
#
# DESCRIPTION
#
# Check whether the compiler for the current language is Microsoft.
#
# This macro is modeled after _AC_LANG_COMPILER_GNU in the GNU
# Autoconf implementation.
#
# LAST MODIFICATION
#
# 2004-11-15
#
# COPYLEFT
#
# Copyright (c) 2004 Braden McDaniel <braden@endoframe.com>
#
# Copying and distribution of this file, with or without
# modification, are permitted in any medium without royalty provided
# the copyright notice and this notice are preserved.
AC_DEFUN([AX_LANG_COMPILER_MS],
[AC_CACHE_CHECK([whether we are using the Microsoft _AC_LANG compiler],
[ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef _MSC_VER
choke me
#endif
]])],
[ax_compiler_ms=yes],
[ax_compiler_ms=no])
ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms=$ax_compiler_ms
])])

View File

@ -42,7 +42,7 @@
// some basic utility routines
#if 0
#ifndef HAVE_HUNSPELL
// string duplication routine
char * mystrdup(const char * p)
{

View File

@ -1,6 +1,3 @@
sinclude([ac/acx_pthread.m4])
sinclude([ac/ax_check_gl.m4])
AC_PREREQ(2.57)
AC_INIT([Aegisub], [2.00-alpha],, [aegisub])
AC_CONFIG_AUX_DIR([ac])
@ -11,14 +8,6 @@ AC_GNU_SOURCE
AC_CANONICAL_HOST
# Commented out for now, since for some reason not all systems have
# /usr/share/aclocal/gettext.m4 and can't get it. (Feisty Fawn for
# one doesn't have it.)
# wxWidgets doesn't use real gettext anyway, but implements its own
# support, so only the gettext tools are required to compile the
# po files.
#AM_GNU_GETTEXT
AC_DEFUN([AC_C_FLAG], [{
AC_LANG_PUSH(C)
ac_c_flag_save="$CFLAGS"
@ -58,8 +47,16 @@ AC_LANG(C++)
AC_PROG_RANLIB
AC_PATH_PROGS(CONVERT, [convert], [])
if test -z "$CONVERT"
then AC_MSG_FAILURE([aegisub needs convert (from ImageMagick) to produce xpms from the supplied bitmaps/icons])
if test -z "$CONVERT"; then
AC_MSG_FAILURE([Aegisub needs convert (from ImageMagick) to produce xpms from the supplied bitmaps/icons])
fi
dnl Don't replace this with AC_GNU_GETTEXT, we don't want the framework-mess
dnl that macro depends on, just check if the single program we need is
dnl installed on the system. We can probably even do with non-GNU versions.
AC_PATH_PROGS(MSGFMT, [msgfmt], [])
if test -z "$MSGFMT"
then AC_MSG_FAILURE([Aegisub needs msgfmt from gettext-tools to compile i18n string tables])
fi
ACX_PTHREAD([], [
@ -100,7 +97,8 @@ AC_ARG_WITH(wx-config,
AX_CHECK_GL
if test ! "$GL_LIBS"; then
AC_MSG_ERROR([Could not find system GL library])
AC_MSG_WARN([Could not find system GL library])
AC_MSG_FAILURE([GL support is required to build Aegisub. (Try mesa3d)])
fi
CPPFLAGS="$CPPFLAGS $GL_CFLAGS"
LIBS="$LIBS $GL_LIBS"

View File

@ -2,7 +2,7 @@ LANGS=de es fr it ko pt_BR ru
localedir = $(datadir)/locale
%.gmo: %/aegisub.po
$(MSGFMT) -o $@ $<
msgfmt -o $@ $<
all-am: $(foreach lang,$(LANGS),$(lang).gmo)