first looking at how to recognize if
a said library was properly installed on a system.
I found more than one answer on how that should
work. Then I pulled back from that and just
started from basics.
I followed the link "Developing software with GNU"
http://www.amath.washington.edu/~lf/tutorials/autoconf/toolsmanual_toc.html
another good reference is
http://developer.gnome.org/doc/books/WGA/creating-configuration.html
The project has these files.
reconf
Makefile.am
configure.in
src/hello.cc
src/Makefile.am
The Makefile.am has the following lines
-------------------- Makefile.am --------------------------
EXTRA_DIST = reconf configure
SUBDIRS = src
-----------------------------------------------------------
EXTRA_DIST says to "List any files that you want to include
into your source code distribution. "
A file Makfile.in will have a target called dist
The dist target can be used to generate a gzip'd tar file
some files are not covered in the automatic rules.
These files should be listed in the EXTRA_DIST variable.
since configure is normally generated it need not be part
of tar dist but you want to include it as a convience
so anyone how get the the tared dist need only
run configure.
SUBDIRS
SUBDIRS = dir1 dir2 ...
`make' will be recursively invoked in each subdirectory
stated before doing anything on the current directory.
On the same token you will need to supply a `Makefile.am'
for each of the `src' directories you have stated.
configure.in
----------------------- configure.in ---------------------
AC_INIT
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(test,0.1)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_OUTPUT(Makefile src/Makefile)
----------------------------------------------------------
configure script must call AC_INIT
AC_INIT(package, version, [bug-report], [tar-name])
AC_INIT and AC_OUTPUT are the two only required macros by the
configure script.
AC_INIT generates the following m4 macros,
output variables and preprocessor symbols:
* [AC_]PACKAGE_NAME
* [AC_]PACKAGE_TARNAME
* [AC_]PACKAGE_VERSION
* [AC_]PACKAGE_STRING
* [AC_]PACKAGE_BUGREPORT
AM_CONFIG_HEADER:
AM_CONFIG_HEADER(config.h)
AM_CONFIG_HEADER(config.h:config.in)
Names the header file which will hold the preprocessor
macro definitions for compile time. Normally, this is
config.h. The source files will then #include "config.h".
Requires a accconfig.h file.
AC_PROG_CC first checks to see if the CC environment
variable is set on the end user's system and the other
AC_PROG_* macros work similarly.
AC_OUTPUT
Automake uses this to determine which files to create
Listed files named Makefile are treated as `Makefile's.
The next files are
src/hello.cc
------------------------------- hello.cc ---------------
#if HAVE_CONFIG_H
# include
#endif
#include
#include
using namespace XERCES_CPP_NAMESPACE
int main(int argc,char *argv[])
{
return 0;
}
the above compile and linked seemlessly.
why? because of the file:
src/Makefile.am
-------------------------- src/Makefile.am ---------------
INCLUDES = -I/usr/inlucde/xerces -I/usr/include/xercesc/sax
LDADD = -lxerces-c
bin_PROGRAMS = hello
hello_SOURCES = hello.cc
----------------------------------------------------------
INCLUDES = -I/dir1 -I/dir2 ...
Insert the -I flags that you want to pass to your compiler
when it builds object files.
LDFLAGS = -L/dir1 -L/dir2 ...
Insert the -L flags that you want to pass to your compiler.
bin_PROGRAMS = prog1 prog2 ....
Lists the executable files that will be compiled with `make'
and installed with `make install' under `/prefix/bin',
prog_SOURCES = foo1.c foo2.c ... header1.h header2.h ....
List all the files that compose the source code of the program,
including header files.
there is also specialization.
your can have the following
prog_SOURCES
prog_LDADD apply headers to a specific file
prog_LDFLAGS apply library includes to a specific file
prog_DEPENDENCIES
No comments:
Post a Comment