[Gambas-devel] I am using ddd to debug - problem

Laurent Carlier lordheavym at ...176...
Sun Aug 10 16:33:21 CEST 2008


Le Saturday 09 August 2008 22:52:20 Benoit Minisini, vous avez écrit :
> On samedi 09 août 2008, Laurent Carlier wrote:
> > Le Saturday 09 August 2008 22:25:52 Benoit Minisini, vous avez écrit :
> > > On samedi 09 août 2008, Laurent Carlier wrote:
> > > > Le Saturday 09 August 2008 09:58:14 Benoit Minisini, vous avez écrit :
> > > > > On vendredi 08 août 2008, Kari Laine wrote:
> > > > > > Found it !
> > > > > >
> > > > > > there is somewhere in the makefiles -O3 which replaces -O0. I
> > > > > > will try to fix this.
> > > > > >
> > > > > > Best Regards
> > > > > > Kari
> > > > >
> > > > > Yes. It was a trick to force gcc to use -O3 and not -Os for a
> > > > > specific file. And I didn't realize that the --disable-optimization
> > > > > flag is not taken into account then.
> > > > >
> > > > > I must find a way to specify file-specific compilation flags with
> > > > > automake. If you have ideas... :-)
> > > > >
> > > > > Regards,
> > > >
> > > > Is it really useful to put only this optimizing option for only one
> > > > file ? (iguess it's for gb_table.c).
> > > >
> > > > ++
> > >
> > > Yes. It makes the code of this file about 5% faster, and as this is the
> > > main interpreter loop, I think it's worth it.
> > >
> > > In Gambas 3, another source file has its own optimization flags.
> > >
> > > But I admit this is not the correct solution. Maybe this is a lack of
> > > feature in automake...
> >
> > Add another variable like CORE_OPTIMIZE replaced in automake with -O3 in
> > case of optimizing or with AM_CFLAG otherwise.
> >
> > Perhaps i will take a look tonight after watching TV :-p
> >
> > ++
>
> Well, this topic is covered in the automake manual. Type that in Konqueror:
>
> info:/automake/Per-Object Flags
>
> In a few words, per-object flags is not supported, but there are
> workarounds that need some work.
>
> Regards,

Ok, so this is my solution:

In the configure.ac file i check for $gambas_optimization to detect if --enable-
optimization is not set (not "yes") and subtitute an $optimized_CFLAGS with 
the proper value if optimized (here -O3) or with an empty string otherwise.

Attached is the configure.ac file for trunk/main and Mafile.am file for 
trunk/main/gbx

I'm waiting for your comments.

Regards,

-------------- next part --------------
dnl ---- configure.ac for main programs

AC_INIT(configure.ac)
AC_CONFIG_SUBDIRS(libltdl)
GB_INIT(main)
AC_PROG_LIBTOOL
AM_PROG_CC_C_O

dnl ---- Check for internationalization library

GB_COMPONENT(
  intl,
  INTL,
  [external internationalization library],
  [],
  [GB_FIND(libintl.h, /usr/local /usr, include)],
  [GB_FIND(libintl.$SHLIBEXT, /usr/local /usr /, lib)],
  [-lintl],
  [],
  [This library may be located inside the system C library, so let's go on...])

dnl ---- Check for charset conversion library

GB_COMPONENT(
  conv,
  CONV,
  [optional external charset conversion library],
  [],
  [GB_FIND(iconv.h, /usr/local /usr, include)],
  [GB_FIND(libiconv.$SHLIBEXT, /usr/local /usr, lib)],
  [-liconv],
  [],
  [This library may be located inside the system C library, so let's go on...])

dnl ---- Check for gettext library

if test "x$GETTEXT_LIB" != x; then

GB_COMPONENT(
  gettext,
  GETTEXT,
  [external gettext library],
  [],
  [],
  [GB_FIND(libgettextlib.$SHLIBEXT, /usr/local /usr, lib)],
  [-lgettextlib],
  [],
  [This library may be located inside the system C library, so let's go on...])
  
fi

dnl ---- Check for ffi library

GB_COMPONENT_PKG_CONFIG(
  ffi,
  FFI,
  [foreign function interface],
  [],
  libffi,
  [],
  [Cannot find libffi support with pkg-config])

if test -z "$FFI_LIB"; then
  GB_COMPONENT(
    ffi,
    FFI,
    [foreign function interface],
    [],
    [GB_FIND(ffi.h, /usr/local /usr/local/lib /usr /usr/lib /usr/lib/gcc/*/*, include ffi/include)],
    [GB_FIND(libffi.$SHLIBEXT, /usr/local /usr, lib)],
    [-lffi])
fi

dnl ---- Remove DISABLED file that could have been generated before

rm -f DISABLED

dnl ---- Should I use libtool to load shared libraries in gbi and gbx ?

if test "$SYSTEM" != "CYGWIN"; then
  AC_DEFINE(DONT_USE_LTDL, 1, [Do not use libtool to load shared libraries])
  if test "$SYSTEM" != "OPENBSD"; then
    DL_LIB="-ldl"
  else
    DL_LIB=""
  fi
else
  DL_LIB=$LIBLTDL
fi

AC_SUBST(DL_LIB)

dnl ---- Check for Portland scripts

AC_CHECK_PROGS(XDG_UTILS, [xdg-mime xdg-icon-resource], [])

dnl ---- Other options

AC_ARG_ENABLE(
  preloading,
  [  --enable-preloading            enable preloading (default: yes)],
  gambas_preloading=$enableval,
  gambas_preloading=yes
)

if test "$SYSTEM" != "CYGWIN"; then
  if test "$gambas_preloading" = "yes"; then
    AC_DEFINE(DO_PRELOADING, 1, allows shared library preloading )
  fi
else
  if test "$gambas_preloading" = "yes"; then
    AC_MSG_WARN([Preloading is disabled on this system])
  fi
fi

dnl ---- Specific optimizations

if test "$gambas_optimization" = "yes"; then
  optimized_FLAGS="-O3"
else
  optimized_FLAGS=""
fi

AC_SUBST(optimized_FLAGS)

dnl ---- Create makefiles

AC_OUTPUT( \
Makefile \
share/Makefile \
gbc/Makefile \
gbx/Makefile \
lib/Makefile \
lib/debug/Makefile \
lib/eval/Makefile \
lib/db/Makefile \
lib/vb/Makefile \
lib/compress/Makefile \
lib/option/Makefile \
lib/draw/Makefile \
lib/gui/Makefile \
)
-------------- next part --------------
INCLUDES = -I$(top_srcdir)/share @INTL_INC@ @CONV_INC@ @GBX_THREAD_INC@ @INCLTDL@ @FFI_INC@

bin_PROGRAMS = gbx3
gblib_LTLIBRARIES = gb.la

gbx3_LDADD = @MATH_LIB@ @INTL_LIB@ @CONV_LIB@ @GETTEXT_LIB@ @DL_LIB@ @GBX_THREAD_LIB@ @FFI_LIB@
gbx3_CFLAGS = -DGAMBAS_PATH="\"$(bindir)\"" $(AM_CFLAGS)

gb_la_LIBADD = @MATH_LIB@ @INTL_LIB@ @CONV_LIB@ @GETTEXT_LIB@ @DL_LIB@ @GBX_THREAD_LIB@ @FFI_LIB@
gb_la_LDFLAGS = -module @LD_FLAGS@ @FFI_LDFLAGS@
gb_la_CFLAGS = -DGBX_INFO $(AM_CFLAGS) -O0

gbx3_SOURCES = \
 gb_common_check.h gb_common.c \
 gbx_debug.h gbx_debug.c \
 gb_error.h gb_error.c \
 gb_alloc.c gb_array.c \
 gbx_stack.h gbx_stack.c \
 gb_buffer.c gbx_replace.c \
 gb_list.c \
 gb_hash.c \
 gb_table.c \
 gbx_type.h gbx_type.c \
 gbx_value.h gbx_value.c \
 gbx_subst.h gbx_subst.c \
 gbx_exec.h gbx_exec.c gbx_exec_push.c gbx_exec_enum.c gbx_exec_pop.c gbx_exec_loop.c \
 gbx_class_desc.h gbx_class.h gbx_class_init.c gbx_class.c gbx_class_native.c \
 gbx_class_load.c gbx_class_load.h \
 gbx_event.h gbx_event.c \
 gb_file.h gb_file.c \
 gbx_stream.h gbx_stream.c gbx_stream_direct.c gbx_stream_buffer.c gbx_stream_memory.c \
 gbx_stream_arch.c gbx_stream_process.c gbx_stream_pipe.c \
 gbx_project.h gbx_project.c \
 gbx_library.h gbx_library.c \
 gbx_subr.h gbx_subr.c \
 gbx_subr_file.c gbx_subr_string.c gbx_subr_conv.c gbx_subr_time.c gbx_subr_extern.c gbx_subr_misc.c \
 gbx_math.h gbx_math.c \
 gbx_subr_math_temp.h gbx_subr_math.c \
 gbx_subr_test_temp.h gbx_subr_test.c \
 gbx_api.h gbx_api.c \
 gbx_local.h gbx_local.c \
 gbx_regexp.h gbx_regexp.c \
 gbx_archive.h gbx_archive.c \
 gbx_watch.h gbx_watch.c \
 gbx_expression.h gbx_eval.h gbx_eval.c \
 gbx_compare.h gbx_compare.c \
 gbx.c \
 gbx_number.h gbx_number.c \
 gbx_object.h gbx_object.c \
 gbx_string.h gbx_string.c \
 gbx_variant.h \
 gbx_date.h gbx_date.c \
 gbx_array.h gbx_array.c \
 gbx_c_class.h gbx_c_class.c \
 gbx_c_collection.h gbx_c_collection.c \
 gbx_c_error.h gbx_c_error.c \
 gbx_c_gambas.h gbx_c_gambas.c \
 gbx_c_file.h gbx_c_file.c \
 gbx_c_application.h gbx_c_application.c \
 gbx_c_array.h gbx_c_array.c \
 gbx_c_process.h gbx_c_process.c \
 gbx_c_subcollection.h gbx_c_subcollection.c \
 gbx_c_string.h gbx_c_string.c \
 gbx_component.h gbx_component.c \
 gbx_extern.h gbx_extern.c \
 gbx_print.h gbx_print.c \
 gbx_c_enum.h gbx_c_enum.c \
 gbx_c_timer.h gbx_c_timer.c \
 gbx_c_quote.h gbx_c_quote.c

gb_la_SOURCES = \
 gbx_info.h \
 gbx_local.h gbx_compare.h gbx_date.h \
 gbx_c_class.h gbx_c_class.c \
 gbx_c_collection.h gbx_c_collection.c \
 gbx_c_error.h gbx_c_error.c \
 gbx_c_gambas.h gbx_c_gambas.c \
 gbx_c_file.h gbx_c_file.c \
 gbx_c_application.h gbx_c_application.c \
 gbx_c_array.h gbx_c_array.c \
 gbx_c_process.h gbx_c_process.c \
 gbx_c_string.h gbx_c_string.c \
 gbx_c_subcollection.h gbx_c_subcollection.c \
 gbx_c_enum.h gbx_c_enum.c \
 gbx_c_timer.h gbx_c_timer.c \
 gbx_c_quote.h gbx_c_quote.c \
 gbx_class_info.c

gbx3-gbx_exec_loop.o: gbx_exec_loop.c
	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gbx3_CFLAGS) $(optimized_FLAGS) $(CFLAGS) -MT gbx3-gbx_exec_loop.o -MD -MP -MF "$(DEPDIR)/gbx3-gbx_exec_loop.Tpo" -c -o gbx3-gbx_exec_loop.o `test -f 'gbx_exec_loop.c' || echo '$(srcdir)/'`gbx_exec_loop.c; then mv -f "$(DEPDIR)/gbx3-gbx_exec_loop.Tpo" "$(DEPDIR)/gbx3-gbx_exec_loop.Po"; else rm -f "$(DEPDIR)/gbx3-gbx_exec_loop.Tpo"; exit 1; fi

gbx3-gb_error.o: gb_error.c
	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gbx3_CFLAGS) $(optimized_FLAGS) $(CFLAGS) -MT gbx3-gb_error.o -MD -MP -MF "$(DEPDIR)/gbx3-gb_error.Tpo" -c -o gbx3-gb_error.o `test -f 'gb_error.c' || echo '$(srcdir)/'`gb_error.c; then mv -f "$(DEPDIR)/gbx3-gb_error.Tpo" "$(DEPDIR)/gbx3-gb_error.Po"; else rm -f "$(DEPDIR)/gbx3-gb_error.Tpo"; exit 1; fi



More information about the Devel mailing list