Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Shafer committed Aug 21, 2015
2 parents 9774df2 + a556a96 commit 708729c
Show file tree
Hide file tree
Showing 154 changed files with 10,851 additions and 1,825 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ configure
.DS_Store

xoconfig.h.in
xo_config.h.in

.gdbinit
.gdbinit.local
Expand Down
15 changes: 15 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!---
# $Id$
#
# Copyright 2015, Juniper Networks, Inc.
# All rights reserved.
# This SOFTWARE is licensed under the LICENSE provided in the
# ../Copyright file. By downloading, installing, copying, or otherwise
# using the SOFTWARE, you agree to be bound by the terms of that
# LICENSE.
#-->

## Instructions for building libxo

Instructions for building libxo are now available in the
[wiki](http://juniper.github.io/libxo/libxo-manual.html#getting-libxo).
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

ACLOCAL_AMFLAGS = -I m4

SUBDIRS = libxo xo xolint xohtml tests doc
SUBDIRS = libxo xo xopo xolint xohtml tests doc encoder
bin_SCRIPTS=libxo-config
dist_doc_DATA = Copyright

Expand Down
5 changes: 5 additions & 0 deletions bin/Zaliases
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set opts=' \
--enable-debug \
--enable-warnings \
--enable-printflike \
--with-gettext=/opt/local \
--prefix ${HOME}/work/root \
'
set opts=`echo $opts`
Expand All @@ -22,3 +23,7 @@ cd build


alias xx 'cc -I.. -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Werror -Waggregate-return -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wformat -Wimplicit -Wmissing-declarations -Wnested-externs -Wparentheses -Wreturn-type -Wshadow -Wswitch -Wtrigraphs -Wuninitialized -Wunused -Wwrite-strings -fno-inline-functions-called-once -g -O2 -o xtest -DUNIT_TEST libxo.c'

alias mm "make CFLAGS='-O0 -g'"

alias mmi 'mm && mi'
164 changes: 161 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ AC_CHECK_FUNCS([sranddev srand strlcpy])
AC_CHECK_FUNCS([fdopen getrusage])
AC_CHECK_FUNCS([gettimeofday ctime])
AC_CHECK_FUNCS([getpass])
AC_CHECK_FUNCS([getprogname])
AC_CHECK_FUNCS([sysctlbyname])
AC_CHECK_FUNCS([flock])
AC_CHECK_FUNCS([asprintf])
AC_CHECK_FUNCS([__flbf])
AC_CHECK_FUNCS([sysctlbyname])


AC_CHECK_HEADERS([dlfcn.h])
AC_CHECK_HEADERS([dlfcn.h])
Expand All @@ -70,6 +73,7 @@ AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([ctype.h errno.h stdio.h stdlib.h])
AC_CHECK_HEADERS([string.h sys/param.h unistd.h ])
AC_CHECK_HEADERS([sys/sysctl.h])
AC_CHECK_HEADERS([threads.h])

dnl humanize_number(3) is a great function, but it's not standard.
dnl Note Macosx has the function in libutil.a but doesn't ship the
Expand All @@ -80,17 +84,128 @@ AC_CHECK_LIB([util], [humanize_number],
[HAVE_HUMANIZE_NUMBER=$ac_cv_header_libutil_h],
[HAVE_HUMANIZE_NUMBER=no])

AC_MSG_RESULT(Humanize is :${HAVE_HUMANIZE_NUMBER}:${ac_cv_header_libutil_h}:)
AC_MSG_RESULT(humanize_number results: :${HAVE_HUMANIZE_NUMBER}:${ac_cv_header_libutil_h}:)

if test "$HAVE_HUMANIZE_NUMBER" = "yes"; then
AC_DEFINE([HAVE_HUMANIZE_NUMBER], [1], [humanize_number(3)])
fi

AM_CONDITIONAL([HAVE_HUMANIZE_NUMBER], [test "$HAVE_HUMANIZE_NUMBER" = "yes"])

AC_ARG_ENABLE([gettext],
[ --disable-gettext Turn off support for gettext],
[GETTEXT_ENABLE=$enableval],
[GETTEXT_ENABLE=yes])

dnl Looking for gettext(), assumably in libintl
AC_ARG_WITH(gettext,
[ --with-gettext=[PFX] Specify location of gettext installation],
[GETTEXT_PREFIX=$withval],
[GETTEXT_PREFIX=/usr],
)

HAVE_GETTEXT=no

if test "$GETTEXT_ENABLE" != "no"; then

AC_MSG_CHECKING([gettext in ${GETTEXT_PREFIX}])

_save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -I${GETTEXT_PREFIX}/include -L${GETTEXT_PREFIX}/lib -Werror -lintl"
AC_LINK_IFELSE([AC_LANG_SOURCE([[#include <libintl.h>]
[int main() {char *cp = dgettext(NULL, "xx"); return 0; }]])],
[HAVE_GETTEXT=yes],
[HAVE_GETTEXT=no])
CFLAGS="$_save_cflags"

AC_MSG_RESULT([$HAVE_GETTEXT])

if test "$HAVE_GETTEXT" != "yes"; then
GETTEXT_PREFIX=/opt/local
AC_MSG_CHECKING([gettext in ${GETTEXT_PREFIX}])

_save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -I${GETTEXT_PREFIX}/include -L${GETTEXT_PREFIX}/lib -Werror -lintl"
AC_LINK_IFELSE([AC_LANG_SOURCE([[#include <libintl.h>]
[int main() {char *cp = dgettext(NULL, "xx"); return 0; }]])],
[HAVE_GETTEXT=yes],
[HAVE_GETTEXT=no])
CFLAGS="$_save_cflags"

AC_MSG_RESULT([$HAVE_GETTEXT])
fi
fi

if test "$HAVE_GETTEXT" = "yes"; then
AC_DEFINE([HAVE_GETTEXT], [1], [gettext(3)])
GETTEXT_CFLAGS="-I${GETTEXT_PREFIX}/include"
GETTEXT_LIBS="-L${GETTEXT_PREFIX}/lib -lintl"
else
GETTEXT_PREFIX=none
GETTEXT_CFLAGS=
GETTEXT_LIBS=
fi
AC_SUBST(GETTEXT_CFLAGS)
AC_SUBST(GETTEXT_LIBS)

GETTEXT_BINDIR=${GETTEXT_PREFIX}/bin
AC_SUBST(GETTEXT_BINDIR)
GETTEXT_LIBDIR=${GETTEXT_PREFIX}/lib
AC_SUBST(GETTEXT_LIBDIR)

AM_CONDITIONAL([HAVE_GETTEXT], [test "$HAVE_GETTEXT" = "yes"])

dnl Looking for how to do thread-local variables
AC_ARG_WITH(threads,
[ --with-threads=[STYLE] Specify style of thread-local support (none)],
[THREAD_LOCAL=$withval],
[THREAD_LOCAL=unknown],
)

AC_MSG_CHECKING([thread-locals are ${THREAD_LOCAL}])

if test "$THREAD_LOCAL" = "unknown"; then
AC_LINK_IFELSE([AC_LANG_SOURCE([[]
[__thread int foo; int main() { foo++; return foo; }]])],
[THREAD_LOCAL=before],
[THREAD_LOCAL=unknown])

AC_MSG_RESULT([$THREAD_LOCAL])
fi

if test "$THREAD_LOCAL" = "unknown"; then
AC_LINK_IFELSE([AC_LANG_SOURCE([[]
[int __thread foo; int main() { foo++; return foo; }]])],
[THREAD_LOCAL=after],
[THREAD_LOCAL=unknown])
AC_MSG_RESULT([$THREAD_LOCAL])
fi

if test "$THREAD_LOCAL" = "unknown"; then
AC_LINK_IFELSE([AC_LANG_SOURCE([[]
[__declspec(int) foo; int main() { foo++; return foo; }]])],
[THREAD_LOCAL=declspec],
[THREAD_LOCAL=unknown])
AC_MSG_RESULT([$THREAD_LOCAL])
fi

if test "$THREAD_LOCAL" != "unknown"; then
AC_DEFINE_UNQUOTED([HAVE_THREAD_LOCAL],
THREAD_LOCAL_${THREAD_LOCAL}, [thread-local setting])
fi

dnl Looking for libcrypto....
AC_CHECK_LIB([crypto], [MD5_Init])
AM_CONDITIONAL([HAVE_LIBCRYPTO], [test "$HAVE_LIBCRYPTO" != "no"])

AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
[HAVE_SUN_LEN=yes ;
AC_DEFINE([HAVE_SUN_LEN], [1], [Have struct sockaddr_un.sun_len])],
[HAS_SUN_LEN=no], [[#include <sys/un.h>]])

AC_CHECK_DECLS([__isthreaded], [], [], [#include <stdio.h>])
HAVE_ISTHREADED=${ac_cv_have_decl___isthreaded}

dnl
dnl Some packages need to be checked against version numbers so we
dnl define a function here for later use
Expand Down Expand Up @@ -125,12 +240,15 @@ then
SLAX_BINDIR="`$SLAX_CONFIG --bindir | head -1`"
SLAX_OXTRADOCDIR="`$SLAX_CONFIG --oxtradoc | head -1`"
AC_MSG_RESULT($LIBSLAX_VERSION found)
HAVE_OXTRADOC=yes
else
LIBSLAX_VERSION=
SLAX_BINDIR=
SLAX_OXTRADOCDIR=
AC_MSG_RESULT([no])
HAVE_OXTRADOC=no
fi
AM_CONDITIONAL([HAVE_OXTRADOC], [test "$HAVE_OXTRADOC" != "no"])

AC_SUBST(SLAX_BINDIR)
AC_SUBST(SLAX_OXTRADOCDIR)
Expand Down Expand Up @@ -159,6 +277,16 @@ AC_ARG_ENABLE([text-only],
AC_MSG_RESULT([$LIBXO_TEXT_ONLY])
AM_CONDITIONAL([LIBXO_TEXT_ONLY], [test "$LIBXO_TEXT_ONLY" != "no"])

AC_MSG_CHECKING([whether to build with local wcwidth implementation])
AC_ARG_ENABLE([wcwidth],
[ --disable-wcwidth Disable local wcwidth implementation],
[LIBXO_WCWIDTH=$enableval],
[LIBXO_WCWIDTH=yes])
AC_MSG_RESULT([$LIBXO_WCWIDTH])
if test "${LIBXO_WCWIDTH}" != "no"; then
AC_DEFINE([LIBXO_WCWIDTH], [1], [Enable local wcwidth implementation])
fi

AC_CHECK_LIB([m], [lrint])
AM_CONDITIONAL([HAVE_LIBM], [test "$HAVE_LIBM" != "no"])

Expand Down Expand Up @@ -195,13 +323,16 @@ AM_CONDITIONAL([NO_LIBXO_OPTIONS], [test "$LIBXO_OPTS" != "yes"])
case $host_os in
darwin*)
LIBTOOL=glibtool
XO_LIBEXT=dylib
;;
Linux*|linux*)
CFLAGS="-D_GNU_SOURCE $CFLAGS"
LDFLAGS=-ldl
XO_LIBEXT=so
;;
cygwin*|CYGWIN*)
LDFLAGS=-no-undefined
XO_LIBEXT=ddl
;;
esac

Expand All @@ -221,6 +352,14 @@ AC_SUBST(XO_SRCDIR)
AC_SUBST(XO_LIBDIR)
AC_SUBST(XO_BINDIR)
AC_SUBST(XO_INCLUDEDIR)
AC_SUBST(XO_LIBEXT)

AC_ARG_WITH(extensions-dir,
[ --with-extensions-dir=[DIR] Specify location of extension libraries],
[XO_EXTDIR=$withval],
[XO_EXTDIR=$libdir/libxo/extensions]
)
AC_SUBST(XO_EXTDIR)

AC_ARG_WITH(share-dir,
[ --with-share-dir=[DIR] Specify location of shared files],
Expand Down Expand Up @@ -250,20 +389,34 @@ AC_SUBST(LIBXO_VERSION)
AC_SUBST(LIBXO_VERSION_NUMBER)
AC_SUBST(LIBXO_VERSION_EXTRA)

AC_CONFIG_HEADERS([libxo/xoconfig.h])
AC_DEFINE_UNQUOTED(LIBXO_VERSION, ["$LIBXO_VERSION"],
[Version number as dotted value])
AC_DEFINE_UNQUOTED(LIBXO_VERSION_NUMBER, [$LIBXO_VERSION_NUMBER],
[Version number as a number])
AC_DEFINE_UNQUOTED(LIBXO_VERSION_STRING, ["$LIBXO_VERSION_NUMBER"],
[Version number as string])
AC_DEFINE_UNQUOTED(LIBXO_VERSION_EXTRA, ["$LIBXO_VERSION_EXTRA"],
[Version number extra information])

AC_CONFIG_HEADERS([libxo/xo_config.h])
AC_CONFIG_FILES([
Makefile
libxo-config
xohtml/xohtml.sh
libxo/Makefile
libxo/xoversion.h
libxo/add.man
encoder/Makefile
encoder/cbor/Makefile
encoder/test/Makefile
xo/Makefile
xolint/Makefile
xohtml/Makefile
xopo/Makefile
packaging/libxo.pc
doc/Makefile
tests/Makefile
tests/core/Makefile
tests/gettext/Makefile
tests/xo/Makefile
packaging/libxo.spec
packaging/libxo.rb.base
Expand All @@ -280,6 +433,7 @@ AC_MSG_NOTICE([summary of build options:
bindir: ${XO_BINDIR}
includedir: ${XO_INCLUDEDIR}
share dir: ${XO_SHAREDIR}
extensions dir: ${XO_EXTDIR}
oxtradoc dir: ${SLAX_OXTRADOCDIR}
compiler: ${CC} (${HAVE_GCC:-no})
Expand All @@ -291,4 +445,8 @@ AC_MSG_NOTICE([summary of build options:
printf-like: ${HAVE_PRINTFLIKE:-no}
libxo-options: ${LIBXO_OPTS:-no}
text-only: ${LIBXO_TEXT_ONLY:-no}
gettext: ${HAVE_GETTEXT:-no} (${GETTEXT_PREFIX})
isthreaded: ${HAVE_ISTHREADED:-no}
thread-local: ${THREAD_LOCAL:-no}
local wcwidth: ${LIBXO_WCWIDTH:-no}
])
23 changes: 14 additions & 9 deletions doc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# using the SOFTWARE, you agree to be bound by the terms of that
# LICENSE.

if HAVE_OXTRADOC
OXTRADOC_DIR = ${SLAX_OXTRADOCDIR}
OXTRADOC_PREFIX = ${OXTRADOC_DIR}
OXTRADOC = ${OXTRADOC_DIR}/oxtradoc
Expand Down Expand Up @@ -38,28 +39,32 @@ OX_ARGS += -S ${SLAXPROC} -p doc
OX_CMD = ${PERL} ${PERLOPTS} ${OXTRADOC} ${OX_ARGS}
OXTRADOC_CMD = ${OX_CMD}


OUTPUT = libxo-manual
INPUT = libxo.txt
INPUT = libxo

EXTRA_DIST = \
${INPUT} \
${INPUT}.txt \
${OUTPUT}.html \
${OUTPUT}.txt

doc docs: ${OUTPUT}.txt ${OUTPUT}.html

${OUTPUT}.txt: ${INPUT} ${OXTRADOC} xolint.txt
${OUTPUT}.txt: ${INPUT}.txt ${OXTRADOC} xolint.txt
${OXTRADOC_CMD} -m text -o $@ $<

${OUTPUT}.html: ${INPUT} ${OXTRADOC} ${XML2HTMLBIN} xolint.txt
${OUTPUT}.html: ${INPUT}.txt ${OXTRADOC} ${XML2HTMLBIN} xolint.txt
${OXTRADOC_CMD} -m html -o $@ $<

xolint.txt: ${top_srcdir}/xolint/xolint.pl
perl ${top_srcdir}/xolint/xolint.pl -D > xolint.txt

CLEANFILES = \
${OUTPUT}.xml \
${OUTPUT}.txt \
${OUTPUT}.fxml \
${OUTPUT}.html
xolint.txt \
${INPUT}.xml \
${INPUT}.txt \
${INPUT}.fxml \
${INPUT}.html
else
doc docs:
@${ECHO} "The 'oxtradoc' tool is not installed; see libslax.org"
endif
Loading

0 comments on commit 708729c

Please sign in to comment.