automake
[Top][All Lists]
Advanced

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

Re: Creating makefile for using Linux-PAM-0.99.6.2


From: Jason Curl
Subject: Re: Creating makefile for using Linux-PAM-0.99.6.2
Date: Tue, 20 Nov 2007 19:47:34 +0100
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

PoWah Wong wrote:
I downloaded the Linux-PAM-0.99.6.2 (which use
automake) and configured and
compiled it successfully.
snip
I want to develop my programs based on the examples
directory but I want to put those programs outside the
Linux-PAM-0.99.6.2 directory, so I copied the examples
directory to the same level as
Linux-PAM-0.99.6.2.
I am a newbie for the Linux-PAM and automake so please
help.  What is the best way to design my makefile
outside the Linux-PAM-0.99.6.2 directory?

$ ls
Linux-PAM-0.99.6.2 examples

I modified the Makefile for my programs.

$ cd examples
$ diff -u Makefile.ok Makefile
snip

$ make
Makefile:329: .deps/pam_unix_passwd.Po: No such file
or directory
Makefile:330: .deps/pam_local.Po: No such file or
directory
make: *** No rule to make target `.deps/pam_local.Po'.
 Stop.
$ automake
automake: `configure.ac' or `configure.in' is required

$ mv .deps/blank.Po .deps/pam_unix_passwd.Po
$ mv .deps/check_user.Po .deps/pam_local.Po
$ make
make: *** No rule to make target `Makefile.am', needed
by `Makefile.in'.  Stop.

You've just copied the Makefile. With Autoconf this is a generated file (shown here to be generated from Makefile.am, that in turn generates Makefile.in during the development stage, that generates Makefile when you type "configure"). As such, the "configure" program, etc. makes all these directories, plus some more and is dependent on the system that you're running for.

Your best bet might be to create your own "configure.ac" file (that with autoconf generates configure) and your own Makefile.am. The Autoconf manuals are pretty good at describing what to do. You could base yours from the Linux PAM's configure.ac.

So:
myprog/
 configure.ac
 Makefile.am
 myprog.c
 ....

Then you'll want to link the PAM stuff to yours. Autoconf provides some help here too, that you can check that the "PAM" library is installed. I've provided some very basic examples, this assumes that the PAM library you've downloaded is also installed (as it is for many different Linux installations already)

Disclaimer: I've just pulled the interesting bits out of my own projects, I haven't tested if this is sufficient.

e.g. configure.ac
AC_INIT([myprog],[1.0.0],address@hidden,[myprog])
AM_INIT_AUTOMAKE()
AC_LANG([C])
AC_GNU_SOURCE
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_HEADER_STDC
AC_CONFIG_FILES([Makefile])

e.g. Makefile.am
noinst_PROGRAMS = myprog
myprog_SOURCES = myprog.c

LDADD=-lpam

Then in your "myprog" directory you'll need to run the "autoconf" tools and fix any errors (mostly missing files).

Then when you modify "configure.ac" or "Makefile.am", you can run autoreconf. At the end you have your own "configure" that you can run and type "make" for.

Cheers,
Jason.




reply via email to

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