tags:

views:

23

answers:

2

I am trying to add an option to my ./configure script. I need to add the location to mysql.h but a few methods I have tried and keep getting the error: configure: error: unrecognized option: --mysql=/usr/local/mysql/include/mysql/

How do I add the option to my configure script aswell as to add the header file which is specified.

A: 

Sounds like what you are trying to get your compiler to include a specific include path when it builds. The easiest way to do that is with the CPPFLAGS environment variable, e.g.

% setenv CPPLAGS -I/usr/local/mysql/include/mysql/
% ./configure
% make
% etc...

If you actually need to add a new option to configure you'll need to learn about autoconf and editing configure.in to generate a new configure script.

Von
I am using autoconf and already have a configure.in script that looks for mysql.h, i just dont know how to specify a custom location for mysql.h in configure.in using options
instigator
You should be able to set the CPPFLAGS environment variable as I show in my answer (I originally said CFLAGS, but CPPFLAGS is more correct).Or do you actually need a configure argument?
Von
+1  A: 

You're probably looking for AC_ARG_WITH. Something like this:

AC_ARG_WITH([mysql],
        [AS_HELP_STRING([--with-mysql=path : path to mysql headers],
        [MYSQL_INCLUDE=$withval],
        [])

Then ./configure --with-mysql=/foo .

vanza
You also need to modify configure.in to do append MYSQL_INCLUDE to the CPP_FLAGS.
Von