From 967d2c595cf54ef3fcdadb4f53c12f7c3c3bf8ab Mon Sep 17 00:00:00 2001 From: Cedric Bastoul Date: Fri, 17 Feb 2012 10:29:27 +0100 Subject: [PATCH] Configure system in line with CLooG In particular for GMP's support. --- Makefile.am | 62 +++++++- autogen.sh | 7 +- configure.in => configure.ac | 129 ++++++--------- doc/openscop.texi | 21 +-- include/Makefile.am | 102 ------------ m4/ax_cc_maxopt.m4 | 178 +++++++++++++++++++++ m4/ax_cflags_warn_all.m4 | 149 ++++++++++++++++++ m4/ax_check_compiler_flags.m4 | 74 +++++++++ m4/ax_compiler_vendor.m4 | 61 +++++++ m4/ax_create_pkgconfig_info.m4 | 349 +++++++++++++++++++++++++++++++++++++++++ m4/ax_gcc_archflag.m4 | 213 +++++++++++++++++++++++++ m4/ax_gcc_x86_cpuid.m4 | 77 +++++++++ m4/ax_submodule.m4 | 63 ++++++++ source/Makefile.am | 105 ------------- source/util.c | 11 +- tests/Makefile.am | 2 +- tests/osl_test.c | 12 +- 17 files changed, 1298 insertions(+), 317 deletions(-) rename configure.in => configure.ac (72%) delete mode 100644 include/Makefile.am create mode 100644 m4/ax_cc_maxopt.m4 create mode 100644 m4/ax_cflags_warn_all.m4 create mode 100644 m4/ax_check_compiler_flags.m4 create mode 100644 m4/ax_compiler_vendor.m4 create mode 100644 m4/ax_create_pkgconfig_info.m4 create mode 100644 m4/ax_gcc_archflag.m4 create mode 100644 m4/ax_gcc_x86_cpuid.m4 create mode 100644 m4/ax_submodule.m4 delete mode 100644 source/Makefile.am diff --git a/Makefile.am b/Makefile.am index 5a7b87f..1c16fac 100644 --- a/Makefile.am +++ b/Makefile.am @@ -68,14 +68,67 @@ ############################################################################# -SUBDIRS = doc source include tests +SUBDIRS = . doc tests +ACLOCAL_AMFLAGS = -I m4 ############################################################################# -ACLOCAL_AMFLAGS = -I autoconf -m4datadir = $(datadir)/aclocal +lib_LTLIBRARIES = libosl.la +############################################################################# + +pkginclude_HEADERS = \ + include/osl/osl.h \ + include/osl/statement.h \ + include/osl/interface.h \ + include/osl/generic.h \ + include/osl/vector.h \ + include/osl/relation.h \ + include/osl/relation_list.h \ + include/osl/macros.h \ + include/osl/int.h \ + include/osl/names.h \ + include/osl/strings.h \ + include/osl/body.h \ + include/osl/util.h \ + include/osl/scop.h + +pkgextensionsincludedir = $(pkgincludedir)/extensions +pkgextensionsinclude_HEADERS = \ + include/osl/extensions/textual.h \ + include/osl/extensions/comment.h \ + include/osl/extensions/scatnames.h \ + include/osl/extensions/arrays.h \ + include/osl/extensions/coordinates.h \ + include/osl/extensions/irregular.h + +DEFAULT_INCLUDES = -I. +INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include +AM_CFLAGS = $(CFLAGS_WARN) + +############################################################################# + +libosl_la_CPPFLAGS = -g +libosl_la_SOURCES = \ + source/scop.c \ + source/statement.c \ + source/extensions/textual.c \ + source/extensions/comment.c \ + source/extensions/scatnames.c \ + source/extensions/arrays.c \ + source/extensions/coordinates.c \ + source/extensions/irregular.c \ + source/interface.c \ + source/generic.c \ + source/relation.c \ + source/relation_list.c \ + source/vector.c \ + source/names.c \ + source/strings.c \ + source/body.c \ + source/int.c \ + source/util.c MAINTAINERCLEANFILES = \ autoconf/texinfo.tex \ @@ -85,8 +138,9 @@ MAINTAINERCLEANFILES = \ source/stamp-h.in \ $(AUX_DIST) - ############################################################################# + ctags: ctags -R --c++-kinds=+p --fields=+iaS --extra=+q -f$(HOME)/.ctags . + ############################################################################# diff --git a/autogen.sh b/autogen.sh index b67de1f..68f4a17 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,5 +1,2 @@ -#! /bin/sh - -aclocal -I autoconf -libtoolize --force --copy -autoreconf -vfi +#!/bin/sh +autoreconf -i diff --git a/configure.in b/configure.ac similarity index 72% rename from configure.in rename to configure.ac index 7d41d63..25070f3 100644 --- a/configure.in +++ b/configure.ac @@ -64,18 +64,24 @@ dnl **************************************************************************/ dnl dnl Input file for autoconf to build a configuration shellscript. +m4_define([version_major], [0]) +m4_define([version_minor], [8]) +m4_define([version_revision], [2]) -AC_PREREQ(2.13) +AC_PREREQ(2.53) dnl Fill here the @bug email adress. -AC_INIT([osl], [0.8.2], [cedric.bastoul@u-psud.fr,pouchet@cse.ohio-state.edu]) +AC_INIT([osl], [version_major.version_minor.version_revision], + [cedric.bastoul@u-psud.fr,pouchet@cse.ohio-state.edu]) dnl A common file, which serve as a test. AC_CONFIG_SRCDIR([include/osl/macros.h]) dnl Put as most as possible configuration files to an auxialiry dnl directory. AC_CONFIG_AUX_DIR([autoconf]) -dnl Initialize automake. Here, a special tar version that enables -dnl (very) long filenames. -AM_INIT_AUTOMAKE([1.9 tar-ustar no-define foreign dist-bzip2]) +AC_CONFIG_MACRO_DIR([m4]) + +dnl Initialize automake. +AM_INIT_AUTOMAKE([foreign]) +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) dnl /************************************************************************** @@ -88,8 +94,13 @@ AC_PROG_CC AC_PROG_LN_S AC_PROG_MAKE_SET AC_CHECK_PROG(CD, cd) +AC_PROG_INSTALL AC_PROG_LIBTOOL AC_CHECK_PROGS(DOXYGEN,doxygen,doxygen) + +AX_CC_MAXOPT +AC_SUBST(CFLAGS_WARN) +AX_CFLAGS_WARN_ALL(CFLAGS_WARN) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -107,93 +118,40 @@ dnl /************************************************************************** dnl * Option setting * dnl **************************************************************************/ -dnl Some default values cause I'm not sure whether autoconf set them, while -dnl documentation says it does... -gmp_package="yes" -gmp_include_package="yes" -gmp_library_package="yes" -gmp_flag="OSL_GMP_IS_HERE" - -ASKED_FOR_GMP="no" - -dnl --with-gmp=gmp-path -AC_ARG_WITH(gmp, - [ --with-gmp=DIR DIR where the gmp package is installed], - [ echo "Package gmp : $withval" && - gmp_package=$withval && - GMP_INC=$gmp_package/include && - GMP_LIB=$gmp_package/lib && - ASKED_FOR_GMP="yes"]) - -AC_ARG_WITH(gmp-include, - [ --with-gmp-include=DIR DIR where gmp.h is installed], - [ echo "Package gmp-include : $withval" && - gmp_include_package=$withval && - GMP_INC=$gmp_include_package && - ASKED_FOR_GMP="yes"]) - -AC_ARG_WITH(gmp-library, - [ --with-gmp-library=DIR DIR where the gmp library is installed], - [ echo "Package gmp-library : $withval" && - gmp_library_package=$withval && - GMP_LIB=$gmp_library_package && - ASKED_FOR_GMP="yes"]) - - dnl /************************************************************************** dnl * Where is GMP? * dnl **************************************************************************/ - -dnl Checking for gmp -AC_MSG_CHECKING(whether gmp works) -if test "$gmp_package" = "no"; then - echo "GMP package not defined" - AC_MSG_RESULT(no) -else - if test "$ASKED_FOR_GMP" = "no"; then - echo "Mode normal GMP" - AC_CHECK_HEADER(gmp.h, - [AC_CHECK_LIB(gmp, - __gmpz_init, - [LIBS="$LIBS -lgmp" && - CPPFLAGS="-D$gmp_flag $CPPFLAGS"], - [echo "Cannot find gmp library." && - echo "MP precision will not be supported."])], - [echo "Can't find gmp headers." && - echo "MP precision will not be supported."]) - else - dnl Default given by --with-X is "yes", --without-X is "no". We also - dnl initialized manually all gmp_package* variables to "yes" (thus they are - dnl supposed to be "yes" except if the user set them himself). - - if test "$gmp_package" != "yes" ; then - echo "(GMP path has been set by user)" - GMP_DIR=$gmp_package - CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS" - LDFLAGS="-L$GMP_DIR/lib $LDFLAGS" - fi - - if test "$gmp_include_package" != "yes" ; then - CPPFLAGS="-I$GMP_INC $CPPFLAGS" +gmp_flag="OSL_GMP_IS_HERE" +AX_SUBMODULE(gmp,no|system|build,system) + +case "$with_gmp" in +build) + CPPFLAGS="-D$gmp_flag -I$with_gmp_builddir $CPPFLAGS" + LDFLAGS="-L$with_gmp_builddir/$lt_cv_objdir $LDFLAGS" + ;; +system) + CPPFLAGS="-D$gmp_flag $CPPFLAGS" + if test "x$with_gmp_prefix" != "x"; then + CPPFLAGS="-I$with_gmp_prefix/include $CPPFLAGS" fi - - if test "$gmp_library_package" != "yes" ; then - LDFLAGS="-L$GMP_LIB $LDFLAGS" + + if test "$with_gmp_exec_prefix" != "yes" ; then + LDFLAGS="-L$with_gmp_exec_prefix/lib $LDFLAGS" fi - + ;; +esac +case "$with_gmp" in +build|system) AC_CHECK_HEADER(gmp.h, [], - [AC_MSG_ERROR("Cannot find gmp headers.")]) + [AC_MSG_ERROR("Can't find gmp headers.")]) AC_CHECK_LIB(gmp, __gmpz_init, - [LIBS="$LIBS -lgmp" && - CPPFLAGS="-D$gmp_flag $CPPFLAGS"], - [AC_MSG_ERROR("Cannot find gmp library.")]) - - AC_MSG_RESULT(yes) - fi -fi + [LIBS="$LIBS -lgmp"], + [AC_MSG_ERROR("Can't find gmp library.")]) + ;; +esac dnl /************************************************************************** @@ -203,15 +161,18 @@ dnl **************************************************************************/ dnl Substitutions to do. AC_SUBST(ac_aux_dir) +AC_SUBST(abs_top_srcdir) + +AC_SUBST(VERSION_MAJOR) +AC_SUBST(VERSION_MINOR) +AC_SUBST(VERSION_REVISION) dnl Configure Makefiles. AC_CONFIG_FILES([ Makefile doc/Makefile doc/Doxyfile - include/Makefile include/osl/scop.h - source/Makefile tests/Makefile ], [test -z "$CONFIG_HEADERS" || echo timestamp > source/stamp-h.in]) diff --git a/doc/openscop.texi b/doc/openscop.texi index 03f2f88..411382b 100644 --- a/doc/openscop.texi +++ b/doc/openscop.texi @@ -3075,16 +3075,17 @@ OpenScop Library top-level directory. The user can specify an installation prefix other than @code{/usr/local} by giving @code{configure} the option @code{--prefix=PATH}. -@item By default, The OpenScop Library is built in 64bits version. -If the user gives to @code{configure} the option -@code{--enable-int-version}, the 32bits version of the OpenScop Library -will be compiled. In the same way, the option @code{--enable-mp-version} -has to be used to build the multiple precision version. - -@item By default, @code{configure} will look for the GMP library -(necessary to build the multiple precision version) in standard -locations. If necessary, the user can specify the GMP path by giving -@code{configure} the option @code{--with-gmp=PATH}. +@item By default, The OpenScop Library supports 32 bits, 64 bits and GMP if +it is installed in the standard locations. Using the @code{--with-gmp} option +of @code{configure} the user can specify that no GMP (@code{--with-gmp=no}), +a previously installed (@code{--with-gmp=system}, the default) GMP or a +build GMP (@code{--with-gmp=build}) GMP should be used. +In case of an installed GMP, the installation location can be specified +using the @code{--with-isl-prefix=PATH} and if different, the installation +of the library can be specified using the +@code{--with-isl-exec-prefix=PATH} options of @code{configure}. +In the case of a build GMP, the user can also specify the build location +using @code{--with-isl-builddir=PATH}. @end itemize @node Uninstallation diff --git a/include/Makefile.am b/include/Makefile.am deleted file mode 100644 index f9e69e7..0000000 --- a/include/Makefile.am +++ /dev/null @@ -1,102 +0,0 @@ -# -# /*+------------------------------------------------------------------** -# ** OpenScop Library ** -# **------------------------------------------------------------------** -# ** makefile.am ** -# **------------------------------------------------------------------** -# ** First version: 30/04/2008 ** -# **------------------------------------------------------------------** -# -# -# *************************************************************************** -# * OpenScop: Structures and formats for polyhedral tools to talk together * -# *************************************************************************** -# * ,___,,_,__,,__,,__,,__,,_,__,,_,__,,__,,___,_,__,,_,__, * -# * / / / // // // // / / / // // / / // / /|,_, * -# * / / / // // // // / / / // // / / // / / / /\ * -# * |~~~|~|~~~|~~~|~~~|~~~|~|~~~|~|~~~|~~~|~~~|~|~~~|~|~~~|/_/ \ * -# * | G |C| P | = | L | P |=| = |C| = | = | = |=| = |=| C |\ \ /\ * -# * | R |l| o | = | e | l |=| = |a| = | = | = |=| = |=| L | \# \ /\ * -# * | A |a| l | = | t | u |=| = |n| = | = | = |=| = |=| o | |\# \ \ * -# * | P |n| l | = | s | t |=| = |d| = | = | = | | |=| o | | \# \ \ * -# * | H | | y | | e | o | | = |l| | | = | | | | G | | \ \ \ * -# * | I | | | | e | | | | | | | | | | | | | \ \ \ * -# * | T | | | | | | | | | | | | | | | | | \ \ \ * -# * | E | | | | | | | | | | | | | | | | | \ \ \ * -# * | * |*| * | * | * | * |*| * |*| * | * | * |*| * |*| * | / \* \ \ * -# * | O |p| e | n | S | c |o| p |-| L | i | b |r| a |r| y |/ \ \ / * -# * '---'-'---'---'---'---'-'---'-'---'---'---'-'---'-'---' '--' * -# * * -# * Copyright (C) 2008 University Paris-Sud 11 and INRIA * -# * * -# * (3-clause BSD license) * -# * Redistribution and use in source and binary forms, with or without * -# * modification, are permitted provided that the following conditions * -# * are met: * -# * * -# * 1. Redistributions of source code must retain the above copyright * -# * notice, this list of conditions and the following disclaimer. * -# * 2. Redistributions in binary form must reproduce the above copyright * -# * notice, this list of conditions and the following disclaimer in the * -# * documentation and/or other materials provided with the distribution. * -# * 3. The name of the author may not be used to endorse or promote * -# * products derived from this software without specific prior written * -# * permission. * -# * * -# * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * -# * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * -# * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * -# * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * -# * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * -# * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * -# * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * -# * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * -# * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * -# * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * -# * POSSIBILITY OF SUCH DAMAGE. * -# * * -# * OpenScop Library, a library to manipulate OpenScop formats and data * -# * structures. Written by: * -# * Cedric Bastoul and * -# * Louis-Noel Pouchet * -# * * -# ***************************************************************************/ -# -# Makefile.am (or makefile if generated) of the OpenScop Library. -# Makefile.am is not a makefile, you must run the 'autogen.sh' THEN the -# configure shellscript to generate the Makefile thanks to this file. - - -############################################################################# -SUBDIRS = - -############################################################################# -MAINTAINERCLEANFILES = Makefile.in - -############################################################################# - -pkginclude_HEADERS = \ - osl/osl.h \ - osl/statement.h \ - osl/interface.h \ - osl/generic.h \ - osl/vector.h \ - osl/relation.h \ - osl/relation_list.h \ - osl/macros.h \ - osl/int.h \ - osl/names.h \ - osl/strings.h \ - osl/body.h \ - osl/util.h \ - osl/scop.h - -pkgextensionsincludedir = $(pkgincludedir)/extensions -pkgextensionsinclude_HEADERS = \ - osl/extensions/textual.h \ - osl/extensions/comment.h \ - osl/extensions/scatnames.h \ - osl/extensions/arrays.h \ - osl/extensions/coordinates.h \ - osl/extensions/irregular.h - diff --git a/m4/ax_cc_maxopt.m4 b/m4/ax_cc_maxopt.m4 new file mode 100644 index 0000000..da415be --- /dev/null +++ b/m4/ax_cc_maxopt.m4 @@ -0,0 +1,178 @@ +# =========================================================================== +# http://www.nongnu.org/autoconf-archive/ax_cc_maxopt.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CC_MAXOPT +# +# DESCRIPTION +# +# Try to turn on "good" C optimization flags for various compilers and +# architectures, for some definition of "good". (In our case, good for +# FFTW and hopefully for other scientific codes. Modify as needed.) +# +# The user can override the flags by setting the CFLAGS environment +# variable. The user can also specify --enable-portable-binary in order to +# disable any optimization flags that might result in a binary that only +# runs on the host architecture. +# +# Note also that the flags assume that ANSI C aliasing rules are followed +# by the code (e.g. for gcc's -fstrict-aliasing), and that floating-point +# computations can be re-ordered as needed. +# +# Requires macros: AX_CHECK_COMPILER_FLAGS, AX_COMPILER_VENDOR, +# AX_GCC_ARCHFLAG, AX_GCC_X86_CPUID. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# 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 3 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +AC_DEFUN([AX_CC_MAXOPT], +[ +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AX_COMPILER_VENDOR]) +AC_REQUIRE([AC_CANONICAL_HOST]) + +AC_ARG_ENABLE(portable-binary, [AC_HELP_STRING([--enable-portable-binary], [disable compiler optimizations that would produce unportable binaries])], + acx_maxopt_portable=$withval, acx_maxopt_portable=no) + +# Try to determine "good" native compiler flags if none specified via CFLAGS +if test "$ac_test_CFLAGS" != "set"; then + CFLAGS="" + case $ax_cv_c_compiler_vendor in + dec) CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host" + if test "x$acx_maxopt_portable" = xno; then + CFLAGS="$CFLAGS -arch host" + fi;; + + sun) CFLAGS="-native -fast -xO5 -dalign" + if test "x$acx_maxopt_portable" = xyes; then + CFLAGS="$CFLAGS -xarch=generic" + fi;; + + hp) CFLAGS="+Oall +Optrs_ansi +DSnative" + if test "x$acx_maxopt_portable" = xyes; then + CFLAGS="$CFLAGS +DAportable" + fi;; + + ibm) if test "x$acx_maxopt_portable" = xno; then + xlc_opt="-qarch=auto -qtune=auto" + else + xlc_opt="-qtune=auto" + fi + AX_CHECK_COMPILER_FLAGS($xlc_opt, + CFLAGS="-O3 -qansialias -w $xlc_opt", + [CFLAGS="-O3 -qansialias -w" + echo "******************************************************" + echo "* You seem to have the IBM C compiler. It is *" + echo "* recommended for best performance that you use: *" + echo "* *" + echo "* CFLAGS=-O3 -qarch=xxx -qtune=xxx -qansialias -w *" + echo "* ^^^ ^^^ *" + echo "* where xxx is pwr2, pwr3, 604, or whatever kind of *" + echo "* CPU you have. (Set the CFLAGS environment var. *" + echo "* and re-run configure.) For more info, man cc. *" + echo "******************************************************"]) + ;; + + intel) CFLAGS="-O3 -ansi_alias" + if test "x$acx_maxopt_portable" = xno; then + icc_archflag=unknown + icc_flags="" + case $host_cpu in + i686*|x86_64*) + # icc accepts gcc assembly syntax, so these should work: + AX_GCC_X86_CPUID(0) + AX_GCC_X86_CPUID(1) + case $ax_cv_gcc_x86_cpuid_0 in # see AX_GCC_ARCHFLAG + *:756e6547:*:*) # Intel + case $ax_cv_gcc_x86_cpuid_1 in + *6a?:*[[234]]:*:*|*6[[789b]]?:*:*:*) icc_flags="-xK";; + *f3[[347]]:*:*:*|*f4[1347]:*:*:*) icc_flags="-xP -xN -xW -xK";; + *f??:*:*:*) icc_flags="-xN -xW -xK";; + esac ;; + esac ;; + esac + if test "x$icc_flags" != x; then + for flag in $icc_flags; do + AX_CHECK_COMPILER_FLAGS($flag, [icc_archflag=$flag; break]) + done + fi + AC_MSG_CHECKING([for icc architecture flag]) + AC_MSG_RESULT($icc_archflag) + if test "x$icc_archflag" != xunknown; then + CFLAGS="$CFLAGS $icc_archflag" + fi + fi + ;; + + gnu) + # default optimization flags for gcc on all systems + CFLAGS="-O3 -fomit-frame-pointer" + + # -malign-double for x86 systems + AX_CHECK_COMPILER_FLAGS(-malign-double, CFLAGS="$CFLAGS -malign-double") + + # -fstrict-aliasing for gcc-2.95+ + AX_CHECK_COMPILER_FLAGS(-fstrict-aliasing, + CFLAGS="$CFLAGS -fstrict-aliasing") + + # note that we enable "unsafe" fp optimization with other compilers, too + AX_CHECK_COMPILER_FLAGS(-ffast-math, CFLAGS="$CFLAGS -ffast-math") + + AX_GCC_ARCHFLAG($acx_maxopt_portable) + ;; + esac + + if test -z "$CFLAGS"; then + echo "" + echo "********************************************************" + echo "* WARNING: Don't know the best CFLAGS for this system *" + echo "* Use ./configure CFLAGS=... to specify your own flags *" + echo "* (otherwise, a default of CFLAGS=-O3 will be used) *" + echo "********************************************************" + echo "" + CFLAGS="-O3" + fi + + AX_CHECK_COMPILER_FLAGS($CFLAGS, [], [ + echo "" + echo "********************************************************" + echo "* WARNING: The guessed CFLAGS don't seem to work with *" + echo "* your compiler. *" + echo "* Use ./configure CFLAGS=... to specify your own flags *" + echo "********************************************************" + echo "" + CFLAGS="" + ]) + +fi +]) diff --git a/m4/ax_cflags_warn_all.m4 b/m4/ax_cflags_warn_all.m4 new file mode 100644 index 0000000..026c6e9 --- /dev/null +++ b/m4/ax_cflags_warn_all.m4 @@ -0,0 +1,149 @@ +# =========================================================================== +# http://www.nongnu.org/autoconf-archive/ax_cflags_warn_all.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] +# +# DESCRIPTION +# +# Try to find a compiler option that enables most reasonable warnings. +# +# For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The +# result is added to the shellvar being CFLAGS by default. +# +# Currently this macro knows about GCC, Solaris C compiler, Digital Unix C +# compiler, C for AIX Compiler, HP-UX C compiler, IRIX C compiler, NEC +# SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos 10.0.0.8) C +# compiler. +# +# - $1 shell-variable-to-add-to : CFLAGS +# - $2 add-value-if-not-found : nothing +# - $3 action-if-found : add value to shellvariable +# - $4 action-if-not-found : nothing +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# +# 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl +AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl +AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl +AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], +VAR,[VAR="no, unknown" + AC_LANG_SAVE + AC_LANG_C + ac_save_[]FLAGS="$[]FLAGS" +for ac_arg dnl +in "-pedantic % -Wall" dnl GCC + "-xstrconst % -v" dnl Solaris C + "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix + "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX + "-ansi -ansiE % -fullwarn" dnl IRIX + "+ESlit % +w1" dnl HP-UX C + "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) + "-h conform % -h msglevel 2" dnl Cray C (Unicos) + # +do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + AC_TRY_COMPILE([],[return 0;], + [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) +done + FLAGS="$ac_save_[]FLAGS" + AC_LANG_RESTORE +]) +case ".$VAR" in + .ok|.ok,*) m4_ifvaln($3,$3) ;; + .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ + AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) + m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; + *) m4_ifvaln($3,$3,[ + if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null + then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) + else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) + m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" + fi ]) ;; +esac +AS_VAR_POPDEF([VAR])dnl +AS_VAR_POPDEF([FLAGS])dnl +]) + +dnl the only difference - the LANG selection... and the default FLAGS + +AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl +AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl +AS_VAR_PUSHDEF([VAR],[ax_cv_cxxflags_warn_all])dnl +AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], +VAR,[VAR="no, unknown" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_[]FLAGS="$[]FLAGS" +for ac_arg dnl +in "-pedantic % -Wall" dnl GCC + "-xstrconst % -v" dnl Solaris C + "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix + "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX + "-ansi -ansiE % -fullwarn" dnl IRIX + "+ESlit % +w1" dnl HP-UX C + "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) + "-h conform % -h msglevel 2" dnl Cray C (Unicos) + # +do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + AC_TRY_COMPILE([],[return 0;], + [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) +done + FLAGS="$ac_save_[]FLAGS" + AC_LANG_RESTORE +]) +case ".$VAR" in + .ok|.ok,*) m4_ifvaln($3,$3) ;; + .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ + AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) + m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; + *) m4_ifvaln($3,$3,[ + if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null + then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) + else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) + m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" + fi ]) ;; +esac +AS_VAR_POPDEF([VAR])dnl +AS_VAR_POPDEF([FLAGS])dnl +]) + +dnl implementation tactics: +dnl the for-argument contains a list of options. The first part of +dnl these does only exist to detect the compiler - usually it is +dnl a global option to enable -ansi or -extrawarnings. All other +dnl compilers will fail about it. That was needed since a lot of +dnl compilers will give false positives for some option-syntax +dnl like -Woption or -Xoption as they think of it is a pass-through +dnl to later compile stages or something. The "%" is used as a +dnl delimimiter. A non-option comment can be given after "%%" marks +dnl which will be shown but not added to the respective C/CXXFLAGS. diff --git a/m4/ax_check_compiler_flags.m4 b/m4/ax_check_compiler_flags.m4 new file mode 100644 index 0000000..7da8324 --- /dev/null +++ b/m4/ax_check_compiler_flags.m4 @@ -0,0 +1,74 @@ +# =========================================================================== +# http://www.nongnu.org/autoconf-archive/ax_check_compiler_flags.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE]) +# +# DESCRIPTION +# +# Check whether the given compiler FLAGS work with the current language's +# compiler, or whether they give an error. (Warnings, however, are +# ignored.) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# LICENSE +# +# Copyright (c) 2009 Steven G. Johnson +# Copyright (c) 2009 Matteo Frigo +# +# 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 3 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +AC_DEFUN([AX_CHECK_COMPILER_FLAGS], +[AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX +AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1]) +dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: +AS_LITERAL_IF([$1], + [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1]), [ + ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$1" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes, + AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no) + _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])], + [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$1" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes, + eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no) + _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS]) +eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1]) +AC_MSG_RESULT($ax_check_compiler_flags) +if test "x$ax_check_compiler_flags" = xyes; then + m4_default([$2], :) +else + m4_default([$3], :) +fi +])dnl AX_CHECK_COMPILER_FLAGS diff --git a/m4/ax_compiler_vendor.m4 b/m4/ax_compiler_vendor.m4 new file mode 100644 index 0000000..b074260 --- /dev/null +++ b/m4/ax_compiler_vendor.m4 @@ -0,0 +1,61 @@ +# =========================================================================== +# http://www.nongnu.org/autoconf-archive/ax_compiler_vendor.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPILER_VENDOR +# +# DESCRIPTION +# +# Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun, +# hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft, +# watcom, etc. The vendor is returned in the cache variable +# $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# 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 3 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +AC_DEFUN([AX_COMPILER_VENDOR], +[ +AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, + [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown + # note: don't check for gcc first since some other compilers define __GNUC__ + for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ pathscale:__PATHCC__,__PATHSCALE__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do + vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ +#if !($vencpp) + thisisanerror; +#endif +])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break]) + done + ]) +]) diff --git a/m4/ax_create_pkgconfig_info.m4 b/m4/ax_create_pkgconfig_info.m4 new file mode 100644 index 0000000..60ac548 --- /dev/null +++ b/m4/ax_create_pkgconfig_info.m4 @@ -0,0 +1,349 @@ +# =========================================================================== +# http://www.nongnu.org/autoconf-archive/ax_create_pkgconfig_info.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CREATE_PKGCONFIG_INFO [(outputfile, [requires [,libs [,summary [,cflags [, ldflags]]]]])] +# +# DESCRIPTION +# +# Defaults: +# +# $1 = $PACKAGE_NAME.pc +# $2 = (empty) +# $3 = $PACKAGE_LIBS $LIBS (as set at that point in configure.ac) +# $4 = $PACKAGE_SUMMARY (or $1 Library) +# $5 = $CPPFLAGS $PACKAGE_CFLAGS (as set at the point in configure.ac) +# $6 = $LDFLAGS $PACKAGE_LDFLAGS (as set at the point in configure.ac) +# +# PACKAGE_NAME defaults to $PACKAGE if not set. +# PACKAGE_LIBS defaults to -l$PACKAGE_NAME if not set. +# +# The resulting file is called $PACKAGE.pc.in / $PACKAGE.pc +# +# You will find this macro most useful in conjunction with +# ax_spec_defaults that can read good initializers from the .spec file. In +# consequencd, most of the generatable installable stuff can be made from +# information being updated in a single place for the whole project. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2008 Sven Verdoolaege +# +# 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +AC_DEFUN([AX_CREATE_PKGCONFIG_INFO],[dnl +AS_VAR_PUSHDEF([PKGCONFIG_suffix],[ax_create_pkgconfig_suffix])dnl +AS_VAR_PUSHDEF([PKGCONFIG_libdir],[ax_create_pkgconfig_libdir])dnl +AS_VAR_PUSHDEF([PKGCONFIG_libfile],[ax_create_pkgconfig_libfile])dnl +AS_VAR_PUSHDEF([PKGCONFIG_libname],[ax_create_pkgconfig_libname])dnl +AS_VAR_PUSHDEF([PKGCONFIG_version],[ax_create_pkgconfig_version])dnl +AS_VAR_PUSHDEF([PKGCONFIG_description],[ax_create_pkgconfig_description])dnl +AS_VAR_PUSHDEF([PKGCONFIG_requires],[ax_create_pkgconfig_requires])dnl +AS_VAR_PUSHDEF([PKGCONFIG_pkglibs],[ax_create_pkgconfig_pkglibs])dnl +AS_VAR_PUSHDEF([PKGCONFIG_libs],[ax_create_pkgconfig_libs])dnl +AS_VAR_PUSHDEF([PKGCONFIG_ldflags],[ax_create_pkgconfig_ldflags])dnl +AS_VAR_PUSHDEF([PKGCONFIG_cppflags],[ax_create_pkgconfig_cppflags])dnl +AS_VAR_PUSHDEF([PKGCONFIG_generate],[ax_create_pkgconfig_generate])dnl +AS_VAR_PUSHDEF([PKGCONFIG_src_libdir],[ax_create_pkgconfig_src_libdir])dnl +AS_VAR_PUSHDEF([PKGCONFIG_src_headers],[ax_create_pkgconfig_src_headers])dnl + +# we need the expanded forms... +test "x$prefix" = xNONE && prefix=$ac_default_prefix +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +AC_MSG_CHECKING(our pkgconfig libname) +test ".$PKGCONFIG_libname" != "." || \ +PKGCONFIG_libname="ifelse($1,,${PACKAGE_NAME},`basename $1 .pc`)" +test ".$PKGCONFIG_libname" != "." || \ +PKGCONFIG_libname="$PACKAGE" +PKGCONFIG_libname=`eval echo "$PKGCONFIG_libname"` +PKGCONFIG_libname=`eval echo "$PKGCONFIG_libname"` +AC_MSG_RESULT($PKGCONFIG_libname) + +AC_MSG_CHECKING(our pkgconfig version) +test ".$PKGCONFIG_version" != "." || \ +PKGCONFIG_version="${PACKAGE_VERSION}" +test ".$PKGCONFIG_version" != "." || \ +PKGCONFIG_version="$VERSION" +PKGCONFIG_version=`eval echo "$PKGCONFIG_version"` +PKGCONFIG_version=`eval echo "$PKGCONFIG_version"` +AC_MSG_RESULT($PKGCONFIG_version) + +AC_MSG_CHECKING(our pkgconfig_libdir) +test ".$pkgconfig_libdir" = "." && \ +pkgconfig_libdir='${libdir}/pkgconfig' +PKGCONFIG_libdir=`eval echo "$pkgconfig_libdir"` +PKGCONFIG_libdir=`eval echo "$PKGCONFIG_libdir"` +PKGCONFIG_libdir=`eval echo "$PKGCONFIG_libdir"` +AC_MSG_RESULT($pkgconfig_libdir) +test "$pkgconfig_libdir" != "$PKGCONFIG_libdir" && ( +AC_MSG_RESULT(expanded our pkgconfig_libdir... $PKGCONFIG_libdir)) +AC_SUBST([pkgconfig_libdir]) + +AC_MSG_CHECKING(our pkgconfig_libfile) +test ".$pkgconfig_libfile" != "." || \ +pkgconfig_libfile="ifelse($1,,$PKGCONFIG_libname.pc,`basename $1`)" +PKGCONFIG_libfile=`eval echo "$pkgconfig_libfile"` +PKGCONFIG_libfile=`eval echo "$PKGCONFIG_libfile"` +AC_MSG_RESULT($pkgconfig_libfile) +test "$pkgconfig_libfile" != "$PKGCONFIG_libfile" && ( +AC_MSG_RESULT(expanded our pkgconfig_libfile... $PKGCONFIG_libfile)) +AC_SUBST([pkgconfig_libfile]) + +AC_MSG_CHECKING(our package / suffix) +PKGCONFIG_suffix="$program_suffix" +test ".$PKGCONFIG_suffix" != .NONE || PKGCONFIG_suffix="" +AC_MSG_RESULT(${PACKAGE_NAME} / ${PKGCONFIG_suffix}) + +AC_MSG_CHECKING(our pkgconfig description) +PKGCONFIG_description="ifelse($4,,$PACKAGE_SUMMARY,$4)" +test ".$PKGCONFIG_description" != "." || \ +PKGCONFIG_description="$PKGCONFIG_libname Library" +PKGCONFIG_description=`eval echo "$PKGCONFIG_description"` +PKGCONFIG_description=`eval echo "$PKGCONFIG_description"` +AC_MSG_RESULT($PKGCONFIG_description) + +AC_MSG_CHECKING(our pkgconfig requires) +PKGCONFIG_requires="ifelse($2,,$PACKAGE_REQUIRES,$2)" +PKGCONFIG_requires=`eval echo "$PKGCONFIG_requires"` +PKGCONFIG_requires=`eval echo "$PKGCONFIG_requires"` +AC_MSG_RESULT($PKGCONFIG_requires) + +AC_MSG_CHECKING(our pkgconfig ext libs) +PKGCONFIG_pkglibs="$PACKAGE_LIBS" +test ".$PKGCONFIG_pkglibs" != "." || PKGCONFIG_pkglibs="-l$PKGCONFIG_libname" +PKGCONFIG_libs="ifelse($3,,$PKGCONFIG_pkglibs $LIBS,$3)" +PKGCONFIG_libs=`eval echo "$PKGCONFIG_libs"` +PKGCONFIG_libs=`eval echo "$PKGCONFIG_libs"` +AC_MSG_RESULT($PKGCONFIG_libs) + +AC_MSG_CHECKING(our pkgconfig cppflags) +PKGCONFIG_cppflags="ifelse($5,,$CPPFLAGS $PACKAGE_CFLAGS,$5)" +PKGCONFIG_cppflags=`eval echo "$PKGCONFIG_cppflags"` +PKGCONFIG_cppflags=`eval echo "$PKGCONFIG_cppflags"` +AC_MSG_RESULT($PKGCONFIG_cppflags) + +AC_MSG_CHECKING(our pkgconfig ldflags) +PKGCONFIG_ldflags="ifelse($6,,$LDFLAGS $PACKAGE_LDFLAGS,$5)" +PKGCONFIG_ldflags=`eval echo "$PKGCONFIG_ldflags"` +PKGCONFIG_ldflags=`eval echo "$PKGCONFIG_ldflags"` +AC_MSG_RESULT($PKGCONFIG_ldflags) + +test ".$PKGCONFIG_generate" != "." || \ +PKGCONFIG_generate="ifelse($1,,$PKGCONFIG_libname.pc,$1)" +PKGCONFIG_generate=`eval echo "$PKGCONFIG_generate"` +PKGCONFIG_generate=`eval echo "$PKGCONFIG_generate"` +test "$pkgconfig_libfile" != "$PKGCONFIG_generate" && ( +AC_MSG_RESULT(generate the pkgconfig later... $PKGCONFIG_generate)) + +if test ".$PKGCONFIG_src_libdir" = "." ; then +PKGCONFIG_src_libdir=`pwd` +PKGCONFIG_src_libdir=`AS_DIRNAME("$PKGCONFIG_src_libdir/$PKGCONFIG_generate")` +test ! -d $PKGCONFIG_src_libdir/src || \ +PKGCONFIG_src_libdir="$PKGCONFIG_src_libdir/src" +case ".$objdir" in +*libs) PKGCONFIG_src_libdir="$PKGCONFIG_src_libdir/$objdir" ;; esac +AC_MSG_RESULT(noninstalled pkgconfig -L $PKGCONFIG_src_libdir) +fi + +if test ".$PKGCONFIG_src_headers" = "." ; then +PKGCONFIG_src_headers=`pwd` +v="$ac_top_srcdir" ; +test ".$v" != "." || v="$ax_spec_dir" +test ".$v" != "." || v="$srcdir" +case "$v" in /*) PKGCONFIG_src_headers="" ;; esac +PKGCONFIG_src_headers=`AS_DIRNAME("$PKGCONFIG_src_headers/$v/x")` +test ! -d $PKGCONFIG_src_headers/incl[]ude || \ +PKGCONFIG_src_headers="$PKGCONFIG_src_headers/incl[]ude" +AC_MSG_RESULT(noninstalled pkgconfig -I $PKGCONFIG_src_headers) +fi + + +dnl AC_CONFIG_COMMANDS crap disallows to use $PKGCONFIG_libfile here... +AC_CONFIG_COMMANDS([$ax_create_pkgconfig_generate],[ +pkgconfig_generate="$ax_create_pkgconfig_generate" +if test ! -f "$pkgconfig_generate.in" +then generate="true" +elif grep ' generated by configure ' $pkgconfig_generate.in >/dev/null +then generate="true" +else generate="false"; +fi +if $generate ; then +AC_MSG_NOTICE(creating $pkgconfig_generate.in) +cat > $pkgconfig_generate.in <conftest.sed < $pkgconfig_generate +if test ! -s $pkgconfig_generate ; then + AC_MSG_ERROR([$pkgconfig_generate is empty]) +fi ; rm conftest.sed # DONE generate $pkgconfig_generate +pkgconfig_uninstalled=`echo $pkgconfig_generate |sed 's/.pc$/-uninstalled.pc/'` +AC_MSG_NOTICE(creating $pkgconfig_uninstalled) +cat >conftest.sed < $pkgconfig_uninstalled +if test ! -s $pkgconfig_uninstalled ; then + AC_MSG_ERROR([$pkgconfig_uninstalled is empty]) +fi ; rm conftest.sed # DONE generate $pkgconfig_uninstalled + pkgconfig_requires_add=`echo ${pkgconfig_requires}` +if test ".$pkgconfig_requires_add" != "." ; then + pkgconfig_requires_add="pkg-config $pkgconfig_requires_add" + else pkgconfig_requires_add=":" ; fi +pkgconfig_uninstalled=`echo $pkgconfig_generate |sed 's/.pc$/-uninstalled.sh/'` +AC_MSG_NOTICE(creating $pkgconfig_uninstalled) +cat >conftest.sed <Name:>for option\\; do case \"\$option\" in --list-all|--name) echo > +s>Description: *>\\;\\; --help) pkg-config --help \\; echo Buildscript Of > +s>Version: *>\\;\\; --modversion|--version) echo > +s>Requires:>\\;\\; --requires) echo $pkgconfig_requires_add> +s>Libs: *>\\;\\; --libs) echo > +s>Cflags: *>\\;\\; --cflags) echo > +/--libs)/a\\ + $pkgconfig_requires_add +/--cflags)/a\\ + $pkgconfig_requires_add\\ +;; --variable=*) eval echo '\$'\`echo \$option | sed -e 's/.*=//'\`\\ +;; --uninstalled) exit 0 \\ +;; *) ;; esac done +AXEOF +sed -f conftest.sed $pkgconfig_generate.in > $pkgconfig_uninstalled +if test ! -s $pkgconfig_uninstalled ; then + AC_MSG_ERROR([$pkgconfig_uninstalled is empty]) +fi ; rm conftest.sed # DONE generate $pkgconfig_uninstalled +],[ +dnl AC_CONFIG_COMMANDS crap, the AS_PUSHVAR defines are invalid here... +ax_create_pkgconfig_generate="$ax_create_pkgconfig_generate" +pkgconfig_prefix='$prefix' +pkgconfig_execprefix='$exec_prefix' +pkgconfig_bindir='$bindir' +pkgconfig_libdir='$libdir' +pkgconfig_includedir='$includedir' +pkgconfig_datarootdir='$datarootdir' +pkgconfig_datadir='$datadir' +pkgconfig_sysconfdir='$sysconfdir' +pkgconfig_suffix='$ax_create_pkgconfig_suffix' +pkgconfig_package='$PACKAGE_NAME' +pkgconfig_libname='$ax_create_pkgconfig_libname' +pkgconfig_description='$ax_create_pkgconfig_description' +pkgconfig_version='$ax_create_pkgconfig_version' +pkgconfig_requires='$ax_create_pkgconfig_requires' +pkgconfig_libs='$ax_create_pkgconfig_libs' +pkgconfig_ldflags='$ax_create_pkgconfig_ldflags' +pkgconfig_cppflags='$ax_create_pkgconfig_cppflags' +pkgconfig_src_libdir='$ax_create_pkgconfig_src_libdir' +pkgconfig_src_headers='$ax_create_pkgconfig_src_headers' +])dnl +AS_VAR_POPDEF([PKGCONFIG_suffix])dnl +AS_VAR_POPDEF([PKGCONFIG_libdir])dnl +AS_VAR_POPDEF([PKGCONFIG_libfile])dnl +AS_VAR_POPDEF([PKGCONFIG_libname])dnl +AS_VAR_POPDEF([PKGCONFIG_version])dnl +AS_VAR_POPDEF([PKGCONFIG_description])dnl +AS_VAR_POPDEF([PKGCONFIG_requires])dnl +AS_VAR_POPDEF([PKGCONFIG_pkglibs])dnl +AS_VAR_POPDEF([PKGCONFIG_libs])dnl +AS_VAR_POPDEF([PKGCONFIG_ldflags])dnl +AS_VAR_POPDEF([PKGCONFIG_cppflags])dnl +AS_VAR_POPDEF([PKGCONFIG_generate])dnl +AS_VAR_POPDEF([PKGCONFIG_src_libdir])dnl +AS_VAR_POPDEF([PKGCONFIG_src_headers])dnl +]) diff --git a/m4/ax_gcc_archflag.m4 b/m4/ax_gcc_archflag.m4 new file mode 100644 index 0000000..dedeef4 --- /dev/null +++ b/m4/ax_gcc_archflag.m4 @@ -0,0 +1,213 @@ +# =========================================================================== +# http://www.nongnu.org/autoconf-archive/ax_gcc_archflag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_ARCHFLAG([PORTABLE?], [ACTION-SUCCESS], [ACTION-FAILURE]) +# +# DESCRIPTION +# +# This macro tries to guess the "native" arch corresponding to the target +# architecture for use with gcc's -march=arch or -mtune=arch flags. If +# found, the cache variable $ax_cv_gcc_archflag is set to this flag and +# ACTION-SUCCESS is executed; otherwise $ax_cv_gcc_archflag is is set to +# "unknown" and ACTION-FAILURE is executed. The default ACTION-SUCCESS is +# to add $ax_cv_gcc_archflag to the end of $CFLAGS. +# +# PORTABLE? should be either [yes] (default) or [no]. In the former case, +# the flag is set to -mtune (or equivalent) so that the architecture is +# only used for tuning, but the instruction set used is still portable. In +# the latter case, the flag is set to -march (or equivalent) so that +# architecture-specific instructions are enabled. +# +# The user can specify --with-gcc-arch= in order to override the +# macro's choice of architecture, or --without-gcc-arch to disable this. +# +# When cross-compiling, or if $CC is not gcc, then ACTION-FAILURE is +# called unless the user specified --with-gcc-arch manually. +# +# Requires macros: AX_CHECK_COMPILER_FLAGS, AX_GCC_X86_CPUID +# +# (The main emphasis here is on recent CPUs, on the principle that doing +# high-performance computing on old hardware is uncommon.) +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# 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 3 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +AC_DEFUN([AX_GCC_ARCHFLAG], +[AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_CANONICAL_HOST]) + +AC_ARG_WITH(gcc-arch, [AC_HELP_STRING([--with-gcc-arch=], [use architecture for gcc -march/-mtune, instead of guessing])], + ax_gcc_arch=$withval, ax_gcc_arch=yes) + +AC_MSG_CHECKING([for gcc architecture flag]) +AC_MSG_RESULT([]) +AC_CACHE_VAL(ax_cv_gcc_archflag, +[ +ax_cv_gcc_archflag="unknown" + +if test "$GCC" = yes; then + +if test "x$ax_gcc_arch" = xyes; then +ax_gcc_arch="" +if test "$cross_compiling" = no; then +case $host_cpu in + i[[3456]]86*|x86_64*) # use cpuid codes, in part from x86info-1.7 by D. Jones + AX_GCC_X86_CPUID(0) + AX_GCC_X86_CPUID(1) + case $ax_cv_gcc_x86_cpuid_0 in + *:756e6547:*:*) # Intel + case $ax_cv_gcc_x86_cpuid_1 in + *5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;; + *5??:*:*:*) ax_gcc_arch=pentium ;; + *6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *6[[9d]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; + *6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *6??:*:*:*) ax_gcc_arch=pentiumpro ;; + *f3[[347]]:*:*:*|*f4[1347]:*:*:*) + case $host_cpu in + x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; + *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; + esac ;; + *f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; + esac ;; + *:68747541:*:*) # AMD + case $ax_cv_gcc_x86_cpuid_1 in + *5[[67]]?:*:*:*) ax_gcc_arch=k6 ;; + *5[[8d]]?:*:*:*) ax_gcc_arch="k6-2 k6" ;; + *5[[9]]?:*:*:*) ax_gcc_arch="k6-3 k6" ;; + *60?:*:*:*) ax_gcc_arch=k7 ;; + *6[[12]]?:*:*:*) ax_gcc_arch="athlon k7" ;; + *6[[34]]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;; + *67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;; + *6[[68a]]?:*:*:*) + AX_GCC_X86_CPUID(0x80000006) # L2 cache size + case $ax_cv_gcc_x86_cpuid_0x80000006 in + *:*:*[[1-9a-f]]??????:*) # (L2 = ecx >> 16) >= 256 + ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;; + *) ax_gcc_arch="athlon-4 athlon k7" ;; + esac ;; + *f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; + *f5?:*:*:*) ax_gcc_arch="opteron k8" ;; + *f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; + *f??:*:*:*) ax_gcc_arch="k8" ;; + esac ;; + *:746e6543:*:*) # IDT + case $ax_cv_gcc_x86_cpuid_1 in + *54?:*:*:*) ax_gcc_arch=winchip-c6 ;; + *58?:*:*:*) ax_gcc_arch=winchip2 ;; + *6[[78]]?:*:*:*) ax_gcc_arch=c3 ;; + *69?:*:*:*) ax_gcc_arch="c3-2 c3" ;; + esac ;; + esac + if test x"$ax_gcc_arch" = x; then # fallback + case $host_cpu in + i586*) ax_gcc_arch=pentium ;; + i686*) ax_gcc_arch=pentiumpro ;; + esac + fi + ;; + + sparc*) + AC_PATH_PROG([PRTDIAG], [prtdiag], [prtdiag], [$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/]) + cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null` + cputype=`echo "$cputype" | tr -d ' -' |tr $as_cr_LETTERS $as_cr_letters` + case $cputype in + *ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;; + *ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;; + *ultrasparc*) ax_gcc_arch="ultrasparc v9" ;; + *supersparc*|*tms390z5[[05]]*) ax_gcc_arch="supersparc v8" ;; + *hypersparc*|*rt62[[056]]*) ax_gcc_arch="hypersparc v8" ;; + *cypress*) ax_gcc_arch=cypress ;; + esac ;; + + alphaev5) ax_gcc_arch=ev5 ;; + alphaev56) ax_gcc_arch=ev56 ;; + alphapca56) ax_gcc_arch="pca56 ev56" ;; + alphapca57) ax_gcc_arch="pca57 pca56 ev56" ;; + alphaev6) ax_gcc_arch=ev6 ;; + alphaev67) ax_gcc_arch=ev67 ;; + alphaev68) ax_gcc_arch="ev68 ev67" ;; + alphaev69) ax_gcc_arch="ev69 ev68 ev67" ;; + alphaev7) ax_gcc_arch="ev7 ev69 ev68 ev67" ;; + alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;; + + powerpc*) + cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | sed 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null` + cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'` + case $cputype in + *750*) ax_gcc_arch="750 G3" ;; + *740[[0-9]]*) ax_gcc_arch="$cputype 7400 G4" ;; + *74[[4-5]][[0-9]]*) ax_gcc_arch="$cputype 7450 G4" ;; + *74[[0-9]][[0-9]]*) ax_gcc_arch="$cputype G4" ;; + *970*) ax_gcc_arch="970 G5 power4";; + *POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";; + *POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";; + 603ev|8240) ax_gcc_arch="$cputype 603e 603";; + *) ax_gcc_arch=$cputype ;; + esac + ax_gcc_arch="$ax_gcc_arch powerpc" + ;; +esac +fi # not cross-compiling +fi # guess arch + +if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then +for arch in $ax_gcc_arch; do + if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code + flags="-mtune=$arch" + # -mcpu=$arch and m$arch generate nonportable code on every arch except + # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr. + case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac + else + flags="-march=$arch -mcpu=$arch -m$arch" + fi + for flag in $flags; do + AX_CHECK_COMPILER_FLAGS($flag, [ax_cv_gcc_archflag=$flag; break]) + done + test "x$ax_cv_gcc_archflag" = xunknown || break +done +fi + +fi # $GCC=yes +]) +AC_MSG_CHECKING([for gcc architecture flag]) +AC_MSG_RESULT($ax_cv_gcc_archflag) +if test "x$ax_cv_gcc_archflag" = xunknown; then + m4_default([$3],:) +else + m4_default([$2], [CFLAGS="$CFLAGS $ax_cv_gcc_archflag"]) +fi +]) diff --git a/m4/ax_gcc_x86_cpuid.m4 b/m4/ax_gcc_x86_cpuid.m4 new file mode 100644 index 0000000..5420b09 --- /dev/null +++ b/m4/ax_gcc_x86_cpuid.m4 @@ -0,0 +1,77 @@ +# =========================================================================== +# http://www.nongnu.org/autoconf-archive/ax_gcc_x86_cpuid.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_X86_CPUID(OP) +# +# DESCRIPTION +# +# On Pentium and later x86 processors, with gcc or a compiler that has a +# compatible syntax for inline assembly instructions, run a small program +# that executes the cpuid instruction with input OP. This can be used to +# detect the CPU type. +# +# On output, the values of the eax, ebx, ecx, and edx registers are stored +# as hexadecimal strings as "eax:ebx:ecx:edx" in the cache variable +# ax_cv_gcc_x86_cpuid_OP. +# +# If the cpuid instruction fails (because you are running a +# cross-compiler, or because you are not using gcc, or because you are on +# a processor that doesn't have this instruction), ax_cv_gcc_x86_cpuid_OP +# is set to the string "unknown". +# +# This macro mainly exists to be used in AX_GCC_ARCHFLAG. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# 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 3 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +AC_DEFUN([AX_GCC_X86_CPUID], +[AC_REQUIRE([AC_PROG_CC]) +AC_LANG_PUSH([C]) +AC_CACHE_CHECK(for x86 cpuid $1 output, ax_cv_gcc_x86_cpuid_$1, + [AC_RUN_IFELSE([AC_LANG_PROGRAM([#include ], [ + int op = $1, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; +])], + [ax_cv_gcc_x86_cpuid_$1=`cat conftest_cpuid`; rm -f conftest_cpuid], + [ax_cv_gcc_x86_cpuid_$1=unknown; rm -f conftest_cpuid], + [ax_cv_gcc_x86_cpuid_$1=unknown])]) +AC_LANG_POP([C]) +]) diff --git a/m4/ax_submodule.m4 b/m4/ax_submodule.m4 new file mode 100644 index 0000000..57e3a56 --- /dev/null +++ b/m4/ax_submodule.m4 @@ -0,0 +1,63 @@ +AC_DEFUN([AX_SUBMODULE], +[ + +AC_ARG_WITH($1, + [AS_HELP_STRING([--with-$1=$2], + [Which $1 to use])]) +case "system" in +$2) + AC_ARG_WITH($1_prefix, + [AS_HELP_STRING([--with-$1-prefix=DIR], + [Prefix of $1 installation])]) + AC_ARG_WITH($1_exec_prefix, + [AS_HELP_STRING([--with-$1-exec-prefix=DIR], + [Exec prefix of $1 installation])]) +esac +case "build" in +$2) + AC_ARG_WITH($1_builddir, + [AS_HELP_STRING([--with-$1-builddir=DIR], + [Location of $1 builddir])]) +esac +if test "x$with_$1_prefix" != "x" -a "x$with_$1_exec_prefix" = "x"; then + with_$1_exec_prefix=$with_$1_prefix +fi +if test "x$with_$1_prefix" != "x" -o "x$with_$1_exec_prefix" != "x"; then + if test "x$with_$1" != "x" -a "x$with_$1" != "xsystem"; then + AC_MSG_ERROR([Setting $with_$1_prefix implies use of system $1]) + fi + with_$1="system" +fi +if test "x$with_$1_builddir" != "x"; then + if test "x$with_$1" != "x" -a "x$with_$1" != "xbuild"; then + AC_MSG_ERROR([Setting $with_$1_builddir implies use of build $1]) + fi + with_$1="build" + $1_srcdir=`echo @abs_srcdir@ | $with_$1_builddir/config.status --file=-` + AC_MSG_NOTICE($1 sources in $$1_srcdir) +fi +case "$with_$1" in +$2) + ;; +*) + if test -d $srcdir/.git -a \ + -d $srcdir/$1 -a \ + ! -d $srcdir/$1/.git; then + AC_MSG_WARN( +[git repo detected, but submodule $1 not initialized]) + AC_MSG_WARN([You may want to run]) + AC_MSG_WARN([ git submodule init]) + AC_MSG_WARN([ git submodule update]) + AC_MSG_WARN([ sh autogen.sh]) + fi + if test -f $srcdir/$1/configure -a "$3" != "no"; then + with_$1="bundled" + else + with_$1="$3" + fi + ;; +esac +AC_MSG_CHECKING([which $1 to use]) +AC_MSG_RESULT($with_$1) + +]) diff --git a/source/Makefile.am b/source/Makefile.am deleted file mode 100644 index bb4e3a6..0000000 --- a/source/Makefile.am +++ /dev/null @@ -1,105 +0,0 @@ -# -# /*+------------------------------------------------------------------** -# ** OpenScop Library ** -# **------------------------------------------------------------------** -# ** makefile.am ** -# **------------------------------------------------------------------** -# ** First version: 30/04/2008 ** -# **------------------------------------------------------------------** -# -# -# *************************************************************************** -# * OpenScop: Structures and formats for polyhedral tools to talk together * -# *************************************************************************** -# * ,___,,_,__,,__,,__,,__,,_,__,,_,__,,__,,___,_,__,,_,__, * -# * / / / // // // // / / / // // / / // / /|,_, * -# * / / / // // // // / / / // // / / // / / / /\ * -# * |~~~|~|~~~|~~~|~~~|~~~|~|~~~|~|~~~|~~~|~~~|~|~~~|~|~~~|/_/ \ * -# * | G |C| P | = | L | P |=| = |C| = | = | = |=| = |=| C |\ \ /\ * -# * | R |l| o | = | e | l |=| = |a| = | = | = |=| = |=| L | \# \ /\ * -# * | A |a| l | = | t | u |=| = |n| = | = | = |=| = |=| o | |\# \ \ * -# * | P |n| l | = | s | t |=| = |d| = | = | = | | |=| o | | \# \ \ * -# * | H | | y | | e | o | | = |l| | | = | | | | G | | \ \ \ * -# * | I | | | | e | | | | | | | | | | | | | \ \ \ * -# * | T | | | | | | | | | | | | | | | | | \ \ \ * -# * | E | | | | | | | | | | | | | | | | | \ \ \ * -# * | * |*| * | * | * | * |*| * |*| * | * | * |*| * |*| * | / \* \ \ * -# * | O |p| e | n | S | c |o| p |-| L | i | b |r| a |r| y |/ \ \ / * -# * '---'-'---'---'---'---'-'---'-'---'---'---'-'---'-'---' '--' * -# * * -# * Copyright (C) 2008 University Paris-Sud 11 and INRIA * -# * * -# * (3-clause BSD license) * -# * Redistribution and use in source and binary forms, with or without * -# * modification, are permitted provided that the following conditions * -# * are met: * -# * * -# * 1. Redistributions of source code must retain the above copyright * -# * notice, this list of conditions and the following disclaimer. * -# * 2. Redistributions in binary form must reproduce the above copyright * -# * notice, this list of conditions and the following disclaimer in the * -# * documentation and/or other materials provided with the distribution. * -# * 3. The name of the author may not be used to endorse or promote * -# * products derived from this software without specific prior written * -# * permission. * -# * * -# * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * -# * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * -# * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * -# * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * -# * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * -# * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * -# * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * -# * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * -# * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * -# * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * -# * POSSIBILITY OF SUCH DAMAGE. * -# * * -# * OpenScop Library, a library to manipulate OpenScop formats and data * -# * structures. Written by: * -# * Cedric Bastoul and * -# * Louis-Noel Pouchet * -# * * -# ***************************************************************************/ -# -# Makefile.am (or makefile if generated) of the OpenScop Library. -# Makefile.am is not a makefile, you must run the 'autogen.sh' THEN the -# configure shellscript to generate the Makefile thanks to this file. - - -############################################################################# -SUBDIRS = - -############################################################################# -MAINTAINERCLEANFILES = Makefile.in - -INCLUDES = -I$(top_builddir) -I$(top_srcdir) \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/include - -############################################################################# - -lib_LTLIBRARIES = libosl.la - - -libosl_la_SOURCES = \ - scop.c \ - statement.c \ - extensions/textual.c \ - extensions/comment.c \ - extensions/scatnames.c \ - extensions/arrays.c \ - extensions/coordinates.c \ - extensions/irregular.c \ - interface.c \ - generic.c \ - relation.c \ - relation_list.c \ - vector.c \ - names.c \ - strings.c \ - body.c \ - int.c \ - util.c - -AM_CFLAGS = -Wall -fomit-frame-pointer -g diff --git a/source/util.c b/source/util.c index fe4b4d1..bd291ca 100644 --- a/source/util.c +++ b/source/util.c @@ -472,10 +472,17 @@ int osl_util_get_precision() { precision = OSL_PRECISION_SP; else if (!strcmp(precision_env, OSL_PRECISION_ENV_DP)) precision = OSL_PRECISION_DP; - else if (!strcmp(precision_env, OSL_PRECISION_ENV_MP)) + else if (!strcmp(precision_env, OSL_PRECISION_ENV_MP)) { +#ifndef OSL_GMP_IS_HERE + OSL_warning("$OSL_PRECISION says GMP but osl not compiled with " + "GMP support, switching to double precision"); + precision = OSL_PRECISION_DP; +#else precision = OSL_PRECISION_MP; +#endif + } else - OSL_warning("bad precision environment value"); + OSL_warning("bad OSL_PRECISION environment value, see osl's manual"); } return precision; diff --git a/tests/Makefile.am b/tests/Makefile.am index 42069f4..365f63f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -81,7 +81,7 @@ TESTS = osl_test osl_test_CPPFLAGS = -I$(top_srcdir)/include -static -osl_test_LDFLAGS = -L$(top_srcdir)/source +osl_test_LDFLAGS = -L$(top_srcdir) osl_test_LDADD = -losl diff --git a/tests/osl_test.c b/tests/osl_test.c index 3cfbd08..cd667e9 100644 --- a/tests/osl_test.c +++ b/tests/osl_test.c @@ -97,7 +97,8 @@ int test_file(char * input_name, int verbose) { int cloning = 0; int dumping = 0; int equal = 0; - char * output_name; + int output_desc; + char output_name[] = "/tmp/osl_test_XXXXXX"; FILE * input_file, * output_file; osl_scop_p input_scop; osl_scop_p output_scop; @@ -124,18 +125,21 @@ int test_file(char * input_name, int verbose) { printf("- cloning failed\n"); // PART III. Dump to file and test. - output_name = tmpnam(NULL); - output_file = fopen(output_name, "w"); + output_desc = mkstemp(output_name); + if ((output_file = fdopen(output_desc, "w")) == NULL) + OSL_error("cannot open temporary output file for writing"); //osl_scop_dump(stdout, input_scop); //osl_scop_print(stdout, input_scop); osl_scop_print(output_file, input_scop); fclose(output_file); // Raise the generated file to data structures. - output_file = fopen(output_name, "r"); + if ((output_file = fopen(output_name, "r")) == NULL) + OSL_error("cannot open temporary output file for reading"); output_scop = osl_scop_read(output_file); //osl_scop_dump(stdout, output_scop); fclose(output_file); + close(output_desc); if (verbose) { printf("\n\n*************************************************\n\n"); -- 2.11.4.GIT