LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-18-2006, 03:42 PM   #1
Voetsjoeba
LQ Newbie
 
Registered: Sep 2006
Distribution: SuSE 9.2 Personal?
Posts: 9

Rep: Reputation: 0
How does ./configure --prefix really work ?


Hi

I'm using SuSE 9.2, and I'm currently at the point where I want to rebuild my PHP 5.1.3 installation to include curl support. So I went to download curl, and I am now at the point where I need to configure, make and make install it.
However, I wonder: How does --prefix=[dir] really work ?

I know I shouldn't omit it, because /usr/local is entirely empty empty indicating that most packages have been installed elsewhere. I don't wanna be the guy that spoils the overall setup convention, so I figured I'd install it elsewhere. Most software seems to be installed with the /usr prefix, because I'm finding all the installed software in /usr/lib, /usr/(s)bin and /usr/include, nicely in their respective subfolders.

So what's confusing me at this point is: if I use the prefix /usr, where will all the files really end up ? With the /usr prefix, I'm thinking that would make the lib, bin and include directories where all curl's stuff will be put respectively the /usr/lib, /usr/bin and /usr/include directories.

But all currently installed software has a nice subfolder in /usr/lib and /usr/include. Will the curl installation just dump all its files into /usr/include rather than /usr/include/curl, like the others seem to have done ? I'm seeing some random header files in there, along with the seperate folders for all the software I have installed. What if a curl header file has the same name as one of the random header files in there ? Won't that just majorly screw up my system ?

So how will it all really end up ? Do I have to set bindir, includedir and libdir seperately in the ./configure command, or is --prefix=/usr something magical that will keep everything clean and together ?

Thanks
 
Old 09-18-2006, 03:47 PM   #2
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
As far as I know, prefix means something is added in front of something. So if dirs A, B and C were to be created under /, with a prefix /usr they would be created into /usr/A, /usr/B and /usrC. That's the logical way. But I cannot guarantee what the programmers have thought..

I don't think prefix is anything magical. Use the other options if you feel so..and one more thought: why are backups made? Because errors do happen
 
Old 09-18-2006, 04:05 PM   #3
Voetsjoeba
LQ Newbie
 
Registered: Sep 2006
Distribution: SuSE 9.2 Personal?
Posts: 9

Original Poster
Rep: Reputation: 0
A quick look at the configured makefile returns this:

pkgdatadir = $(datadir)/curl
pkglibdir = $(libdir)/curl
pkgincludedir = $(includedir)/curl

Looks like the cURL developers are smart enough indeed =)
 
Old 09-18-2006, 04:16 PM   #4
soggycornflake
Member
 
Registered: May 2006
Location: England
Distribution: Slackware 10.2, Slamd64
Posts: 249

Rep: Reputation: 31
All it does is create a variable in the Makefile called 'prefix', which is used as a base directory. There is indeed, nothing magical about it.

Quote:
But all currently installed software has a nice subfolder in /usr/lib and /usr/include. Will the curl installation just dump all its files into /usr/include rather than /usr/include/curl, like the others seem to have done ? I'm seeing some random header files in there, along with the seperate folders for all the software I have installed. What if a curl header file has the same name as one of the random header files in there ? Won't that just majorly screw up my system ?
Most packages put their headers in a sub directory of /usr/include, some don't. Indeed it will screw something up if it overwrites an existing file (but one would assume the developers have the sense to choose unique names).

You shouldn't need to specify bindir/libdir explicitly unless the dev's screwed up the configure script, or if you want one part in a different location, e.g. one might use '--prefix=/usr --bindir=/bin --etcdir=/etc'. Thus, binaries go in /bin, config files go in /etc and everything else goes under /usr.

BTW, on my system (slackware) curl headers are in /usr/include/curl, so there shouldn't be a problem there.

You can always configure with a tmp directory to see exactly what it's going to install (e.g. --prefix=/var/tmp/<pkgname>, inspect what make install did, then if it looks OK, reconfigure with --prefix=/usr).

In any case, it's always a good idea to create a package that you can install with your package manager rather than just doing a make install (which makes removing the package difficult unless the dev's included an 'uninstall' target, which most don't). checkinstall is a handy tool that can create rpm's, deb's and slackware tgz packages. It's certainly worth a look.
 
Old 09-18-2006, 04:30 PM   #5
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
When you build and install using the "./configure && make && sudo make install", the default is that files get installed somewhere under the prefix (which is /usr/local if you don't specify something else using the --prefix option).

I say somewhere because what files get installed is ultimately up to the developer of whatever project you are building. I don't have first-hand experience of building PHP, so I can't make any specific predictions here.

It's customary for executables to go in [prefix]/bin, libraries in [prefix]/lib and so on. If the build process uses a configure script, the chances are these customs will be followed. These customs are formalised in the FHS - Filesystem Hierarchy Standard. Follow the link for more information than you ever wanted to know about Linux's filesystem structure. It's a bit dry as bedtime reading, but it will help to de-mystify the apparently weird structure of your filesystem. The FHS says:

Quote:
Locally installed software must be placed within /usr/local rather than /usr unless it is being installed to replace or upgrade software in /usr.
So if you're building and installing something, it should probably go in /usr/local (hence the configure script default).

There may be better methods, but if you want to see what files will be installed where under your prefex, do an install in a test prefix which has nothing else there... e.g.

Code:
$ mkdir $HOME/testinstall
$ ./configure --prefix $HOME/testinstall && make && make install
$ find $HOME/testinstall -type -printf "%P\n"
The last command will print a list of all files which will be installed under the prefix.

When you're happy with what will be installed where, you can delete your test install directory, and repeat the process with your desired prefix.
 
Old 09-19-2006, 03:08 AM   #6
Voetsjoeba
LQ Newbie
 
Registered: Sep 2006
Distribution: SuSE 9.2 Personal?
Posts: 9

Original Poster
Rep: Reputation: 0
Thank you both very much, that cleared up a lot
 
  


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
./configure --prefix= plan9 Slackware 5 01-03-2013 04:44 AM
./configure --prefix ?? itzig Linux - Software 10 02-03-2006 07:30 PM
a portable ./configure --prefix option spuzzzzzzz Linux - Software 2 07-27-2004 04:34 AM
./configure --prefix=/??? mykrob Linux - Newbie 7 06-24-2004 09:59 AM
prefix argument to ./configure luck___ Linux - Software 2 03-13-2004 02:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:24 PM.

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