Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

preliminary autoconf/automake/libtool funtionality for phpembed build…

…s. Added setup.sh for initial configuration

git-svn-id: svn+ssh://tubbs/svnroot/projects/phpembed/trunk@56874 2c7ba8d8-a2f7-0310-a573-de162e16dcc7
  • Loading branch information...
commit 90877f237191c789699c54c451eb4df4b443e65b 1 parent c676969
mvaradachari authored
View
27 Makefile.am
@@ -0,0 +1,27 @@
+# Automake input file.
+# $Id$
+
+SUBDIRS = src examples
+
+EXTRA_DIST = phpembedVersion.h
+
+# Update config if configure.ac or aclocal.m4 changes
+
+#$(srcdir)/configure: configure.ac aclocal.m4
+# (cd $(srcdir);autoconf)
+
+#Makefile: Makefile.in config.status
+# ./config.status
+
+#config.status: configure
+# ./config.status --recheck
+
+#This macro sets the shell variable LIBTOOL_DEPS, that can be used to automatically update libtool.
+#script if it becomes out-of-date.
+# To add to configure.ac
+#AC_SUBST(LIBTOOL_DEPS)
+
+# LIBTOOL_DEPS = @LIBTOOL_DEPS@
+#libtool: $(LIBTOOL_DEPS)
+# $(SHELL) ./config.status --recheck
+
View
224 configure.ac
@@ -0,0 +1,224 @@
+# Autoconf input file
+# $Id$
+
+AC_PREREQ(2.52)
+AC_INIT(phpembed, 1.0.0, mvaradachari@facebook.com)
+
+AC_CANONICAL_SYSTEM
+AC_CONFIG_SRCDIR(phpembedVersion.h.in)
+AM_INIT_AUTOMAKE(phpembed, 1.0.0)
+AM_CONFIG_HEADER(config.h)
+
+AC_PREFIX_DEFAULT(`pwd`/install)
+
+AC_PROG_CPP
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_RANLIB(RANLIB, ranlib)
+
+############################################################
+# Turns off shared lib creation. Use --enable-shared=pkg1,pkg2
+# This implies all libs are built static except pkg1, pkg2
+# --enable-static=pkg3,pkg4 . Implies shared is enabled except for pkg3 and pkg4
+# When developing a package use --disable-shared OR AC_DISABLE_SHARED macro.
+
+AC_DISABLE_SHARED
+AC_PROG_LIBTOOL
+
+##############################################################
+
+AC_PROG_INSTALL
+cache_file="config.cache"
+
+# sets the variables BASH, PERL, RANLIB
+AC_PATH_PROGS(BASH, bash)
+AC_PATH_PROGS(PERL, perl)
+AC_PATH_PROGS(PYTHON, python)
+AC_PATH_PROGS(AR, ar)
+AC_PATH_PROGS(ANT, ant)
+
+# Checks for header files.
+#AC_INCLUDES_DEFAULT
+#AC_HEADER_STDC
+#AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/param.h sys/socket.h sys/time.h unistd.h])
+
+AC_HEADER_STDBOOL
+AC_HEADER_TIME
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_SIZE_T
+AC_HEADER_TIME
+AC_C_VOLATILE
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_FUNC_STAT
+AC_FUNC_STRTOD
+AC_CHECK_FUNCS([gethostname gettimeofday memset socket strchr strerror strstr strtoul strtoull])
+
+# Check for programs
+AC_CHECK_PROG([PHPCONFIG],[php-config],[yes],[],[],[reject])
+if test -z "${PHPCONFIG}"; then
+ AC_ERROR([php-config not found.])
+fi
+
+
+PHPCONFIGINCLUDES=`php-config --includes`
+PHPCONFIGLDFLAGS=`php-config --ldflags`
+PHPCONFIGLIBS=`php-config --libs`
+
+AC_SUBST(PHPCONFIGINCLUDES)
+AC_SUBST(PHPCONFIGLDFLAGS)
+AC_SUBST(PHPCONFIGLIBS)
+
+
+AC_MSG_CHECKING(whether to use ccache)
+AC_ARG_WITH(ccache,
+ [ --with-ccache Use ccache.],
+ [ case "${with_ccache}" in
+ no)
+ ;;
+ "" | yes)
+ CC="ccache ${CC}"
+ CXX="ccache ${CXX}"
+ with_ccache="yes"
+ #AC_ERROR(The compilers are ${CC} ${CXX}.)
+ ;;
+ *)
+ AC_ERROR(Option --with-ccache will only accept yes or no arguments. Arg given:${with_ccache}.)
+ ;;
+ esac ],[
+ with_ccache="no"
+ ]
+)
+AC_MSG_RESULT($with_ccache)
+
+AC_MSG_CHECKING([whether to enable release build])
+AC_ARG_ENABLE(release,
+ [ --enable-release Set CFLAGS DEFS for release build.],
+ [
+ # If the user wants something different than last time, die.
+ # Debug and release/final builds should be done in different trees.
+ if test ! -z "$php_cv_enable_release" \
+ -a "$enable_release" != "$php_cv_enable_release"; then
+ AC_ERROR( Debug level changed!!
+ Configure should be run in a separate directory.
+ (If you insist on configuring here, remove $cache_file
+ and 'make clean' before compiling.)
+ )
+ fi
+ case "${enableval}" in
+ no)
+ php_cv_enable_release=no
+ ;;
+ "" | yes)
+ if test x$enable_debug = "xyes"; then
+ AC_MSG_RESULT(NO!)
+ AC_MSG_ERROR([Can only specify one of: --enable-debug,release.])
+ else
+ php_cv_enable_release=yes
+ AC_DEFINE([RELEASE], [1], [Define])
+ fi
+ CFLAGS="-O3"
+ CXXFLAGS="-O3"
+ ;;
+ esac ],[
+ # Default to 'no' unless it was something else last time.
+ if test ! -z "$php_cv_enable_release" \
+ -a "$php_cv_enable_release" != "no"; then
+ AC_ERROR( Debug level changed!!
+ Configure should be run in a separate directory.
+ (If you insist on configuring here, remove $cache_file
+ and 'make clean' before compiling.)
+ )
+ fi
+ enable_release=no
+ php_cv_enable_release=no
+ ]
+)
+AC_MSG_RESULT($enable_release)
+
+
+AC_MSG_CHECKING([whether to enable debug build])
+AC_ARG_ENABLE(debug,
+ [ --enable-debug Set CFLAGS DEFS for release build.],
+ [
+ # If the user wants something different than last time, die.
+ # Debug and release/final builds should be done in different trees.
+ if test ! -z "$php_cv_enable_debug" \
+ -a "$enable_debug" != "$php_cv_enable_debug"; then
+ AC_ERROR( Debug level changed!!
+ Configure should be run in a separate directory.
+ (If you insist on configuring here, remove $cache_file
+ and 'make clean' before compiling.)
+ )
+ fi
+ case "${enableval}" in
+ no )
+ php_cv_enable_debug=no
+ ;;
+ * )
+ if test x$enable_release = "xyes"; then
+ AC_MSG_RESULT(NO!)
+ AC_MSG_ERROR([Can only specify one of: --enable-debug,--enable-release.])
+ else
+ php_cv_enable_debug=yes
+ fi
+ CFLAGS="$CFLAGS -O3"
+ CXXFLAGS="$CXXFLAGS -O3"
+ ;;
+ esac ],[
+ if test x$enable_release = "xyes"; then
+ enable_debug=no
+ else
+ enable_debug=yes
+ CFLAGS="-g"
+ CXXFLAGS="-g"
+ fi
+ if test ! -z "$php_cv_enable_debug" \
+ -a "$php_cv_enable_debug" != "$enable_debug"; then
+ AC_ERROR( Debug level changed!!
+ Configure should be run in a separate directory.
+ (If you insist on configuring here, remove $cache_file
+ and 'make clean' before compiling.)
+ )
+ fi
+ php_cv_enable_debug=$enable_debug
+ ]
+)
+AC_MSG_RESULT($enable_debug)
+
+# phpembed versioning
+PHPEMBED_MAJOR_VERSION=`echo $VERSION | cut -f1 -d.`
+PHPEMBED_MINOR_VERSION=`echo $VERSION | cut -f2 -d.`
+PHPEMBED_PATCH_VERSION=`echo $VERSION | cut -f3 -d.`
+PHPEMBED_VERSION_NUMBER="$PHPEMBED_MAJOR_VERSION $PHPEMBED_MINOR_VERSION $PHPEMBED_PATCH_VERSION"
+PHPEMBED_VERSION_STRING=\"$VERSION\"
+
+AC_SUBST(PHPEMBED_MAJOR_VERSION)
+AC_SUBST(PHPEMBED_MINOR_VERSION)
+AC_SUBST(PHPEMBED_PATCH_VERSION)
+AC_SUBST(PHPEMBD_VERSION_NUMBER)
+AC_SUBST(PHPEMBED_VERSION_STRING)
+
+# Add common compiler options.
+CFLAGS="$CFLAGS -Wall"
+CXXFLAGS="$CXXFLAGS -Wall"
+
+AC_CONFIG_FILES(Makefile phpembedVersion.h src/Makefile examples/Makefile)
+AC_OUTPUT
+
+echo " PHPCONFIG -- $PHPCONFIGLD"
+echo "CFLAGS = $CFLAGS"
+echo "CXXFLAGS = $CXXFLAGS"
+echo "CPPFLAGS = $CPPFLAGS"
+echo "DEFS = $DEFS"
+echo "cache_file = $cache_file"
+echo "CC = $CC"
+echo "CXX = $CXX"
+echo "VERSION = $VERSION"
+echo "PHPEMBED_VERSION_NUMBER= ${PHPEMBED_MAJOR_VERSION}"
+echo "PHPEMBED_VERSION_NUMBER= ${PHPEMBED_VERSION_NUMBER}"
+echo "INCLUDES= ${INCLUDES}"
View
23 examples/Makefile.am
@@ -0,0 +1,23 @@
+# Automake input file.
+# $Id$
+
+# Includes paths
+INCLUDES = -I.
+INCLUDES += @PHPCONFIGINCLUDES@
+INCLUDES += -I$(top_srcdir)/src
+INCLUDES += -I/usr/local/php/include/php
+INCLUDES += -I/usr/local/php/include/php/Zend
+INCLUDES += -I/usr/local/php/include/php/TSRM
+INCLUDES += -I/usr/local/php/include/php/main
+INCLUDES += -I/usr/local/php/include/php/sapi/embed
+
+# Paths to installed libraries
+AM_LDFLAGS = @PHPCONFIGLDFLAGS@ -L/usr/local/php/lib
+
+# List of libraries to link with.
+LDADD = @PHPCONFIGLIBS@ $(top_builddir)/src/libphpembed.a -lphp5
+
+
+bin_PROGRAMS = test usage
+test_SOURCES = test.cpp
+usage_SOURCES = usage.cpp
View
10 phpembedVersion.h.in
@@ -0,0 +1,10 @@
+// Autoconf versioning
+// $Id
+
+#ifndef _PHPEMBED_VERSION_DEFINED_
+#define _PHPEMBED_VERSION_DEFINED_
+#define PHPEMBED_MAJOR_VERSION @PHPEMBED_MAJOR_VERSION@
+#define PHPEMBED_MINOR_VERSION @PHPEMBED_MINOR_VERSION@
+#define PHPEMBED_PATCH_VERSION @PHPEMBED_PATCH_VERSION@
+#define PHPEMBED_VERSION_STRING @PHPEMBED_VERSION_STRING@
+#endif
View
35 setup.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+# $Id$
+
+# Script to set up environment.
+
+rm -rf NEWS README AUTHORS ChangeLog
+rm -rf ltmain.sh configure depcomp config.guess config.sub config.h.in autom4te.cache INSTALL COPYING missing install-sh aclocal.m4
+rm -rf mkinstalldirs phpembedVersion.h config.log config.status stamp-h1 config.h libtool
+
+
+touch NEWS README AUTHORS ChangeLog
+
+echo "libtoolize..."
+LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
+$LIBTOOLIZE --automake
+
+echo "aclocal..."
+ACLOCAL=`which aclocal-1.9 || which aclocal19 || which aclocal-1.7 || which aclocal17 || which aclocal-1.5 || which aclocal15 || which aclocal || exit 1`
+$ACLOCAL || exit 1
+
+echo "autoheader..."
+AUTOHEADER=${AUTOHEADER:-autoheader}
+$AUTOHEADER || exit 1
+
+echo "automake..."
+AUTOMAKE=`which automake-1.9 || which automake-1.7 || which automake`
+#$AUTOMAKE --foreign --add-missing || $AUTOMAKE --gnu --add-missing || exit 1
+$AUTOMAKE -a
+
+echo "autoconf..."
+AUTOCONF=${AUTOCONF:-autoconf}
+$AUTOCONF || exit 1
+
+echo "running make clean ....."
+make clean 1>/dev/null 2>&1
View
16 src/Makefile.am
@@ -0,0 +1,16 @@
+# Automake input file.
+# $Id$
+
+INCLUDES = -I.
+#INCLUDES += @PHPCONFIGINCLUDES@
+INCLUDES += -I/usr/local/php/include/php
+INCLUDES += -I/usr/local/php/include/php/Zend
+INCLUDES += -I/usr/local/php/include/php/TSRM
+INCLUDES += -I/usr/local/php/include/php/main
+INCLUDES += -I/usr/local/php/include/php/sapi/embed
+
+# add includes to dist.
+libphpembed_includes = php_arr.h php_cxx.h php_stl.h php_tok_consts.h php_tok.h
+
+lib_LIBRARIES = libphpembed.a
+libphpembed_a_SOURCES = php_cxx.cpp php_arr.cpp php_stl.cpp php_tok.cpp $(libphpembed_includes)
Please sign in to comment.
Something went wrong with that request. Please try again.