Skip to content

Commit

Permalink
Renamed package from Tclsha to ExampleA.
Browse files Browse the repository at this point in the history
    * Source files renamed
    * configure macros revised to reflect new name

Added configure macros for locating public or privage Tcl header files.
The public header file macro is still kinda lame...
  • Loading branch information
wart committed Aug 20, 1999
1 parent faecd1d commit 6114193
Show file tree
Hide file tree
Showing 8 changed files with 268 additions and 90 deletions.
40 changes: 20 additions & 20 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
# "autoconf" program (constructs like "@foo@" will get replaced in the actual
# Makefile.
#
# RCS: @(#) $Id: Makefile.in,v 1.12 1999/08/19 20:52:41 wart Exp $
# RCS: @(#) $Id: Makefile.in,v 1.13 1999/08/20 21:47:01 wart Exp $

#========================================================================
# Edit the following few lines when writing a new extension
#========================================================================

#========================================================================
# Change the name of the variable "TCLSHA_LIB_FILE" to match the one
# Change the name of the variable "exampleA_LIB_FILE" to match the one
# used in the configure script. This is the parameterized name of the
# library that we are building.
#========================================================================

lib_BINARIES=$(TCLSHA_LIB_FILE)
lib_BINARIES=$(exampleA_LIB_FILE)
BINARIES=$(lib_BINARIES)

#========================================================================
# Enumerate the names of the source files included in this package.
# This will be used when a dist target is added to the Makefile.
#========================================================================

tclsha_SOURCES = sha1.c tclsha1.c
SOURCES = $(tclsha_SOURCES)
exampleA_SOURCES = exampleA.c tclexampleA.c
SOURCES = $(exampleA_SOURCES)

#========================================================================
# Enumerate the names of the object files included in this package.
Expand All @@ -35,17 +35,17 @@ SOURCES = $(tclsha_SOURCES)
# above.
#========================================================================

tclsha_OBJECTS = sha1.$(OBJEXT) tclsha1.$(OBJEXT)
TCLSHA_LIB_FILE = @TCLSHA_LIB_FILE@
$(TCLSHA_LIB_FILE)_OBJECTS = $(tclsha_OBJECTS)
OBJECTS = $(tclsha_OBJECTS)
exampleA_OBJECTS = exampleA.$(OBJEXT) tclexampleA.$(OBJEXT)
exampleA_LIB_FILE = @exampleA_LIB_FILE@
$(exampleA_LIB_FILE)_OBJECTS = $(exampleA_OBJECTS)
OBJECTS = $(exampleA_OBJECTS)

#========================================================================
# This is a list of header files to be installed
#========================================================================

GENERIC_HDRS= \
$(srcdir)/sha1.h
$(srcdir)/exampleA.h

#========================================================================
# Add additional lines to handle any additional AC_SUBST cases that
Expand Down Expand Up @@ -150,7 +150,7 @@ LDFLAGS = $(LDFLAGS_DEFAULT)
# Change the following if you require the Tcl private includes.
#

INCLUDES = -I$(INCLUDE_DIR_NATIVE)
INCLUDES = @TCL_INCLUDES@
#INCLUDES = -I$(INCLUDE_DIR_NATIVE) -I$(TCL_PLATFORM_DIR_NATIVE) -I$(TCL_GENERIC_DIR_NATIVE) -I$(TCL_BMAP_DIR_NATIVE)

EXTRA_CFLAGS = $(TCL_DEFS) $(PROTO_FLAGS) $(SECURITY_FLAGS) $(MEM_DEBUG_FLAGS) $(KEYSYM_FLAGS) $(NO_DEPRECATED_FLAGS)
Expand Down Expand Up @@ -191,8 +191,8 @@ doc:
@echo "If you have documentation to create, place the commands to"
@echo "build the docs in the 'doc:' target. For example:"
@echo ""
@echo "xml2nroff sha1.xml > sha1.n"
@echo "xml2html sha1.xml > sha1.html"
@echo "xml2nroff exampleA.xml > exampleA.n"
@echo "xml2html exampleA.xml > exampleA.html"

install: all install-binaries install-libraries install-doc

Expand Down Expand Up @@ -289,21 +289,21 @@ distclean: clean
# above.
#========================================================================

$(TCLSHA_LIB_FILE): $(tclsha_OBJECTS)
-rm -f $(TCLSHA_LIB_FILE)
$(exampleA_LIB_FILE): $(exampleA_OBJECTS)
-rm -f $(exampleA_LIB_FILE)
@MAKE_LIB@
$(RANLIB) $(TCLSHA_LIB_FILE)
$(RANLIB) $(exampleA_LIB_FILE)

# We need to enumerate the list of .c to .o lines here.
# Unfortunately, there does not seem to be any other way to do this
# in a Makefile-independent way. We can't use VPATH because it picks up
# object files that may be located in the source directory.

sha1.$(OBJEXT): $(srcdir)/sha1.c
$(COMPILE) -c `@CYGPATH@ $(srcdir)/sha1.c` -o $@
exampleA.$(OBJEXT): $(srcdir)/exampleA.c
$(COMPILE) -c `@CYGPATH@ $(srcdir)/exampleA.c` -o $@

tclsha1.$(OBJEXT): $(srcdir)/tclsha1.c
$(COMPILE) -c `@CYGPATH@ $(srcdir)/tclsha1.c` -o $@
tclexampleA.$(OBJEXT): $(srcdir)/tclexampleA.c
$(COMPILE) -c `@CYGPATH@ $(srcdir)/tclexampleA.c` -o $@


#========================================================================
Expand Down
8 changes: 3 additions & 5 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,14 @@ mkIndex.tcl.in Script template used for generating an installed pkgIndex.tcl
mkinstalldirs Program used to create a directory heirarchy (because
mkdir -p is not portable)

sha1.c Core Secure Hash Algorithm code.
exampleA.c Core Secure Hash Algorithm code.

sha1.h Header file for functions in the C files.
exampleA.h Header file for functions in the C files.

sha1.n Unix nroff man page

sha1.tcl Sample script file.

tcl.m4 Collection of Tcl autoconf macros. This file should be copied
to aclocal.m4 before running autoconf.

tclsha1.c Implementation of new Tcl command "sha1".
tclexampleA.c Implementation of new Tcl command "sha1".

106 changes: 106 additions & 0 deletions aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1845,3 +1845,109 @@ AC_DEFUN(SC_LIB_NAME, [
fi
])

#------------------------------------------------------------------------
# SC_PRIVATE_TCL_INCLUDE --
#
# Locate the private Tcl include files
#
# Arguments:
#
# Requires:
# TCL_SRC_DIR Assumes that SC_LOAD_TCLCONFIG has
# already been called.
#
# Results:
#
# Substs the following vars:
# TCL_TOP_DIR_NATIVE
# TCL_GENERIC_DIR_NATIVE
# TCL_UNIX_DIR_NATIVE
# TCL_WIN_DIR_NATIVE
# TCL_BMAP_DIR_NATIVE
# TCL_TOOL_DIR_NATIVE
# TCL_PLATFORM_DIR_NATIVE
# TCL_BIN_DIR_NATIVE
# TCL_INCLUDES
#------------------------------------------------------------------------

AC_DEFUN(SC_PRIVATE_TCL_HEADERS, [
AC_MSG_CHECKING(for Tcl private include files)
case "`uname -s`" in
*win32* | *WIN32* | *CYGWIN_NT*)
TCL_TOP_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/..`\"
TCL_GENERIC_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/../generic`\"
TCL_UNIX_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/../unix`\"
TCL_WIN_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/../win`\"
TCL_BMAP_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/../bitmaps`\"
TCL_TOOL_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/../tools`\"
TCL_COMPAT_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/../compat`\"
TCL_PLATFORM_DIR_NATIVE=${TCL_WIN_DIR_NATIVE}
;;
*)
TCL_TOP_DIR_NATIVE=${TCL_SRC_DIR}
TCL_GENERIC_DIR_NATIVE='$(TCL_TOP_DIR_NATIVE)/generic'
TCL_UNIX_DIR_NATIVE='$(TCL_TOP_DIR_NATIVE)/unix'
TCL_WIN_DIR_NATIVE='$(TCL_TOP_DIR_NATIVE)/win'
TCL_BMAP_DIR_NATIVE='$(TCL_TOP_DIR_NATIVE)/bitmaps'
TCL_TOOL_DIR_NATIVE='$(TCL_TOP_DIR_NATIVE)/tools'
TCL_COMPAT_DIR_NATIVE='$(TCL_TOP_DIR_NATIVE)/compat'
TCL_PLATFORM_DIR_NATIVE=${TCL_UNIX_DIR_NATIVE}
;;
esac
AC_SUBST(TCL_TOP_DIR_NATIVE)
AC_SUBST(TCL_GENERIC_DIR_NATIVE)
AC_SUBST(TCL_UNIX_DIR_NATIVE)
AC_SUBST(TCL_WIN_DIR_NATIVE)
AC_SUBST(TCL_BMAP_DIR_NATIVE)
AC_SUBST(TCL_TOOL_DIR_NATIVE)
AC_SUBST(TCL_PLATFORM_DIR_NATIVE)
TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
AC_SUBST(TCL_INCLUDES)
AC_MSG_RESULT(Using srcdir found in tclConfig.sh)
])

#------------------------------------------------------------------------
# SC_PUBLIC_TCL_HEADERS --
#
# Locate the public Tcl include files
#
# Arguments:
#
# Requires:
#
# Results:
#
# Substs the following vars:
# TCL_INCLUDES
#------------------------------------------------------------------------

AC_DEFUN(SC_PUBLIC_TCL_HEADERS, [
eval "INCLUDE_DIR=${includedir}"
AC_MSG_CHECKING(for public tcl include files in ${INCLUDE_DIR})
case "`uname -s`" in
*win32* | *WIN32* | *CYGWIN_NT*)
CYGPATH="cygpath -w"
INCLUDE_DIR_NATIVE=\"`${CYGPATH} ${INCLUDE_DIR}`\"
;;
*)
CYGPATH=echo
INCLUDE_DIR_NATIVE="${includedir}"
;;
esac
if test -f "${INCLUDE_DIR}/tcl.h" ; then
AC_MSG_RESULT(found)
else
AC_MSG_ERROR(not found)
fi
TCL_INCLUDES=-I${INCLUDE_DIR_NATIVE}
AC_SUBST(TCL_INCLUDES)
])

69 changes: 16 additions & 53 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# AC_INIT(../generic/tcl.h)
#--------------------------------------------------------------------

AC_INIT(sha1.h)
AC_INIT(exampleA.h)

#--------------------------------------------------------------------
# Set your version numbers here. The NODOT_VERSION is required
Expand All @@ -15,7 +15,7 @@ AC_INIT(sha1.h)
# other systems.
#--------------------------------------------------------------------

PACKAGE=tclsha
PACKAGE=exampleA

MAJOR_VERSION=0
MINOR_VERSION=2
Expand Down Expand Up @@ -79,10 +79,6 @@ SC_PATH_TCLCONFIG
SC_LOAD_TCLCONFIG

#--------------------------------------------------------------------
# Set some values that point to parts of the Tcl source tree. Many
# extensions require headers/source files that Tcl doesn't normally
# export.
#
# "cygpath" is used on windows to generate native path names for include
# files.
# These variables should only be used with the compiler and linker since
Expand All @@ -96,60 +92,27 @@ SC_LOAD_TCLCONFIG
case "`uname -s`" in
*win32* | *WIN32* | *CYGWIN_NT*)
CYGPATH="cygpath -w"
TCL_TOP_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/..`\"
TCL_GENERIC_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/../generic`\"
TCL_UNIX_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/../unix`\"
TCL_WIN_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/../win`\"
TCL_BMAP_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/../bitmaps`\"
TCL_TOOL_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/../tools`\"
eval "INCLUDE_DIR=${includedir}"
INCLUDE_DIR_NATIVE=\"`${CYGPATH} ${INCLUDE_DIR}`\"
;;
*)
CYGPATH=echo
TCL_TOP_DIR_NATIVE=${TCL_SRC_DIR}
TCL_GENERIC_DIR_NATIVE='$(TCL_TOP_DIR_NATIVE)/generic'
TCL_UNIX_DIR_NATIVE='$(TCL_TOP_DIR_NATIVE)/unix'
TCL_WIN_DIR_NATIVE='$(TCL_TOP_DIR_NATIVE)/win'
TCL_BMAP_DIR_NATIVE='$(TCL_TOP_DIR_NATIVE)/bitmaps'
TCL_TOOL_DIR_NATIVE='$(TCL_TOP_DIR_NATIVE)/tools'
INCLUDE_DIR_NATIVE="${includedir}"
;;
esac

#--------------------------------------------------------------------
# Locate the platform-specific piece of the Tcl source tree.
#--------------------------------------------------------------------

case "`uname -s`" in
*win32* | *WIN32* | *CYGWIN_NT*)
TCL_PLATFORM_DIR_NATIVE=${TCL_WIN_DIR_NATIVE}
;;
*)
TCL_PLATFORM_DIR_NATIVE=${TCL_UNIX_DIR_NATIVE}
;;
esac
AC_SUBST(CYGPATH)

#--------------------------------------------------------------------
# Put all of these in the Makefile so we can add them to the compiler's
# include line.
# Set some values that point to parts of the Tcl source tree. Many
# extensions require headers/source files that Tcl doesn't normally
# export.
#--------------------------------------------------------------------

AC_SUBST(TCL_TOP_DIR_NATIVE)
AC_SUBST(TCL_GENERIC_DIR_NATIVE)
AC_SUBST(TCL_UNIX_DIR_NATIVE)
AC_SUBST(TCL_WIN_DIR_NATIVE)
AC_SUBST(TCL_BMAP_DIR_NATIVE)
AC_SUBST(TCL_TOOL_DIR_NATIVE)
AC_SUBST(TCL_PLATFORM_DIR_NATIVE)
AC_SUBST(TCL_BIN_DIR_NATIVE)
AC_SUBST(INCLUDE_DIR_NATIVE)
AC_SUBST(CYGPATH)
#SC_PRIVATE_TCL_HEADERS
SC_PUBLIC_TCL_HEADERS

#--------------------------------------------------------------------
# A few miscellaneous platform-specific items:
#
# Define a special symbol for Windows (BUILD_sha in this case) so
# Define a special symbol for Windows (BUILD_exampleA in this case) so
# that we create the export library with the dll. See sha1.h on how
# to use this.
#
Expand All @@ -158,7 +121,7 @@ AC_SUBST(CYGPATH)

case "`uname -s`" in
*win32* | *WIN32* | *CYGWIN_NT*)
AC_DEFINE(BUILD_sha)
AC_DEFINE(BUILD_exampleA)
CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb vc50.pch"
AC_SUBST(CLEANFILES)
;;
Expand Down Expand Up @@ -246,24 +209,24 @@ case "`uname -s`" in
*win32* | *WIN32* | *CYGWIN_NT*)
if test "${SHARED_BUILD}" = "1" ; then
SHLIB_LD_LIBS="\"`cygpath -w ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\" ${TCL_SHLIB_LD_LIBS}"
eval "TCLSHA_LIB_FILE=${PACKAGE}${SHARED_LIB_SUFFIX}"
eval "${PACKAGE}_LIB_FILE=${PACKAGE}${SHARED_LIB_SUFFIX}"
RANLIB=:
else
eval "TCLSHA_LIB_FILE=${PACKAGE}${UNSHARED_LIB_SUFFIX}"
eval "${PACKAGE}_LIB_FILE=${PACKAGE}${UNSHARED_LIB_SUFFIX}"
fi
;;
*)
if test "${SHARED_BUILD}" = "1" ; then
SHLIB_LD_LIBS="${TCL_STUB_LIB_SPEC}"
eval "TCLSHA_LIB_FILE=lib${PACKAGE}${SHARED_LIB_SUFFIX}"
eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}${SHARED_LIB_SUFFIX}"
RANLIB=:
else
eval "TCLSHA_LIB_FILE=lib${PACKAGE}${UNSHARED_LIB_SUFFIX}"
eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}${UNSHARED_LIB_SUFFIX}"
fi
;;
esac

AC_SUBST(TCLSHA_LIB_FILE)
AC_SUBST(exampleA_LIB_FILE)
AC_SUBST(SHLIB_LD_LIBS)

#--------------------------------------------------------------------
Expand All @@ -272,7 +235,7 @@ AC_SUBST(SHLIB_LD_LIBS)
# ${CYGPATH} because it's being used directly by make.
#--------------------------------------------------------------------

AC_PATH_PROGS(TCLSH_PROG, tclsh8.2${EXEEXT} tclsh82${EXEEXT} tclsh${EXEEXT}, :, ${exec_prefix}:${PATH})
AC_PATH_PROGS(TCLSH_PROG, tclsh8.2${EXEEXT} tclsh82${EXEEXT} tclsh8.1${EXEEXT} tclsh81${EXEEXT} tclsh${EXEEXT}, :, ${exec_prefix}:${PATH})

if test "x${TCLSH_PROG}" = "x:" ; then
AC_MSG_WARN(No tclsh executable found. You will have to build the pkgIndex.tcl file manually.)
Expand Down
4 changes: 2 additions & 2 deletions sha1.c → exampleA.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* sha1.c --
* exampleA.c --
*
* This file implements a secure hashing algorithm
*
Expand All @@ -26,7 +26,7 @@ A million repetitions of "a"

#include <stdio.h>
#include <string.h>
#include "sha1.h"
#include "exampleA.h"

#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))

Expand Down
Loading

0 comments on commit 6114193

Please sign in to comment.