#
# Checks for programs.
-#
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AC_PROG_CXX
#AC_PROG_AWK
#
-# Checks for configuration arguments.
+# Configure platform-specific stuff.
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+case "${host}" in
+ *mingw32*)
+ MINGW32=yes
+ WIN32=yes
+ ;;
+ *cygwin*)
+ CYGWIN=yes
+ WIN32=yes
+ ;;
+ *-apple-darwin*)
+ MACOSX=yes
+ LIBS="$LIBS -Wl,-framework"
+esac
+
+
#
+# Checks for configuration arguments.
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+AC_ARG_ENABLE([developer],
+ [ --enable-developer use all compiler flags developers need],
+ [developer=$enableval],
+ [developer=no])
AC_ARG_ENABLE([debug],
[ --enable-debug include debugging symbols and features],
- [debug=$enableval
- if test x$debug = xyes
- then
- CFLAGS="-O0 -DDEBUG"
- CXXFLAGS="-O0 -DDEBUG"
- else
- CFLAGS="-O2 -DNDEBUG"
- CXXFLAGS="-O2 -DNDEBUG"
- fi],
- [CFLAGS="-O2 -DNDEBUG"
- CXXFLAGS="-O2 -DNDEBUG"])
+ [debug=$enableval],
+ [debug=no])
AC_ARG_ENABLE([profile],
- [ --enable-profile make a binary for use with gprof],
- [profile=$enableval
- if test x$profile = xyes
- then
- CFLAGS="$CFLAGS -pg"
- CXXFLAGS="$CXXFLAGS -pg"
- fi])
+ [ --enable-profile make a binary for use with gprof profiler],
+ [profile=$enableval],
+ [profile=no])
+
+AC_ARG_ENABLE([extra-warnings],
+ [ --enable-extra-warnings make the gcc compiler give more warnings],
+ [extra_warnings=$enableval],
+ [extra_warnings=no])
+
+AC_ARG_WITH([log-level],
+ [AS_HELP_STRING([--with-log-level=NUM],
+ [0, none... 1, errors... 4, everything (default: 3)])],
+ [log_level=$withval],
+ [log_level=3])
+
+
+if test x$developer = xyes
+then
+ debug=yes
+ profile=yes
+ extra_warnings=yes
+ log_level=4
+fi
+
+if test x$debug = xyes
+then
+ CFLAGS="$CFLAGS -Wall -O0 -g -DDEBUG"
+ CXXFLAGS="$CXXFLAGS -Wall -O0 -g -DDEBUG"
+else
+ CFLAGS="$CFLAGS -O2 -DNDEBUG"
+ CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
+fi
+
+if test x$profile = xyes
+then
+ CFLAGS="$CFLAGS -pg"
+ CXXFLAGS="$CXXFLAGS -pg"
+fi
+
+if test x$extra_warnings = xyes
+then
+ CFLAGS="$CFLAGS -Wextra"
+ CXXFLAGS="$CXXFLAGS -Wextra"
+fi
+
+AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
+ [Define to detail level of logging.])
-if test x$prefix = xNONE
+
+if test "x$prefix" = xNONE
then
prefix="$ac_default_prefix"
fi
AC_ARG_WITH([assetdir],
[AS_HELP_STRING([--with-assetdir=DIR],
- [real path to game assets (default: $datarootdir/yoink)])],
+ [real path to assets (default: $datarootdir/yoink)])],
[DATADIR="$withval"],
[eval DATADIR="$datarootdir/yoink"])
-case "${host}" in
- *mingw32*)
+if test x$WIN32 = xyes
+then
DATADIR="data"
-esac
+fi
AC_SUBST([DATADIR])
AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
[Define to path of game asset directory.])
+
CONFIGFILES="\$HOME/.yoinkrc:/etc/yoinkrc"
AC_DEFINE_UNQUOTED([YOINK_CONFIGFILES], ["$CONFIGFILES"],
#
-# Checks for libraries.
+# Checks for typedefs, structures, and compiler characteristics.
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+AC_C_STRINGIZE
+AC_C_INLINE
+
+AC_TYPE_UINT8_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_SIZE_T
+AC_TYPE_SSIZE_T
+
+
#
+# Checks for system functions.
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-AM_PATH_SDL([1.2.10],
- [CFLAGS="$CFLAGS $SDL_CFLAGS"
- CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
- LIBS="$LIBS $SDL_LIBS"])
+AC_FUNC_ERROR_AT_LINE
+AC_FUNC_STRTOD
+AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
+
+
+#
+# Checks for header files.
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+AC_HEADER_STDBOOL
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
-#BOOST_REQUIRE([1.35])
-#CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
BOOST_SMART_PTR
BOOST_STRING_ALGO
BOOST_BIND
BOOST_FUNCTION
-AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
- [AC_MSG_ERROR([SDL_image is required])])
-
-AC_SEARCH_LIBS([Sound_Init], [SDL_sound],,
- [AC_MSG_ERROR([SDL_sound is required])])
+AM_PATH_SDL([1.2.10],
+ [CFLAGS="$CFLAGS $SDL_CFLAGS"
+ CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
+ LIBS="$LIBS $SDL_LIBS"])
-AC_SEARCH_LIBS([glBegin], [GL opengl32],,
- [AC_MSG_ERROR([OpenGL is required])])
+AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
+ [missing="$missing OpenGL"])
-AC_SEARCH_LIBS([gluPerspective], [GLU MesaGLU glu32],,
- [AC_MSG_ERROR([GLU is required])])
+AC_CHECK_HEADERS([AL/al.h AL/alut.h],,
+ [missing="$missing OpenAL"])
-AC_SEARCH_LIBS([alGenBuffers], [openal openal32],,
- [AC_MSG_ERROR([OpenAL is required])])
+AC_CHECK_HEADERS([SDL/SDL_image.h],,
+ [missing="$missing SDL_image"])
-AC_SEARCH_LIBS([alutInit], [alut],,
- [AC_MSG_ERROR([alut is required])])
+AC_CHECK_HEADERS([SDL/SDL_sound.h],,
+ [missing="$missing SDL_sound"])
-AC_SEARCH_LIBS([clock_gettime], [rt],
- [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
- [Define to 1 if you have the 'clock_gettime' function.])])
+if test "x$missing" != x
+then
+ echo "** Required header files from these libraries are missing:"
+ for header in $missing
+ do
+ echo "** $header"
+ done
+ AC_MSG_ERROR([please install missing dependencies])
+fi
#
-# Checks for header files.
-#
-
-AC_HEADER_STDBOOL
-AC_HEADER_STDC
-AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
+# Checks for libraries.
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
+ [missing="$missing SDL_image"])
-#
-# Checks for typedefs, structures, and compiler characteristics.
-#
+AC_SEARCH_LIBS([Sound_Init], [SDL_sound],,
+ [missing="$missing SDL_sound"])
-AC_C_STRINGIZE
-AC_C_INLINE
+if test x$WIN32 == xyes
+then
+# autoconf library search macro doesn't find opengl32 on windows because it uses
+# different name hashing, but it links fine; assume it's there
+ LIBS="$LIBS -lglu32 -lopengl32"
+else
+ AC_SEARCH_LIBS([gluPerspective], [GLU MesaGLU],,
+ [missing="$missing GLU"])
+
+ AC_SEARCH_LIBS([glBegin], [GL MesaGL],,
+ [missing="$missing OpenGL"])
+fi
-AC_TYPE_UINT8_T
-AC_TYPE_UINT16_T
-AC_TYPE_UINT32_T
-AC_TYPE_SIZE_T
-AC_TYPE_SSIZE_T
+AC_SEARCH_LIBS([alGenBuffers], [openal openal32],,
+ [missing="$missing OpenAL"])
+AC_SEARCH_LIBS([alutInit], [alut],,
+ [missing="$missing ALUT"])
-#
-# Checks for library functions.
-#
+AC_SEARCH_LIBS([clock_gettime], [rt],
+ [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
+ [Define to 1 if you have the 'clock_gettime' function.])])
-AC_FUNC_ERROR_AT_LINE
-AC_FUNC_STRTOD
-AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
+if test "x$missing" != x
+then
+ echo "** One or more required libraries are missing:"
+ for library in $missing
+ do
+ echo "** $library"
+ done
+ AC_MSG_ERROR([please install missing dependencies])
+fi
#
# Find the data files to install.
-#
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DATA_FILES=$(echo $(cd data; \
find . -name "*.json" \
#
# Create the build files.
-#
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AC_CONFIG_FILES([Makefile
data/Makefile
doc/Makefile
doc/yoink.6
+ extra/Makefile
extra/yoink.spec
src/Makefile
yajl/Makefile])
#
# Print a friendly little message.
-#
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-echo "======================================"
-echo " Configuration complete!"
echo ""
-
-echo " Prefix: $prefix"
-echo " Data: $DATADIR"
+echo " Configuration complete! :-)"
+echo ""
+echo " Target: $target"
+echo " Prefix: $prefix"
+echo " Data Directory: $DATADIR"
+echo " Log Level: $log_level"
+echo " Debug: $debug"
+echo " Profile: $profile"
+echo " Extra Warnings: $extra_warnings"
echo ""
-
-if test x$debug = xyes
-then
- echo " * Debugging enabled."
- echo ""
-fi
-
-if test x$profile = xyes
-then
- echo " * Profiling enabled."
- echo ""
-fi
-
echo " To finish the installation, execute:"
echo " make"
echo " make install"
-echo "======================================"
+echo ""
--- /dev/null
+CML_ENABLE_MATRIX_BRACES
+- Allow matrices to be accessed as A[row][col] in addition to A(row,col).
+ This is primarily for testing, and is not used anywhere in the library
+ proper since the proxy object mechanism that's used is not guaranteed to
+ produce optimal code.
+
+CML_NO_DEFAULT_EXPR_TRAITS
+- Don't use default expression traits for built-in types. This is handy
+ for debugging, since no classes or built-in types will have an expression
+ traits class by default (i.e. the expression traits class must be created
+ explicitly).
+
+CML_DEFAULT_BASIS_ORIENTATION
+- Either cml::row_basis or cml::col_basis. This determines the basis
+ vector orientation for the matrix result of a vector outer product. The
+ default is cml::col_basis.
+
+CML_DEFAULT_ARRAY_LAYOUT
+- Either cml::row_major or cml::col_major. This determines the layout of the
+ resulting matrix when promoting matrices with different layouts. If the
+ matrices have the same layout, the promoted type will also have that layout,
+ unless CML_ALWAYS_PROMOTE_TO_DEFAULT_LAYOUT is defined. This parameter also
+ determines the default 2D array memory layout.
+
+CML_DEFAULT_ARRAY_ALLOC
+- Defines the default allocator for arrays generated at run-time by the type
+ deduction system. The default value is std::allocator<void>.
+
+CML_ALWAYS_PROMOTE_TO_DEFAULT_LAYOUT
+- If this is defined, 2D arrays will always be promoted to the default layout.
+ This is useful if matrix expressions should always be handled in
+ a particular orientation for efficiency.
+
+CML_VECTOR_UNROLL_LIMIT=<N>
+- <N> is the maximum vector length that should be automatically unrolled by
+ the expression template engine. If the vector (expression) is longer,
+ the normal for loop is used. Note also that unrolling is available only
+ for fixed-size vectors.
+
+CML_2D_UNROLLER
+- Use a 2D unroller for matrix expressions. This causes very poor code for
+ most of the supported compilers, but with GCC4/G5, it's required for
+ optimal code. Note that unrolling is available only for fixed-size
+ matrices.
+
+CML_MATRIX_UNROLL_LIMIT=<N>
+- <N> is the maximum number of matrix elements (#rows x #cols) that
+ a matrix (expression) can have before being unrolled. A 2D loop is used
+ for matrices with more than <N> elements. When either CML_2D_UNROLLER or
+ CML_2D_TO_1D_UNROLLER is defined, this must also be defined.
+
+CML_NO_2D_UNROLLER
+- Don't unroll at all, just use a loop. This seems to generate the best
+ code on at least GCC4/x86 and Intel 9/Linux/x86.
+
+CML_RECIPROCAL_OPTIMIZATION
+- Use "*= 1./x" instead of "/= x" for per-element division. This may generate
+ better code for certain systems, but isn't yet tested for any configuration.
+
+CML_AUTOMATIC_VECTOR_RESIZE_ON_ASSIGNMENT
+- Enable automatic resizing of dynamic vectors on assignment and copy from
+ other vectors and expressions. This guarantees that vectors have the right
+ size on assignment, but imposes a significant performance penalty when
+ vectors already have the correct size. Without this option, however,
+ assigned-to vectors must be constructed with the correct size, or must be
+ explicitly resized with the resize() method. Note that this has no
+ effect when assigning using a scalar operator, since the vector must already
+ have the proper size. Also note that temporaries will be automatically
+ resized as necessary regardless of the setting of this option.
+
+CML_CHECK_VECTOR_EXPR_SIZES
+- Verify that all arguments in a vector expression have the proper size. This
+ is particularly handy for debugging when CML_AUTOMATIC_VECTOR_RESIZE is
+ undefined. Note that the performance penalty for defining this option is
+ dependent upon the number of binary expressions and the compiler. Also,
+ this has no effect for expressions composed of entirely fixed-size vectors,
+ since the sizes are automatically checked at compile time.
+
+CML_AUTOMATIC_MATRIX_RESIZE_ON_ASSIGNMENT
+CML_CHECK_MATRIX_EXPR_SIZES
+CML_CHECK_MATVEC_EXPR_SIZES
+- Same as CML_AUTOMATIC_VECTOR_RESIZE and CML_CHECK_VECTOR_EXPR_SIZES, but for
+ matrices.
+
+CML_USE_GENERATED_MATRIX_ASSIGN_OP
+- Allow the compiler to generate its own matrix assignment code. This yields
+ better performance at least on Intel C++ 9/x86 Linux.