05.01.2013 Views

Mac OS X Leopard - ARCAism

Mac OS X Leopard - ARCAism

Mac OS X Leopard - ARCAism

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

which will return a whole list of configure options. Most of these options either have sensible<br />

defaults or are automatically set during the configure stage. The things you want to look at are<br />

the optional features to see whether any of them would be useful to you.<br />

NOTE Certain programs require that your system provide specific libraries or other applications<br />

to compile correctly, and this is especially true for certain options you may want to build<br />

into your application; these are what are referred to as dependencies. <strong>Mac</strong>Ports and Fink will<br />

usually solve dependency issues automatically when you install apps using them, but when you<br />

are compiling things yourself, you need to make sure these dependencies are satisfied.<br />

If you think you don’t need any options, you can usually configure your build by just typing<br />

this:<br />

./configure<br />

If you want to include options, then you would type something like this:<br />

./configure --with-option1 --with-option2 --enable-feature-x [...]<br />

Either way, when you press Return, the configure script will run and attempt to create a<br />

makefile, which will guide the actual build and install process (together referred to as the make<br />

process). For a complex program, the configure script can take a few minutes or even longer to<br />

do its work, during which time lots of text will scroll by, letting you know what’s happening.<br />

Upon successful completion, the text will often issue a message saying that the configure completed<br />

successfully and perhaps giving some additional build advice. If something goes wrong,<br />

the text may or may not give you a clue as to what needs to be fixed.<br />

NOTE If something goes wrong, it’s not always going to be easy to fix. Scrolling through the<br />

configure text may reveal a missing library, or it may indicate it cannot figure out what to do<br />

with your system. A missing library can usually be found and installed (sometimes it’s there, but<br />

configure can’t find it in which case you may need to specify the library path as a configure<br />

option). Sometimes there is a specific issue and if you poke around support forums, you can<br />

get an answer. Sadly, sometimes it’s just not going to work on your system.<br />

Step 2: Build<br />

If the configure stage went without issue, the next step is to build the app. This should be as easy<br />

as typing the following:<br />

make<br />

CHAPTER 19 EXTENDING THE POWER OF DARWIN 347<br />

Yep, that’s it. Now go get a cup of coffee, stretch your legs, play a game on your Wii, or<br />

whatever, while your computer compiles your program. OK, although these days it could take<br />

your computer anywhere from a few seconds to a few hours to compile a program, for a moderately<br />

complex application it usually takes only between 5 minutes to 30 minutes depending on<br />

your computer.<br />

If you have a newer Intel-based <strong>Mac</strong>, there is a trick to significantly speed up this process.<br />

Since even the lowliest Intel-based i<strong>Mac</strong> has at least two processor cores, to use them both, just<br />

add -j 2 to the end of make. make -j 4 will work if you have four cores (a quad G5 or two dualcore<br />

Intel chips), and so on.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!