wiki:pm-comments

Version 21 (modified by asm4, 12 years ago) (diff)

--

Hints, tricks, bugs, and suggestions

This page is meant to provide a place to project managers using the COIN autotools system to share their experience. Please write anything down that might be useful to other project managers. For example, what didn't work the way you expected, what did you misunderstand, what bug did you find in the autotools, how did you get something to work, what is not clear in the documentation, etc. This will also be helpful for the BuildTools maintainers to improve the system and documentation.


Here are a few comments from a person new to the autotools. Experienced users may not find these useful.

First, some important terminology. This terminology is consistent with that used by Andreas Waechter in his BuildTools? Wiki.

Project Base Directory: If, for example, you download the Cbc project via svn using

svn co https://projects.coin-or.org/svn/Cbc/trunk  Coin-Cbc

then Coin-Cbc is the Project Base Directory.

Project Main Subirectory: If you download the Cbc project via svn with the above command there will be Cbc subdirectory under the Project Base Directory Coin-Cbc. We call this Cbc subdirectory the Project Main Subdirectory.

Source Subdirectory: It is common for the Project Main Subdirectory to have a src subdirectory. This is the Source Subdirectory. Some projects such as Cgl will have source code in the src subdirectory and source code in directories under src.

The following points are all made at the BuildTools Wiki. I am just summarizing a few key points that are useful to have at your fingertips.

  1. If the configure.ac file in the Project Main Subdirectory contains (we again illustrate with the Cbc project) the macro
AC_COIN_HAS_PROJECT(Cbc)

then the variable COIN_HAS_CBC will be defined to 1 and there will be a variable CBCSRCDIR which is the path to the Cbc Project Main subdirectory and a variable CBCOBJDIR which is the path to the Cbc object subdirectory. So, if you have some code and want to include the Cbc header files you can do this

if COIN_HAS_CBC
  AM_CPPFLAGS += -I`$(CYGPATH_W) $(CBCSRCDIR)/src`   

endif

Similarly you can add the Cbc libraries to the library myLibrary by

	myLibrary_LDADD = $(CBCOBJDIR)/src/libCbc.la 
  1. The variable AM_CPPFLAGS is important. It is used to set the include directories for the header files. It is also used to set additional -D preprocessor flags.
  1. There is a very useful header file, config_prj.h (e.g., config_cbc.h) that is automatically generated by the configure script and put into the inc subdirectory in the Project Main Subirectory. It has #defines such as
    /* If defined, debug sanity checks are performed during runtime */
    /* #undef COIN_DEBUG */
    
    /* If defined, the Ampl Solver Library is available. */
    #define COIN_HAS_ASL 1
    

These variables can then be used in #ifdef statements inside the C++ code. See CbcConfig.h for an example of how to use the config_prj.h file.

  1. Use the Correct Version of Autools. What ever you do take the advice given at the BuildTools page and put your autotools in $HOME/bin and the configuration files in $HOME/share. The BuildTools page says you can alternatively install them in another directory and set the appropriate environment variable (like doing export AUTOTOOLS_DIR=/somepath/autotools; export PATH=/somepath/autotools/bin). Don't even think about it! Also make sure you don't have alternative versions of the autotools lurking about in directories such as /usr/bin that appear before $HOME/bin in PATH.

Many projects use third-party software. See UsingThirdPartySoftware


Using autoreconf

As distributed, COIN packages do not provide acinclude.m4 and aclocal.m4. Instead, these are generated when the script BuildTools/run_autotools is executed. (Have a look at the script to see how it's done; aclocal is responsible for aclocal.m4.) Documentation to the contrary, autoreconf is not capable of correctly (re)generating acinclude.m4 and aclocal.m4. If you're writing configuration macros, you want to be using run_autotools to incorporate your changes into acinclude.m4 and aclocal.m4. If you're not writing configuration macros, you need to run run_autotools at least once to prodice acinclude.m4 and aclocal.m4, after which you can use autoreconf.