I am working on a new PHP Extension written in C. Typically the commands I would use to build it look like this:
phpize
./configure --enable-framework
make
sudo make install
So nothing too crazy here, just standard. My config.m4
is very basic and looks like this:
PHP_ARG_ENABLE(framework, whether to enable framework support,
[ --enable-framework Enable Framework support])
if test "$PHP_FRAMEWORK" = "yes"; then
AC_DEFINE(HAVE_FRAMEWORK, 1, [Whether you have Framework])
PHP_NEW_EXTENSION(framework, framework.c, $ext_shared)
fi
But I have the multi.o
binary file generated from gccgo that I want to be part of the compilation process. Adding it just after framework.c
doesn't work; like it would for a .c
source file.
Because the Makefile
is generated automaticly it obviously doesn't know about multi.o
, so I know it has to be in this config.m4
file somewhere but I've no idea where.
Does anybody know what I need to do in order for this to work?
I have added this line to my config.m4
file and it appears to have fixed it:
EXTRA_LDFLAGS=multi.o
So now the whole file looks like this:
PHP_ARG_ENABLE(framework, whether to enable framework support,
[ --enable-framework Enable Framework support])
if test "$PHP_FRAMEWORK" = "yes"; then
AC_DEFINE(HAVE_FRAMEWORK, 1, [Whether you have Framework])
PHP_NEW_EXTENSION(framework, framework.c, $ext_shared)
EXTRA_LDFLAGS=multi.o
fi
Which generates the Makefile
that has the line EXTRA_LDFLAGS = multi.o
on line 36. This then pulls in the source I need and works correctly.
Not sure if this is the best / right way of doing it, but it works.