Re: [RFA] iRe: [RFC][patch 1/9] initial Python support

Thiago Jung Bauermann
2008-07-20T23:47:49Z

Thiago Jung Bauermann wrote:
> Daniel Jacobowitz wrote:
>> On Wed, Jul 16, 2008 at 07:00:20PM -0300, Thiago Jung Bauermann wrote:
>>> @@ -1283,7 +1303,11 @@ test-cp-name-parser$(EXEEXT):
>>> test-cp-name-parser.o $(LIBIBERTY)
>>> # duplicates. Files in the gdb/ directory can end up appearing in
>>> # COMMON_OBS (as a .o file) and CONFIG_SRCS (as a .c file).
>>>
>>> -INIT_FILES = $(COMMON_OBS) $(TSOBS) $(CONFIG_SRCS)
>>> +# NOTE: bauermann/2008-06-15: python.c needs to be explicitly included
>>> +# because the generation of init.c does not work for .c files which
>>> +# result in differently named objects (i.e., python/python ->
>>> python.o). +
>>> +INIT_FILES = $(COMMON_OBS) $(TSOBS) $(CONFIG_SRCS) python/python.c
>>
>> This comment doesn't make sense. python/python.c is already included
>> in INIT_FILES, because of CONFIG_SRCS.
>
> Indeed. I just tried saving face by reproducing the problem which prompted
> me to add python/python.c there in the first place, but couldn't. I don't
> remember why I needed it at the time.

Actually, I just found the problem. If Python support is not being
compiled in, python/python.c will not be included in INIT_FILES. And the
fact that python.o is in COMMON_OBS will not help because of the reason
outlined in my comment. That's why I added python/python.c explicitly in
INIT_FILES.

Another way to solve the problem, which I am using this time, is to add
the following else clause to configure.ac:

if test "${have_libpython}" = yes; then
AC_DEFINE(HAVE_PYTHON, 1, [Define if Python interpreter is being linked in.])
CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)"
CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)"
CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_PYTHON_INITS)"
ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)"
else
# Even if Python support is not compiled in, we need to have python/python.c
# included, in order to recognize the python command. Even though python.o is
# in Makefile.in's COMMON_OBS, the code generating init.c won't include a
# call to _initialize_python unless python/python.c is explicitly added to
# INIT_FILES.
CONFIG_SRCS="$CONFIG_SRCS python/python.c"
fi

--
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center