autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

building a smiple hello_world


From: Fred J.
Subject: building a smiple hello_world
Date: Tue, 7 Sep 2004 14:04:57 -0700 (PDT)

Hello
I am learning the GNU build system and need some help.

I constructed an simple program but not sure if there
is something wrong.
$automake gives this error
configure.ac:7: required file `./ltmain.sh' not found

questions:
--why the error above and how to fix?

--do I need to include the following in every scource
file in the tree?
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

I use the run file to save typing, any problem with
using it with ever project I create?

many thanks

:~/Hello_world$ tree.
=============
|-- Makefile.am
|-- configure.ac
|-- run
`-- src
***|-- Makefile.am
***|-- hello.cpp
***`-- prnt
*****|-- Makefile.am
*****|-- print.cpp
*****`-- print.h


Hello_world/Makefile.am
===============
SUBDIRS = src


Hello_world/configure.ac
===============
AC_INIT(src/hello.cpp)
AM_INIT_AUTOMAKE(hello,0.1)
AM_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_OUTPUT(Makefile src/Makefile src/prnt/Makefile)


src/Makefile.am
==========
bin_PROGRAMS = hello
hello_SOURCES = print.h print.cpp hello.cpp
SUBDIRS = prnt
LDADD = prnt/libprnt.a

prnt/Makefile.am
===========
noinst_LIBRARIES = libprnt.a
libprnt_a_SOURCES = print.h print.cpp
INCLUDES = address@hidden@/


src/hello.cpp
========
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "print.h"
#include <iostream>

int main(){
   print( "I am ok for now" );
   return 0;
}


prnt/print.h
=======
#ifndef PRINT_H
#define PRINT_H
#include <string>

void print(std::string);
#endif

prnt/print.cpp
=========
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "prnt/print.h"
#include <iostream>
#include <string>

void print(std::string s){
   std::cout << s << std::endl;
}

Hello_world/run
==========
#!/bin/bash

echo *************************autoheader
autoheader

echo ***************************touching
touch NEWS README AUTHORS ChangeLog stamp-h


echo ****************************aclocal
aclocal

echo ***************************autoconf
autoconf

echo  ***************************automake
automake -a

echo *************************configuring
./configure

echo ******************************making
make


                
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush




reply via email to

[Prev in Thread] Current Thread [Next in Thread]