{"id":201,"date":"2008-08-10T18:23:30","date_gmt":"2008-08-11T02:23:30","guid":{"rendered":"http:\/\/wp.colliertech.org\/cj\/?p=201"},"modified":"2009-03-20T13:50:55","modified_gmt":"2009-03-20T21:50:55","slug":"writing-free-software-part-8-exploring-configureac-variables","status":"publish","type":"post","link":"https:\/\/wp.c9h.org\/cj\/?p=201","title":{"rendered":"Writing Free Software &#8211; Part 8: Exploring configure.ac variables"},"content":{"rendered":"<h3>Introduction<\/h3>\n<p>One of autotools&#8217; primary purposes is to allow software to be built and installed on a wide range of platforms.  The <i>configure<\/i> script is responsible for a great deal of this flexibility.  When it is run, it interrogates the system on which it is being run to determine the features available.  If required features are missing, the script can do any number of things, including but not limited to:<\/p>\n<ul>\n<li>reporting a problem and bailing out<\/li>\n<li>trying an alternate approach<\/li>\n<li>attempting to fetch the missing software and continuing\/aborting depending on the outcome<\/li>\n<li>recommending that the person running the configure script install the required bits<\/li>\n<li>mocking the user<\/li>\n<\/ul>\n<p>In this post, I will note a few of the variables that can be used to determine the configuration of the system.<\/p>\n<h3>Return to the workplace<\/h3>\n<p><code><b>$<\/b> cd ~\/src\/greeting<\/code><\/p>\n<h3>Modify configure.ac to report some findings<\/h3>\n<p><code><b>$<\/b> patch configure.ac<\/p>\n<pre>--- configure.ac.orig\t2009-03-20 14:49:16.000000000 -0700\r\n+++ configure.ac\t2009-03-20 14:46:16.000000000 -0700\r\n@@ -1,5 +1,11 @@\r\n AC_INIT([greeting],[0.0.1])\r\n AM_INIT_AUTOMAKE([1.9 tar-ustar])\r\n+\r\n+AC_PATH_PROG(RUNTIME, mono, no)\r\n+if test \"x$RUNTIME\" = \"x\" ; then\r\n+  AC_MSG_ERROR([Can't find \"mono\" in your PATH])\r\n+fi\r\n+\r\n AC_PATH_PROG(CSC, gmcs, no)\r\n if test \"x$CSC\" = \"x\" ; then\r\n   AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])\r\n@@ -8,3 +14,12 @@\r\n Makefile\r\n ])\r\n AC_OUTPUT\r\n+\r\n+echo \"=================\"\r\n+echo \"\"\r\n+echo \"Thank you for configuring '$PACKAGE_NAME' version '$PACKAGE_VERSION'\"\r\n+echo \"Runtime:             $RUNTIME\"\r\n+echo \"C# compiler:         $CSC\"\r\n+echo \"installation prefix: $prefix\"\r\n+echo \"\"\r\n+echo \"=================\"\r\n^D^D\r\n<\/pre>\n<p><\/code><\/p>\n<h3>Re-run configure to see results<\/h3>\n<p><code><b>$<\/b> autoconf &amp;&amp; .\/configure<br \/>\nchecking for a BSD-compatible install... \/usr\/bin\/install -c<br \/>\nchecking whether build environment is sane... yes<br \/>\nchecking for a thread-safe mkdir -p... \/bin\/mkdir -p<br \/>\nchecking for gawk... no<br \/>\nchecking for mawk... mawk<br \/>\nchecking whether make sets $(MAKE)... yes<br \/>\nchecking how to create a ustar tar archive... gnutar<br \/>\nchecking for mono... \/usr\/bin\/mono<br \/>\nchecking for gmcs... \/usr\/bin\/gmcs<br \/>\nconfigure: creating .\/config.status<br \/>\nconfig.status: creating Makefile<br \/>\n=================<br \/>\n&nbsp;<br \/>\nThank you for configuring 'greeting' version '0.0.1'<br \/>\nRuntime:             \/usr\/bin\/mono<br \/>\nC# compiler:         \/usr\/bin\/gmcs<br \/>\ninstallation prefix: \/usr\/local<br \/>\n&nbsp;<br \/>\n=================<br \/>\n<\/code><\/p>\n<h3>Conclusion<\/h3>\n<p>One of the primary reasons that autotools is so powerful is that it can figure out what&#8217;s on your system and use it to build the software in the package.  In following posts, we will make use of some of these system configuration variables.<\/p>\n\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=cjamescollier\" class=\"twitter-share-button\">Tweet<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction One of autotools&#8217; primary purposes is to allow software to be built and installed on a wide range of platforms. The configure script is responsible for a great deal of this flexibility. When it is run, it interrogates the system on which it is being run to determine the features available. If required features [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[180,38,188,17,79,7,166],"tags":[],"class_list":["post-201","post","type-post","status-publish","format-standard","hentry","category-autotools","category-c","category-cli","category-debian","category-free-software","category-mono","category-software"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1YDIB-3f","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/posts\/201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=201"}],"version-history":[{"count":6,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/posts\/201\/revisions"}],"predecessor-version":[{"id":347,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/posts\/201\/revisions\/347"}],"wp:attachment":[{"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}