From f9b0dae473b79eae3b121274bf0ca7ecc3560bd8 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Tue, 24 Nov 1998 20:32:39 +0000 Subject: [PATCH] Initial revision --- depdemo/Makefile.am | 30 ++++++++++++++++++++++++++++ depdemo/README | 11 +++++++++++ depdemo/configure.in | 12 +++++++++++ depdemo/l1.c | 34 ++++++++++++++++++++++++++++++++ depdemo/l1.h | 31 +++++++++++++++++++++++++++++ depdemo/l2.c | 37 ++++++++++++++++++++++++++++++++++ depdemo/l2.h | 31 +++++++++++++++++++++++++++++ depdemo/l3.c | 39 ++++++++++++++++++++++++++++++++++++ depdemo/l3.h | 31 +++++++++++++++++++++++++++++ depdemo/l4.c | 41 ++++++++++++++++++++++++++++++++++++++ depdemo/l4.h | 31 +++++++++++++++++++++++++++++ depdemo/main.c | 34 ++++++++++++++++++++++++++++++++ depdemo/sysdep.h | 47 ++++++++++++++++++++++++++++++++++++++++++++ 13 files changed, 409 insertions(+) create mode 100644 depdemo/Makefile.am create mode 100644 depdemo/README create mode 100644 depdemo/configure.in create mode 100644 depdemo/l1.c create mode 100644 depdemo/l1.h create mode 100644 depdemo/l2.c create mode 100644 depdemo/l2.h create mode 100644 depdemo/l3.c create mode 100644 depdemo/l3.h create mode 100644 depdemo/l4.c create mode 100644 depdemo/l4.h create mode 100644 depdemo/main.c create mode 100644 depdemo/sysdep.h diff --git a/depdemo/Makefile.am b/depdemo/Makefile.am new file mode 100644 index 00000000..74dc0404 --- /dev/null +++ b/depdemo/Makefile.am @@ -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 diff --git a/depdemo/README b/depdemo/README new file mode 100644 index 00000000..f122fabf --- /dev/null +++ b/depdemo/README @@ -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. \ No newline at end of file diff --git a/depdemo/configure.in b/depdemo/configure.in new file mode 100644 index 00000000..3cb95918 --- /dev/null +++ b/depdemo/configure.in @@ -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) diff --git a/depdemo/l1.c b/depdemo/l1.c new file mode 100644 index 00000000..cb2fd4c7 --- /dev/null +++ b/depdemo/l1.c @@ -0,0 +1,34 @@ +/* l1.c -- trivial test library + Copyright (C) 1998 Thomas Tanner + 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 + +int var_l1; + +int +func_l1(int ident) +{ + int i; + + for (i = 0; i < ident; i++) + putchar(' '); + printf("l1\n"); + return 0; +} diff --git a/depdemo/l1.h b/depdemo/l1.h new file mode 100644 index 00000000..a9499f63 --- /dev/null +++ b/depdemo/l1.h @@ -0,0 +1,31 @@ +/* l1.h -- interface to a trivial library + Copyright (C) 1998 Thomas Tanner + 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_ */ diff --git a/depdemo/l2.c b/depdemo/l2.c new file mode 100644 index 00000000..f9f90323 --- /dev/null +++ b/depdemo/l2.c @@ -0,0 +1,37 @@ +/* l2.c -- trivial test library + Copyright (C) 1998 Thomas Tanner + 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 + +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; +} diff --git a/depdemo/l2.h b/depdemo/l2.h new file mode 100644 index 00000000..3c08143f --- /dev/null +++ b/depdemo/l2.h @@ -0,0 +1,31 @@ +/* l2.h -- interface to a trivial library + Copyright (C) 1998 Thomas Tanner + 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_ */ diff --git a/depdemo/l3.c b/depdemo/l3.c new file mode 100644 index 00000000..b33a8e5a --- /dev/null +++ b/depdemo/l3.c @@ -0,0 +1,39 @@ +/* l3.c -- trivial test library + Copyright (C) 1998 Thomas Tanner + 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 + +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; +} diff --git a/depdemo/l3.h b/depdemo/l3.h new file mode 100644 index 00000000..e8659f4e --- /dev/null +++ b/depdemo/l3.h @@ -0,0 +1,31 @@ +/* l3.h -- interface to a trivial library + Copyright (C) 1998 Thomas Tanner + 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_ */ diff --git a/depdemo/l4.c b/depdemo/l4.c new file mode 100644 index 00000000..b8a675f0 --- /dev/null +++ b/depdemo/l4.c @@ -0,0 +1,41 @@ +/* l4.c -- trivial test library + Copyright (C) 1998 Thomas Tanner + 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 +#include + +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; +} diff --git a/depdemo/l4.h b/depdemo/l4.h new file mode 100644 index 00000000..20a5ff66 --- /dev/null +++ b/depdemo/l4.h @@ -0,0 +1,31 @@ +/* l4.h -- interface to a trivial library + Copyright (C) 1998 Thomas Tanner + 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_ */ diff --git a/depdemo/main.c b/depdemo/main.c new file mode 100644 index 00000000..65683d11 --- /dev/null +++ b/depdemo/main.c @@ -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 +#include + +int +main (int argc, char **argv) +{ + printf("dependencies:\n"); + func_l1(0); + func_l2(0); + func_l4(0); + return 0; +} diff --git a/depdemo/sysdep.h b/depdemo/sysdep.h new file mode 100644 index 00000000..797669db --- /dev/null +++ b/depdemo/sysdep.h @@ -0,0 +1,47 @@ +/* foo.h -- interface to the libfoo* libraries + Copyright (C) 1998 Thomas Tanner + 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_ */