Skip to content
Snippets Groups Projects
Commit 334768c1 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Update build environment to fix VPATH support.

  make depend, make tests, and make install all work when build directory
  is not the $srcdir.
Also modified library handling such that -lpthread more likely to be last.
WARNING: new orderring requires use of LDFLAGS to set global loader options
  such as -L/usr/local/lib.  If you put this in LIBS, some libraries
  may not be found a link time.
Likely broke Kerberos/LDAPD support.  Don't have those in my testbed.
parent d0516836
No related branches found
No related tags found
No related merge requests found
Showing
with 495 additions and 355 deletions
......@@ -10,14 +10,26 @@
/* define this if needed to get reentrant functions */
#ifndef REENTRANT
#undef REENTRANT
#endif
#ifndef _REENTRANT
#undef _REENTRANT
#endif
/* define this if needed to get threadsafe functions */
#ifndef THREADSAFE
#undef THREADSAFE
#endif
#ifndef _THREADSAFE
#undef _THREADSAFE
#endif
#ifndef THREAD_SAFE
#undef THREAD_SAFE
#endif
#ifndef _THREAD_SAFE
#undef _THREAD_SAFE
#endif
/* define this if cross compiling */
#undef CROSS_COMPILING
......
......@@ -12,6 +12,7 @@ install-common: FORCE
-$(MKDIR) -p $(MANDIR)
@TMPMAN=/tmp/ldapman.$$$$$(MANCOMPRESSSUFFIX); \
VERSION=`$(CAT) $(VERSIONFILE)`; \
cd $(srcdir); \
for page in *.$(MANSECT); do \
$(SED) -e "s%LDVERSION%$$VERSION%" \
-e 's%ETCDIR%$(sysconfdir)%' \
......
......@@ -26,14 +26,26 @@ set -e # exit immediately if any errors occur
MAKE=Makefile # default makefile name is "Makefile"
NOSLASH="no" # by default, / dependencies are included
CC=${CC-cc} # default compiler is cc
SRCDIR=""
SED=cat
while :
do case "$1" in
# the -s flag removes dependencies to files that begin with /
-s)
NOSLASH=yes;
shift ;;
# -f allows you to select a makefile name
-f)
MAKE=$2
shift; shift ;;
# -d allows you to select a VPATH directory
-d)
SRCDIR=$2
shift; shift ;;
# -c allows you to select a compiler to use (default is cc)
-c)
CC=$2
......@@ -42,18 +54,13 @@ while :
# the -p flag produces "program: program.c" style dependencies
# so .o's don't get produced
-p)
SED='s;\.o;;'
SED='sed -e s;\.o;;'
shift ;;
# the -l flag produces libtool compatible dependencies
-l)
SED='s;\.o:;.lo:;'
shift ;;
# the -s flag removes dependencies to files that begin with /
-s)
NOSLASH=yes;
SED='sed -e s;\.o:;.lo:;'
shift ;;
# -*) shift ;;
......@@ -64,7 +71,7 @@ while :
done
if [ $# = 0 ] ; then
echo 'usage: mkdep [-p] [-s] [-c cc] [-f makefile] [flags] file ...'
echo 'usage: mkdep [-p] [-s] [-c cc] [-f makefile] [-d srcdir] [flags] file ...'
exit 1
fi
......@@ -95,10 +102,34 @@ _EOF_
# egrep '^#include[ ]*".*"' /dev/null $* |
# sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' |
$CC -M $* |
sed "
s; \./; ;g
$SED" |
if test "x$SRCDIR" = "x" ; then
files=$*
else
files=
for i in $* ; do
if test -f $i ; then
files="$files $i"
elif test -f $SRCDIR/$i ; then
files="$files $SRCDIR/$i"
else
files="$files $i"
fi
done
CC="$CC -I$SRCDIR"
fi
cat << _EOF_ >> $TMP
#
# files: $*
# command: $CC -M $files
#
_EOF_
$CC -M $files | \
sed -e 's; \./; ;g' | \
$SED | \
awk '
$1 ~ /:/ {
filenm=$1
......@@ -108,25 +139,13 @@ $1 !~ /:/ {
dep=$1
}
/.*/ {
if ( noslash = "yes" && dep ~ /^\// ) next
if (filenm != prev) {
if (rec != "")
print rec;
rec = filenm " " dep;
prev = filenm;
}
else {
if (length(rec dep) > 78) {
print rec;
rec = filenm " " dep;
}
else
rec = rec " " dep
}
if (( noslash == "yes") && (dep ~ /^\// )) next
if ( length(dep) < 2 ) next
rec = filenm " " dep;
print rec;
}
END {
print rec
}' noslash="$NOSLASH" >> $TMP
' noslash="$NOSLASH" >> $TMP
cat << _EOF_ >> $TMP
......
......@@ -49,11 +49,11 @@ AR = ar
LINT = lint
5LINT = 5lint
MKDEP = $(top_srcdir)/build/mkdep $(MKDEPFLAG) -c "$(CC)"
MKDEP = $(top_srcdir)/build/mkdep $(MKDEPFLAG) -d "$(srcdir)" -c "$(CC)"
LIBTOOL = @LIBTOOL@
LIBVERSION = 0:0:0
LTLINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LFLAGS) $(LTVERSION)
LTLINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LTVERSION)
LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
# Misc UNIX commands used in makefiles
......@@ -85,32 +85,46 @@ LDAP_INCPATH= -I$(LDAP_INCDIR) -I$(INCLUDEDIR)
LDAP_LIBADIR= $(top_builddir)/libraries
LDAP_LIBPATH= -L$(LDAP_LIBADIR)
LDAP_LIBLBER = $(LDAP_LIBADIR)/liblber/liblber.la
LDAP_LIBLDAP = $(LDAP_LIBADIR)/libldap/libldap.la
LDAP_LIBLBER = -llber
LDAP_LIBLDAP = -lldap
LDAP_LIBLDIF = -lldif
LDAP_LIBLUTIL = -llutil @LUTIL_LIBS@
LDAP_LIBLDBM = -lldbm @LDBM_LIBS@
LDAP_LIBLTHREAD = -llthread @LTHREAD_LIBS@
LDAP_LIBLBER_DEPEND = $(LDAP_LIBDIR)/liblber/liblber.la
LDAP_LIBLDAP_DEPEND = $(LDAP_LIBDIR)/libldap/libldap.la
LDAP_LIBLDIF_DEPEND = $(LDAP_LIBDIR)/libldif/libldif.a
LDAP_LIBLUTIL_DEPEND = $(LDAP_LIBDIR)/liblutil/liblutil.a
LDAP_LIBLDBM_DEPEND = $(LDAP_LIBDIR)/libldbm/libldbm.a
LDAP_LIBLTHREAD_DEPEND = $(LDAP_LIBDIR)/liblthread/liblthread.a
LDAP_LIBS = $(LDAP_LIBPATH) -lldif $(LDAP_LIBLDAP) $(LDAP_LIBLBER)
LDAP_LIBDEPEND = $(LDAP_LIBDIR)/libldif.a $(LDAP_LIBLDAP) $(LDAP_LIBLBER)
LDAP_LIBS = $(LDAP_LIBPATH) $(LDAP_LIBLDAP) $(LDAP_LIBLBER) \
$(LDAP_LIBLDIF) $(LDAP_LIBLUTIL)
LDAP_LIBDEPEND = $(LDAP_LIBLDAP_DEPEND) $(LDAP_LIBLBER_DEPEND) \
$(LDAP_LIBLDIF_DEPEND) $(LDAP_LIBLUTIL_DEPEND)
# AutoConfig generated
AC_CC = @CC@
AC_DEFS = @CPPFLAGS@ @DEFS@
AC_LIBS = @LDFLAGS@ @LIBS@
AC_CFLAGS = @CFLAGS@
AC_LDFLAGS =
AC_DEFS = @CPPFLAGS@ @DEFS@
AC_LDFLAGS = @LDFLAGS@
AC_LIBS = @LIBS@
KRB_LIBS = @KRB_LIBS@
TERMCAP_LIBS = @TERMCAP_LIBS@
LDAPD_LIBS = @LDAPD_LIBS@
SLAPD_LIBS = @SLAPD_LIBS@
SLURPD_LIBS = @SLURPD_LIBS@
# Our Defaults
CC = $(AC_CC)
DEFS = $(LDAP_INCPATH) $(XINCPATH) $(XDEFS) $(AC_DEFS)
LIBS = $(LDAP_LIBS) $(XLIBS) $(AC_LIBS)
CFLAGS = $(AC_CFLAGS) $(DEFS) $(DEFINES)
LDFLAGS = $(AC_LDFLAGS)
DEFS = $(LDAP_INCPATH) $(XINCPATH) $(XDEFS) $(AC_DEFS) $(DEFINES)
LIBS = $(XLIBS) $(AC_LIBS) $(XXLIBS)
CFLAGS = $(AC_CFLAGS) $(DEFS)
LDFLAGS = $(AC_LDFLAGS) $(XLDFLAGS)
all: all-common all-local FORCE
install: install-common install-local FORCE
......
......@@ -9,6 +9,9 @@ RPOBJS = rp500.o faxtotpc.o
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
XLIBS = $(LDAP_LIBS)
XXLIBS = $(KRB_LIBS)
rp500 : rpversion.o
$(LTLINK) -o $@ $(RPOBJS) rpversion.o $(LIBS)
......
......@@ -6,6 +6,9 @@ PROGRAMS= in.xfingerd
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
XLIBS = $(LDAP_LIBS)
XXLIBS = $(KRB_LIBS)
in.xfingerd : version.o
$(LTLINK) -o $@ version.o $(OBJS) $(LIBS)
......
......@@ -11,7 +11,8 @@ GWOBJS = go500gw.o
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
XLIBS = -llutil @LUTIL_LIBS@
XLIBS = $(LDAP_LIBS)
XXLIBS = $(KRB_LIBS)
go500 : goversion.o
$(LTLINK) -o $@ $(GOOBJS) goversion.o $(LIBS)
......@@ -40,4 +41,4 @@ install-local: $(PROGRAMS) go500gw.help FORCE
$(LTINSTALL) $(INSTALLFLAGS) -m 755 go500 $(libexecdir)
$(LTINSTALL) $(INSTALLFLAGS) -m 755 go500gw $(libexecdir)
-$(MV) $(datadir)/go500gw.help $(datadir)/go500gw.help-
$(INSTALL) $(INSTALLFLAGS) -m 644 go500gw.help $(datadir)
$(INSTALL) $(INSTALLFLAGS) -m 644 $(srcdir)/go500gw.help $(datadir)
......@@ -7,6 +7,9 @@ OBJS= main.o
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
XLIBS = $(LDAP_LIBS)
XXLIBS = $(KRB_LIBS)
mail500 : version.o
$(LTLINK) -o $@ version.o $(OBJS) $(LIBS)
......
......@@ -7,6 +7,9 @@ HDRS= rcpt500.h
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
XLIBS = $(LDAP_LIBS)
XXLIBS = $(KRB_LIBS)
rcpt500 : version.o
$(LTLINK) -o $@ version.o $(OBJS) $(LIBS)
......@@ -22,4 +25,4 @@ install-local: $(PROGRAMS) rcpt500.help FORCE
-$(MKDIR) $(libexecdir) $(datadir)
$(LTINSTALL) $(INSTALLFLAGS) -m 755 rcpt500 $(libexecdir)
-$(MV) $(datadir)/rcpt500.help $(datadir)/rcpt500.help-
$(INSTALL) $(INSTALLFLAGS) -m 644 rcpt500.help $(datadir)
$(INSTALL) $(INSTALLFLAGS) -m 644 $(srcdir)/rcpt500.help $(datadir)
......@@ -4,11 +4,12 @@
SRCS = ldapsearch.c ldapmodify.c ldapdelete.c ldapmodrdn.c ldappasswd.c
OBJS = ldapsearch.o ldapmodify.o ldapdelete.o ldapmodrdn.o ldappasswd.o
XLIBS = $(KRB_LIBS)
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
XLIBS = $(LDAP_LIBS)
XXLIBS = $(KRB_LIBS)
XSRCS = ldsversion.c ldmversion.c lddversion.c ldrversion.c
PROGRAMS = ldapsearch ldapmodify ldapdelete ldapmodrdn ldapadd ldappasswd
......@@ -26,7 +27,7 @@ ldapmodrdn: ldrversion.o
$(LTLINK) -o $@ ldapmodrdn.o ldrversion.o $(LIBS)
ldappasswd: ldappasswd.o
$(LTLINK) -o $@ ldappasswd.o $(LIBS) @LUTIL_LIBS@ $(LDAP_LIBPATH) -llutil
$(LTLINK) -o $@ ldappasswd.o $(LUTIL_LIBS) $(LIBS)
ldapadd: ldapmodify
$(RM) $@
......
......@@ -9,7 +9,8 @@ PROGRAMS= ud
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
XLIBS = $(TERMCAP_LIBS) $(KRB_LIBS)
XLIBS = $(LDAP_LIBS)
XXLIBS = $(TERMCAP_LIBS) $(KRB_LIBS)
ud : version.o
$(LTLINK) -o $@ version.o $(OBJS) $(LIBS)
......
This diff is collapsed.
......@@ -273,7 +273,8 @@ dnl
AC_CHECK_LIB(gen, main)
])
dnl Check for resolv
dnl Check for resolver routines
AC_CHECK_LIB(bind, res_search)
AC_CHECK_LIB(resolv, res_search)
dnl HP-UX requires -lV3
......@@ -448,7 +449,7 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
if test $ol_link_threads = no ; then
dnl try DEC Threads -lpthread -lexc
save_LIBS="$LIBS"
AC_CHECK_LIB(pthread, pthread_join, [
AC_CHECK_LIB(pthread, pthread_mutex_lock, [
ol_link_threads=posix
LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lexc"
if test $ol_with_yielding_select = auto ; then
......@@ -461,7 +462,7 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
if test $ol_link_threads = no ; then
dnl try DEC Threads -lpthreads -lmach -lexc -lc_r
save_LIBS="$LIBS"
AC_CHECK_LIB(pthreads, pthread_join, [
AC_CHECK_LIB(pthreads, pthread_mutex_unlock, [
ol_link_threads=posix
LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lmach -lexc -lc_r"
if test $ol_with_yielding_select = auto ; then
......@@ -498,7 +499,18 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
LIBS="$save_LIBS"
fi
dnl HP-UX 11 check
dnl IRIX Pthread check
if test $ol_link_threads = no ; then
dnl try IRIX Pthreads -Wl,-woff,85 -lpthreads
save_LIBS="$LIBS"
AC_CHECK_LIB(pthreads, pthread_join, [
ol_link_threads=posix
LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads"
],[-Wl,-woff,85])
LIBS="$save_LIBS"
fi
dnl HP-UX 11 Pthread check
if test $ol_link_threads = no; then
save_LIBS="$LIBS"
LIBS="$LIBS -lpthread"
......@@ -1326,7 +1338,6 @@ AC_SUBST(BUILD_SLAPD)
AC_SUBST(BUILD_SHELL)
AC_SUBST(BUILD_SLURPD)
AC_SUBST(LDAP_LIBS)
AC_SUBST(LDAPD_LIBS)
AC_SUBST(SLAPD_LIBS)
......
......@@ -7,12 +7,12 @@ all-local: ldapconfig.h FORCE
install-local: FORCE
-$(MKDIR) -p $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 ldap.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 lber.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 ldap_cdefs.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 $(srcdir)/ldap.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 $(srcdir)/lber.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 $(srcdir)/ldap_cdefs.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 $(srcdir)/disptmpl.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 $(srcdir)/srchpref.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 ldap_features.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 disptmpl.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 srchpref.h $(includedir)
clean-local: FORCE
$(RM) ldapconfig.h
......
......@@ -92,14 +92,26 @@
#undef WORDS_BIGENDIAN
/* define this if needed to get reentrant functions */
#ifndef REENTRANT
#undef REENTRANT
#endif
#ifndef _REENTRANT
#undef _REENTRANT
#endif
/* define this if needed to get threadsafe functions */
#ifndef THREADSAFE
#undef THREADSAFE
#endif
#ifndef _THREADSAFE
#undef _THREADSAFE
#endif
#ifndef THREAD_SAFE
#undef THREAD_SAFE
#endif
#ifndef _THREAD_SAFE
#undef _THREAD_SAFE
#endif
/* define this if cross compiling */
#undef CROSS_COMPILING
......
......@@ -13,4 +13,4 @@ LIBRARY = libavl.a
PROGRAMS = testavl
testavl: $(LIBRARY) testavl.o
$(LTLINK) $(LDFLAGS) -o $@ testavl.o $(LDAP_LIBPATH) -lavl
$(LTLINK) $(LDFLAGS) -o $@ testavl.o $(LDAP_LIBPATH) -lavl $(LIBS)
......@@ -16,7 +16,7 @@ PROGRAMS= dtest etest idtest
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
LIBS = $(LDAP_LIBPATH) $(LDAP_LIBLBER) $(AC_LIBS)
XXLIBS = $(LDAP_LIBPATH) $(LDAP_LIBLBER)
dtest: $(LIBRARY) dtest.o
$(LTLINK) $(LDFLAGS) -o $@ dtest.o $(LIBS)
......
......@@ -28,7 +28,7 @@ OBJS = bind.lo open.lo result.lo error.lo compare.lo search.lo \
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
LIBS = $(LDAP_LIBPATH) $(LDAP_LIBLDAP) $(LDAP_LIBLBER) $(AC_LIBS)
XXLIBS = $(LDAP_LIBPATH) $(LDAP_LIBLDAP) $(LDAP_LIBLBER)
apitest: $(LIBRARY) apitest.o $(LDAP_LIBLBER_DEPEND)
$(LTLINK) $(LDFLAGS) -o $@ apitest.o $(LIBS)
......@@ -46,14 +46,14 @@ install-local: $(CFFILES) FORCE
@for i in $(CFFILES); do \
if test ! -f $(sysconfdir)/$$i; then \
echo "installing $$i in $(sysconfdir)"; \
echo "$(INSTALL) $(INSTALLFLAGS) -m 644 $$i $(sysconfdir)/$$i"; \
$(INSTALL) $(INSTALLFLAGS) -m 644 $$i $(sysconfdir)/$$i; \
echo "$(INSTALL) $(INSTALLFLAGS) -m 644 $(srcdir)/$$i $(sysconfdir)/$$i"; \
$(INSTALL) $(INSTALLFLAGS) -m 644 $(srcdir)/$$i $(sysconfdir)/$$i; \
else \
echo "PRESERVING EXISTING CONFIGURATION FILE $(sysconfdir)/$$i" ; \
fi; \
$(INSTALL) $(INSTALLFLAGS) -m 644 $$i $(sysconfdir)/$$i.default; \
$(INSTALL) $(INSTALLFLAGS) -m 644 $(srcdir)/$$i $(sysconfdir)/$$i.default; \
done
-$(MKDIR) $(datadir)
-$(MV) $(datadir)/ldapfriendly $(datadir)/ldapfriendly-
$(INSTALL) $(INSTALLFLAGS) -m 644 ldapfriendly $(datadir)/ldapfriendly
$(INSTALL) $(INSTALLFLAGS) -m 644 $(srcdir)/ldapfriendly $(datadir)/ldapfriendly
......@@ -27,7 +27,7 @@ LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
XDEFS = -DLDAP_R_COMPILE -I$(XXDIR)
LIBS = $(LDAP_LIBPATH) $(LDAP_LIBLDAP) $(LDAP_LIBLBER) $(AC_LIBS)
XXLIBS = $(LDAP_LIBPATH) $(LDAP_LIBLDAP) $(LDAP_LIBLBER)
.links : FORCE
@for i in $(XXSRCS); do \
......
......@@ -10,7 +10,7 @@ OBJS = ldbm.o
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
XLIBS = @LDBM_LIBS@ -lavl
XXLIBS = $(LDBM_LIBS) -lavl
testldbm: libldbm.a testldbm.o
$(CC) $(LDFLAGS) -o $@ testldbm.o $(LIBS)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment