Made nicer/saner some macros

This commit is contained in:
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: configure has the following medit-specific options:
--enable-debug enable debug options (default = NO) --enable-debug enable debug options (default = NO)
--enable-all-gcc-warnings --enable-all-warnings enable lot of compiler warnings (default = NO)
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-relocation do not hardcode data directories (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 This option seems to be working, but it's useful only for custom binary
distributions. 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() # MOO_AC_DEBUG()
# #
@ -31,38 +45,27 @@ AC_ARG_ENABLE(debug,
MOO_DEBUG="no" MOO_DEBUG="no"
]) ])
_moo_all_gcc_warnings="no" _moo_all_warnings="no"
AC_ARG_ENABLE(all-gcc-warnings, AC_ARG_ENABLE(all-warnings,
AC_HELP_STRING([--enable-all-gcc-warnings],[enable most of gcc warnings and turn on -pedantic mode (default = NO)]),[ AC_HELP_STRING([--enable-all-warnings],[enable lot of compiler warnings (default = NO)]),[
if test "x$enable_all_gcc_warnings" = "xyes"; then _moo_all_warnings="$withval"
_moo_all_gcc_warnings="yes"
fi
]) ])
_moo_all_intel_warnings="no" MOO_DEBUG_CFLAGS=
AC_ARG_ENABLE(all-intel-warnings, if test "x$_moo_all_warnings" = "xyes"; then
AC_HELP_STRING([--enable-all-intel-warnings], [enable most of intel compiler warnings (default = NO)]),[ if test "x$GCC" = "xyes"; then
if test "x$enable_all_intel_warnings" = "xyes"; then _MOO_AC_CHECK_COMPILER_OPTIONS(MOO_DEBUG_CFLAGS,
_moo_all_intel_warnings="yes" [-W -Wall -Wpointer-arith -Wcast-align -Wsign-compare -Winline -Wreturn-type dnl
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
-Wwrite-strings -Wmissing-prototypes -Wmissing-declarations dnl -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations dnl
-Wmissing-noreturn -Wmissing-format-attribute -Wnested-externs dnl -Wmissing-noreturn -Wmissing-format-attribute -Wnested-externs dnl
-Wdisabled-optimization" -Wdisabled-optimization])
MOO_PYTHON_DEBUG_CFLAGS="$MOO_PYTHON_DEBUG_CFLAGS -Wall -Wpointer-arith dnl elif test "x$CC" = "icc"; then
-Wcast-align -Wsign-compare -Winline -Wreturn-type dnl _MOO_AC_CHECK_COMPILER_OPTIONS(MOO_DEBUG_CFLAGS, [-Wall -Wcheck -w2 -wd981 -wd188])
-Wmissing-prototypes -Wmissing-declarations dnl fi
-Wmissing-noreturn -Wmissing-format-attribute -Wnested-externs dnl else
-Wdisabled-optimization" if test x$GCC = "xyes"; then
elif test x$GCC = "xyes"; then _MOO_AC_CHECK_COMPILER_OPTIONS(MOO_DEBUG_CFLAGS, [-Wall -W])
MOO_DEBUG_CFLAGS="-W -Wall" fi
MOO_PYTHON_DEBUG_CFLAGS=
fi fi
if test "x$MOO_DEBUG" = "xyes"; then 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) PKG_CHECK_MODULES($1,$2)
AC_MSG_CHECKING($1 version) AC_MSG_CHECKING($1 version)
$1[]_VERSION=`$PKG_CONFIG --modversion $2` _moo_ac_version=`$PKG_CONFIG --modversion $2`
i=0 $1[]_VERSION=$_moo_ac_version
for part in `echo $[]$1[]_VERSION | sed 's/\./ /g'`; do $1[]_MAJOR_VERSION=`echo "$_moo_ac_version" | $SED 's/\([[^.]][[^.]]*\).*/\1/'`
i=`expr $i + 1` $1[]_MINOR_VERSION=`echo "$_moo_ac_version" | $SED 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
eval part$i=$part $1[]_MICRO_VERSION=`echo "$_moo_ac_version" | $SED 's/[[^.]][[^.]]*.[[^.]][[^.]]*.\(.*\)/\1/'`
done
$1[]_MAJOR_VERSION=$part1 m4_foreach([num],[2,4,6,8,10,12,14],
$1[]_MINOR_VERSION=$part2 [AM_CONDITIONAL($1[]_2_[]num, test $[]$1[]_MINOR_VERSION -ge num)])
$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
AC_MSG_RESULT($[]$1[]_MAJOR_VERSION.$[]$1[]_MINOR_VERSION.$[]$1[]_MICRO_VERSION) AC_MSG_RESULT($[]$1[]_MAJOR_VERSION.$[]$1[]_MINOR_VERSION.$[]$1[]_MICRO_VERSION)
fi 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> <gtk-cvs>
<build_dir>/home/muntyan/projects/gtk/build/moo</build_dir> <build_dir>/home/muntyan/projects/gtk/build/moo</build_dir>
<configure> <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> <vars>
<var name="CFLAGS">-g</var> <var name="CFLAGS">-g</var>
</vars> </vars>