LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-29-2010, 02:49 PM   #1
tpe
Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Suse Linux
Posts: 98

Rep: Reputation: 16
Autoconf help


Hallo,
I need you help with auitoconf. I have a project with existing source. I need to convert that program and include support for mysql.
Since I want to do it with the "right" way, I want to add the mysql autoconf macros I found at: ac-archive (http://ac-archive.sourceforge.net/ac...lib_mysql.html)
So, I have a few questions:

1. I want to make the ./configure script to check for the mysql.h and libmysqlclient.so files. Is that macro suitable for this?
2. Is there any other simpler way to do it?
3. The program's directory contains a subdirectory named "m4". Is this the target directory under which I have to add the macro? If not, how do I instruct autoconf to check for that macro?

And a final question: How do I instruct the ./configure && make to add the necessary -lmysqlclient -lz flags?
 
Old 11-29-2010, 07:01 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -
Quote:
Q: I want to make the ./configure script to check for the mysql.h and libmysqlclient.so files. Is that macro suitable for this?
A: It certainly looks like it'll do the trick. But the best thing, of course, is to try it yourself
Quote:
Q: Is there any other simpler way to do it?
A: Assuming you want to go the "./configure" autoconf route, it sounds like it's probably an excellent choice
Quote:
Q: [Is] "m4" ...the target directory?
Q: How do I instruct the ./configure && make to add the necessary -lmysqlclient -lz flags?
A: This tutorial (and a little trial and error) should answer most of your questions:
http://www.developingprogrammers.com...ools-tutorial/

SUGGESTION:
I'd strongly encourage you to install a "virgin" copy of Linux on a VM.
EXAMPLE:
1) Download a prebuilt VM from here:
http://www.thoughtpolice.co.uk/vmware/

2) Then download VMWare Player from here:
http://downloads.vmware.com/d/info/d...are_player/3_0

That way you'll have a "sandbox" to test your configure scripts, as though you were an end-user.
 
Old 12-01-2010, 06:29 AM   #3
tpe
Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Suse Linux
Posts: 98

Original Poster
Rep: Reputation: 16
Thank you for your answer. The tutorial is really good, but only for an initial work on the project. Still, I have no clue on how to include the mysql macro in the configure.ac or Makefile.am or whatever (Still, I don't know how to call it!)
 
Old 12-01-2010, 11:17 AM   #4
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by tpe View Post
3. The program's directory contains a subdirectory named "m4". Is this the target directory under which I have to add the macro? If not, how do I instruct autoconf to check for that macro?
See Local Macros.

Quote:
And a final question: How do I instruct the ./configure && make to add the necessary -lmysqlclient -lz flags?
See Prgram And Library Variables.
 
Old 12-02-2010, 03:17 AM   #5
tpe
Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Suse Linux
Posts: 98

Original Poster
Rep: Reputation: 16
Thank you all for your answers.
I have managed to add it (aclocal -I ./m4 without a training / was the key!)
Now, I have a final question. In my PC (on purpose in order to test the ./configure) I have not installed the mysql-dev package, thus, the mysql.h file is missing.
I use the AC_CHECK_HEADERS(mysql.h) - and I tried the AC_CHECK_HEADERS([mysql.h]) too.
./configure reports -correctly- that the mysql.h is not found. BUT, it continues till the end. I want to make ./configure to stop when the mysql.h is not found. How do I do that?
 
Old 12-02-2010, 10:41 AM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Generally you can do this by passing a failing action to the third argument [action-if-not-found]:

Code:
AC_CHECK_HEADERS([mysql.h],
                 [],
                 [AC_MSG_FAILURE([cannot find mysql.h])])
But in this case AX_LIB_MYSQL already checked the headers for you so:
Code:
AX_LIB_MYSQL
AS_TEST([test "x$MYSQL_VERSION" = x],
        [AC_MSG_FAILURE([mysql library and headers are required to compile this package])])
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
*** YOU'RE USING autoconf (GNU Autoconf) 2.60. KDE requires autoconf 2.52, 2.53 or 2. arubin Slackware 6 09-24-2008 03:31 AM
No autoconf? lectraplayer SUSE / openSUSE 9 01-24-2005 09:23 PM
autoconf 2.52 or 2.53 caleb Conectiva 14 10-08-2002 03:53 PM
Autoconf jISV Linux - Software 2 05-30-2002 01:45 AM
autoconf.h safrout Linux - Newbie 3 05-25-2002 04:48 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration