Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Back: Writing macros within the GNU Autotools framework
Forward: Debugging with M4
 
FastBack: M4
Up: Writing macros within the GNU Autotools framework
FastForward: Writing Portable Bourne Shell
Top: Autoconf, Automake, and Libtool
Contents: Table of Contents
Index: Index
About: About this document

21.5.1 Syntactic conventions

Some conventions have grown over the life of the GNU Autotools, mostly as a disciplined way of avoiding M4 pitfalls. These conventions are designed to make your macros more robust, your code easier to read and, most importantly, improve your chances for getting things to work the first time! A brief list of recommended conventions appears below:

  • Do not use the M4 built-in changequote. Any good macro will already perform sufficient quoting.

  • Never use the argument macros (e.g. `$1') within shell comments and dnl remarks. If such a comment were to be placed within a macro definition, M4 will expand the argument macros leading to strange results. Instead, quote the argument number to prevent unwanted expansion. For instance, you would use `$[1]' in the comment.

  • Quote the M4 comment character, `#'. This can appear often in shell code fragments and can have undesirable effects if M4 ignores any expansions in the text between the `#' and the next newline.

  • In general, macros invoked from `configure.in' should be placed one per line. Many of the GNU Autotools macros conclude their definitions with a dnl to prevent unwanted whitespace from accumulating in `configure'.

  • Many of the AC_ macros, and others which emulate their good behavior, permit default values for unspecified arguments. It is considered good style to explicitly show your intention to use an empty argument by using a pair of quotes, such as [].

  • Always quote the names of macros used within the definitions of other macros.

  • When writing new macros, generate a small `configure.in' that uses (and abuses!) the macro--particularly with respect to quoting. Generate a `configure' script with autoconf and inspect the results.


This document was generated by Gary V. Vaughan on February, 8 2006 using texi2html

 
 
  Published under the terms of the Open Publication License Design by Interspire