Hello. I'm using autoconf / automake to build my program. I'd like to set some default CFLAGS for my project with the following variable in my src/Makefile.am: AM_CFLAGS = $(GLIB_CFLAGS) -O3 -Wall -ffast-math The problem is that during compilation this default CFLAGS are hidden with '-g -O2': if gcc -DHAVE_CONFIG_H -I. -I. -I.. -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -O3 -Wall -ffast-math -g -O2 -MT ry-psi-function.o -MD -MP -MF ".deps/ry-psi-function.Tpo" -c -o ry-psi-function.o ry-psi-function.c; \ then mv -f ".deps/ry-psi-function.Tpo" ".deps/ry-psi-function.Po"; else rm -f ".deps/ry-psi-function.Tpo"; exit 1; fi My environment does not contain any CFLAGS. echo $CFLAGS gives nothing. I found that the problem sits in configure script itself. The following code seems defines CFLAGS and then substitutes it in Makefile.in: ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi So it sets CFLAGS... But why it does not revert before making substitutions in Makefile.in? The only thing I can think about it the order of macroses in my configure.ac: AC_PREREQ(2.59) AC_INIT([Rydberg Atom], 0.0.1, [pvolkov@xxxxxxxxxxx], ry-atom) AC_LANG_C AC_CONFIG_SRCDIR([src/ry-psi-function.h]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([aux]) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE() AM_CONDITIONAL([I686], [test "$target_cpu" = i686]) save_prefix="$prefix" save_exec_prefix="$exec_prefix" test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix=$prefix if test "$target_cpu" = i686 ; then ry_integ_dir=`eval echo ${datadir}/${PACKAGE}/x86` RY_INTEG_DIR=${ry_integ_dir} AC_DEFINE_UNQUOTED([RY_INTEG_DIR], "${ry_integ_dir}", [Integrals Path Directory]) else echo Unknown target arch. fi AC_SUBST([RY_INTEG_DIR]) prefix="$save_prefix" exec_prefix="$save_exec_prefix" AC_PROG_CC AC_CHECK_LIB([m],[sqrt]) AM_PATH_GLIB_2_0(2.6.0,,AC_MSG_ERROR([ *** GLib 2.6 is required to build ry-atom; please make sure you have the GLib *** development headers installed. The latest version of GLib is *** always available at http://www.gtk.org/.]),[gobject gthread]) AC_C_CONST AC_CONFIG_FILES([Makefile integrals/Makefile integrals/x86/Makefile scripts/Makefile scripts/ry-build-figures.sh scripts/build-r_avr_fixed_theta-in-dep-theta.sh src/Makefile]) AC_OUTPUT echo echo "Building for target $target_cpu $target_vendor $target_os" echo Does anybody see what is the problem here? I do not want to set CFLAGS environment variable forever... Any suggestions are welcome. Another related question is what if I want to have different CFLAGS for release and for debugging. How should I do this? I thought about different AM_CFLAGS in Makefile.am and chose between them with AM_CONDITIONAL, but now I don't know what to do. BTW. I'm using autoconf 2.59 and automake automake 1.9.6. Thank you for your time, Peter.
Attachment:
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf