1# Makefile.am for the SASL library
2# Rob Earhart
3# $Id: Makefile.am,v 1.88 2011/09/05 14:18:10 murch Exp $
4# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9#
10# 1. Redistributions of source code must retain the above copyright
11#    notice, this list of conditions and the following disclaimer.
12#
13# 2. Redistributions in binary form must reproduce the above copyright
14#    notice, this list of conditions and the following disclaimer in
15#    the documentation and/or other materials provided with the
16#    distribution.
17#
18# 3. The name "Carnegie Mellon University" must not be used to
19#    endorse or promote products derived from this software without
20#    prior written permission. For permission or any other legal
21#    details, please contact
22#      Office of Technology Transfer
23#      Carnegie Mellon University
24#      5000 Forbes Avenue
25#      Pittsburgh, PA  15213-3890
26#      (412) 268-4387, fax: (412) 268-7395
27#      tech-transfer@andrew.cmu.edu
28#
29# 4. Redistributions of any form whatsoever must retain the following
30#    acknowledgment:
31#    "This product includes software developed by Computing Services
32#     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
33#
34# CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
35# THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
36# AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
37# FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
38# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
39# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
40# OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
41#
42
43# Library version info - here at the top, for sanity
44# See <http://www.gnu.org/software/libtool/manual/libtool.html#Versioning>
45# CURRENT:REVISION:AGE
46sasl_version = 3:0:0
47
48AM_CPPFLAGS=-DLIBSASL_EXPORTS=1 -I$(top_srcdir)/include -I$(top_srcdir)/plugins \
49               -I$(top_builddir)/include -I$(top_srcdir)/sasldb -I$(top_srcdir)/common -DCONFIGDIR='"${configdir}"' -DPLUGINDIR='"${plugindir}"'
50PLUGIN_COMMON_OBJS = $(top_builddir)/common/libplugin_common.la
51
52EXTRA_DIST = windlopen.c dlopen.c staticopen.h NTMakefile
53EXTRA_LIBRARIES = libsasl2.a
54noinst_LIBRARIES = @SASL_STATIC_LIBS@
55libsasl2_a_SOURCES=
56
57BUILT_SOURCES = $(SASL_STATIC_SRCS)
58
59if WINDOWS
60DLOPEN_C = windlopen.c
61else
62DLOPEN_C = dlopen.c
63endif
64
65common_headers = saslint.h
66common_sources = auxprop.c canonusr.c checkpw.c client.c common.c config.c external.c md5.c saslutil.c server.c seterror.c $(DLOPEN_C)
67
68LTLIBOBJS = @LTLIBOBJS@
69LIB_DOOR= @LIB_DOOR@
70
71lib_LTLIBRARIES = libsasl2.la
72if BUILD_LIBOBJ
73noinst_LTLIBRARIES = libobj.la
74else
75noinst_LTLIBRARIES =
76endif
77
78libobj_la_SOURCES =
79libobj_la_LIBADD = $(LTLIBOBJS)
80
81libsasl2_la_SOURCES = $(common_sources) $(common_headers)
82libsasl2_la_LDFLAGS = -version-info $(sasl_version) -no-undefined
83
84libsasl2_la_LIBADD = $(SASL_DL_LIB) $(LIB_SOCKET) $(LIB_DOOR) $(PLUGIN_COMMON_OBJS)
85if BUILD_LIBOBJ
86libsasl2_la_LIBADD += libobj.la
87endif
88
89if MACOSX
90framedir = /Library/Frameworks/SASL2.framework
91install-exec-hook:
92	$(mkinstalldirs) $(framedir)/Versions/A
93	ln -fs $(libdir)/libsasl2.dylib $(framedir)/Versions/A/SASL2
94	cd $(framedir) ; ln -fs Versions/A/SASL2 .
95else
96install-exec-hook:
97endif
98
99libsasl2.a: libsasl2.la $(SASL_STATIC_OBJS)
100	@echo adding static plugins and dependencies
101	$(AR) cru .libs/$@ $(SASL_STATIC_OBJS)
102	@for i in ./libsasl2.la ../common/libplugin_common.la ../sasldb/libsasldb.la ../plugins/lib*.la; do \
103	if test ! -f $$i; then continue; fi; . $$i; \
104	for j in $$dependency_libs foo; do \
105	case $$j in foo) ;; \
106	-L*) for k in $$depdirs foo; do \
107	    if test $$k = $$j; then break; fi; done; \
108	  if test $$k = foo; then depdirs="$$depdirs $$j"; fi ;; \
109	-l*) for k in $$deplibs foo; do \
110	    if test $$k = $$j; then break; fi; done; \
111	  if test $$k = foo; then deplibs="$$deplibs $$j"; fi ;; \
112	esac; done; dependency_libs=""; done; \
113	sed -e "/^dependency_libs=/s%=.*%='$${depdirs}$${deplibs}'%" \
114	libsasl2.la >TMP.$$ && mv TMP.$$ libsasl2.la
115	rm -f $@
116	ln -s .libs/$@ $@
117
118$(SASL_STATIC_SRCS): linksrcs
119
120linksrcs:
121	-ln -s $(SASL_STATIC_SRCS) .
122
123