Initial revision

This commit is contained in:
Thomas Tanner 1998-11-24 20:32:39 +00:00
parent 2bbff0ffe7
commit f9b0dae473
13 changed files with 409 additions and 0 deletions

30
depdemo/Makefile.am Normal file
View File

@ -0,0 +1,30 @@
# A brief demonstration of using Automake with Libtool. -*-Makefile-*-
#
# NOTE: Don't forget that in the libtool distribution, files in this
# directory are distributed by the demo_distfiles variable in the top
# level Makefile.
AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = acinclude.m4
lib_LTLIBRARIES = libl1.la libl2.la libl3.la libl4.la
libl1_la_SOURCES = l1.c l1.h sysdep.h
libl2_la_SOURCES = l2.c l2.h sysdep.h
libl2_la_LIBADD = libl1.la
libl3_la_SOURCES = l3.c l3.h sysdep.h
libl3_la_LIBADD = libl1.la libl2.la
libl4_la_SOURCES = l4.c l4.h sysdep.h
libl4_la_LIBADD = libl3.la -lm
bin_PROGRAMS = depdemo depdemo.static
depdemo_SOURCES = main.c
depdemo_LDADD = libl1.la libl2.la libl4.la \
libl3.la # remove this!
depdemo_DEPENDENCIES = libl1.la libl2.la libl4.la
depdemo_static_SOURCES = main.c
depdemo_static_LDADD = libl1.la libl2.la libl4.la \
libl3.la # remove this!
depdemo_static_DEPENDENCIES = libl1.la libl2.la libl4.la
depdemo_static_LDFLAGS = -static

11
depdemo/README Normal file
View File

@ -0,0 +1,11 @@
This is depdemo, an example package that uses GNU libtool with an
Automake-generated environment to build many interdependent libraries
and a test program.
There are four libraries: l1, l2, l3 and l4.
l1 depends on nothing.
l2 depends on l1.
l3 depends on l1 and l2.
l4 depends on l3 and libm.
The test program uses l1, l2 and l4.

12
depdemo/configure.in Normal file
View File

@ -0,0 +1,12 @@
dnl Initialize the hell package.
AC_INIT(main.c)
AM_INIT_AUTOMAKE(depdemo,1.0)
AC_PROG_CC
AC_EXEEXT
AM_PROG_LIBTOOL
AC_CHECK_HEADERS(string.h)
dnl Output the makefile
AC_OUTPUT(Makefile)

34
depdemo/l1.c Normal file
View File

@ -0,0 +1,34 @@
/* l1.c -- trivial test library
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
#include "l1.h"
#include <stdio.h>
int var_l1;
int
func_l1(int ident)
{
int i;
for (i = 0; i < ident; i++)
putchar(' ');
printf("l1\n");
return 0;
}

31
depdemo/l1.h Normal file
View File

@ -0,0 +1,31 @@
/* l1.h -- interface to a trivial library
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
/* Only include this header file once. */
#ifndef _L1_H_
#define _L1_H_ 1
#include "sysdep.h"
__BEGIN_DECLS
extern int var_l1;
int func_l1 __P((int));
__END_DECLS
#endif /* !_L1_H_ */

37
depdemo/l2.c Normal file
View File

@ -0,0 +1,37 @@
/* l2.c -- trivial test library
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
#include "l2.h"
#include "l1.h"
#include <stdio.h>
int var_l2;
int
func_l2(int ident)
{
int i;
for (i = 0; i < ident; i++)
putchar(' ');
printf("l2\n");
func_l1(ident+1);
return 0;
}

31
depdemo/l2.h Normal file
View File

@ -0,0 +1,31 @@
/* l2.h -- interface to a trivial library
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
/* Only include this header file once. */
#ifndef _L2_H_
#define _L2_H_ 1
#include "sysdep.h"
__BEGIN_DECLS
extern int var_l2;
int func_l2 __P((int));
__END_DECLS
#endif /* !_L2_H_ */

39
depdemo/l3.c Normal file
View File

@ -0,0 +1,39 @@
/* l3.c -- trivial test library
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
#include "l3.h"
#include "l1.h"
#include "l2.h"
#include <stdio.h>
int var_l3;
int
func_l3(int ident)
{
int i;
for (i = 0; i < ident; i++)
putchar(' ');
printf("l3\n");
func_l1(ident+1);
func_l2(ident+1);
return 0;
}

31
depdemo/l3.h Normal file
View File

@ -0,0 +1,31 @@
/* l3.h -- interface to a trivial library
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
/* Only include this header file once. */
#ifndef _L3_H_
#define _L3_H_ 1
#include "sysdep.h"
__BEGIN_DECLS
extern int var_l3;
int func_l3 __P((int));
__END_DECLS
#endif /* !_L3_H_ */

41
depdemo/l4.c Normal file
View File

@ -0,0 +1,41 @@
/* l4.c -- trivial test library
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
#include "l4.h"
#include "l3.h"
#include <stdio.h>
#include <math.h>
int var_l4;
int
func_l4(int ident)
{
int i;
for (i = 0; i < ident; i++)
putchar(' ');
printf("l4\n");
func_l3(ident+1);
for (i = 0; i <= ident; i++)
putchar(' ');
printf("libm [sin(1.5) = %f]\n", sin(1.5));
return 0;
}

31
depdemo/l4.h Normal file
View File

@ -0,0 +1,31 @@
/* l4.h -- interface to a trivial library
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
/* Only include this header file once. */
#ifndef _L4_H_
#define _L4_H_ 1
#include "sysdep.h"
__BEGIN_DECLS
extern int var_l4;
int func_l4 __P((int));
__END_DECLS
#endif /* !_L4_H_ */

34
depdemo/main.c Normal file
View File

@ -0,0 +1,34 @@
/* main.c -- inter-library dependency test program
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
#include "l1.h"
#include "l2.h"
#include "l4.h"
#include <stdio.h>
#include <string.h>
int
main (int argc, char **argv)
{
printf("dependencies:\n");
func_l1(0);
func_l2(0);
func_l4(0);
return 0;
}

47
depdemo/sysdep.h Normal file
View File

@ -0,0 +1,47 @@
/* foo.h -- interface to the libfoo* libraries
Copyright (C) 1998 Thomas Tanner <tanner@gmx.de>
This file is part of GNU Libtool.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
/* Only include this header file once. */
#ifndef _SYSDEP_H_
#define _SYSDEP_H_ 1
/* __BEGIN_DECLS should be used at the beginning of your declarations,
so that C++ compilers don't mangle their names. Use __END_DECLS at
the end of C declarations. */
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
/* __P is a macro used to wrap function prototypes, so that compilers
that don't understand ANSI C prototypes still work, and ANSI C
compilers can issue warnings about type mismatches. */
#undef __P
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus)
# define __P(protos) protos
#else
# define __P(protos) ()
#endif
#endif /* !_SYSDEP_H_ */