Page 1 of 1

./configure multiple lines?

Posted: Mon Nov 17, 2008 5:52 pm
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?

Re: ./configure multiple lines?

Posted: Mon Nov 17, 2008 5:59 pm
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

Re: ./configure multiple lines?

Posted: Mon Nov 17, 2008 6:12 pm
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. :?

Re: ./configure multiple lines?

Posted: Mon Nov 17, 2008 6:26 pm
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"

Re: ./configure multiple lines?

Posted: Mon Nov 17, 2008 6:31 pm
by alex.barylski
Cool I was just about to ask how you chain commands togather without piping. :)

Re: ./configure multiple lines?

Posted: Tue Nov 18, 2008 6:30 am
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.

Re: ./configure multiple lines?

Posted: Tue Nov 18, 2008 6:45 am
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.