Skip to content

Commit

Permalink
refine autoconf and makefile to locate libmemcached
Browse files Browse the repository at this point in the history
  • Loading branch information
bovine committed Oct 29, 2010
1 parent d9ec439 commit b84c063
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 35 deletions.
49 changes: 18 additions & 31 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@

# .PSEUDO: all
# all: memcache.so

# .PSEUDO: clean
# clean:
# rm -f memcache.so

# memcache.so: mymemcache.c
# gcc -Wall -O2 -DUSE_TCL_STUBS -I/usr/local/include -L/usr/local/lib \
# -o memcache.so -shared mymemcache.c -lmemcached -ltclstub8.5


# Makefile.in --
#
# This file is a Makefile for Sample TEA Extension. If it has the name
Expand Down Expand Up @@ -92,7 +79,7 @@ includedir = @includedir@

DESTDIR =

PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION)
PKG_DIR = $(PACKAGE_NAME)
pkgdatadir = $(datadir)/$(PKG_DIR)
pkglibdir = $(libdir)/$(PKG_DIR)
pkgincludedir = $(includedir)/$(PKG_DIR)
Expand Down Expand Up @@ -211,10 +198,10 @@ libraries:
#========================================================================

doc:
@echo "If you have documentation to create, place the commands to"
@echo "build the docs in the 'doc:' target. For example:"
@echo " xml2nroff sample.xml > sample.n"
@echo " xml2html sample.xml > sample.html"
# @echo "If you have documentation to create, place the commands to"
# @echo "build the docs in the 'doc:' target. For example:"
# @echo " xml2nroff sample.xml > sample.n"
# @echo " xml2html sample.xml > sample.html"

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

Expand All @@ -226,26 +213,26 @@ install-binaries: binaries install-lib-binaries install-bin-binaries
#========================================================================

install-libraries: libraries
@mkdir -p $(DESTDIR)$(includedir)
@echo "Installing header files in $(DESTDIR)$(includedir)"
@list='$(PKG_HEADERS)'; for i in $$list; do \
echo "Installing $(srcdir)/$$i" ; \
$(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \
done;
# @mkdir -p $(DESTDIR)$(includedir)
# @echo "Installing header files in $(DESTDIR)$(includedir)"
# @list='$(PKG_HEADERS)'; for i in $$list; do \
# echo "Installing $(srcdir)/$$i" ; \
# $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \
# done;

#========================================================================
# Install documentation. Unix manpages should go in the $(mandir)
# directory.
#========================================================================

install-doc: doc
@mkdir -p $(DESTDIR)$(mandir)/mann
@echo "Installing documentation in $(DESTDIR)$(mandir)"
@list='$(srcdir)/doc/*.n'; for i in $$list; do \
echo "Installing $$i"; \
rm -f $(DESTDIR)$(mandir)/mann/`basename $$i`; \
$(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \
done
# @mkdir -p $(DESTDIR)$(mandir)/mann
# @echo "Installing documentation in $(DESTDIR)$(mandir)"
# @list='$(srcdir)/doc/*.n'; for i in $$list; do \
# echo "Installing $$i"; \
# rm -f $(DESTDIR)$(mandir)/mann/`basename $$i`; \
# $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \
# done

test: binaries libraries
$(TCLSH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS)
Expand Down
149 changes: 147 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -6954,7 +6954,7 @@ $as_echo "$as_me: error: could not find source file '$i'" >&2;}
vars=""
vars="-lmemcached -lsasl2"
for i in $vars; do
if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
# Convert foo.lib to -lfoo for GCC. No-op if not *.lib
Expand Down Expand Up @@ -7021,6 +7021,148 @@ $as_echo "$as_me: error: could not find tcl source file '${srcdir}/$i'" >&2;}
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------
if test "${ac_cv_header_libmemcached_memcached_h+set}" = set; then
{ $as_echo "$as_me:$LINENO: checking for libmemcached/memcached.h" >&5
$as_echo_n "checking for libmemcached/memcached.h... " >&6; }
if test "${ac_cv_header_libmemcached_memcached_h+set}" = set; then
$as_echo_n "(cached) " >&6
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libmemcached_memcached_h" >&5
$as_echo "$ac_cv_header_libmemcached_memcached_h" >&6; }
else
# Is the header compilable?
{ $as_echo "$as_me:$LINENO: checking libmemcached/memcached.h usability" >&5
$as_echo_n "checking libmemcached/memcached.h usability... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <libmemcached/memcached.h>
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_header_compiler=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }
# Is the header present?
{ $as_echo "$as_me:$LINENO: checking libmemcached/memcached.h presence" >&5
$as_echo_n "checking libmemcached/memcached.h presence... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <libmemcached/memcached.h>
_ACEOF
if { (ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then
ac_header_preproc=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ $as_echo "$as_me:$LINENO: WARNING: libmemcached/memcached.h: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: libmemcached/memcached.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: libmemcached/memcached.h: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: libmemcached/memcached.h: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ $as_echo "$as_me:$LINENO: WARNING: libmemcached/memcached.h: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: libmemcached/memcached.h: present but cannot be compiled" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: libmemcached/memcached.h: check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: libmemcached/memcached.h: check for missing prerequisite headers?" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: libmemcached/memcached.h: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: libmemcached/memcached.h: see the Autoconf documentation" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: libmemcached/memcached.h: section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: libmemcached/memcached.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: libmemcached/memcached.h: proceeding with the preprocessor's result" >&5
$as_echo "$as_me: WARNING: libmemcached/memcached.h: proceeding with the preprocessor's result" >&2;}
{ $as_echo "$as_me:$LINENO: WARNING: libmemcached/memcached.h: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: libmemcached/memcached.h: in the future, the compiler will take precedence" >&2;}
;;
esac
{ $as_echo "$as_me:$LINENO: checking for libmemcached/memcached.h" >&5
$as_echo_n "checking for libmemcached/memcached.h... " >&6; }
if test "${ac_cv_header_libmemcached_memcached_h+set}" = set; then
$as_echo_n "(cached) " >&6
else
ac_cv_header_libmemcached_memcached_h=$ac_header_preproc
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libmemcached_memcached_h" >&5
$as_echo "$ac_cv_header_libmemcached_memcached_h" >&6; }
fi
if test $ac_cv_header_libmemcached_memcached_h = yes; then
:
else
{ { $as_echo "$as_me:$LINENO: error: Could not find libmemcached headers
See \`config.log' for more details." >&5
$as_echo "$as_me: error: Could not find libmemcached headers
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
if test "${TEA_PLATFORM}" = "windows" ; then
cat >>confdefs.h <<\_ACEOF
Expand Down Expand Up @@ -10690,12 +10832,15 @@ $as_echo "${TCLSH_PROG}" >&6; }
#TEA_PROG_WISH
# TODO: way may want to bundle libmemcached in the future
#AC_CONFIG_SUBDIRS([libmemcached-0.44])
#--------------------------------------------------------------------
# Finally, substitute all of the various values into the Makefile.
# You may alternatively have a special pkgIndex.tcl.in or other files
# which require substituting th AC variables in. Include these here.
#--------------------------------------------------------------------
ac_config_files="$ac_config_files Makefile pkgIndex.tcl"
cat >confcache <<\_ACEOF
Expand Down
12 changes: 10 additions & 2 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ TEA_SETUP_COMPILER
TEA_ADD_SOURCES([tclMemcache.c])
#TEA_ADD_HEADERS([generic/tclMemcache.h])
TEA_ADD_INCLUDES([])
TEA_ADD_LIBS([])
TEA_ADD_LIBS([-lmemcached -lsasl2])
TEA_ADD_CFLAGS([])
TEA_ADD_STUB_SOURCES([])
TEA_ADD_TCL_SOURCES([])
Expand All @@ -89,6 +89,11 @@ TEA_ADD_TCL_SOURCES([])
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------

AC_CHECK_HEADER(libmemcached/memcached.h,,[
AC_MSG_FAILURE([Could not find libmemcached headers])
])


if test "${TEA_PLATFORM}" = "windows" ; then
AC_DEFINE(BUILD_tcl_memcache, 1, [Build windows export dll])
CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch"
Expand Down Expand Up @@ -173,10 +178,13 @@ TEA_MAKE_LIB
TEA_PROG_TCLSH
#TEA_PROG_WISH


# TODO: way may want to bundle libmemcached in the future
#AC_CONFIG_SUBDIRS([libmemcached-0.44])

#--------------------------------------------------------------------
# Finally, substitute all of the various values into the Makefile.
# You may alternatively have a special pkgIndex.tcl.in or other files
# which require substituting th AC variables in. Include these here.
#--------------------------------------------------------------------

AC_OUTPUT([Makefile pkgIndex.tcl])

0 comments on commit b84c063

Please sign in to comment.