initial version ( megaglest 3.2.3-beta3 )

This commit is contained in:
Titus Tscharntke 2010-01-22 01:48:05 +00:00
parent 0ce9b5fcac
commit 9f4f9d10ea
55 changed files with 15440 additions and 0 deletions

75
mk/linux/Jamfile Normal file
View File

@ -0,0 +1,75 @@
SubDir TOP ;
UseAutoconf ;
Package license.txt readme.txt ;
#### Library ####
SubDir TOP shared_lib sources ;
LIB_DIRS =
platform/sdl
platform/posix
util
graphics
graphics/gl
sound
sound/openal
xml
glew
lua
;
LIB_INCLUDE_DIRS = ../include/$(LIB_DIRS) ;
for i in $(LIB_DIRS) {
LIB_SOURCES += [ Wildcard $(i) : *.c *.cpp *.h ] ;
}
Library glestlib : $(LIB_SOURCES) ;
ExternalLibs glestlib : SDL GL GLU XERCES VORBIS VORBISFILE OGG OPENAL LUA ;
IncludeDir glestlib : $(LIB_INCLUDE_DIRS) ;
#### Game ####
SubDir TOP glest_game ;
GLEST_DIRS =
.
ai
facilities
game
global
graphics
gui
main
menu
network
sound
type_instances
types
world
;
for i in $(GLEST_DIRS) {
GLEST_SOURCES += [ Wildcard $(i) : *.cpp *.h ] ;
}
Application glest : $(GLEST_SOURCES) ;
LinkWith glest : glestlib ;
ExternalLibs glest : SDL GL GLU XERCES VORBIS VORBISFILE OGG OPENAL LUA ;
IncludeDir glest : ../shared_lib/include/$(LIB_INCLUDE_DIRS) $(GLEST_DIRS) ;
#### Editor ####
if $(WX_AVAILABLE) = "yes" {
SubDir TOP glest_map_editor ;
GLEST_MAP_DIRS = . ;
for i in $(GLEST_DIRS) {
GLEST_MAP_SOURCES += [ Wildcard $(i) : *.cpp *.h ] ;
}
Application glest_editor : $(GLEST_MAP_SOURCES) ;
LinkWith glest_editor : glestlib ;
ExternalLibs glest_editor : SDL GL GLU XERCES VORBIS VORBISFILE OGG OPENAL WX ;
IncludeDir glest_editor : ../shared_lib/include/$(LIB_INCLUDE_DIRS) $(GLEST_MAP_DIRS) ;
}

39
mk/linux/Jamrules Normal file
View File

@ -0,0 +1,39 @@
if ! $(top_builddir)
{
top_builddir = $(TOP) ;
}
top_srcdir = $(TOP) ;
JAMCONFIG ?= $(top_builddir)/Jamconfig ;
include $(JAMCONFIG) ;
if ! $(JAMCONFIG_READ)
{
EXIT "Couldn't find config. Please run 'configure' first." ;
}
if $(USE_STLPORT_DEBUG)
{
CPPFLAGS += -I/usr/include/stlport ;
CPPFLAGS += -D_STLP_DEBUG=1 -D_STLP_DEBUG_UNINITIALIZED=1 ;
CPPFLAGS += -D_STLP_SHRED_BYTE=0xA3 ;
LIBS += -lstlport_gcc_debug ;
}
COMPILER_CFLAGS += -Wall -W -Wno-unused -Wno-sign-compare ;
COMPILER_CFLAGS_optimize += -O3 -DNDEBUG ;
COMPILER_CXXFLAGS_optimize += -O3 -DNDEBUG ;
COMPILER_LIBS_optimize += ;
COMPILER_CFLAGS_debug += -DDEBUG -g3 ;
COMPILER_CXXFLAGS_debug += -DDEBUG -g3 ;
COMPILER_LIBS_debug += -g3 ;
COMPILER_CFLAGS_profile += -O3 -fno-inline -pg ;
COMPILER_CXXFLAGS_profile += -O3 -fno-inline -g3 -pg ;
COMPILER_LIBS_profile += -pg ;
LINK = $(CXX) ;
# Include build rules
include $(TOP)/mk/jam/build.jam ;
# Include Dirs
IncludeDir $(top_builddir) ; # for config.h

37
mk/linux/autogen.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/sh
# Correct working directory?
if test ! -f configure.ac ; then
echo "*** Please invoke this script from directory containing configure.ac."
exit 1
fi
echo "aclocal..."
#autoheader
aclocal -I mk/autoconf
# generate Jamconfig.in
echo "generating Jamconfig.in ..."
autoconf --trace=AC_SUBST \
| sed -e 's/configure.ac:[0-9]*:AC_SUBST:\([^:]*\).*/\1 ?= "@\1@" ;/g' \
> Jamconfig.in
sed -e 's/.*BACKSLASH.*//' -i~ Jamconfig.in
rm Jamconfig.in~
echo 'INSTALL ?= "@INSTALL@" ;' >> Jamconfig.in
echo 'JAMCONFIG_READ = yes ;' >> Jamconfig.in
echo "autoconf"
autoconf
# create symlinks to the source dirs
echo "Updating Source symlinks..."
if [ ! -d shared_lib ]; then
ln -sf ../../source/shared_lib .
fi
if [ ! -d glest_game ]; then
ln -sf ../../source/glest_game .
fi
if [ ! -d glest_map_editor ]; then
ln -sf ../../source/glest_map_editor .
fi

131
mk/linux/configure.ac Normal file
View File

@ -0,0 +1,131 @@
#----------------------------------------------------------------------------
# Autoconf input script. Start the ./autgen.sh script for producing a
# configure script.
#----------------------------------------------------------------------------
AC_PREREQ([2.54])
AC_INIT([glest], [3.2.3-beta3], [matze@braunis.de])
AC_CONFIG_SRCDIR([mk/jam/build.jam])
AC_CONFIG_AUX_DIR([mk/autoconf])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
#----------------------------------------------------------------------------
# Configuration header
#----------------------------------------------------------------------------
AC_C_BIGENDIAN()
# stupid autoconf is adding default -g -O2 flags when we don't want this :-/
test ".$CXXFLAGS" = "." && CXXFLAGS=" "
#----------------------------------------------------------------------------
# Check for build variant (debug, profile, optimize)
#----------------------------------------------------------------------------
VARIANT=optimize
AC_ARG_ENABLE([optimize], [AC_HELP_STRING([--enable-optimize],
[build with optimizations enabled (default YES)])],
[test "$enableval" = "yes" && VARIANT=optimize])
AC_ARG_ENABLE([debug], [AC_HELP_STRING([--enable-debug],
[build with debugging information (default NO)])],
[test "$enableval" = "yes" && VARIANT=debug])
AC_ARG_ENABLE([profile], [AC_HELP_STRING([--enable-profile],
[build with profiling information (default NO)])],
[test "$enableval" = "yes" && VARIANT=profile])
AC_SUBST([VARIANT])
#----------------------------------------------------------------------------
# find applications
#----------------------------------------------------------------------------
AC_PROG_CXX
AC_PROG_INSTALL
#----------------------------------------------------------------------------
# Check for operating system
#----------------------------------------------------------------------------
AC_MSG_CHECKING([for target host])
winapi_available=no
case $host_os in
mingw*|cygwin*)
AC_MSG_RESULT([WIN32])
winapi_available=yes
AC_DEFINE([USE_WINSOCK], [], [Define if winsock should be used])
LIBS="$LIBS -lwsock32"
;;
*)
AC_MSG_RESULT([assume posix])
AC_DEFINE([USE_POSIX_SOCKETS], [],
[Define if posix sockets should be used])
AC_PATH_X
if test "$no_x" != "yes"; then
AC_DEFINE([X11_AVAILABLE], [1], [Defined if X11 is avilable])
else
AC_MSG_ERROR("Please install X11 libraries and headers.")
fi
;;
esac
#----------------------------------------------------------------------------
# find libraries
#----------------------------------------------------------------------------
AC_CHECK_HEADERS([glob.h sys/ioctl.h sys/filio.h])
AX_TYPE_SOCKLEN_T
AM_PATH_SDL([1.2.5],
[AC_DEFINE([USE_SDL], [], [Define when SDL should be used])], [
if test "$winapi_available" != "yes"; then
AC_MSG_ERROR([Please install libsdl >= 1.2.])
else
AC_DEFINE([USE_WINAPI], [], [Define if win32 API should be used])
fi
])
AC_LANG_PUSH([C++])
NP_FINDLIB([XERCES], [xerces], [xerces],
NP_LANG_PROGRAM([#include <xercesc/util/PlatformUtils.hpp>
XERCES_CPP_NAMESPACE_USE;], [XMLPlatformUtils::Initialize();]),
[], [-lxerces-c -lpthread],
[],
[AC_MSG_ERROR([Please install xerces-c])],
[], [])
AC_LANG_POP([C++])
NP_FINDLIB([OPENAL], [OpenAL], [OpenAL],
NP_LANG_PROGRAM([#include <AL/al.h>],
[alcOpenDevice(0);]),
[], [-lopenal],
[],
[AC_MSG_ERROR([Please intall OpenAL])],
[], [])
CHECK_LUA([], [AC_MSG_ERROR([Please install lua 5.1])])
AX_CHECK_GL
if test "$no_gl" = "yes"; then
AC_MSG_ERROR([You need to have OpenGL headers and libraries installed])
fi
AX_CHECK_GLU
if test "$no_glu" = "yes"; then
AC_MSG_ERROR([You need to have GLU headers and libraries installed])
fi
XIPH_PATH_VORBIS(, [AC_MSG_ERROR([Please install vorbis])])
XIPH_PATH_OGG(, [AC_MSG_ERROR([Please install ogg/vorbis])])
AM_OPTIONS_WXCONFIG
AM_PATH_WXCONFIG([2.6.0], [WX_AVAILABLE="yes"], [WX_AVAILABLE="no"], [std,gl], [--unicode=yes])
AC_SUBST([WX_AVAILABLE])
AC_INIT_JAM
AC_CONFIG_FILES([Jamconfig])
AC_OUTPUT
AC_MSG_NOTICE([
Notice: This project uses jam (and not make) as build tool.
])

46
mk/linux/glest.ini Normal file
View File

@ -0,0 +1,46 @@
; === Properties File ===
AiLog=0
AiRedir=0
AutoTest=0
CheckGlCaps=1
ColorBits=32
ConsoleMaxLines=10
ConsoleTimeout=10
DayTime=1000
DebugMode=0
DepthBits=16
FactoryGraphics=OpenGL
FactorySound=OpenAL
FastSpeedLoops=2
Filter=Bilinear
FilterMaxAnisotropy=1
FirstTime=0
FocusArrows=1
FogOfWar=1
FogOfWarSmoothing=1
FogOfWarSmoothingFrameSkip=3
FontConsole=-*-*-*-*-*-*-12-*-*-*-*-*-*-*
FontDisplay=-*-*-*-*-*-*-12-*-*-*-*-*-*-*
FontMenu=-*-*-*-*-*-*-12-*-*-*-*-*-*-*
Lang=english.lng
MaxLights=1
NetworkConsistencyChecks=1
PhotoMode=0
RefreshFrequency=75
ScreenHeight=480
ScreenWidth=640
ServerIp=192.168.1.102
ServerPort=6666
ShadowAlpha=0.2
ShadowFrameSkip=2
ShadowTextureSize=512
Shadows=Projected
SoundStaticBuffers=16
SoundStreamingBuffers=4
SoundVolumeAmbient=80
SoundVolumeFx=80
SoundVolumeMusic=90
StencilBits=0
Textures3D=1
Windowed=0

31
mk/linux/makerelease.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
VERSION=`autoconf -t AC_INIT | sed -e 's/[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/g'`
RELEASENAME=megaglest-source
RELEASEDIR="`pwd`/release/$RELEASENAME-$VERSION"
echo "Creating source package in $RELEASEDIR"
rm -rf $RELEASEDIR
mkdir -p $RELEASEDIR
# copy sources
pushd "`pwd`/../../source"
find glest_game/ \( -name "*.cpp" -o -name "*.h" \) -exec cp -p --parents "{}" $RELEASEDIR ';'
find shared_lib/ \( -name "*.cpp" -o -name "*.h" \) -exec cp -p --parents "{}" $RELEASEDIR ';'
find glest_map_editor/ \( -name "*.cpp" -o -name "*.h" \) -exec cp -p --parents "{}" $RELEASEDIR ';'
popd
AUTOCONFSTUFF="configure.ac autogen.sh Jamrules Jamfile `find mk/jam -name "*.jam"` `find mk/autoconf -name "*.m4" -o -name "config.*" -o -name "*sh"`"
cp -p --parents $AUTOCONFSTUFF $RELEASEDIR
cp -p ../../docs/readme*.txt ../../docs/*license*.txt $RELEASEDIR
cp -p glest.ini $RELEASEDIR
pushd $RELEASEDIR
./autogen.sh
popd
pushd release
PACKAGE="$RELEASENAME-$VERSION.tar.bz2"
echo "creating $PACKAGE"
tar -c --bzip2 -f "$PACKAGE" "$RELEASENAME-$VERSION"
popd

View File

@ -0,0 +1,235 @@
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
dnl
dnl This macro figures out how to build C programs using POSIX threads.
dnl It sets the PTHREAD_LIBS output variable to the threads library and
dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
dnl C compiler flags that are needed. (The user can also force certain
dnl compiler flags/libs to be tested by setting these environment
dnl variables.)
dnl
dnl Also sets PTHREAD_CC to any special C compiler that is needed for
dnl multi-threaded programs (defaults to the value of CC otherwise).
dnl (This is necessary on AIX to use the special cc_r compiler alias.)
dnl
dnl NOTE: You are assumed to not only compile your program with these
dnl flags, but also link it with them as well. e.g. you should link
dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
dnl $LIBS
dnl
dnl If you are only building threads programs, you may wish to use
dnl these variables in your default LIBS, CFLAGS, and CC:
dnl
dnl LIBS="$PTHREAD_LIBS $LIBS"
dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
dnl CC="$PTHREAD_CC"
dnl
dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
dnl
dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
dnl default action will define HAVE_PTHREAD.
dnl
dnl Please let the authors know if this macro fails on any platform, or
dnl if you have any other suggestions or comments. This macro was based
dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
dnl We are also grateful for the helpful feedback of numerous users.
dnl
dnl @category InstalledPackages
dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
dnl @version 2005-01-14
dnl @license GPLWithACException
AC_DEFUN([ACX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_SAVE
AC_LANG_C
acx_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
AC_MSG_RESULT($acx_pthread_ok)
if test x"$acx_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case "${host_cpu}-${host_os}" in
*solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthread or
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
;;
esac
if test x"$acx_pthread_ok" = xno; then
for flag in $acx_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
pthread-config)
AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
if test x"$acx_pthread_config" = xno; then continue; fi
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_TRY_LINK([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
[acx_pthread_ok=yes])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($acx_pthread_ok)
if test "x$acx_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$acx_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_TRY_LINK([#include <pthread.h>], [int attr=$attr;],
[attr_name=$attr; break])
done
AC_MSG_RESULT($attr_name)
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case "${host_cpu}-${host_os}" in
*-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with cc_r
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
else
PTHREAD_CC="$CC"
fi
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$acx_pthread_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
:
else
acx_pthread_ok=no
$2
fi
AC_LANG_RESTORE
])dnl ACX_PTHREAD

View File

@ -0,0 +1,95 @@
dnl @synopsis AX_CHECK_GL
dnl
dnl Check for an OpenGL implementation. If GL is found, the required
dnl compiler and linker flags are included in the output variables
dnl "GL_CFLAGS" and "GL_LIBS", respectively. This macro adds the
dnl configure option "--with-apple-opengl-framework", which users can
dnl use to indicate that Apple's OpenGL framework should be used on Mac
dnl OS X. If Apple's OpenGL framework is used, the symbol
dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GL implementation
dnl is found, "no_gl" is set to "yes".
dnl
dnl @category InstalledPackages
dnl @author Braden McDaniel <braden@endoframe.com>
dnl @version 2004-11-15
dnl @license AllPermissive
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

@ -0,0 +1,71 @@
dnl @synopsis AX_CHECK_GLU
dnl
dnl Check for GLU. If GLU is found, the required preprocessor and
dnl linker flags are included in the output variables "GLU_CFLAGS" and
dnl "GLU_LIBS", respectively. This macro adds the configure option
dnl "--with-apple-opengl-framework", which users can use to indicate
dnl that Apple's OpenGL framework should be used on Mac OS X. If
dnl Apple's OpenGL framework is used, the symbol
dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GLU implementation
dnl is found, "no_glu" is set to "yes".
dnl
dnl @category InstalledPackages
dnl @author Braden McDaniel <braden@endoframe.com>
dnl @version 2004-11-15
dnl @license AllPermissive
AC_DEFUN([AX_CHECK_GLU],
[AC_REQUIRE([AX_CHECK_GL])dnl
AC_REQUIRE([AC_PROG_CXX])dnl
GLU_CFLAGS="${GL_CFLAGS}"
if test "X${with_apple_opengl_framework}" != "Xyes"; then
AC_CACHE_CHECK([for OpenGL Utility library], [ax_cv_check_glu_libglu],
[ax_cv_check_glu_libglu="no"
ax_save_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}"
ax_save_LIBS="${LIBS}"
LIBS=""
ax_check_libs="-lglu32 -lGLU"
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}"
#
# libGLU typically links with libstdc++ on POSIX platforms. However,
# setting the language to C++ means that test program source is named
# "conftest.cc"; and Microsoft cl doesn't know what to do with such a
# file.
#
AC_LANG_PUSH([C++])
if test X$ax_compiler_ms = Xyes; then
AC_LANG_PUSH([C])
fi
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
# if HAVE_WINDOWS_H && defined(_WIN32)
# include <windows.h>
# endif
# include <GL/glu.h>]],
[[gluBeginCurve(0)]])],
[ax_cv_check_glu_libglu="${ax_try_lib}"; break])
if test X$ax_compiler_ms = Xyes; then
AC_LANG_POP([C])
fi
AC_LANG_POP([C++])
done
LIBS=${ax_save_LIBS}
CPPFLAGS=${ax_save_CPPFLAGS}])
if test "X${ax_cv_check_glu_libglu}" = "Xno"; then
no_glu="yes"
GLU_CFLAGS=""
GLU_LIBS=""
else
GLU_LIBS="${ax_cv_check_glu_libglu} ${GL_LIBS}"
fi
fi
AC_SUBST([GLU_CFLAGS])
AC_SUBST([GLU_LIBS])
])

View File

@ -0,0 +1,23 @@
dnl @synopsis AX_LANG_COMPILER_MS
dnl
dnl Check whether the compiler for the current language is Microsoft.
dnl
dnl This macro is modeled after _AC_LANG_COMPILER_GNU in the GNU
dnl Autoconf implementation.
dnl
dnl @category InstalledPackages
dnl @author Braden McDaniel <braden@endoframe.com>
dnl @version 2004-11-15
dnl @license AllPermissive
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

@ -0,0 +1,23 @@
dnl @synopsis TYPE_SOCKLEN_T
dnl
dnl Check whether sys/socket.h defines type socklen_t. Please note
dnl that some systems require sys/types.h to be included before
dnl sys/socket.h can be compiled.
dnl
dnl @version $Id: ax_type_socklen_t.m4,v 1.1 2005/06/12 18:14:34 matzebraun Exp $
dnl @author Lars Brinkhoff <lars@nocrew.org>
dnl
AC_DEFUN([AX_TYPE_SOCKLEN_T],
[AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
[
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>],
[socklen_t len = 42; return 0;],
ac_cv_type_socklen_t=yes,
ac_cv_type_socklen_t=no)
])
if test $ac_cv_type_socklen_t != yes; then
AC_DEFINE(socklen_t, int, [define socklen_t if sys headers don't do that])
fi
])

View File

@ -0,0 +1,77 @@
# Check for binary relocation support
# Hongli Lai
# slightly modified by Matze (don't enable automatically)
# http://autopackage.org/
AC_DEFUN([AM_BINRELOC],
[
AC_ARG_ENABLE(binreloc,
[ --enable-binreloc compile with binary relocation support
(default=disabled)],
enable_binreloc=$enableval,enable_binreloc=no)
AC_ARG_ENABLE(binreloc-threads,
[ --enable-binreloc-threads compile binary relocation with threads support
(default=yes)],
enable_binreloc_threads=$enableval,enable_binreloc_threads=yes)
BINRELOC_CFLAGS=
BINRELOC_LIBS=
if test "x$enable_binreloc" = "xauto"; then
AC_CHECK_FILE([/proc/self/maps])
AC_CACHE_CHECK([whether everything is installed to the same prefix],
[br_cv_valid_prefixes], [
if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
"$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
"$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
then
br_cv_valid_prefixes=yes
else
br_cv_valid_prefixes=no
fi
])
fi
AC_CACHE_CHECK([whether binary relocation support should be enabled],
[br_cv_binreloc],
[if test "x$enable_binreloc" = "xyes"; then
br_cv_binreloc=yes
elif test "x$enable_binreloc" = "xauto"; then
if test "x$br_cv_valid_prefixes" = "xyes" -a \
"x$ac_cv_file__proc_self_maps" = "xyes"; then
br_cv_binreloc=yes
else
br_cv_binreloc=no
fi
else
br_cv_binreloc=no
fi])
if test "x$br_cv_binreloc" = "xyes"; then
#BINRELOC_CFLAGS="-DENABLE_BINRELOC"
AC_DEFINE(ENABLE_BINRELOC,,[Use binary relocation?])
if test "x$enable_binreloc_threads" = "xyes"; then
AC_CHECK_LIB([pthread], [pthread_getspecific])
fi
AC_CACHE_CHECK([whether binary relocation should use threads],
[br_cv_binreloc_threads],
[if test "x$enable_binreloc_threads" = "xyes"; then
if test "x$ac_cv_lib_pthread_pthread_getspecific" = "xyes"; then
br_cv_binreloc_threads=yes
else
br_cv_binreloc_threads=no
fi
else
br_cv_binreloc_threads=no
fi])
if test "x$br_cv_binreloc_threads" = "xyes"; then
BINRELOC_LIBS="-lpthread"
AC_DEFINE(BR_PTHREAD,1,[Include pthread support for binary relocation?])
else
BINRELOC_CFLAGS="$BINRELOC_CFLAGS -DBR_PTHREADS=0"
AC_DEFINE(BR_PTHREAD,0,[Include pthread support for binary relocation?])
fi
fi
AC_SUBST(BINRELOC_CFLAGS)
AC_SUBST(BINRELOC_LIBS)
])

View File

@ -0,0 +1,97 @@
# derived from lua.m4 in mod_wombat from httpd.apache.org
# http://svn.apache.org/viewvc/httpd/mod_wombat/trunk/build/ac-macros/lua.m4?view=markup
# which is under Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
#
# Apache mod_wombat
# Copyright 2006 The Apache Software Foundation
#
# This product includes software developed at
# The Apache Software Foundation (http://www.apache.org/).
#
# This software makes use of Lua ( http://www.lua.org/ )
# developed by Copyright 1994-2006 Lua.org, PUC-Rio.
# Lua is distributed under the MIT license
# ( http://www.lua.org/license.html ).
#
# ==========================================
# Check for Lua 5.1 Libraries
# CHECK_LUA(ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
# Sets:
# LUA_AVAILABLE
# LUA_CFLAGS
# LUA_LIBS
AC_DEFUN([CHECK_LUA],
[
AC_ARG_WITH(
lua,
[AC_HELP_STRING([--with-lua=PFX],[Prefix where Lua 5.1 is installed (optional)])],
lua_pfx="$withval",
:)
# Determine lua lib directory
if test -z "${lua_pfx}"; then
paths="/usr/local /usr"
else
paths="${lua_pfx}"
fi
[LUA_AVAILABLE=no
LUA_LIBS=""
LUA_CFLAGS=""]
AC_CHECK_LIB([m], [pow], lib_m=" -lm")
AC_LANG_PUSH([C++])
for p in $paths ; do
AC_MSG_CHECKING([for lua.hpp in ${p}/include/lua5.1])
if test -f ${p}/include/lua5.1/lua.hpp; then
AC_MSG_RESULT([yes])
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
CFLAGS="$CFLAGS"
LDFLAGS="-L${p}/lib $LDFLAGS $lib_m"
AC_CHECK_LIB(lua5.1, luaL_newstate,
[
LUA_AVAILABLE=yes
LUA_LIBS="-L${p}/lib -llua5.1"
LUA_CFLAGS="-I${p}/include/lua5.1"
])
CFLAGS=$save_CFLAGS
LDFLAGS=$save_LDFLAGS
break
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([for lua.hpp in ${p}/include])
if test -f ${p}/include/lua.hpp; then
AC_MSG_RESULT([yes])
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
CFLAGS="$CFLAGS"
LDFLAGS="-L${p}/lib $LDFLAGS $lib_m"
AC_CHECK_LIB(lua, luaL_newstate,
[
LUA_AVAILABLE=yes
LUA_LIBS="-L${p}/lib -llua"
LUA_CFLAGS="-I${p}/include"
])
CFLAGS=$save_CFLAGS
LDFLAGS=$save_LDFLAGS
break
else
AC_MSG_RESULT([no])
fi
done
AC_LANG_POP([C++])
AC_SUBST(LUA_AVAILABLE)
AC_SUBST(LUA_LIBS)
AC_SUBST(LUA_CFLAGS)
if test -z "${LUA_LIBS}"; then
ifelse([$2], , :, [$2])
else
ifelse([$1], , :, [$1])
fi
])

1438
mk/linux/mk/autoconf/config.guess vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,548 @@
#! /bin/sh
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
# Copyright 1996-2003 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
#
# The first argument passed to this file is the canonical host specification,
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
# should be set by the caller.
#
# The set of defined variables is at the end of this script.
# Known limitations:
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
# than 256 bytes, otherwise the compiler driver will dump core. The only
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
# All known linkers require a `.a' archive for static linking (except M$VC,
# which needs '.lib').
libext=a
shrext=.so
host="$1"
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
wl=
if test "$GCC" = yes; then
wl='-Wl,'
else
case "$host_os" in
aix*)
wl='-Wl,'
;;
mingw* | pw32* | os2*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
;;
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
newsos6)
;;
linux*)
case $CC in
icc|ecc)
wl='-Wl,'
;;
ccc)
wl='-Wl,'
;;
esac
;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
sco3.2v5*)
;;
solaris*)
wl='-Wl,'
;;
sunos4*)
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
wl='-Wl,'
;;
sysv4*MP*)
;;
uts4*)
;;
esac
fi
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
openbsd*)
with_gnu_ld=no
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
case "$host_os" in
aix3* | aix4* | aix5*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
# that the semantics of dynamic libraries on AmigaOS, at least up
# to version 4, is to share data among multiple programs linked
# with the same dynamic library. Since this doesn't match the
# behavior of shared libraries on other platforms, we can use
# them.
ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
netbsd*)
;;
solaris* | sysv5*)
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
sunos4*)
hardcode_direct=yes
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = yes; then
# Unlike libtool, we use -rpath here, not --rpath, since the documented
# option of GNU ld is called -rpath, not --rpath.
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
fi
else
case "$host_os" in
aix3*)
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$GCC" = yes; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix4* | aix5*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
esac
fi
hardcode_direct=yes
hardcode_libdir_separator=':'
if test "$GCC" = yes; then
case $host_os in aix4.[012]|aix4.[012].*)
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
hardcode_direct=yes
else
# We have old collect2
hardcode_direct=unsupported
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
esac
fi
# Begin _LT_AC_SYS_LIBPATH_AIX.
echo 'int main () { return 0; }' > conftest.c
${CC} ${LDFLAGS} conftest.c -o conftest
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
if test -z "$aix_libpath"; then
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
fi
if test -z "$aix_libpath"; then
aix_libpath="/usr/lib:/lib"
fi
rm -f conftest.c conftest
# End _LT_AC_SYS_LIBPATH_AIX.
if test "$aix_use_runtimelinking" = yes; then
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
else
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
fi
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# see comment about different semantics on the GNU ld section
ld_shlibs=no
;;
bsdi4*)
;;
cygwin* | mingw* | pw32*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
libext=lib
;;
darwin* | rhapsody*)
if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then
hardcode_direct=no
fi
;;
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
freebsd1*)
ld_shlibs=no
;;
freebsd2.2*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
freebsd2*)
hardcode_direct=yes
hardcode_minus_L=yes
;;
freebsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
hpux9*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
hpux10* | hpux11*)
if test "$with_gnu_ld" = no; then
case "$host_cpu" in
hppa*64*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=no
;;
ia64*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=no
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
netbsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
newsos6)
hardcode_direct=yes
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
openbsd*)
hardcode_direct=yes
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
else
case "$host_os" in
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
hardcode_libdir_flag_spec='-R$libdir'
;;
*)
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
fi
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
osf3*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*)
if test "$GCC" = yes; then
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
# Both cc and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
hardcode_libdir_separator=:
;;
sco3.2v5*)
;;
solaris*)
hardcode_libdir_flag_spec='-R$libdir'
;;
sunos4*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
sysv4)
case $host_vendor in
sni)
hardcode_direct=yes # is this really true???
;;
siemens)
hardcode_direct=no
;;
motorola)
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
esac
;;
sysv4.3*)
;;
sysv4*MP*)
if test -d /usr/nec; then
ld_shlibs=yes
fi
;;
sysv4.2uw2*)
hardcode_direct=yes
hardcode_minus_L=no
;;
sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*)
;;
sysv5*)
hardcode_libdir_flag_spec=
;;
uts4*)
hardcode_libdir_flag_spec='-L$libdir'
;;
*)
ld_shlibs=no
;;
esac
fi
# Check dynamic linker characteristics
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
libname_spec='lib$name'
case "$host_os" in
aix3*)
;;
aix4* | aix5*)
;;
amigaos*)
;;
beos*)
;;
bsdi4*)
;;
cygwin* | mingw* | pw32*)
shrext=.dll
;;
darwin* | rhapsody*)
shrext=.dylib
;;
dgux*)
;;
freebsd1*)
;;
freebsd*)
;;
gnu*)
;;
hpux9* | hpux10* | hpux11*)
case "$host_cpu" in
ia64*)
shrext=.so
;;
hppa*64*)
shrext=.sl
;;
*)
shrext=.sl
;;
esac
;;
irix5* | irix6* | nonstopux*)
case "$host_os" in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
*) libsuff= shlibsuff= ;;
esac
;;
esac
;;
linux*oldld* | linux*aout* | linux*coff*)
;;
linux*)
;;
netbsd*)
;;
newsos6)
;;
nto-qnx)
;;
openbsd*)
;;
os2*)
libname_spec='$name'
shrext=.dll
;;
osf3* | osf4* | osf5*)
;;
sco3.2v5*)
;;
solaris*)
;;
sunos4*)
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
;;
sysv4*MP*)
;;
uts4*)
;;
esac
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
# How to pass a linker flag through the compiler.
wl="$escaped_wl"
# Static library suffix (normally "a").
libext="$libext"
# Shared library suffix (normally "so").
shlibext="$shlibext"
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator"
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="$hardcode_direct"
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="$hardcode_minus_L"
EOF

1544
mk/linux/mk/autoconf/config.sub vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,103 @@
# iconv.m4 serial AM4 (gettext-0.11.3)
dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl From Bruno Haible.
AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
[
dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_RPATH])
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
dnl accordingly.
AC_LIB_LINKFLAGS_BODY([iconv])
])
AC_DEFUN([AM_ICONV_LINK],
[
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
dnl those with the standalone portable GNU libiconv installed).
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
dnl accordingly.
AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
dnl Add $INCICONV to CPPFLAGS before performing the following checks,
dnl because if the user has installed libiconv and not disabled its use
dnl via --without-libiconv-prefix, he wants to use it. The first
dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
am_save_CPPFLAGS="$CPPFLAGS"
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
am_cv_func_iconv=yes)
if test "$am_cv_func_iconv" != yes; then
am_save_LIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
am_cv_lib_iconv=yes
am_cv_func_iconv=yes)
LIBS="$am_save_LIBS"
fi
])
if test "$am_cv_func_iconv" = yes; then
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
fi
if test "$am_cv_lib_iconv" = yes; then
AC_MSG_CHECKING([how to link with libiconv])
AC_MSG_RESULT([$LIBICONV])
else
dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
dnl either.
CPPFLAGS="$am_save_CPPFLAGS"
LIBICONV=
LTLIBICONV=
fi
AC_SUBST(LIBICONV)
AC_SUBST(LTLIBICONV)
])
AC_DEFUN([AM_ICONV],
[
AM_ICONV_LINK
if test "$am_cv_func_iconv" = yes; then
AC_MSG_CHECKING([for iconv declaration])
AC_CACHE_VAL(am_cv_proto_iconv, [
AC_TRY_COMPILE([
#include <stdlib.h>
#include <iconv.h>
extern
#ifdef __cplusplus
"C"
#endif
#if defined(__STDC__) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
#else
size_t iconv();
#endif
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
AC_MSG_RESULT([$]{ac_t:-
}[$]am_cv_proto_iconv)
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
[Define as const if the declaration of iconv() needs const.])
fi
])

View File

@ -0,0 +1,24 @@
#----------------------------------------------------------------------------
# AC_INIT_JAM
# This rule fixes several issues related to autoconf being make centric
#----------------------------------------------------------------------------
AC_DEFUN([AC_INIT_JAM],
[
AC_INIT_JAMFILE
AC_OUTPUT_INSTALLDIRS
AC_FIX_INSTALL])
#----------------------------------------------------------------------------
# AC_INIT_JAMFILE
# This rule let's config.status create a wrapper Jamfile in case configure
# has been invoked from a directory outside the source directory
#----------------------------------------------------------------------------
AC_DEFUN([AC_INIT_JAMFILE],
[AC_CONFIG_COMMANDS([Jamfile],
[AS_IF([test ! -f "${ac_top_builddir}Jamfile"],
[echo Installing Jamfile wrapper.
echo "# This file was automatically create by config.status" > Jamfile
echo "TOP ?= $ac_top_srcdir ;" >> Jamfile
echo "top_builddir ?= . ;" >> Jamfile
echo "include \$(TOP)/Jamfile ;" >> Jamfile])])])

View File

@ -0,0 +1,276 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd=$cpprog
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "$0: no input file specified" >&2
exit 1
else
:
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d "$dst" ]; then
instcmd=:
chmodcmd=""
else
instcmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f "$src" ] || [ -d "$src" ]
then
:
else
echo "$0: $src does not exist" >&2
exit 1
fi
if [ x"$dst" = x ]
then
echo "$0: no destination specified" >&2
exit 1
else
:
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d "$dst" ]
then
dst=$dst/`basename "$src"`
else
:
fi
fi
## this sed command emulates the dirname command
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS=$oIFS
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp=$pathcomp$1
shift
if [ ! -d "$pathcomp" ] ;
then
$mkdirprog "$pathcomp"
else
:
fi
pathcomp=$pathcomp/
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd "$dst" &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename "$dst"`
else
dstfile=`basename "$dst" $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename "$dst"`
else
:
fi
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/#inst.$$#
rmtmp=$dstdir/#rm.$$#
# Trap to clean up temp files at exit.
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
# Move or copy the file name to the temp name
$doit $instcmd "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
# Now remove or move aside any old file at destination location. We try this
# two ways since rm can't unlink itself on some systems and the destination
# file might be busy for other reasons. In this case, the final cleanup
# might fail but the new file should still install successfully.
{
if [ -f "$dstdir/$dstfile" ]
then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
{
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
fi &&
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit
}

View File

@ -0,0 +1,91 @@
#-----------------------------------------------------------------------------
# installdirs.m4 (c) Matze Braun <matze@braunis.de>
# Macros for outputing the installation paths which autoconf gathers into the
# Jamconfig file.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# AC_OUTPUT_INSTALLDIRS
# Transforms the installation dirs which are gathered by autoconf and sets
# properties in the Jamconfig file for them. We deal with stuff like
# variable references inside the paths (often the paths contain ${prefix})
# and with correct quoting here.
# The script will set the INSTALLDIR.PREFIX, INSTALLDIR.EXEC_PREFIX,
# INSTALLDIR.APPLICATION, INSTALLDIR.SBIN, INSTALLDIR.LIBEXEC,
# INSTALLDIR.DATA, INSTALLDIR.MAP, INSTALLDIR.CONFIG, INSTALLDIR.SHAREDSTATE
# INSTALLDIR.LOCALSTATE, INSTALLDIR.PLUGIN, INSTALLDIR.DOC
# INSTALLDIR.LIBRARY, INSTALLDIR.INCLUDE, INSTALLDIR.OLDINCLUDE,
# INSTALLDIR.INFO, INSTALLDIR.MAN
#-----------------------------------------------------------------------------
AC_DEFUN([AC_OUTPUT_INSTALLDIRS],[
# Handle the case when no prefix is given. And the special case when a path
# contains more than 2 slashes, these paths seem to be correct but jam fails
# on them.
AS_IF([test $prefix = NONE], [prefix="$ac_default_prefix"],
[prefix=`echo "$prefix" | sed -e 's:///*:/:g'`])
AS_IF([test $exec_prefix = NONE],
[exec_prefix="AS_ESCAPE([$(prefix)])"],
[exec_prefix=`echo "$exec_prefix" | sed -e 's:///*:/:g'`])
prefix=AC_FIX_VARIABLEREF([$prefix])
exec_prefix=AC_FIX_VARIABLEREF([$exec_prefix])
bindir=AC_FIX_VARIABLEREF([$bindir])
sbindir=AC_FIX_VARIABLEREF([$sbindir])
libexecdir=AC_FIX_VARIABLEREF([$libexecdir])
datadir=AC_FIX_VARIABLEREF([$datadir])
sysconfdir=AC_FIX_VARIABLEREF([$sysconfdir])
sharedstatedir=AC_FIX_VARIABLEREF([$sharedstatedir])
localstatedir=AC_FIX_VARIABLEREF([$localstatedir])
libdir=AC_FIX_VARIABLEREF([$libdir])
includedir=AC_FIX_VARIABLEREF([$includedir])
oldincludedir=AC_FIX_VARIABLEREF([$oldincludedir])
infodir=AC_FIX_VARIABLEREF([$infodir])
mandir=AC_FIX_VARIABLEREF([$mandir])
#hack to get the order right :-/ (autoconf --trace reports wrong order...)
AC_SUBST(prefix)
AC_SUBST(exec_prefix)
AC_SUBST(bindir)
AC_SUBST(sbindir)
AC_SUBST(libexecdir)
AC_SUBST(datadir)
AC_SUBST(sysconfdir)
AC_SUBST(sharedstatedir)
AC_SUBST(localstatedir)
AC_SUBST(libdir)
AC_SUBST(includedir)
AC_SUBST(oldincludedir)
AC_SUBST(infodir)
AC_SUBST(mandir)
])
#-----------------------------------------------------------------------------
# AC_FIX_INSTALL
# Fixes the output from AC_PROG_INSTALL
#-----------------------------------------------------------------------------
AC_DEFUN([AC_FIX_INSTALL], [
AC_REQUIRE([AC_PROG_INSTALL])
INSTALL=AC_FIX_VARIABLEREF([$INSTALL])
INSTALL_PROGRAM=AC_FIX_VARIABLEREF([$INSTALL_PROGRAM])
INSTALL_SCRIPT=AC_FIX_VARIABLEREF([$INSTALL_SCRIPT])
INSTALL_DATA=AC_FIX_VARIABLEREF([$INSTALL_DATA])
# fix for order...
AC_SUBST([INSTALL])
AC_SUBST([INSTALL_PROGRAM])
AC_SUBST([INSTALL_SCRIPT])
AC_SUBST([INSTALL_DATA])
])
#-----------------------------------------------------------------------------
# AC_PREPARE_INSTALLPATH
# Transform variables of the form ${bla} to $(bla) inside the string and
# correctly quotes backslashes.
# This is needed if you want to output some of the paths that autoconf
# creates to the Jamconfig file.
#-----------------------------------------------------------------------------
AC_DEFUN([AC_FIX_VARIABLEREF],
dnl We need all the strange \\\\ quoting here, because the command will be
dnl inserted into a "" block and sed needs quoting as well
[`echo "$1" | sed -e 's/\${\([[a-zA-Z_][a-zA-Z_]]*\)}/$(\1)/g' -e 's/\\\\/\\\\\\\\/g'`])

View File

@ -0,0 +1,112 @@
# lib-ld.m4 serial 3 (gettext-0.13)
dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl Subroutines of libtool.m4,
dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
dnl with libtool.m4.
dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
AC_DEFUN([AC_LIB_PROG_LD_GNU],
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
case `$LD -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
acl_cv_prog_gnu_ld=yes ;;
*)
acl_cv_prog_gnu_ld=no ;;
esac])
with_gnu_ld=$acl_cv_prog_gnu_ld
])
dnl From libtool-1.4. Sets the variable LD.
AC_DEFUN([AC_LIB_PROG_LD],
[AC_ARG_WITH(gnu-ld,
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
# Prepare PATH_SEPARATOR.
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by GCC])
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
*)
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
esac
case $ac_prog in
# Accept absolute paths.
[[\\/]* | [A-Za-z]:[\\/]*)]
[re_direlt='/[^/][^/]*/\.\./']
# Canonicalize the path of ld
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL(acl_cv_path_LD,
[if test -z "$LD"; then
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
acl_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
*GNU* | *'with BFD'*)
test "$with_gnu_ld" != no && break ;;
*)
test "$with_gnu_ld" != yes && break ;;
esac
fi
done
IFS="$ac_save_ifs"
else
acl_cv_path_LD="$LD" # Let the user override the test with a path.
fi])
LD="$acl_cv_path_LD"
if test -n "$LD"; then
AC_MSG_RESULT($LD)
else
AC_MSG_RESULT(no)
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_LIB_PROG_LD_GNU
])

View File

@ -0,0 +1,551 @@
# lib-link.m4 serial 4 (gettext-0.12)
dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl From Bruno Haible.
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
dnl the libraries corresponding to explicit and implicit dependencies.
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
dnl augments the CPPFLAGS variable.
AC_DEFUN([AC_LIB_LINKFLAGS],
[
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_RPATH])
define([Name],[translit([$1],[./-], [___])])
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
AC_LIB_LINKFLAGS_BODY([$1], [$2])
ac_cv_lib[]Name[]_libs="$LIB[]NAME"
ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
])
LIB[]NAME="$ac_cv_lib[]Name[]_libs"
LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
AC_SUBST([LIB]NAME)
AC_SUBST([LTLIB]NAME)
dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
dnl results of this search when this library appears as a dependency.
HAVE_LIB[]NAME=yes
undefine([Name])
undefine([NAME])
])
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
dnl searches for libname and the libraries corresponding to explicit and
dnl implicit dependencies, together with the specified include files and
dnl the ability to compile and link the specified testcode. If found, it
dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
[
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_RPATH])
define([Name],[translit([$1],[./-], [___])])
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
dnl accordingly.
AC_LIB_LINKFLAGS_BODY([$1], [$2])
dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
dnl because if the user has installed lib[]Name and not disabled its use
dnl via --without-lib[]Name-prefix, he wants to use it.
ac_save_CPPFLAGS="$CPPFLAGS"
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
ac_save_LIBS="$LIBS"
LIBS="$LIBS $LIB[]NAME"
AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
LIBS="$ac_save_LIBS"
])
if test "$ac_cv_lib[]Name" = yes; then
HAVE_LIB[]NAME=yes
AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
AC_MSG_CHECKING([how to link with lib[]$1])
AC_MSG_RESULT([$LIB[]NAME])
else
HAVE_LIB[]NAME=no
dnl If $LIB[]NAME didn't lead to a usable library, we don't need
dnl $INC[]NAME either.
CPPFLAGS="$ac_save_CPPFLAGS"
LIB[]NAME=
LTLIB[]NAME=
fi
AC_SUBST([HAVE_LIB]NAME)
AC_SUBST([LIB]NAME)
AC_SUBST([LTLIB]NAME)
undefine([Name])
undefine([NAME])
])
dnl Determine the platform dependent parameters needed to use rpath:
dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
dnl hardcode_direct, hardcode_minus_L.
AC_DEFUN([AC_LIB_RPATH],
[
AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
. ./conftest.sh
rm -f ./conftest.sh
acl_cv_rpath=done
])
wl="$acl_cv_wl"
libext="$acl_cv_libext"
shlibext="$acl_cv_shlibext"
hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
hardcode_direct="$acl_cv_hardcode_direct"
hardcode_minus_L="$acl_cv_hardcode_minus_L"
dnl Determine whether the user wants rpath handling at all.
AC_ARG_ENABLE(rpath,
[ --disable-rpath do not hardcode runtime library paths],
:, enable_rpath=yes)
])
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
dnl the libraries corresponding to explicit and implicit dependencies.
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
[
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
dnl By default, look in $includedir and $libdir.
use_additional=yes
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
])
AC_LIB_ARG_WITH([lib$1-prefix],
[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
--without-lib$1-prefix don't search for lib$1 in includedir and libdir],
[
if test "X$withval" = "Xno"; then
use_additional=no
else
if test "X$withval" = "X"; then
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
])
else
additional_includedir="$withval/include"
additional_libdir="$withval/lib"
fi
fi
])
dnl Search the library and its dependencies in $additional_libdir and
dnl $LDFLAGS. Using breadth-first-seach.
LIB[]NAME=
LTLIB[]NAME=
INC[]NAME=
rpathdirs=
ltrpathdirs=
names_already_handled=
names_next_round='$1 $2'
while test -n "$names_next_round"; do
names_this_round="$names_next_round"
names_next_round=
for name in $names_this_round; do
already_handled=
for n in $names_already_handled; do
if test "$n" = "$name"; then
already_handled=yes
break
fi
done
if test -z "$already_handled"; then
names_already_handled="$names_already_handled $name"
dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
dnl or AC_LIB_HAVE_LINKFLAGS call.
uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
eval value=\"\$HAVE_LIB$uppername\"
if test -n "$value"; then
if test "$value" = yes; then
eval value=\"\$LIB$uppername\"
test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
eval value=\"\$LTLIB$uppername\"
test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
else
dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
dnl that this library doesn't exist. So just drop it.
:
fi
else
dnl Search the library lib$name in $additional_libdir and $LDFLAGS
dnl and the already constructed $LIBNAME/$LTLIBNAME.
found_dir=
found_la=
found_so=
found_a=
if test $use_additional = yes; then
if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
found_dir="$additional_libdir"
found_so="$additional_libdir/lib$name.$shlibext"
if test -f "$additional_libdir/lib$name.la"; then
found_la="$additional_libdir/lib$name.la"
fi
else
if test -f "$additional_libdir/lib$name.$libext"; then
found_dir="$additional_libdir"
found_a="$additional_libdir/lib$name.$libext"
if test -f "$additional_libdir/lib$name.la"; then
found_la="$additional_libdir/lib$name.la"
fi
fi
fi
fi
if test "X$found_dir" = "X"; then
for x in $LDFLAGS $LTLIB[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
case "$x" in
-L*)
dir=`echo "X$x" | sed -e 's/^X-L//'`
if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
found_dir="$dir"
found_so="$dir/lib$name.$shlibext"
if test -f "$dir/lib$name.la"; then
found_la="$dir/lib$name.la"
fi
else
if test -f "$dir/lib$name.$libext"; then
found_dir="$dir"
found_a="$dir/lib$name.$libext"
if test -f "$dir/lib$name.la"; then
found_la="$dir/lib$name.la"
fi
fi
fi
;;
esac
if test "X$found_dir" != "X"; then
break
fi
done
fi
if test "X$found_dir" != "X"; then
dnl Found the library.
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
if test "X$found_so" != "X"; then
dnl Linking with a shared library. We attempt to hardcode its
dnl directory into the executable's runpath, unless it's the
dnl standard /usr/lib.
if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
dnl No hardcoding is needed.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
else
dnl Use an explicit option to hardcode DIR into the resulting
dnl binary.
dnl Potentially add DIR to ltrpathdirs.
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
haveit=
for x in $ltrpathdirs; do
if test "X$x" = "X$found_dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
ltrpathdirs="$ltrpathdirs $found_dir"
fi
dnl The hardcoding into $LIBNAME is system dependent.
if test "$hardcode_direct" = yes; then
dnl Using DIR/libNAME.so during linking hardcodes DIR into the
dnl resulting binary.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
else
if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
dnl Use an explicit option to hardcode DIR into the resulting
dnl binary.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
dnl Potentially add DIR to rpathdirs.
dnl The rpathdirs will be appended to $LIBNAME at the end.
haveit=
for x in $rpathdirs; do
if test "X$x" = "X$found_dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
rpathdirs="$rpathdirs $found_dir"
fi
else
dnl Rely on "-L$found_dir".
dnl But don't add it if it's already contained in the LDFLAGS
dnl or the already constructed $LIBNAME
haveit=
for x in $LDFLAGS $LIB[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-L$found_dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
fi
if test "$hardcode_minus_L" != no; then
dnl FIXME: Not sure whether we should use
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
dnl here.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
else
dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
dnl here, because this doesn't fit in flags passed to the
dnl compiler. So give up. No hardcoding. This affects only
dnl very old systems.
dnl FIXME: Not sure whether we should use
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
dnl here.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
fi
fi
fi
fi
else
if test "X$found_a" != "X"; then
dnl Linking with a static library.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
else
dnl We shouldn't come here, but anyway it's good to have a
dnl fallback.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
fi
fi
dnl Assume the include files are nearby.
additional_includedir=
case "$found_dir" in
*/lib | */lib/)
basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
additional_includedir="$basedir/include"
;;
esac
if test "X$additional_includedir" != "X"; then
dnl Potentially add $additional_includedir to $INCNAME.
dnl But don't add it
dnl 1. if it's the standard /usr/include,
dnl 2. if it's /usr/local/include and we are using GCC on Linux,
dnl 3. if it's already present in $CPPFLAGS or the already
dnl constructed $INCNAME,
dnl 4. if it doesn't exist as a directory.
if test "X$additional_includedir" != "X/usr/include"; then
haveit=
if test "X$additional_includedir" = "X/usr/local/include"; then
if test -n "$GCC"; then
case $host_os in
linux*) haveit=yes;;
esac
fi
fi
if test -z "$haveit"; then
for x in $CPPFLAGS $INC[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-I$additional_includedir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test -d "$additional_includedir"; then
dnl Really add $additional_includedir to $INCNAME.
INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
fi
fi
fi
fi
fi
dnl Look for dependencies.
if test -n "$found_la"; then
dnl Read the .la file. It defines the variables
dnl dlname, library_names, old_library, dependency_libs, current,
dnl age, revision, installed, dlopen, dlpreopen, libdir.
save_libdir="$libdir"
case "$found_la" in
*/* | *\\*) . "$found_la" ;;
*) . "./$found_la" ;;
esac
libdir="$save_libdir"
dnl We use only dependency_libs.
for dep in $dependency_libs; do
case "$dep" in
-L*)
additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
dnl But don't add it
dnl 1. if it's the standard /usr/lib,
dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
dnl 3. if it's already present in $LDFLAGS or the already
dnl constructed $LIBNAME,
dnl 4. if it doesn't exist as a directory.
if test "X$additional_libdir" != "X/usr/lib"; then
haveit=
if test "X$additional_libdir" = "X/usr/local/lib"; then
if test -n "$GCC"; then
case $host_os in
linux*) haveit=yes;;
esac
fi
fi
if test -z "$haveit"; then
haveit=
for x in $LDFLAGS $LIB[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-L$additional_libdir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test -d "$additional_libdir"; then
dnl Really add $additional_libdir to $LIBNAME.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
fi
fi
haveit=
for x in $LDFLAGS $LTLIB[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-L$additional_libdir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test -d "$additional_libdir"; then
dnl Really add $additional_libdir to $LTLIBNAME.
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
fi
fi
fi
fi
;;
-R*)
dir=`echo "X$dep" | sed -e 's/^X-R//'`
if test "$enable_rpath" != no; then
dnl Potentially add DIR to rpathdirs.
dnl The rpathdirs will be appended to $LIBNAME at the end.
haveit=
for x in $rpathdirs; do
if test "X$x" = "X$dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
rpathdirs="$rpathdirs $dir"
fi
dnl Potentially add DIR to ltrpathdirs.
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
haveit=
for x in $ltrpathdirs; do
if test "X$x" = "X$dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
ltrpathdirs="$ltrpathdirs $dir"
fi
fi
;;
-l*)
dnl Handle this in the next round.
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
;;
*.la)
dnl Handle this in the next round. Throw away the .la's
dnl directory; it is already contained in a preceding -L
dnl option.
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
;;
*)
dnl Most likely an immediate library name.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
;;
esac
done
fi
else
dnl Didn't find the library; assume it is in the system directories
dnl known to the linker and runtime loader. (All the system
dnl directories known to the linker should also be known to the
dnl runtime loader, otherwise the system is severely misconfigured.)
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
fi
fi
fi
done
done
if test "X$rpathdirs" != "X"; then
if test -n "$hardcode_libdir_separator"; then
dnl Weird platform: only the last -rpath option counts, the user must
dnl pass all path elements in one option. We can arrange that for a
dnl single library, but not when more than one $LIBNAMEs are used.
alldirs=
for found_dir in $rpathdirs; do
alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
done
dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
acl_save_libdir="$libdir"
libdir="$alldirs"
eval flag=\"$hardcode_libdir_flag_spec\"
libdir="$acl_save_libdir"
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
else
dnl The -rpath options are cumulative.
for found_dir in $rpathdirs; do
acl_save_libdir="$libdir"
libdir="$found_dir"
eval flag=\"$hardcode_libdir_flag_spec\"
libdir="$acl_save_libdir"
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
done
fi
fi
if test "X$ltrpathdirs" != "X"; then
dnl When using libtool, the option that works for both libraries and
dnl executables is -R. The -R options are cumulative.
for found_dir in $ltrpathdirs; do
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
done
fi
])
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
dnl unless already present in VAR.
dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
dnl contains two or three consecutive elements that belong together.
AC_DEFUN([AC_LIB_APPENDTOVAR],
[
for element in [$2]; do
haveit=
for x in $[$1]; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X$element"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
[$1]="${[$1]}${[$1]:+ }$element"
fi
done
])

View File

@ -0,0 +1,155 @@
# lib-prefix.m4 serial 3 (gettext-0.13)
dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl From Bruno Haible.
dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
dnl require excessive bracketing.
ifdef([AC_HELP_STRING],
[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
dnl to access previously installed libraries. The basic assumption is that
dnl a user will want packages to use other packages he previously installed
dnl with the same --prefix option.
dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
dnl libraries, but is otherwise very convenient.
AC_DEFUN([AC_LIB_PREFIX],
[
AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
dnl By default, look in $includedir and $libdir.
use_additional=yes
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
])
AC_LIB_ARG_WITH([lib-prefix],
[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
--without-lib-prefix don't search for libraries in includedir and libdir],
[
if test "X$withval" = "Xno"; then
use_additional=no
else
if test "X$withval" = "X"; then
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
])
else
additional_includedir="$withval/include"
additional_libdir="$withval/lib"
fi
fi
])
if test $use_additional = yes; then
dnl Potentially add $additional_includedir to $CPPFLAGS.
dnl But don't add it
dnl 1. if it's the standard /usr/include,
dnl 2. if it's already present in $CPPFLAGS,
dnl 3. if it's /usr/local/include and we are using GCC on Linux,
dnl 4. if it doesn't exist as a directory.
if test "X$additional_includedir" != "X/usr/include"; then
haveit=
for x in $CPPFLAGS; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-I$additional_includedir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test "X$additional_includedir" = "X/usr/local/include"; then
if test -n "$GCC"; then
case $host_os in
linux*) haveit=yes;;
esac
fi
fi
if test -z "$haveit"; then
if test -d "$additional_includedir"; then
dnl Really add $additional_includedir to $CPPFLAGS.
CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
fi
fi
fi
fi
dnl Potentially add $additional_libdir to $LDFLAGS.
dnl But don't add it
dnl 1. if it's the standard /usr/lib,
dnl 2. if it's already present in $LDFLAGS,
dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
dnl 4. if it doesn't exist as a directory.
if test "X$additional_libdir" != "X/usr/lib"; then
haveit=
for x in $LDFLAGS; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-L$additional_libdir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test "X$additional_libdir" = "X/usr/local/lib"; then
if test -n "$GCC"; then
case $host_os in
linux*) haveit=yes;;
esac
fi
fi
if test -z "$haveit"; then
if test -d "$additional_libdir"; then
dnl Really add $additional_libdir to $LDFLAGS.
LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
fi
fi
fi
fi
fi
])
dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
dnl acl_final_exec_prefix, containing the values to which $prefix and
dnl $exec_prefix will expand at the end of the configure script.
AC_DEFUN([AC_LIB_PREPARE_PREFIX],
[
dnl Unfortunately, prefix and exec_prefix get only finally determined
dnl at the end of configure.
if test "X$prefix" = "XNONE"; then
acl_final_prefix="$ac_default_prefix"
else
acl_final_prefix="$prefix"
fi
if test "X$exec_prefix" = "XNONE"; then
acl_final_exec_prefix='${prefix}'
else
acl_final_exec_prefix="$exec_prefix"
fi
acl_save_prefix="$prefix"
prefix="$acl_final_prefix"
eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
prefix="$acl_save_prefix"
])
dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
dnl variables prefix and exec_prefix bound to the values they will have
dnl at the end of the configure script.
AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
[
acl_save_prefix="$prefix"
prefix="$acl_final_prefix"
acl_save_exec_prefix="$exec_prefix"
exec_prefix="$acl_final_exec_prefix"
$1
exec_prefix="$acl_save_exec_prefix"
prefix="$acl_save_prefix"
])

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,51 @@
# NP_FINDLIB(VARNAME, NAME, STRING, TESTAPP, CFLAGS, LIBS, ACTION_IF_FOUND,
# ACTION_IF_NOT_FOUND, EXTRACFLAGS, EXTRALIBS)
AC_DEFUN([NP_FINDLIB], [
AC_ARG_WITH([lib$2], [AC_HELP_STRING([--with-lib$2=dir],
[specify location of lib$2 if not detected automatically; uses
dir, dir/include and dir/lib])])
save_CFLAGS="$CFLAGS"
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
RESCFLAGS="$5"
RESLIBS="$6"
CFLAGS="$CFLAGS $5 $9"
CPPFLAGS="$CPPFLAGS $5 $9"
LIBS="$LIBS $6 $10"
AS_IF([test -n "$with_lib$2"], [
CFLAGS="-I$with_lib$2/include $CFLAGS"
CPPFLAGS="-I$with_lib$2/include $CPPFLAGS"
LIBS="-L$with_lib$2/lib $LIBS"
RESCFLAGS="-I$with_lib$2/include $RESCFLAGS"
RESLIBS="-L$with_lib$2/lib $RESLIBS"
])
AC_MSG_CHECKING([for $3])
AC_LINK_IFELSE([$4], [buildok=yes], [buildok=no])
LIBS=$save_LIBS
CPPFLAGS=$save_CPPFLAGS
CFLAGS=$save_CFLAGS
AS_IF([test $buildok = yes],
[AC_MSG_RESULT([found])
$1_AVAILABLE=yes
$1_CFLAGS="$RESCFLAGS"
$1_LIBS="$RESLIBS"],
[AC_MSG_RESULT([not found])
$1_AVAILABLE=no
$1_CFLAGS=""
$1_LIBS=""])
AC_SUBST([$1_AVAILABLE])
AC_SUBST([$1_CFLAGS])
AC_SUBST([$1_LIBS])
AS_IF([test $buildok = yes],
[ifelse([$7], , :, [$7])],
[ifelse([$8], , :, [$8])])
])

View File

@ -0,0 +1,13 @@
# NP_LANG_PROGRAM, custom version of AC_LANG_PROGRAM (because SDL on win32
# NEEDS main(int argc, char** argv)
AC_DEFUN([NP_LANG_PROGRAM],
[$1
m4_ifdef([_AC_LANG_PROGRAM_C_F77_HOOKS], [_AC_LANG_PROGRAM_C_F77_HOOKS])[]dnl
int
main(int argc, char** argv)
{
$2
;
return 0;
}
])

103
mk/linux/mk/autoconf/ogg.m4 Normal file
View File

@ -0,0 +1,103 @@
# Configure paths for libogg
# Jack Moffitt <jack@icecast.org> 10-21-2000
# Shamelessly stolen from Owen Taylor and Manish Singh
dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
dnl
AC_DEFUN([XIPH_PATH_OGG],
[dnl
dnl Get the cflags and libraries
dnl
AC_ARG_WITH(ogg,[ --with-ogg=PFX Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
AC_ARG_WITH(ogg-libraries,[ --with-ogg-libraries=DIR
Directory where libogg library is installed (optional)], ogg_libraries="$withval", ogg_libraries="")
AC_ARG_WITH(ogg-includes,[ --with-ogg-includes=DIR Directory where libogg header files are installed (optional)], ogg_includes="$withval", ogg_includes="")
AC_ARG_ENABLE(oggtest, [ --disable-oggtest Do not try to compile and run a test Ogg program],, enable_oggtest=yes)
if test "x$ogg_libraries" != "x" ; then
OGG_LIBS="-L$ogg_libraries"
elif test "x$ogg_prefix" != "x" ; then
OGG_LIBS="-L$ogg_prefix/lib"
elif test "x$prefix" != "xNONE" ; then
OGG_LIBS="-L$prefix/lib"
fi
OGG_LIBS="$OGG_LIBS -logg"
if test "x$ogg_includes" != "x" ; then
OGG_CFLAGS="-I$ogg_includes"
elif test "x$ogg_prefix" != "x" ; then
OGG_CFLAGS="-I$ogg_prefix/include"
elif test "x$prefix" != "xNONE"; then
OGG_CFLAGS="-I$prefix/include"
fi
AC_MSG_CHECKING(for Ogg)
no_ogg=""
if test "x$enable_oggtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $OGG_CFLAGS"
LIBS="$LIBS $OGG_LIBS"
dnl
dnl Now check if the installed Ogg is sufficiently new.
dnl
rm -f conf.oggtest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ogg/ogg.h>
int main ()
{
system("touch conf.oggtest");
return 0;
}
],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
if test "x$no_ogg" = "x" ; then
AC_MSG_RESULT(yes)
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
if test -f conf.oggtest ; then
:
else
echo "*** Could not run Ogg test program, checking why..."
CFLAGS="$CFLAGS $OGG_CFLAGS"
LIBS="$LIBS $OGG_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <ogg/ogg.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding Ogg or finding the wrong"
echo "*** version of Ogg. If it is not finding Ogg, 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 Ogg was incorrectly installed"
echo "*** or that you have moved Ogg since it was installed." ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
OGG_CFLAGS=""
OGG_LIBS=""
ifelse([$2], , :, [$2])
fi
AC_SUBST(OGG_CFLAGS)
AC_SUBST(OGG_LIBS)
rm -f conf.oggtest
])

View File

@ -0,0 +1,57 @@
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
dnl also defines GSTUFF_PKG_ERRORS on error
AC_DEFUN([PKG_CHECK_MODULES], [
succeeded=no
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test "$PKG_CONFIG" = "no" ; then
echo "*** The pkg-config script could not be found. Make sure it is"
echo "*** in your path, or set the PKG_CONFIG environment variable"
echo "*** to the full path to pkg-config."
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
AC_MSG_CHECKING(for $2)
if $PKG_CONFIG --exists "$2" ; then
AC_MSG_RESULT(yes)
succeeded=yes
AC_MSG_CHECKING($1_CFLAGS)
$1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
AC_MSG_RESULT($$1_CFLAGS)
AC_MSG_CHECKING($1_LIBS)
$1_LIBS=`$PKG_CONFIG --libs "$2"`
AC_MSG_RESULT($$1_LIBS)
else
$1_CFLAGS=""
$1_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
$1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
ifelse([$4], ,echo $$1_PKG_ERRORS,)
fi
AC_SUBST($1_CFLAGS)
AC_SUBST($1_LIBS)
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
if test $succeeded = yes; then
ifelse([$3], , :, [$3])
else
ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
fi
])

176
mk/linux/mk/autoconf/sdl.m4 Normal file
View File

@ -0,0 +1,176 @@
# 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
AC_REQUIRE([AC_CANONICAL_TARGET])
PATH="$prefix/bin:$prefix/usr/bin:$PATH"
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_LIBS="$LIBS"
CFLAGS="$CFLAGS $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"
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"
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"
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
])

View File

@ -0,0 +1,124 @@
# Configure paths for libvorbis
# Jack Moffitt <jack@icecast.org> 10-21-2000
# Shamelessly stolen from Owen Taylor and Manish Singh
# thomasvs added check for vorbis_bitrate_addblock which is new in rc3
dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
dnl
AC_DEFUN([XIPH_PATH_VORBIS],
[dnl
dnl Get the cflags and libraries
dnl
AC_ARG_WITH(vorbis,[ --with-vorbis=PFX Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
AC_ARG_WITH(vorbis-libraries,[ --with-vorbis-libraries=DIR
Directory where libvorbis library is installed (optional)], vorbis_libraries="$withval", vorbis_libraries="")
AC_ARG_WITH(vorbis-includes,[ --with-vorbis-includes=DIR
Directory where libvorbis header files are installed (optional)], vorbis_includes="$withval", vorbis_includes="")
AC_ARG_ENABLE(vorbistest, [ --disable-vorbistest Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
if test "x$vorbis_libraries" != "x" ; then
VORBIS_LIBS="-L$vorbis_libraries"
elif test "x$vorbis_prefix" != "x" ; then
VORBIS_LIBS="-L$vorbis_prefix/lib"
elif test "x$prefix" != "xNONE"; then
VORBIS_LIBS="-L$prefix/lib"
fi
VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
VORBISFILE_LIBS="-lvorbisfile"
VORBISENC_LIBS="-lvorbisenc"
if test "x$vorbis_includes" != "x" ; then
VORBIS_CFLAGS="-I$vorbis_includes"
elif test "x$vorbis_prefix" != "x" ; then
VORBIS_CFLAGS="-I$vorbis_prefix/include"
elif test "x$prefix" != "xNONE"; then
VORBIS_CFLAGS="-I$prefix/include"
fi
AC_MSG_CHECKING(for Vorbis)
no_vorbis=""
if test "x$enable_vorbistest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
LIBS="$LIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
dnl
dnl Now check if the installed Vorbis is sufficiently new.
dnl
rm -f conf.vorbistest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vorbis/codec.h>
#include <vorbis/vorbisenc.h>
int main ()
{
vorbis_block vb;
vorbis_dsp_state vd;
vorbis_info vi;
vorbis_info_init (&vi);
vorbis_encode_init (&vi, 2, 44100, -1, 128000, -1);
vorbis_analysis_init (&vd, &vi);
vorbis_block_init (&vd, &vb);
/* this function was added in 1.0rc3, so this is what we're testing for */
vorbis_bitrate_addblock (&vb);
system("touch conf.vorbistest");
return 0;
}
],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
if test "x$no_vorbis" = "x" ; then
AC_MSG_RESULT(yes)
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
if test -f conf.vorbistest ; then
:
else
echo "*** Could not run Vorbis test program, checking why..."
CFLAGS="$CFLAGS $VORBIS_CFLAGS"
LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <vorbis/codec.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
echo "*** version of Vorbis. If it is not finding Vorbis, 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 Vorbis was incorrectly installed"
echo "*** or that you have moved Vorbis since it was installed." ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
VORBIS_CFLAGS=""
VORBIS_LIBS=""
VORBISFILE_LIBS=""
VORBISENC_LIBS=""
ifelse([$2], , :, [$2])
fi
AC_SUBST(VORBIS_CFLAGS)
AC_SUBST(VORBIS_LIBS)
AC_SUBST(VORBISFILE_LIBS)
AC_SUBST(VORBISENC_LIBS)
rm -f conf.vorbistest
])

View File

@ -0,0 +1,336 @@
dnl ---------------------------------------------------------------------------
dnl Macros for wxWidgets detection. Typically used in configure.in as:
dnl
dnl AC_ARG_ENABLE(...)
dnl AC_ARG_WITH(...)
dnl ...
dnl AM_OPTIONS_WXCONFIG
dnl ...
dnl ...
dnl AM_PATH_WXCONFIG(2.6.0, wxWin=1)
dnl if test "$wxWin" != 1; then
dnl AC_MSG_ERROR([
dnl wxWidgets must be installed on your system
dnl but wx-config script couldn't be found.
dnl
dnl Please check that wx-config is in path, the directory
dnl where wxWidgets libraries are installed (returned by
dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
dnl equivalent variable and wxWidgets version is 2.3.4 or above.
dnl ])
dnl fi
dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
dnl
dnl LIBS="$LIBS $WX_LIBS"
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl AM_OPTIONS_WXCONFIG
dnl
dnl adds support for --wx-prefix, --wx-exec-prefix, --with-wxdir and
dnl --wx-config command line options
dnl ---------------------------------------------------------------------------
AC_DEFUN([AM_OPTIONS_WXCONFIG],
[
AC_ARG_WITH(wxdir,
[ --with-wxdir=PATH Use uninstalled version of wxWidgets in PATH],
[ wx_config_name="$withval/wx-config"
wx_config_args="--inplace"])
AC_ARG_WITH(wx-config,
[ --with-wx-config=CONFIG wx-config script to use (optional)],
wx_config_name="$withval" )
AC_ARG_WITH(wx-prefix,
[ --with-wx-prefix=PREFIX Prefix where wxWidgets is installed (optional)],
wx_config_prefix="$withval", wx_config_prefix="")
AC_ARG_WITH(wx-exec-prefix,
[ --with-wx-exec-prefix=PREFIX
Exec prefix where wxWidgets is installed (optional)],
wx_config_exec_prefix="$withval", wx_config_exec_prefix="")
])
dnl Helper macro for checking if wx version is at least $1.$2.$3, set's
dnl wx_ver_ok=yes if it is:
AC_DEFUN([_WX_PRIVATE_CHECK_VERSION],
[
wx_ver_ok=""
if test "x$WX_VERSION" != x ; then
if test $wx_config_major_version -gt $1; then
wx_ver_ok=yes
else
if test $wx_config_major_version -eq $1; then
if test $wx_config_minor_version -gt $2; then
wx_ver_ok=yes
else
if test $wx_config_minor_version -eq $2; then
if test $wx_config_micro_version -ge $3; then
wx_ver_ok=yes
fi
fi
fi
fi
fi
fi
])
dnl ---------------------------------------------------------------------------
dnl AM_PATH_WXCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
dnl [, WX-LIBS [, ADDITIONAL-WX-CONFIG-FLAGS]]]])
dnl
dnl Test for wxWidgets, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC
dnl (the latter is for static linking against wxWidgets). Set WX_CONFIG_NAME
dnl environment variable to override the default name of the wx-config script
dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this
dnl case the macro won't even waste time on tests for its existence.
dnl
dnl Optional WX-LIBS argument contains comma- or space-separated list of
dnl wxWidgets libraries to link against (it may include contrib libraries). If
dnl it is not specified then WX_LIBS and WX_LIBS_STATIC will contain flags to
dnl link with all of the core wxWidgets libraries.
dnl
dnl Optional ADDITIONAL-WX-CONFIG-FLAGS argument is appended to wx-config
dnl invocation command in present. It can be used to fine-tune lookup of
dnl best wxWidgets build available.
dnl
dnl Example use:
dnl AM_PATH_WXCONFIG([2.6.0], [wxWin=1], [wxWin=0], [html,core,net]
dnl [--unicode --debug])
dnl ---------------------------------------------------------------------------
dnl
dnl Get the cflags and libraries from the wx-config script
dnl
AC_DEFUN([AM_PATH_WXCONFIG],
[
dnl do we have wx-config name: it can be wx-config or wxd-config or ...
if test x${WX_CONFIG_NAME+set} != xset ; then
WX_CONFIG_NAME=wx-config
fi
if test "x$wx_config_name" != x ; then
WX_CONFIG_NAME="$wx_config_name"
fi
dnl deal with optional prefixes
if test x$wx_config_exec_prefix != x ; then
wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix"
WX_LOOKUP_PATH="$wx_config_exec_prefix/bin"
fi
if test x$wx_config_prefix != x ; then
wx_config_args="$wx_config_args --prefix=$wx_config_prefix"
WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin"
fi
if test "$cross_compiling" = "yes"; then
wx_config_args="$wx_config_args --host=$host_alias"
fi
dnl don't search the PATH if WX_CONFIG_NAME is absolute filename
if test -x "$WX_CONFIG_NAME" ; then
AC_MSG_CHECKING(for wx-config)
WX_CONFIG_PATH="$WX_CONFIG_NAME"
AC_MSG_RESULT($WX_CONFIG_PATH)
else
AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH")
fi
if test "$WX_CONFIG_PATH" != "no" ; then
WX_VERSION=""
min_wx_version=ifelse([$1], ,2.2.1,$1)
if test -z "$5" ; then
AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version])
else
AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version ($5)])
fi
WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args $5 $4"
WX_VERSION=`$WX_CONFIG_PATH --version 2>/dev/null`
wx_config_major_version=`echo $WX_VERSION | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
wx_config_minor_version=`echo $WX_VERSION | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
wx_config_micro_version=`echo $WX_VERSION | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
wx_requested_major_version=`echo $min_wx_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
wx_requested_minor_version=`echo $min_wx_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
wx_requested_micro_version=`echo $min_wx_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
_WX_PRIVATE_CHECK_VERSION([$wx_requested_major_version],
[$wx_requested_minor_version],
[$wx_requested_micro_version])
if test -n "$wx_ver_ok"; then
AC_MSG_RESULT(yes (version $WX_VERSION))
WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs`
dnl starting with version 2.2.6 wx-config has --cppflags argument
wx_has_cppflags=""
if test $wx_config_major_version -gt 2; then
wx_has_cppflags=yes
else
if test $wx_config_major_version -eq 2; then
if test $wx_config_minor_version -gt 2; then
wx_has_cppflags=yes
else
if test $wx_config_minor_version -eq 2; then
if test $wx_config_micro_version -ge 6; then
wx_has_cppflags=yes
fi
fi
fi
fi
fi
if test "x$wx_has_cppflags" = x ; then
dnl no choice but to define all flags like CFLAGS
WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
WX_CPPFLAGS=$WX_CFLAGS
WX_CXXFLAGS=$WX_CFLAGS
WX_CFLAGS_ONLY=$WX_CFLAGS
WX_CXXFLAGS_ONLY=$WX_CFLAGS
else
dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS
WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags`
WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags`
WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
dnl WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"`
dnl WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"`
fi
dnl we don't need no \n in the flags
WX_CFLAGS=`echo $WX_CFLAGS`
WX_CPPFLAGS=`echo $WX_CPPFLAGS`
WX_CXXFLAGS=`echo $WX_CXXFLAGS`
WX_LIBS=`echo $WX_LIBS`
ifelse([$2], , :, [$2])
else
if test "x$WX_VERSION" = x; then
dnl no wx-config at all
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(no (version $WX_VERSION is not new enough))
fi
WX_CFLAGS=""
WX_CPPFLAGS=""
WX_CXXFLAGS=""
WX_LIBS=""
ifelse([$3], , :, [$3])
fi
else
WX_CFLAGS=""
WX_CPPFLAGS=""
WX_CXXFLAGS=""
WX_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(WX_CPPFLAGS)
AC_SUBST(WX_CFLAGS)
AC_SUBST(WX_CXXFLAGS)
AC_SUBST(WX_CFLAGS_ONLY)
AC_SUBST(WX_CXXFLAGS_ONLY)
AC_SUBST(WX_LIBS)
AC_SUBST(WX_VERSION)
])
dnl ---------------------------------------------------------------------------
dnl Get information on the wxrc program for making C++, Python and xrs
dnl resource files.
dnl
dnl AC_ARG_ENABLE(...)
dnl AC_ARG_WITH(...)
dnl ...
dnl AM_OPTIONS_WXCONFIG
dnl AM_OPTIONS_WXRC
dnl ...
dnl AM_PATH_WXCONFIG(2.6.0, wxWin=1)
dnl if test "$wxWin" != 1; then
dnl AC_MSG_ERROR([
dnl wxWidgets must be installed on your system
dnl but wx-config script couldn't be found.
dnl
dnl Please check that wx-config is in path, the directory
dnl where wxWidgets libraries are installed (returned by
dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
dnl equivalent variable and wxWidgets version is 2.6.0 or above.
dnl ])
dnl fi
dnl
dnl AM_PATH_WXRC([HAVE_WXRC=1], [HAVE_WXRC=0])
dnl if test "x$HAVE_WXRC" != x1; then
dnl AC_MSG_ERROR([
dnl The wxrc program was not installed or not found.
dnl
dnl Please check the wxWidgets installation.
dnl ])
dnl fi
dnl
dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
dnl
dnl LDFLAGS="$LDFLAGS $WX_LIBS"
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl AM_PATH_WXRC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Test for wxWidgets' wxrc program for creating either C++, Python or XRS
dnl resources. The variable WXRC will be set and substituted in the configure
dnl script and Makefiles.
dnl
dnl Example use:
dnl AM_PATH_WXRC([wxrc=1], [wxrc=0])
dnl ---------------------------------------------------------------------------
dnl
dnl wxrc program from the wx-config script
dnl
AC_DEFUN([AM_PATH_WXRC],
[
AC_ARG_VAR([WXRC], [Path to wxWidget's wxrc resource compiler])
if test "x$WX_CONFIG_NAME" = x; then
AC_MSG_ERROR([The wxrc tests must run after wxWidgets test.])
else
AC_MSG_CHECKING([for wxrc])
if test "x$WXRC" = x ; then
dnl wx-config --utility is a new addition to wxWidgets:
_WX_PRIVATE_CHECK_VERSION(2,5,3)
if test -n "$wx_ver_ok"; then
WXRC=`$WX_CONFIG_WITH_ARGS --utility=wxrc`
fi
fi
if test "x$WXRC" = x ; then
AC_MSG_RESULT([not found])
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT([$WXRC])
ifelse([$1], , :, [$1])
fi
AC_SUBST(WXRC)
fi
])

View File

@ -0,0 +1,94 @@
#============================================================================
# Rules for compiling applications
#============================================================================
## Application appname : sources [ : options ]
## Build an application out of sourcefiles. All sourcefiles will be passed
## to the Objects rule which tries to compile them into object-files. You
## can create rules for your own filetypes with the UserObject rule. Header
## files will just be ignored. They are only used for MSVC projectfile
## generation.
## Possible options are "noinstall" if you don't want a default install
## target to be created and "console" if you're building a console
## application (an application without any graphical output which is
## intended to be used on commandline)
## Some notes: You should not add the .exe extension to the appname - jam
## will do that on win32.
## If you have sourcefiles in subdirectories, then you'll need to use the
## SearchSubdir rule. Never specify sourcefiles with paths, only specify
## the filenames.
## Options:
## console: Create a console application
## noinstall: Don't setup a default installation target.
## independent: The target will not be made a dependency of the apps and
## all target.
rule Application
{
# check options
CheckOptions noinstall console independent : $(3) : $(<) ;
local target = [ ConstructApplicationTarget $(<) : $(3) ] ;
local sources = [ SearchSource $(>) ] ;
local objects = [ CompileObjects $(sources) ] ;
$(<)_TYPE = application ;
$(<)_OBJECTS = $(objects) ;
$(<)_SOURCES = $(sources) ;
$(<)_TARGET = $(target) ;
$(<)_OPTIONS = $(3) ;
$(<)_INSTALLTARGET = ;
# create target clean rule
Always $(<)clean ;
NotFile $(<)clean ;
Clean $(<)clean : $(objects) ; # create target clean rule
Depends clean : $(<)clean ;
# so 'jam foo' works when it's really foo.exe (Windows) or foo.app (MacOS/X)
if $(target) != $(<)
{
Depends $(<) : $(target) ;
NotFile $(<) ;
}
# make dependency on apps target
if ! [ IsElem independent : $(3) ]
{
Depends apps : $(<) ;
}
# construct Install target
if ! [ IsElem noinstall : $(3) ]
{
$(<)_INSTALLTARGET = [
DoInstall $(target) : $(bindir) : $(INSTALL_PROGRAM) : nopackage
] ;
Depends install_bin : $($(<)_INSTALLTARGET) ;
}
# Link
MakeLocate $(target) : $(LOCATE_TARGETS) ;
SystemLinkApplication $(<) : $(objects) : $(3) ;
# Import default flags
CppFlags $(<) : $(APPLICTION_CPPFLAGS) ;
CFlags $(<) : $(APPLICATION_CFLAGS) ;
C++Flags $(<) : $(APPLICATION_CXXFLAGS) ;
LFlags $(<) : $(APPLICATION_LIBS) ;
# Sources are part of the package
if ! [ IsElem nopackage : $(3) ]
{
Package $(sources) ;
}
return $(target) ;
}
#----------------------------------------------------------------------------
# private part
# Construct pseudo target apps
Depends all : apps ;
NotFile apps ;

View File

@ -0,0 +1,44 @@
# Clean rules for autoconf generated stuff
## Setup some stuff that makes usage of autoconf easier
rule UseAutoconf
{
# construct some clean targets
Clean distclean : config.log config.status config.cache aclocal.m4
Jamconfig config.h out.txt log.txt stamp-h1
libtool ;
CleanDir distclean : autom4te.cache out ;
Depends distclean : clean ;
Clean maintainer-clean : configure aclocal.m4 config.h.in Jamconfig.in ;
Depends maintainer-clean : distclean ;
Help clean : "Cleanup objectfiles and targets" ;
Help distclean : "Cleanup objectfiles and build configuration" ;
Help maintainer-clean :
"Cleanup all objectfiles, buildconfig and generated files." ;
Package autogen.sh configure.ac configure config.h.in
Jamrules Jamconfig.in ;
Package [ Wildcard mk/jam : *.jam ] [ Wildcard mk/autoconf : *.m4 ]
[ Wildcard mk/autoconf : config.* ]
mk/autoconf/install-sh ;
actions CheckNewer {
echo Error: $(>) is newer than $(<).
echo ""
echo You should rerun ./autogen.sh and ./configure
exit 1
}
rule CheckNewer {
Depends $(<) : $(>) ;
Depends all : $(<) ;
}
# Disabled for now because it often gives false alarm...
#configurefiles
# = configure.ac [ Wildcard mk/autoconf : *.m4 ] ;
# SEARCH on $(configurefiles) = $(top_srcdir) ;
# CheckNewer configure : $(configurefiles) ;
# CheckNewer Jamconfig : $(configurefiles) ;
}

View File

@ -0,0 +1,117 @@
#============================================================================
# Rules for flex and bison
#============================================================================
if $(LEX)
{
rule LexRule
{
local cfile = [ LocateTarget $(<:S=.c) ] ;
local object = [ CompileObjects $(cfile) ] ;
Lex $(cfile) : $(<) ;
return $(object) ;
}
RegisterFileType LexRule : .l ;
rule Lex++Rule
{
local cppfile = [ LocateTarget $(<:S=.cpp) ] ;
local object = [ CompileObjects $(cppfile) ] ;
Lex $(cppfile) : $(<) ;
return $(object) ;
}
RegisterFileType Flex++Rule : .ll ;
if $(COMPILER_TYPE) != "GCC"
{
# compilers like msvc don't like #line statements.
LEX_FLAGS += -L ;
}
rule Lex
{
Depends $(<) : $(>) ;
LEX_FLAGS on $(cfile) += $(LEX_FLAGS) ;
Clean clean : $(cfile) ;
}
# Use -t and output redirection to avoid flex choosing stupid names for it's
# output files.
actions Lex
{
$(LEX) -t $(LEX_FLAGS) $(>) > $(<)
}
}
if $(BISON)
{
rule BisonRule
{
local cfile = [ LocateTarget $(<:S=.c) ] ;
local headerfile = [ LocateTarget $(<:S=.h) ] ;
local object = [ CompileObjects $(cfile) ] ;
Includes $(headerfile:G=) : $(headerfile) ;
Bison $(cfile) $(headerfile) : $(<) ;
# work around jam warning about independent target
Includes $(cfile) : $(headerfile) ;
return $(object) ;
}
RegisterFileType BisonRule : .y ;
rule Bison++Rule
{
local cppfile = [ LocateTarget $(<:S=.cpp) ] ;
local headerfile = [ LocateTarget $(<:S=.hpp) ] ;
headerfile = $(headerfile:G=) ;
local object = [ CompileObjects $(cppfile) ] ;
# jams header file scannning doesn't use grist so we have to workaround this
# here
Includes $(headerfile:G=) : $(headerfile) ;
Bison $(cppfile) $(headerfile) : $(<) ;
Includes $(cppfile) : $(headerfile) ;
return $(object) ;
}
RegisterFileType Bison++Rule : .yy ;
rule Bison
{
Depends $(<) : $(>) ;
BISON_FLAGS on $(<) += $(BISON_FLAGS) ;
Clean clean : $(<) ;
}
rule BisonFlags
{
local target ;
if $(<:S) = .yy
{
target = [ LocateTarget $(<:S=.cpp) $(<:S=.hpp) ] ;
}
else
{
target = [ LocateTarget $(<:S=.c) $(<:S=.h) ] ;
}
BISON_FLAGS on $(target) += $(>) ;
}
if $(COMPILER_TYPE) != "GCC"
{
# compilers like msvc don't like #line statements.
BISON_FLAGS += --no-lines ;
}
actions Bison
{
$(BISON) -d $(BISON_FLAGS) -o $(<[1]) $(>)
}
}

51
mk/linux/mk/jam/build.jam Normal file
View File

@ -0,0 +1,51 @@
#============================================================================
# Main rules file - Includes all important rulefiles in correct order
#============================================================================
# enable if you want debug messages
JAM_DEBUG ?= 1 ;
jamrulesdir = $(TOP)/mk/jam ;
include $(jamrulesdir)/jamcompatibility.jam ;
include $(jamrulesdir)/helper.jam ;
include $(jamrulesdir)/subdir.jam ;
include $(jamrulesdir)/package.jam ;
include $(jamrulesdir)/variant.jam ;
include $(jamrulesdir)/resource.jam ;
include $(jamrulesdir)/help.jam ;
include $(jamrulesdir)/groups.jam ;
include $(jamrulesdir)/install.jam ;
include $(jamrulesdir)/clean.jam ;
include $(jamrulesdir)/objects.jam ;
include $(jamrulesdir)/compiler.jam ;
include $(jamrulesdir)/bisonflex.jam ;
include $(jamrulesdir)/autoconf.jam ;
include $(jamrulesdir)/flags.jam ;
include $(jamrulesdir)/libtool.jam ;
include $(jamrulesdir)/library.jam ;
include $(jamrulesdir)/application.jam ;
include $(jamrulesdir)/options.jam ;
# Include OS specific rules
switch $(target_os)
{
case cygwin* :
include $(jamrulesdir)/win32.jam ;
case mingw32* :
include $(jamrulesdir)/win32.jam ;
case apple-darwin :
include $(jamrulesdir)/macosx.jam ;
case linux-gnu :
include $(jamrulesdir)/unix.jam ;
case * :
include $(jamrulesdir)/unix.jam ;
}

21
mk/linux/mk/jam/clean.jam Normal file
View File

@ -0,0 +1,21 @@
#============================================================================
# Rules for cleaning build detritus.
#============================================================================
DELTREE ?= "rm -rf" ;
# CleanDir <tag> : <dir> ...
# Forcibly delete a set of directories, even if they are not empty.
# Tag is one of the standard targets used with the "Clean" rule, such as
# "clean" or "distclean".
rule CleanDir
{
Always $(<) ;
NotFile $(<) ;
NoCare $(>) ;
}
actions piecemeal together existing CleanDir
{
$(DELTREE) $(>)
}

View File

@ -0,0 +1,72 @@
#============================================================================
# Rules for C and C++ files
#============================================================================
if $(CC)
{
rule CcRule
{
local object ;
if [ IsElem shared : $(2) ]
{
object = [ LocateTarget $(<:S=.lo) ] ;
CC on $(object) = "$(LIBTOOL) --mode=compile $(CC)" ;
} else {
object = [ LocateTarget $(<:S=.o) ] ;
}
CFLAGS on $(object) = $(CFLAGS) ;
CPPFLAGS on $(object) = $(CPPFLAGS) ;
Cc $(object) : $(<) ;
Depends $(object) : $(<) ;
return $(object) ;
}
RegisterFileType CcRule : .c ;
RegisterHeaderRule HeaderRule : $(HDRPATTERN) : .c ;
actions Cc
{
$(CC) -c -o $(<) $(CPPFLAGS) $(CFLAGS) $(>)
}
} # end if $(CC)
if $(CXX)
{
rule C++Rule
{
local object ;
if [ IsElem shared : $(2) ] {
object = [ LocateTarget $(<:S=.lo) ] ;
CXX on $(object) = "$(LIBTOOL) --mode=compile $(CXX)" ;
} else {
object = [ LocateTarget $(<:S=.o) ] ;
}
CXXFLAGS on $(object) = $(CXXFLAGS) ;
CPPFLAGS on $(object) = $(CPPFLAGS) ;
C++ $(object) : $(<) ;
Depends $(object) : $(<) ;
return $(object) ;
}
RegisterFileType C++Rule : .cpp .cc .c++ ; # we can't register .C here because
# of windows being case-insensitive.
RegisterHeaderRule HeaderRule : $(HDRPATTERN) : .cpp .cc .c++ ;
actions C++
{
$(CXX) -c -o $(<) $(CPPFLAGS) $(CXXFLAGS) $(>)
}
} # end if $(CXX)
rule CreateIncludeFlags
{
return -I$(<) ;
}
rule CreateDefineFlags
{
return -D$(<) ;
}

172
mk/linux/mk/jam/flags.jam Normal file
View File

@ -0,0 +1,172 @@
#============================================================================
# Rules for specifying compiler and linker flags
#============================================================================
## LinkWith target : libs [ : options ]
## Link a target with libraries. The specified libraries should have
## build rules in the same project. For external libraries use the
## ExternalLibs rule. Specify the library names without any extensions or
## the leading "lib".
rule LinkWith
{
local i libs sharedlib ;
for i in $(>) {
if $($(i)_TYPE) = "library" {
if [ IsElem shared : $($(i)_OPTIONS) ] {
libs += $(i) ;
sharedlib = true ;
} else {
# for non shared libs add inherit the compile flags and libs
libs += $(i) $($(i)_LIBRARIES) ;
# inherit the exported flags
CppFlags $(<) : $($(i)_CPPFLAGS) : $(3) ;
CFlags $(<) : $($(i)_CFLAGS) : $(3) ;
C++Flags $(<) : $($(i)_CXXFLAGS) : $(3) ;
LFlags $(<) : $($(i)_LIBS) : $(3) ;
LdFlags $(<) : $($(i)_LDFLAGS) : $(3) ;
}
} else {
echo "WARNING: Trying to link" $(i)
"with" $(<) "which is not a library." ;
}
}
# resolve library dependencies
libs = [ RemoveDups $(libs) ] ;
$(<)_LIBRARIES = $(libs) ;
local libfiles ;
for i in $(libs) {
libfiles += $($(i)_TARGET) ;
}
DEPENDS $($(<)_TARGET) : $(libfiles) ;
NEEDLIBS on $($(<)_TARGET) += $(libfiles) ;
# the usual libtool hack...
if $(sharedlib) {
LINK on $($(<)_TARGET) = "$(LIBTOOL) $(LINK)" ;
INSTALL on $($(<)_INSTALLTARGET) = "$(LIBTOOL) --mode=install $(INSTALL)" ;
}
}
rule CppFlags
{
CPPFLAGS on $($(<)_OBJECTS) += $(>) ;
if [ IsElem export : $(3) ] {
$(<)_CPPFLAGS = $(>) ;
}
}
## CFlags target : flags [ : options ]
## Sets cflags on all sourcefiles of a target
## This rule affects c++ and c compiler flags. Options:
## export - export the cflags to dependent targets (for example in
## a library context this will inherit the cflags to the apps using
## the library)
rule CFlags
{
CFLAGS on $($(<)_OBJECTS) += $(>) ;
if [ IsElem export : $(3) ] {
$(<)_CFLAGS = $(>) ;
}
}
rule C++Flags
{
CXXFLAGS on $($(<)_OBJECTS) += $(>) ;
if [ IsElem export : $(3) ] {
$(<)_CXXFLAGS = $(>) ;
}
}
## LFlags target : flags [ : options ]
## Sets linker flags for a library, plugin or application target
rule LFlags
{
LIBS on $($(<)_TARGET) += $(>) ;
if [ IsElem export : $(3) ] {
$(<)_LIBS = $(>) ;
}
}
rule LdFlags
{
LDFLAGS on $($(<)_TARGET) += $(>) ;
if [ IsElem export : $(3) ] {
$(<)_LDFLAGS = $(>) ;
}
}
## ExternalLibs appname : packages [ : options ]
## Link an application/library/plugin with external libraries. This mainly
## takes $(package)_CFLAGS and $(package)_LIBS and appends them to the target
## specific CPPFLAGS/LIBS.
rule ExternalLibs
{
local i ;
for i in $(>)
{
# Hack: most autoconf macros only define CFLAGS and not CPPFLAGS and
# CXXFLAGS so we import the CFLAGS to CPPFLAGS which makes them
# shared between C and C++ compiler
CppFlags $(<) : $($(i)_CFLAGS) : $(3) ;
LFlags $(<) : $($(i)_LIBS) : $(3) ;
}
}
## ExtraObjects target : objectfiles
## Link additional object files with a target
rule ExtraObjects
{
EXTRAOBJECTS on $($(<)_TARGET) += $(>) ;
Depends $($(<)_TARGET) : $(>) ;
Clean $(<)clean : $(>) ;
Clean clean : $(>) ;
}
## IncludeDir [target : ] directories
## Description: Is used to specify the location of header files for a
## target or the whole project if no target is given.
## This rule will automatically generate the -I compiler flags and makes
## sure the dependency scanner is able to locate your header files. The
## directories are relative to the current subdir specified with the SubDir
## rule.
## Implementation: The directories are simply added to the HDRSEARCH variable
## which is respected by all jam rules.
rule IncludeDir
{
local dir i ;
if $(>) {
for i in $(>) {
dir = [ ConcatDirs $(SUBDIR) $(i) ] ;
CppFlags $(<) : [ CreateIncludeFlags $(dir) ] ;
# needed for header scanning
HDRSEARCH on $($(<)_SOURCES) += $(dir) ;
}
} else {
for i in $(<) {
dir = [ ConcatDirs $(SUBDIR) $(i) ] ;
CPPFLAGS += [ CreateIncludeFlags $(dir) ] ;
# needed for header scanning
HDRSEARCH += $(dir) ;
}
}
}
rule DefineConst
{
if $(>) {
CppFlags $(<) : [ CreateDefineFlags $(>) ] ;
} else {
CPPFLAGS += [ CreateDefineFlags $(<) ] ;
}
}

View File

@ -0,0 +1,27 @@
#============================================================================
# Rules for building compile groups
#============================================================================
## CompileGroups target : groups
## Adds a target to a list of compile groups. A compile group is a virtual
## target which combines several targets. This is usefull for things like a
## creating a target which compiles all image loaders, all renderers, ...
rule CompileGroups
{
local _i ;
for _i in $(>)
{
Depends $(_i) : $(<) ;
Depends $(_i)clean : $(<)clean ;
}
}
## RegisterCompileGroups
## Registers compilegroups. You must specify all compile groups here before
## can use them.
rule RegisterCompileGroups
{
# nothing here (but msvcgen will override this)
}

28
mk/linux/mk/jam/help.jam Normal file
View File

@ -0,0 +1,28 @@
#============================================================================
# Rules for displaying help messages about targets
#============================================================================
## Help target : description
## Adds a description to a target which will be shown to the user when
## "jam help" is invoked.
rule Help
{
$(<)_help = $(>) ;
local target = $(<:G=help) ;
Depends help : $(target) ;
NotFile $(>) ;
PrintHelp $(target) : $(>) ;
Always $(target) ;
}
#----------------------------------------------------------------------------
NotFile help ;
Always help ;
actions quietly PrintHelp
{
# target width:13, description width:51
echo "jam ->$(<) <- =>$(>) <=" | \
sed 's/->\(..............\).*<-/\1/;s/=>\(...................................................\).*<=/\1/'
}

177
mk/linux/mk/jam/helper.jam Normal file
View File

@ -0,0 +1,177 @@
#============================================================================
# Helper rules
#============================================================================
CP ?= "cp" ;
MV ?= "mv" ;
## Wildcard [ dir : ] patterns
## Create a list of files in a directory which match the pattern. You can
## optionally specify a subdirectory. The files will be returned with
## stripped pathnames. The difference from GLOB is that this rule respects
## subdirectories which may have been entered with the SubDir rule.
rule Wildcard
{
local files dir sdir wildcards ;
# Is a directory given?
if $(>) {
dir = $(<)/ ;
sdir = $(<) ;
wildcards = $(>) ;
} else {
dir = "" ;
sdir = "" ;
wildcards = $(<) ;
}
files = [ GLOB [ ConcatDirs $(SUBDIR) $(dir) ] : $(wildcards) ] ;
return $(files:BSR=$(sdir)) ;
}
## Prefix list : prefix
## Adds a prefix to a all elements in list.
rule Prefix
{
return $(>)$(<) ;
}
if $(JAMVERSION) >= 2.5
{
## IsElem element : list
## Returns "true" if the elemnt is in the list. Otherwise nothing is
## returned.
rule IsElem
{
local i ;
for i in $(>)
{
if $(i) = $(<)
{
return "true" ;
}
}
return ;
}
}
else
{
# jam<2.4's return statement doesn't exit the function
rule IsElem
{
local i result ;
for i in $(>)
{
if $(i) = $(<)
{
result = "true" ;
$(>) = ;
}
}
return $(result) ;
}
}
## Filter list : filter
## Returns the list without the words contained in filter.
rule Filter
{
local i result ;
for i in $(<)
{
if ! [ IsElem $(i) : $(>) ]
{
result += $(i) ;
}
}
return $(result) ;
}
## RemoveDups list
## Removes duplicates in the list (this function tries to preserve the list
## order)
rule RemoveDups
{
local i result ;
for i in $(<)
{
if ! [ IsElem $(i) : $(result) ]
{
result += $(i) ;
}
}
return $(result) ;
}
rule Reverse
{
local result ;
for i in $(<)
{
result = $(i) $(result) ;
}
return $(result) ;
}
## GetVar argument
## Simply returns the value of the variable with name argument.
## This is useful to query on target variables:
## bla = [ on TARGET GetVar CFlags ] ;
rule GetVar
{
return $($(<)) ;
}
## ConcatDirs dirs
## Concatenates a set of directories. This is a substitute for FDirName in
## Jambase. It works also correctly for several rooted paths, where FDirName
## fails.
## The advantage over $(dir1)/$(dir2) is that this also works correctly if
## $(dir1) or $(dir2) is not set.
rule ConcatDirs
{
local i ;
local result = $(<[1]) ;
if ! $(result) { $result = "" ; }
local dir1 dir2 ;
for i in $(<[2-])
{
# eleminate multiple slashes because jam is somewhat buggy here
dir1 = [ MATCH (.*[^/]?) : $(result) ] ;
dir2 = [ MATCH ([^/].*) : $(i) ] ;
if ! $(dir1) { dir1 = "" ; }
if $(dir1) != "" { dir1 = $(dir1)/ ; }
if ! $(dir2) { dir2 = "" ; }
result = $(dir1)$(dir2) ;
}
return $(result) ;
}
## Copy target : source
## Copy source file to target.
actions Copy
{
$(CP) "$(>)" "$(<)"
}
actions ignore Move
{
$(MV) $(>) $(<)
}

162
mk/linux/mk/jam/install.jam Normal file
View File

@ -0,0 +1,162 @@
#============================================================================
# Rules for installation
#============================================================================
COPYDIRS ?= "cp -R" ;
INSTALL ?= "install" ;
INSTALL_PROGRAM ?= $(INSTALL) ;
INSTALL_SCRIPT ?= $(INSTALL) ;
INSTALL_DATA ?= "$(INSTALL) -m644" ;
# set some paths
appdatadir ?= [ ConcatDirs $(datadir) $(PACKAGE_NAME) ] ;
appdocdir ?= [ ConcatDirs $(datadir) doc $(PACKAGE_NAME)-$(PACKAGE_VERSION) ] ;
appconfdir ?= [ ConcatDirs $(sysconfdir) $(PACKAGE_NAME) ] ;
plugindir ?= [ ConcatDirs $(libdir) $(PACKAGE_NAME) ] ;
applicationsdir ?= [ ConcatDirs $(datadir) applications ] ;
pixmapsdir ?= [ ConcatDirs $(datadir) pixmaps ] ;
## InstallHeader headername [ : subdir ]
## DoInstall a headerfile into the includedir directory. A subdirectory
## relative to the includedir can be specified.
rule InstallHeader
{
SEARCH on $(<:G=installheader) = $(SUBDIR) ;
Depends install_include : [ DoInstall $(<:G=installheader) : $(includedir) $(2) ] ;
}
## InstallShellScript scriptname [ : subdir ]
## Installs a shell script into the bindir directory. A subdirectory
## relative to the bindir can be specified.
rule InstallShellScript
{
SEARCH on $(<:G=installscript) = $(SUBDIR) ;
Depends install_shellscript
: [ DoInstall $(<:G=installscript) : $(bindir) $(2) : $(INSTALL_SCRIPT) ]
;
}
## InstallData files [ : subdir ]
## Installs data files
rule InstallData
{
SEARCH on $(<:G=installdata) = $(SUBDIR) ;
Depends install_data : [ DoInstall $(<:G=installdata) : $(appdatadir) $(2) ] ;
}
## InstallConfig files [ : subdir ]
## Installs configuration files
rule InstallConfig
{
SEARCH on $(<:G=installconfig) = $(SUBDIR) ;
Depends install_config : [ DoInstall $(<:G=installconfig) : $(appconfdir) $(2) ] ;
}
## InstallDoc files [ : subdir ]
## Installs documentation files
rule InstallDoc
{
SEARCH on $(<:G=installdoc) = $(SUBDIR) ;
Depends install_doc : [ DoInstall $(<:G=installdoc) : $(appdocdir) $(2) ] ;
}
## InstallMan files
## DoInstall man files
rule InstallMan
{
local dir i ;
SEARCH on $(<:G=installman) = $(SUBDIR) ;
for i in $(<:G=installman) {
dir = $(mandir) ;
switch $(i:S) {
case .1 : dir += man1 ;
case .2 : dir += man2 ;
case .3 : dir += man3 ;
case .4 : dir += man4 ;
case .5 : dir += man5 ;
case .6 : dir += man6 ;
case .7 : dir += man7 ;
case .8 : dir += man8 ;
case .9 : dir += man9 ;
case * :
echo "WARNING: manfile has no *.[0-9] ending." ;
}
Depends install_man : [ DoInstall $(i) : $(dir) ] ;
}
}
## InstallPixmap files [ : subdir ]
## Install a pixmap
rule InstallPixmap
{
LOCATE on $(<:G=installpixmap) = $(SUBDIR) ;
Depends install_data
: [ DoInstall $(<:G=installpixmap) : $(pixmapsdir) $(2) ] ;
}
## InstallDesktop files [ : subdir ]
## Install a .desktop file (menu entries for kde/gnome and others)
rule InstallDesktop
{
LOCATE on $(<:G=installdesktop) = $(SUBDIR) ;
Depends install_bin
: [ DoInstall $(<:G=installdesktop) : $(applicationsdir) $(2) ] ;
}
## DoInstall sourcename : directories [ : installapp ] [ : options ]
## Creates a new installtarget for the given sources. The target(s) are
## returned as function result.
rule DoInstall
{
local targets target i dir gdir ;
dir = [ ConcatDirs $(DESTDIR) $(2) ] ;
gdir = $(dir:G=dir) ;
MkDir $(gdir) ;
for i in $(<) {
target = $(i:BSR=$(dir):G=install) ;
targets += $(target) ;
Depends $(target) : $(gdir) $(i) ;
Install1 $(target) : $(i) ;
if $(3) {
INSTALL on $(target) = $(3) ;
} else {
INSTALL on $(target) = $(INSTALL_DATA) ;
}
}
# We want to package all files we install
if ! [ IsElem nopackage : $(4) ] {
Package $(<) ;
}
Always $(targets) ;
return $(targets) ;
}
#----------------------------------------------------------------------------
INSTALLTARGETS = install_bin install_plugin install_lib install_header
install_shellscript install_data install_config
install_doc ;
Always install $(INSTALLTARGETS) ;
NotFile install $(INSTALLTARGETS) ;
Depends install : $(INSTALLTARGETS) ;
Help install : "Install $(PACKAGE_NAME)" ;
actions Install1
{
$(INSTALL) "$(>)" "$(<:D)" $(INSTALLIBS) ;
}
actions CopyDirs
{
$(COPYDIRS) "$(>)" "$(<)"
}

View File

@ -0,0 +1,29 @@
#============================================================================
# Several hacks to make the build compatible with certain old/broken jam
# versions
#============================================================================
# boostjam is evil: It is compatible to jam 2.4 but has a version number 3.1, we# try to detect boostjam with the ARGV extension
if $(ARGV[0])
{
EXIT "Error: You can't use boostjam for this build." ;
}
# we can't use boostjam at the moment as it still has the bug from jam 2.4 where
# settings variables on header targets doesn't work
if $(JAMVERSION) <= 2.4
{
EXIT "Error: This buildsystem requires jam version 2.5 or later." ;
}
# All scripts invoked by the build system expect a Bourne or compatible shell.
# Reject C-shell and its variants (such as tcsh). Unfortunately, this is a bit
# of an ugly hack. It would be nicer to perform this logic at the very end of
# this file as a last-minute assertion. Unfortunately, however, it seems that
# references to $(SHELL) in any of the included files get bound at the point
# of reference, thus we need to perform this filtering as early as possible.
if [ Match (csh) : $(SHELL) ]
{
SHELL = "/bin/sh" ;
}

172
mk/linux/mk/jam/library.jam Normal file
View File

@ -0,0 +1,172 @@
#============================================================================
# Rules for library creation
#============================================================================
## Library libname : sources [ : options ]
## Build a library out of sourcefiles. All sourcefiles will be passed
## to the Objects rule which tries to compile them into object-files. You
## can create rules for your own filetypes with the UserObject rule. Header
## files will just be ignored. They are only used for MSVC projectfile
## generation. If additional objects are given (fourth argument), they
## should be the output of CompileObjects, and will be included in the
## library.
## Available options are 'shared' if you want to build a shared library on
## platforms which support that. You can specify the 'noinstall' option if
## you don't want an install target is generated.
## Don't specify any extensions for the library name, also leave out the
## leading "lib".
rule Library
{
# check options
CheckOptions noinstall independent shared : $(3) : $(<) ;
local no_scan_archive = $(NOARSCAN) ;
local target = [ ConstructLibraryTarget $(<) : $(3) ] ;
local sources = [ SearchSource $(>) ] ;
local objects = [ CompileObjects $(sources) : $(3) ] ;
local install_targets ;
$(<)_TYPE = library ;
$(<)_OBJECTS = $(objects) ;
$(<)_SOURCES = $(sources) ;
$(<)_TARGET = $(target) ;
$(<)_OPTIONS = $(3) ;
# create target clean rule
Always $(<)clean ;
NotFile $(<)clean ;
Clean $(<)clean : $(objects) ; # create target clean rule
# so 'jam foo' works when it's really foo.exe (Windows) or foo.app (MacOS/X)
if $(target) != $(<)
{
Depends $(<) : $(target) ;
NotFile $(<) ; }
# library depends on its member objects
if ! [ IsElem independent : $(3) ]
{
if $(KEEPOBJS)
{
Depends obj : $(objects) ;
}
else
{
Depends libs : $(<) ;
}
}
# Generate install rules
if ! [ IsElem noinstall : $(3) ]
{
install_targets = [ DoInstall $(target) : $(libdir) : $(INSTALL) : nopackage ] ;
Depends install_lib : $(install_targets) ;
}
if [ IsElem shared : $(3) ]
{
if ! $(LIBTOOL) {
exit "LIBTOOL not defined, can't create dynamic library." ;
}
no_scan_archive = 1 ;
DoLibToolClean ;
if $(install_targets) {
INSTALL on $(install_targets) = "$(LIBTOOL) --mode=install $(INSTALL)" ;
InvokeLibtoolFinish $(install_targets) ;
}
}
# Set LOCATE for the library and its contents. The bound
# value shows up as $(NEEDLIBS) on the Link actions.
# For compatibility, we only do this if the library doesn't
# already have a path.
if ! $(target:D)
{
MakeLocate $(target) $(target)($(objects:BS)) : $(LOCATE_TARGET) ;
}
if ! $(no_scan_archive)
{
# If we can scan the library, we make the library depend
# on its members and each member depend on the on-disk
# object file.
Depends $(target) : $(target)($(objects:BS)) ;
local i ;
for i in $(objects)
{
Depends $(target)($(i:BS)) : $(i) ;
}
} else {
Depends $(target) : $(objects) ;
}
if $(CRELIB) { CreLib $(target) : $(objects[1]) ; }
SystemLinkLibrary $(<) : $(objects) : $(3) ;
# If we can't scan the library, we have to leave the .o's around.
if ! ( $(no_scan_archive) || $(NOARUPDATE) )
{
RmTemps $(target) : $(objects) ;
}
# Import default flags
CppFlags $(<) : $(LIBRARY_CPPFLAGS) ;
CFlags $(<) : $(LIBRARY_CFLAGS) ;
C++Flags $(<) : $(LIBRARY_CXXFLAGS) ;
LFlags $(<) : $(LIBRARY_LIBS) ;
# Sources are part of the package
if ! [ IsElem nopackage : $(3) ]
{
Package $(sources) ;
}
return $(target) ;
}
## LibraryVersion
## Specify the version of a library. The version should have the form
## major:minor:patchlevel
rule LibraryVersion
{
LIBS on $($(<)_TARGET) = -version-info $(>) ;
}
#----------------------------------------------------------------------------
# private part
# default implementation of SystemLinkLibrary
rule SystemLinkLibrary
{
local target = $($(<)_TARGET) ;
if [ IsElem shared : $(3) ] {
LINK on $(target) = "$(LIBTOOL) --mode=link $(LINK) -rpath $(libdir)" ;
LinkLibrary $(target) : $(>) ;
} else {
Archive $(target) : $(>) ;
if $(RANLIB) { Ranlib $(target) ; }
}
Clean clean : $(target) ;
Clean $(<)clean : $(target) ;
}
actions together Ranlib
{
$(RANLIB) $(<)
}
actions LinkLibrary bind NEEDLIBS bind EXTRAOBJECTS
{
$(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
}
# Construct pseudo target libs which is used instead of the pseudo target lib
# in Jambase
Depends lib : libs ;
NotFile libs ;

View File

@ -0,0 +1,38 @@
rule InvokeLibtoolFinish
{
# eventually invoke libtool --mode=finish after installation
if ! $(INVOKE_LIBTOOL_FINISH) && ! $(DESTDIR) {
INVOKE_LIBTOOL_FINISH = true ;
NotFile libtool_finish ;
Always libtool_finish ;
LibToolFinish libtool_finish ;
Depends install_lib : libtool_finish ;
}
Depends libtool_finish : $(<) ;
}
rule DoLibToolClean
{
local target = libtoolclean ;
Always $(target) ;
NotFile $(target) ;
Depends clean : $(target) ;
LibToolClean $(target) ;
}
actions LibToolFinish bind INSTALLLIBS
{
$(LIBTOOL) --mode=finish $(libdir)
}
actions LibToolClean
{
$(LIBTOOL) --mode=clean $(RM)
}
if ! $(LIBTOOL_VERBOSE)
{
LIBTOOL = "$(LIBTOOL) --quiet" ;
}

View File

@ -0,0 +1,55 @@
#============================================================================
# Jam configuration and actions for MacOS/X
# Copyright (C) 2003 by Eric Sunshine <sunshine@sunshineco.com>
#============================================================================
SHELL ?= "/bin/sh" ;
DEEPCOPY ?= "cp -R" ;
# Experience seems to indicate that library scanning misbehaves on MacOS/X with
# Jam 2.4, consequently we disable it.
AR = "ar ru" ;
NOARUPDATE = true ;
NOARSCAN = true ;
actions Archive
{
$(AR) $(<) $(>)
}
#------------------------------------------------------------------------------
# Public rules.
#------------------------------------------------------------------------------
# ConstructApplicationTarget target : options
# Constructs the application target name (ie. foo.app for foo)
rule ConstructApplicationTarget
{
return $(<) ;
}
# ConstructLibraryTarget target : options
rule ConstructLibraryTarget
{
return lib$(<).a ;
}
# SystemLinkApplication target : objects : options
rule SystemLinkApplication
{
local target = $($(<)_TARGET) ;
Depends $(target) : $(>) ;
LinkApplication $(target) : $(>) ;
LIBS on $(target) = $(LIBS) ;
LDFLAGS on $(target) = $(LDFLAGS) ;
Clean clean : $(target) ;
Clean $(<)clean : $(target) ;
}
# LinkApplicationConsole exe : objects
# Link a console (non-GUI) appliation from a set of object files.
actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
{
$(MACOSX.ENVIRON)
$(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LDFLAGS) $(LIBS)
}

383
mk/linux/mk/jam/msvcgen.jam Normal file
View File

@ -0,0 +1,383 @@
#============================================================================
# Rules for creating msvc projectfiles
#============================================================================
# BUGS & TODO
#------------
# - Create a secondary target (such as "msvcinst") which copies the generated
# project files from the build/"out" directory back into the source
# directory. This is useful for maintainers who, after having created and
# tested a new set of project files, want to then commit them to the CVS
# repository.
#
# - Either respect ExternaLibs() or fix all the Jamfiles which require special
# Windows libraries to invoke MsvcExternalLibrary(). This is necessary for
# modules such as cssocket and ensocket which require wsock32.lib, for
# instance. There are a number of other such modules. The current monlithic
# solution of placing this information in CS/mk/msvcgen/Jamconfig is ugly,
# error-prone, and a maintenance headache.
#
# - Overhaul the "config" file handling rule so that it associates
# configuration files with built targets. This will allow the generated
# projects to reference configuration files. Rather than the present
# InstallConfig rule, we either need a ConfigFile:<target>:<configs> rule, or
# we should upgrade the Application and Plugin rules to also accept
# configuration files.
#
# - Likewise, provide a generic Resources() rule which allows specification of
# additional textual resources for inclusion in generated projects.
#
# - Upgrade module Jamfiles to mention headers from the CS/include/module
# directory. This will allow related headers to appear in the generated
# project files. For instance, the libcsengine project should mention
# headers from CS/include/csengine, in addition to the ones from
# CS/libs/csengine which it currently mentions.
#
# - When PERL5.SDK.AVAILABLE is "yes", Jam reports that it doesn't know how to
# locate or create <grist>csperlxs.c.
if $(MSVCGEN_CONFIG)
{
MSVCGEN = "$(PERL) $(TOP)/mk/msvcgen/msvcgen.pl" ;
MKVERRES = "$(SHELL) $(TOP)/libs/cssys/win32/mkverres.sh" ;
MKMETADATARES = "$(SHELL) $(TOP)/libs/cssys/win32/mkmetadatares.sh" ;
MERGERES = "$(SHELL) $(TOP)/libs/cssys/win32/mergeres.sh" ;
MSVCGEN_BUILD_ROOT = $(BUILDTOP)/out ;
MSVC_VERSION ?= 6 ;
if $(MSVC_VERSION) = 6
{
MSVCGEN_LOCATE_TARGET ?= $(MSVCGEN_BUILD_ROOT)/mk/visualc6 ;
MSVCGEN_LOCATE_FRAGMENT ?= $(MSVCGEN_BUILD_ROOT)/mk/fragment6 ;
MSVCGEN_TEMPLATEDIR ?= $(TOP)/mk/msvcgen/template6 ;
MSVCGEN_EXTRA_OPTS = ;
SSUFPRJ = dsp ;
SSUFWSP = dsw ;
SUFPRJ = .dsp ;
SUFWSP = .dsw ;
}
else if $(MSVC_VERSION) = 7
{
MSVCGEN_LOCATE_TARGET ?= $(MSVCGEN_BUILD_ROOT)/mk/visualc7 ;
MSVCGEN_LOCATE_FRAGMENT ?= $(MSVCGEN_BUILD_ROOT)/mk/fragment7 ;
MSVCGEN_TEMPLATEDIR ?= $(TOP)/mk/msvcgen/template7 ;
MSVCGEN_EXTRA_OPTS = --xml-protect ;
SSUFPRJ = vcproj ;
SUFPRJ = .vcproj ;
SSUFWSP = sln ;
SUFWSP = .sln ;
}
else
{
EXIT "No support for MSVC version $(MSVC_VERSION) yet!" ;
}
#----------------------------------------------------------------------------
# Override some rules
## MsvcProject target : sources : type : target-with-ext
rule MsvcProject
{
local rcpath resource msvcname target fragments fragroot files i ;
switch $(3)
{
case appgui :
msvcname = app$(<) ;
case appcon :
msvcname = app$(<) ;
case plugin :
msvcname = plg$(<) ;
case library :
msvcname = lib$(<) ;
case group :
msvcname = grp$(<) ;
case * :
exit "Unknown msvc projecttype: $(3) specified!" ;
}
$(<)_MSVCNAME = $(msvcname) ;
fragroot = $(MSVCGEN_LOCATE_FRAGMENT)/$(msvcname).frag ;
NotFile $(fragroot) ;
fragments = [ FAppendSuffix $(msvcname) : .frag.cff ]
[ FAppendSuffix $(msvcname) : .frag.dpf ]
[ FAppendSuffix $(msvcname) : .frag.pjf ] ;
MakeLocate $(fragments) : $(MSVCGEN_LOCATE_FRAGMENT) ;
target = [ FAppendSuffix $(msvcname) : $(SUFPRJ) ] ;
MakeLocate $(target) : $(MSVCGEN_LOCATE_TARGET) ;
target += $(fragments) ;
$(<)_TARGET = $(target) ;
# Only include source and headers files for now. In the future, we also
# want to include .cfg files and any other textual resources which which the
# user might care to read/view in the MSVC IDE.
for i in $(>)
{
i = $(i:G=$(LOCATE_SOURCE)) ;
switch $(i:S)
{
case .h : files += $(i) ;
case .hpp : files += $(i) ;
case .H : files += $(i) ;
case .c : files += $(i) ;
case .cc : files += $(i) ;
case .cpp : files += $(i) ;
case .m : files += $(i) ;
case .mm : files += $(i) ;
case .M : files += $(i) ;
}
}
# Search at the correct place for the files
SEARCH on $(files) = $(SEARCH_SOURCE) ;
# Add resource file
if $(3) = "plugin" || $(3) = "appgui" || $(3) = "appcon"
{
resource = $(msvcname:S=.rc) ;
# @@@ Uber-ugly
rcpath = ../../../mk/visualc7/$(msvcname:S=.rc) ;
#files += $(resource) ;
Depends $(target) : $(resource) ;
LOCATE on $(resource) = $(MSVCGEN_LOCATE_TARGET) ;
SEARCH on $(resource) = $(MSVCGEN_LOCATE_FRAGMENT) ;
NAME on $(resource) = $(<) ;
#RCNAME on $(<) = $(resource) ;
$(<)_RCNAME = $(resource) ;
#ResourceGen $(resource) ;
local versionrc = $(resource:S=.vrctmp) ;
# normalize version list
local v1, v2, v3, v4 ;
v1 = $(PACKAGE.VERSION.LIST[1]) ;
if ! $(v1) { v1 = 0 ; }
v2 = $(PACKAGE.VERSION.LIST[2]) ;
if ! $(v2) { v2 = 0 ; }
v3 = $(PACKAGE.VERSION.LIST[3]) ;
if ! $(v3) { v3 = 0 ; }
v4 = $(PACKAGE.VERSION.LIST[4]) ;
if ! $(v4) { v4 = 0 ; }
PACKAGE.VERSION.LIST on $(versionrc) = $(v1) $(v2) $(v3) $(v4) ;
# @@@ The "Help" rule is usually invoked after 'Plugin'/'Application',
# so "$(<)_help" is empty...
DESCRIPTION on $(versionrc) = $($(<)_help) ;
LOCATE on $(versionrc) = $(MSVCGEN_LOCATE_FRAGMENT) ;
GenerateWin32VersionRc $(versionrc) ;
Always $(versionrc) ;
Win32Resource $(<) : $(versionrc) ;
RmTemps $(target) : $(versionrc) ;
if $(3) = "plugin"
{
local metarc = $(resource:S=.mrctmp) ;
LOCATE on $(metarc) = $(MSVCGEN_LOCATE_FRAGMENT) ;
SEARCH on $(metarc) = $(SEARCH_SOURCE) ;
Depends $(metarc) : $($(<)_METAFILE) ;
GenerateWin32MetadataRc $(metarc) : $($(<)_METAFILE) ;
Always $(metarc) ;
Win32Resource $(<) : $(metarc) ;
RmTemps $(target) : $(metarc) ;
}
Always $(resource) ;
}
RAWNAME on $(target) = $(<) ;
PROJECTNAME on $(target) = $(msvcname) ;
TARGET on $(target) = $(4) ;
TYPE on $(target) = $(3) ;
FRAGMENT_ROOT on $(target) = $(fragroot) ;
DEPEND on $(target) += $(MSVC.DEPEND) $(MSVC.DEPEND.$(3)) ;
LIBRARIES on $(target) += $(MSVC.LIBRARY) $(MSVC.LIBRARY.$(3)) ;
LFLAGS on $(target) += $(MSVC.LFLAGS) $(MSVC.LFLAGS.$(3)) ;
CFLAGS on $(target) += $(MSVC.CFLAGS) $(MSVC.CFLAGS.$(3)) ;
Depends msvcgen : $(target) ;
Depends $(target) : $(files) $(MSVCGEN_LOCATE_FRAGMENT:G=dir) ;
MsvcProjectGen $(target) : $(files) $(rcpath) ;
Always $(target) ;
MSVCWorkspace csall : $(fragments) : $(fragroot) ;
Clean msvcclean : $(target) ;
}
#----------------------------------------------------------------------------
rule Application
{
# _Options $(<) : $(3) ;
local projtype ;
if $(CONSOLEAPP_$(<)) = "yes"
{
projtype = appcon ;
}
else
{
projtype = appgui ;
}
MsvcProject $(<) : $(>) : $(projtype) : $(<:S=.exe) ;
CompileGroups $(<) : all apps ;
}
rule Plugin
{
local metafile ;
metafile = [ FAppendSuffix $(<) : $(SUFMETA) ] ;
SEARCH on $(metafile) = $(SEARCH_SOURCE) ;
$(<)_METAFILE = $(metafile) ;
MsvcProject $(<) : $(>) : plugin : $(<:S=.dll) ;
CompileGroups $(<) : all plugins ;
}
rule Library
{
MsvcProject $(<) : $(>) : library : $(<:S=.lib) ;
CompileGroups $(<) : all libs ;
}
rule RegisterCompileGroups
{
local i ;
for i in $(<)
{
RegisterCompileGroup $(i) ;
}
}
rule RegisterCompileGroup
{
MsvcProject $(<) : $(>) : group ;
}
rule CompileGroups
{
for i in $(>)
{
DEPEND on $($(i)_TARGET) += $($(<)_MSVCNAME) ;
}
}
rule LinkWith
{
DEPEND on $($(<)_TARGET) += lib$(>) ;
}
rule MsvcExternalLibrary
{
LIBRARIES on $($(<)_TARGET) += $(>) ;
}
rule CFlags
{
if $(>) != ""
{
CFLAGS on $($(<)_TARGET) += $(>) ;
}
}
rule LFlags
{
LFLAGS on $($(<)_TARGET) += $(>) ;
}
rule ExternalLibs
{
local i ;
for i in $(>)
{
CFlags $(<) : $($(i).CFLAGS) ;
LFlags $(<) : $($(i).LFLAGS) ;
MsvcExternalLibrary $(<) : $($(i).MSVCLIBS) ;
}
}
rule MSVCWorkspace
{
local target ;
target = [ FAppendSuffix $(<) : $(SUFWSP) ] ;
MakeLocate $(target) : $(MSVCGEN_LOCATE_TARGET) ;
Depends msvcgen : $(target) ;
Depends $(target) : $(>[1]) ;
MsvcWorkspaceGen $(target) : $(3) ;
RmTemps $(target) : $(>) ;
}
rule Win32Resource
{
Depends $(<) : $($(<)_RCNAME) ;
Depends $($(<)_RCNAME) : $(>) ;
MergeRcs $($(<)_RCNAME) : $(>) ;
}
#----------------------------------------------------------------------------
actions MsvcProjectGen
{
$(MSVCGEN) \
--quiet \
--project \
$(MSVCGEN_EXTRA_OPTS) \
--project-extension=$(SSUFPRJ) \
--name=$(RAWNAME) \
--template=$(TYPE) \
--template-dir=$(MSVCGEN_TEMPLATEDIR) \
--project-name=$(PROJECTNAME) \
--output=$(<[1]) \
--target=$(TARGET) \
--fragment=$(FRAGMENT_ROOT) \
--depend=$(DEPEND) \
--library=$(LIBRARIES) \
--lflags='$(LFLAGS)' \
--cflags='$(CFLAGS)' \
--strip-root='$(TOP)/' \
--strip-root='$(MSVCGEN_BUILD_ROOT)/' \
$(>)
}
actions together MsvcWorkspaceGen
{
$(MSVCGEN) \
--quiet \
--workspace \
$(MSVCGEN_EXTRA_OPTS) \
--workspace-extension=$(SSUFWSP) \
--output=$(<) \
--template-dir=$(MSVCGEN_TEMPLATEDIR) \
$(>)
}
actions together MergeRcs
{
$(MERGERES) '$(<)' '$(TOP)' '../..' '$(>)'
}
#----------------------------------------------------------------------------
RegisterCompileGroups all apps plugins libs ;
NotFile msvcgen ;
Always msvcgen ;
Clean clean : $(MSVCGEN_LOCATE_TARGET:G=dir) ;
Clean clean : $(MSVCGEN_LOCATE_FRAGMENT:G=dir) ;
Clean clean : $(MSVCGEN_BUILD_ROOT) ;
Clean msvcclean : $(MSVCGEN_LOCATE_TARGET:G=dir) ;
Clean msvcclean : $(MSVCGEN_LOCATE_FRAGMENT:G=dir) ;
}

192
mk/linux/mk/jam/objects.jam Normal file
View File

@ -0,0 +1,192 @@
#============================================================================
# Rules for compiling a set of sources to object files
#============================================================================
# These are slightly modified versions of the Object and Objects rules from
# jam. The problem with the original rules in Jambase is the handling of
# custom file types. The solution with the UserObject rule is monolithic, you
# can only have 1 such rule. Thus we construct a more flexible toolkit here
# which let's you register rules for certain filetypes.
## RegisterFileType Rulename : extensions
## Register a rule which is used to compile a filetype into object
## files. The registered rule is called with the name of the
## sourcefile as argument (completely gristed and SEARCH is set already).
## The rule should return the object files created completely gristed and
## with LOCATE set (use the LocateTarget rule to do this).
rule RegisterFileType
{
local suffix ;
for suffix in $(>)
{
FILETYPE_$(suffix) = $(<) ;
}
}
## RegisterHeaderRule rulename : regexpattern : extensions
## Registers a rule and a regular expression which will be used for header
## file scanning of the specified extensions.
rule RegisterHeaderRule
{
local suffix ;
for suffix in $(3)
{
HDRRULE_$(suffix) = $(<) ;
HDRPATTERN_$(suffix) = $(>) ;
}
}
## CompileObjects sources [ : options ]
## Compile a set of sourcefiles into objectfiles (usually .o extension).
## For ungristed sourcefiles $(SEARCH) will be set to $(SEARCH_SOURCE).
## The function returns the names of the targets being built (gristed and
## with LOCATE set.
## Normally you don't have to use this rule. The Application or Library rules
## are taking care of calling it for you.
rule CompileObjects
{
local s ;
local sources = [ SearchSource $(<) ] ;
local targets ;
for s in $(sources)
{
# compile the sourcefile to targetfile
targets += [ CompileObject $(s) : $(2) ] ;
}
return $(targets) ;
}
#----------------------------------------------------------------------------
# private part
# CompileObject sourcefile [ : options ]
# helper rule: Compiles a source file to an object file. The source should be
# correctly gristed and SEARCH should be set. The function will return the
# target names gristed and with LOCATE set.
rule CompileObject
{
# handle #includes for source: Jam scans for headers with
# the regexp pattern $(HDRSCAN) and then invokes $(HDRRULE)
# with the scanned file as the target and the found headers
# as the sources. HDRSEARCH is the value of SEARCH used for
# the found header files.
# $(SEARCH_SOURCE:E) is where cc first looks for #include
# "foo.h" files. If the source file is in a distant directory,
# look there. Else, look in "" (the current directory).
if $(HDRRULE_$(<:S))
{
HDRSEARCH on $(<) = $(SEARCH_SOURCE:E) $(HDRSEARCH) $(STDHDRSEARCH) ;
SEARCH_SOURCE on $(<) = $(SEARCH_SOURCE) ;
HDRRULE on $(<) = $(HDRRULE_$(<:S)) ;
HDRSCAN on $(<) = $(HDRPATTERN_$(<:S)) ;
}
local targets ;
# Invoke filetype specific rule
if $(FILETYPE_$(<:S)) {
targets = [ $(FILETYPE_$(<:S)) $(<) : $(2) ] ;
} else {
echo "Warning: no rules for filetype $(<:S) defined (at file $(<))." ;
}
if $(targets) {
# construct clean target
Clean clean : $(targets) ;
}
return $(targets) ;
}
## HeaderRule source : headers
## This rule is the default header rule used by the objects rules. You
## might register custom rules with the RegisterHeaderRule rule.
rule HeaderRule
{
# N.B. This rule is called during binding, potentially after
# the fate of many targets has been determined, and must be
# used with caution: don't add dependencies to unrelated
# targets, and don't set variables on $(<).
# Tell Jam that anything depending on $(<) also depends on $(>),
# set SEARCH so Jam can find the headers, but then say we don't
# care if we can't actually find the headers (they may have been
# within ifdefs),
local HDRSEARCH = [ on $(<) GetVar HDRSEARCH ] ;
local SEARCH_SOURCE = [ on $(<) GetVar SEARCH_SOURCE ] ;
Includes $(<) : $(>) ;
SEARCH on $(>) = $(HDRSEARCH) $(SEARCH_SOURCE)/$(<:D) ;
NoCare $(>) ;
local i ;
for i in $(>)
{
SEARCH on $(>) = $(HDRSEARCH) $(SEARCH_SOURCE)/$(<:D) ;
if $(i:D) = "" {
SEARCH_SOURCE on $(i) = $(SEARCH_SOURCE)/$(<:D) ;
} else {
SEARCH_SOURCE on $(i) = $(SEARCH_SOURCE) ;
}
HDRSEARCH on $(>) = $(HDRSEARCH) ;
HDRRULE on $(>) = [ on $(<) GetVar HDRRULE ] ;
HDRSCAN on $(>) = [ on $(<) GetVar HDRPATTERN ] ;
}
}
# Dummy rule: .o files are used as is.
rule UseObjectFile
{
return $(<) ;
}
RegisterFileType UseObjectFile : .o ;
# Ignore header files.
rule UseHeaderFile
{
return ;
}
RegisterFileType UseHeaderFile : .h .hpp ;
RegisterHeaderRule HeaderRule : $(HDRPATTERN) : .h .hpp .inc ;
## SearchSource
## Sets search path of the sourcefiles to the current SUBDIR and sets a
## suitable grist on the sources. Ignores source files that already have
## grist set.
rule SearchSource
{
local sources ;
for f in $(<) {
if $(f:G) {
sources += $(f) ;
} else {
local source = $(f:G=$(SOURCE_GRIST:E)) ;
sources += $(source) ;
SEARCH on $(source) = $(SEARCH_SOURCE) ;
}
}
return $(sources) ;
}
## LocateTarget
## Sets LOCATE on the current output directory (depending on builddir,
## variant and current subdir), sets a suitable grist and makes sure the
## target directory is created if it doesn't exist.
rule LocateTarget
{
local targetdir ;
if $(>) {
targetdir = $(>) ;
} else {
targetdir = $(LOCATE_TARGET) ;
}
local targets = $(<:G=T!$(SOURCE_GRIST:E)!$(SUBVARIANT)) ;
MakeLocate $(targets) : $(targetdir) ;
return $(targets) ;
}

View File

@ -0,0 +1,21 @@
#============================================================================
# Rule for setting options at targets
#============================================================================
#----------------------------------------------------------------------------
# private rule - please specify the options in Application, Plugin or Library
# rule and don't use this rule here directly.
## CheckOptions candidates : Options : target
rule CheckOptions
{
local i ;
for i in $(>)
{
if ! [ IsElem $(i) : $(<) ]
{
echo "WARNING: Unknown option $(i) specified at $(3)." ;
}
}
}

View File

@ -0,0 +1,33 @@
#============================================================================
# Rules for creating distribution packages
#============================================================================
PACKAGE_FILES = ;
PACKAGE_FILE = $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.bz2 ;
PACKAGE_DIR = $(PACKAGE_NAME)-$(PACKAGE_VERSION) ;
LOCATE_DISTTEMP ?= $(top_builddir)/build/dist ;
## Package files
## Add files to distribution package
rule Package
{
for i in $(<) {
local target = $(i:R=$(LOCATE_DISTTEMP)/$(PACKAGE_DIR)/$(SUBDIR)) ;
local dir = $(i:DR=$(LOCATE_DISTTEMP)/$(PACKAGE_DIR)/$(SUBDIR)) ;
local source = $(i:G=$(SOURCE_GRIST:E)_PACKAGE) ;
MkDir $(dir) ;
Copy $(target) : $(source) ;
LOCATE on $(source) = $(SUBDIR) ;
Depends $(target) : $(dir) ;
Depends $(target) : $(source) ;
Depends $(PACKAGE_FILE) : $(target) ;
}
}
actions TarBz2
{
tar -c --bzip2 -C $(LOCATE_DISTTEMP) -f $(<) $(PACKAGE_DIR)
}
TarBz2 $(PACKAGE_FILE) ;
Depends dist : $(PACKAGE_FILE) ;

View File

@ -0,0 +1,22 @@
#============================================================================
# Stub Rules for handling additional resources (the OS specific Jamfiles will
# override these.
#============================================================================
## Win32Resource
## Specify .rc files for targets. The .rc files should already have SEARCH
## set correctly.
rule Win32Resource { }
## ApplicationIconOSX basename : icon [ : pathcomponents ]
## Specify the icon for the application given by basename. If
## pathcomponents is omitted, SEARCH_SOURCE is used. If this rule is not
## invoked, then the icon specified via ApplicationIconDefaultOSX is used.
## If ApplicationIconDefaultOSX was never invoked, then no icon is used.
rule ApplicationIconOSX { }
## ApplicationIconDefaultOSX icon [ : pathcomponents ]
## Specify the default icon for GUI applications. This setting can be
## overriden for a individual application with the ApplicationIconOSX rule.
rule ApplicationIconDefaultOSX { }

View File

@ -0,0 +1,93 @@
#============================================================================
# Work around problems the SubDir rule of Jambase
# (until jampeople accept my patches :-/ )
#============================================================================
LOCATE_OBJECTS ?= $(top_builddir)/build/$(target) ;
LOCATE_TARGETS ?= $(top_builddir) ;
LOCATE_DOCS ?= $(top_builddir)/build ;
SUBDIRRULES += FixSubDirPath ;
MKDIR ?= mkdir ;
MKDIRS ?= "$(MKDIR) -p" ;
rule FixSubDirPath
{
LOCATE_SOURCE = [ ConcatDirs $(LOCATE_OBJECTS) $(SUBDIR_TOKENS) ] ;
LOCATE_TARGET = [ ConcatDirs $(LOCATE_OBJECTS) $(SUBDIR_TOKENS) ] ;
# We need to package the Jamfile (a bit hacky here...)
Package Jamfile ;
}
# fix bug in Jambase where SubInclude in the middle of a jam file made it break
rule SubInclude
{
if ! $($(<[1]))
{
Exit SubInclude $(<[1]) without prior SubDir $(<[1]) ;
}
local save_SUBDIR_TOKENS = $(SUBDIR_TOKENS) ;
SubDir $(<) ;
include $(JAMFILE:D=$(SUBDIR)) ;
SubDir $(<[1]) $(save_SUBDIR_TOKENS) ;
}
# this MakeLocate rule differs from the Jambase one in that it also works with
# files being in subdirectories
rule MakeLocate
{
# MakeLocate targets : directory ;
# Sets special variable LOCATE on targets, and arranges
# with MkDir to create target directory.
# Note we grist the directory name with 'dir',
# so that directory path components and other
# targets don't conflict.
if $(>) && $(>) != "" && $(>) != "."
{
local i ;
for i in $(<) {
LOCATE on $(i) = $(>) ;
local targetfile = $(i:R=$(>)) ;
Depends $(i) : $(targetfile:DG=dir) ;
MkDir $(targetfile:DG=dir) ;
}
}
}
# The default MkDir rule in Jambase has problems when paths contains a sequence
# of multiple slashes (ie. bla////fup). We solve these problems and greatly
# simply this rule by using the "mkdir -p" or mkdirs command.
rule MkDir
{
# MkDir directory ;
# Make a directory and all its parent directories.
# Ignore timestamps on directories: we only care if they
# exist.
NoUpdate $(<) ;
# don't create the dir multiple times
if ! $($(<)-mkdir)
{
$(<)-mkdir = true ;
MkDir1 $(<) ;
}
}
actions MkDir1
{
$(MKDIRS) "$(<)"
}

49
mk/linux/mk/jam/unix.jam Normal file
View File

@ -0,0 +1,49 @@
#============================================================================
# Jam configuration and actions for Linux/Unix
#============================================================================
SHELL ?= "/bin/sh" ;
#----------------------------------------------------------------------------
# platform specific rules
## ConstructApplicationTarget target : options
## Constructs the application atrget name (ie. foo.exe for foo)
rule ConstructApplicationTarget
{
return $(<) ;
}
rule ConstructLibraryTarget
{
if [ IsElem shared : $(2) ] {
return lib$(<).la ;
} else {
return lib$(<).a ;
}
}
rule ConstructPluginTarget
{
return $(<).so ;
}
# SystemLinkApplication target : objects : options
# do system specific actions needed for linking the application and construct
# correct clean targets.
rule SystemLinkApplication
{
local target = $($(<)_TARGET) ;
Depends $(target) : $(>) ;
LinkApplication $(target) : $(>) ;
LIBS on $(target) = $(LIBS) ;
LDFLAGS on $(target) = $(LDFLAGS) ;
# setup clean rules
Clean clean : $(target) ;
Clean $(<)clean : $(target) ;
}
actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
{
$(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LDFLAGS) $(LIBS)
}

View File

@ -0,0 +1,39 @@
#============================================================================
# Setup of compiler/linker flags for debug/optimize mode
#============================================================================
VARIANT ?= optimize ;
# Set modus related flags
CPPFLAGS += $(DEFS) ;
CFLAGS += $(COMPILER_CFLAGS) $(COMPILER_CFLAGS_$(VARIANT)) ;
CXXFLAGS += $(COMPILER_CXXFLAGS) $(COMPILER_CXXFLAGS_$(VARIANT)) ;
LIBS += $(COMPILER_LIBS) $(COMPILER_LIBS_$(VARIANT)) ;
LDFLAGS += $(COMPILER_LDFLAGS) $(COMPILER_LDFLAGS_$(VARIANT)) ;
LOCATE_OBJECTS = $(LOCATE_OBJECTS)/$(VARIANT) ;
## SubVariant variantname
## Specify subvarianet which are placed in separate compilation directories.
SUBVARIANT ?= "" ;
rule SubVariant
{
SUBVARIANT = $(<) ;
if ! $(<)
{
SUBVARIANT = "" ;
if $(SAVED_LOCATE_TARGET)
{
LOCATE_TARGET = $(SAVED_LOCATE_TARGET) ;
}
SAVED_LOCATE_TARGET = ;
}
else
{
if ! $(SAVED_LOCATE_TARGET)
{
SAVED_LOCATE_TARGET = $(LOCATE_TARGET) ;
}
LOCATE_TARGET = $(LOCATE_TARGET)/$(SUBVARIANT) ;
}
}

73
mk/linux/mk/jam/win32.jam Normal file
View File

@ -0,0 +1,73 @@
#============================================================================
# Jam configuration and actions for Win32
#============================================================================
SHELL ?= "/bin/sh" ;
#----------------------------------------------------------------------------
# resource handling
# Unfortunately we can't simply specify resources on the source list, because
# Mingw/Cygwin have the limitation that they can only link 1 resource file
# in. So we have to concatenate all resourcefiles here before compiling them.
actions together CompileResources
{
cat $(>) | $(WINDRES) $(WINDRES_FLAGS) --include-dir=$(>:D) -o $(<)
}
rule CompileResources
{
Depends $(<) : $(>) ;
}
rule Win32Resource
{
local target = $($(<)_TARGET) ;
local rcobject = [ LocateTarget _resource.o ] ;
# only add 1 resource object per target
if ! $($(<)_HASWIN32RESOURCE)
{
$(<)_HASWIN32RESOURCE = yes ;
ExtraObjects $(<) : $(rcobject) ;
}
CompileResources $(rcobject) : $(>) ;
}
#----------------------------------------------------------------------------
# linking part
## ConstructApplicationTarget target : options
## Constructs the application atrget name (ie. foo.exe for foo)
rule ConstructApplicationTarget
{
return $(<).exe ;
}
rule ConstructLibraryTarget
{
return lib$(<).a ;
}
rule ConstructPluginTarget
{
return $(<).dll ;
}
# SystemLinkApplication target : objects : options
rule SystemLinkApplication
{
local target = $($(<)_TARGET) ;
Depends $(target) : $(>) ;
LinkApplication $(target) : $(>) ;
LIBS on $(target) = $(LIBS) ;
LDFLAGS on $(target) = $(LDFLAGS) ;
# setup clean rules
Clean clean : $(target) ;
Clean $(<)clean : $(target) ;
}
actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
{
$(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LDFLAGS) $(LIBS)
}