./configure multiple lines?

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

./configure multiple lines?

Post by alex.barylski »

My configure script for PHP has grown to be verbose and it's annoying having to paste it in as a single line. Can I store the switches in a file and somehow include the file instead of all the switches manually?

Code: Select all

./configure -f switches.dat
I looked at the --help but seen nothing of interest...hopefully I over looked it?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: ./configure multiple lines?

Post by VladSun »

In the shell you can use the "\" symbol in order to have multiple lines.
Or you may use xargs llike this (untested):

Code: Select all

cat file | xargs ./configure
http://unixhelp.ed.ac.uk/CGI/man-cgi?xargs
There are 10 types of people in this world, those who understand binary and those who don't
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: ./configure multiple lines?

Post by alex.barylski »

"\" thats what I was looking for...sweetness...thanks man. :)

p.s-Do you happen to know when you invoke ./configure and it's switches require a directory...if you provide the switch but not the directory does it use a default?

I'm trying to install IMAP now and it requires Kerberos and SSL but have no idea where those directories are so I left them blank and ./configure worked not sure if it actuallyed worked or just didn't raise an error. :?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: ./configure multiple lines?

Post by VladSun »

I think it will use the defaults as shown in --help listing.
If ./configure did not show any errors, most probably make will be successful.
I prefer:

Code: Select all

./configure && make && make install
in shell the && operator means - "continue with next command if the current one has exited with no errors (exit code)".
It's the opposite of "||" which means - "continue with next command if the current one has exited with some errors"
There are 10 types of people in this world, those who understand binary and those who don't
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: ./configure multiple lines?

Post by alex.barylski »

Cool I was just about to ask how you chain commands togather without piping. :)
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: ./configure multiple lines?

Post by Jenk »

&& is the AND operator, || is the OR operator. It's a bit more specific than "do this if the previous fails/passes" as it is dependant on the return code of the command, some applications return 1 as the success code (which is incorrect, it should be 0) so be aware.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: ./configure multiple lines?

Post by VladSun »

Jenk wrote:&& is the AND operator, || is the OR operator. It's a bit more specific than "do this if the previous fails/passes" as it is dependant on the return code of the command, some applications return 1 as the success code (which is incorrect, it should be 0) so be aware.
Also, the expression is evaluated from left to right and its evaluation stops if a value of an operand is enough to define the result:

Code: Select all

root@designer:/# true || echo 1
root@designer:/# false || echo 1
1
root@designer:/# false && echo 1
root@designer:/# true && echo 1
1
This behaviour permits us to use && and || in other contexts than "the-plain-OR/AND-logic" - such as the command chaining I've described above.
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply