2

I want to write a test php extension, which will provide a test class. I want to extract class declaration into a separate C-File and call class registration from module init function of myext.c file. I have the following files:

   testlib/
    test_class.c
   myext.c
   php_myext.h
   config.m4
   ...

Now config.m4 file is quite simple:

PHP_ARG_ENABLE(myext, [whether to enable myext support], [  --enable-myext           Enable myext support])

if test "$PHP_MYEXT" != "no"; then
  PHP_NEW_EXTENSION(myext, myext.c, $ext_shared)
fi

How to configure config.m4 to be able to add test_class.c to extension building?

UPDATE:

How to configure config.m4 to make it searching .c files in a specific folder and add to extension building automatically?

Eugene Manuilov
  • 4,271
  • 8
  • 32
  • 48

1 Answers1

1

It's pretty straightforward:

PHP_NEW_EXTENSION(myext, myext.c testlib/test_class.c, $ext_shared)
Artefacto
  • 96,375
  • 17
  • 202
  • 225
  • Thanks for the answer! One more question: how to automate it? I mean how to make script, which will look through some folder and add .c files to the extension automatically? – Eugene Manuilov Dec 20 '11 at 08:56