Made nicer/saner some macros

master
Yevgen Muntyan 2006-12-12 20:02:04 -06:00
parent ed76c60d60
commit e2e3a9e7f8
4 changed files with 40 additions and 60 deletions

View File

@ -10,12 +10,7 @@ if you are not familiar with configure).
configure has the following medit-specific options:
--enable-debug enable debug options (default = NO)
--enable-all-gcc-warnings
enable most of gcc warnings and turn on -pedantic
mode (default = NO)
--enable-all-intel-warnings
enable most of intel compiler warnings (default =
NO)
--enable-all-warnings enable lot of compiler warnings (default = NO)
--enable-relocation do not hardcode data directories (default = NO)
This option seems to be working, but it's useful only for custom binary
distributions.

View File

@ -1,3 +1,17 @@
# _MOO_AC_CHECK_COMPILER_OPTIONS(var,options)
AC_DEFUN([_MOO_AC_CHECK_COMPILER_OPTIONS],[
AC_LANG_SAVE
AC_LANG_C
for opt in $2; do
AC_MSG_CHECKING(whether C compiler accepts $opt)
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $opt"
AC_TRY_COMPILE([],[],[$1="$[]$1 $opt"; AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
CFLAGS="$save_CFLAGS"
done
AC_LANG_RESTORE
])
##############################################################################
# MOO_AC_DEBUG()
#
@ -31,38 +45,27 @@ AC_ARG_ENABLE(debug,
MOO_DEBUG="no"
])
_moo_all_gcc_warnings="no"
AC_ARG_ENABLE(all-gcc-warnings,
AC_HELP_STRING([--enable-all-gcc-warnings],[enable most of gcc warnings and turn on -pedantic mode (default = NO)]),[
if test "x$enable_all_gcc_warnings" = "xyes"; then
_moo_all_gcc_warnings="yes"
fi
_moo_all_warnings="no"
AC_ARG_ENABLE(all-warnings,
AC_HELP_STRING([--enable-all-warnings],[enable lot of compiler warnings (default = NO)]),[
_moo_all_warnings="$withval"
])
_moo_all_intel_warnings="no"
AC_ARG_ENABLE(all-intel-warnings,
AC_HELP_STRING([--enable-all-intel-warnings], [enable most of intel compiler warnings (default = NO)]),[
if test "x$enable_all_intel_warnings" = "xyes"; then
_moo_all_intel_warnings="yes"
fi
])
if test "x$_moo_all_intel_warnings" = "xyes"; then
MOO_DEBUG_CFLAGS="$MOO_DEBUG_CFLAGS -Wall -Wcheck -w2 -wd981 -wd188"
elif test "x$_moo_all_gcc_warnings" = "xyes"; then
MOO_DEBUG_CFLAGS="$MOO_DEBUG_CFLAGS -W -Wall -Wpointer-arith dnl
-Wcast-align -Wsign-compare -Winline -Wreturn-type dnl
MOO_DEBUG_CFLAGS=
if test "x$_moo_all_warnings" = "xyes"; then
if test "x$GCC" = "xyes"; then
_MOO_AC_CHECK_COMPILER_OPTIONS(MOO_DEBUG_CFLAGS,
[-W -Wall -Wpointer-arith -Wcast-align -Wsign-compare -Winline -Wreturn-type dnl
-Wwrite-strings -Wmissing-prototypes -Wmissing-declarations dnl
-Wmissing-noreturn -Wmissing-format-attribute -Wnested-externs dnl
-Wdisabled-optimization"
MOO_PYTHON_DEBUG_CFLAGS="$MOO_PYTHON_DEBUG_CFLAGS -Wall -Wpointer-arith dnl
-Wcast-align -Wsign-compare -Winline -Wreturn-type dnl
-Wmissing-prototypes -Wmissing-declarations dnl
-Wmissing-noreturn -Wmissing-format-attribute -Wnested-externs dnl
-Wdisabled-optimization"
elif test x$GCC = "xyes"; then
MOO_DEBUG_CFLAGS="-W -Wall"
MOO_PYTHON_DEBUG_CFLAGS=
-Wdisabled-optimization])
elif test "x$CC" = "icc"; then
_MOO_AC_CHECK_COMPILER_OPTIONS(MOO_DEBUG_CFLAGS, [-Wall -Wcheck -w2 -wd981 -wd188])
fi
else
if test x$GCC = "xyes"; then
_MOO_AC_CHECK_COMPILER_OPTIONS(MOO_DEBUG_CFLAGS, [-Wall -W])
fi
fi
if test "x$MOO_DEBUG" = "xyes"; then

View File

@ -6,36 +6,18 @@ if test x$MOO_OS_CYGWIN != xyes; then
PKG_CHECK_MODULES($1,$2)
AC_MSG_CHECKING($1 version)
$1[]_VERSION=`$PKG_CONFIG --modversion $2`
_moo_ac_version=`$PKG_CONFIG --modversion $2`
i=0
for part in `echo $[]$1[]_VERSION | sed 's/\./ /g'`; do
i=`expr $i + 1`
eval part$i=$part
done
$1[]_VERSION=$_moo_ac_version
$1[]_MAJOR_VERSION=`echo "$_moo_ac_version" | $SED 's/\([[^.]][[^.]]*\).*/\1/'`
$1[]_MINOR_VERSION=`echo "$_moo_ac_version" | $SED 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
$1[]_MICRO_VERSION=`echo "$_moo_ac_version" | $SED 's/[[^.]][[^.]]*.[[^.]][[^.]]*.\(.*\)/\1/'`
$1[]_MAJOR_VERSION=$part1
$1[]_MINOR_VERSION=$part2
$1[]_MICRO_VERSION=$part3
for i in 2 4 6 8 10 12 14; do
if test $[]$1[]_MINOR_VERSION -ge $i; then
eval moo_ver_2_[]$i=yes
else
eval moo_ver_2_[]$i=no
fi
done
m4_foreach([num],[2,4,6,8,10,12,14],
[AM_CONDITIONAL($1[]_2_[]num, test $[]$1[]_MINOR_VERSION -ge num)])
AC_MSG_RESULT($[]$1[]_MAJOR_VERSION.$[]$1[]_MINOR_VERSION.$[]$1[]_MICRO_VERSION)
fi
AM_CONDITIONAL($1[]_2_14, test x$moo_ver_2_14 = "xyes")
AM_CONDITIONAL($1[]_2_12, test x$moo_ver_2_12 = "xyes")
AM_CONDITIONAL($1[]_2_10, test x$moo_ver_2_10 = "xyes")
AM_CONDITIONAL($1[]_2_8, test x$moo_ver_2_8 = "xyes")
AM_CONDITIONAL($1[]_2_6, test x$moo_ver_2_6 = "xyes")
AM_CONDITIONAL($1[]_2_4, test x$moo_ver_2_4 = "xyes")
AM_CONDITIONAL($1[]_2_2, test x$moo_ver_2_2 = "xyes")
])

View File

@ -14,7 +14,7 @@
<gtk-cvs>
<build_dir>/home/muntyan/projects/gtk/build/moo</build_dir>
<configure>
<args>--enable-debug --enable-all-gcc-warnings --prefix=$PREFIX --with-fam</args>
<args>--enable-debug --enable-all-warnings --prefix=$PREFIX --with-fam</args>
<vars>
<var name="CFLAGS">-g</var>
</vars>