gnet-2.0.8/0000777000175000017500000000000010751404361007464 500000000000000gnet-2.0.8/acinclude.m40000755000175000017500000001305010751326732011600 00000000000000dnl Usage: dnl GTK_DOC_CHECK([minimum-gtk-doc-version]) AC_DEFUN([GTK_DOC_CHECK], [ AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first dnl for overriding the documentation installation directory AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),, [with_html_dir='${datadir}/gtk-doc/html']) HTML_DIR="$with_html_dir" AC_SUBST(HTML_DIR) dnl enable/disable documentation building AC_ARG_ENABLE(gtk-doc, AC_HELP_STRING([--enable-gtk-doc], [use gtk-doc to build documentation [default=no]]),, enable_gtk_doc=no) have_gtk_doc=no if test x$enable_gtk_doc = xyes; then if test -z "$PKG_CONFIG"; then AC_PATH_PROG(PKG_CONFIG, pkg-config, no) fi if test "$PKG_CONFIG" != "no" && $PKG_CONFIG --exists gtk-doc; then have_gtk_doc=yes fi dnl do we want to do a version check? ifelse([$1],[],, [gtk_doc_min_version=$1 if test "$have_gtk_doc" = yes; then AC_MSG_CHECKING([gtk-doc version >= $gtk_doc_min_version]) if $PKG_CONFIG --atleast-version $gtk_doc_min_version gtk-doc; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) have_gtk_doc=no fi fi ]) if test "$have_gtk_doc" != yes; then enable_gtk_doc=no fi fi AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes) AM_CONDITIONAL(GTK_DOC_USE_LIBTOOL, test -n "$LIBTOOL") ]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test "x$ac_cv_env_[]$1[]_set" = "xset"; then pkg_cv_[]$1=$ac_cv_env_[]$1[]_value elif test -n "$PKG_CONFIG"; then if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.in # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS], [_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])]) AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS], [_PKG_CONFIG([$1][_LIBS], [libs], [$2])]) if test $pkg_failed = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD ifelse([$4], , [AC_MSG_ERROR(dnl [Package requirements ($2) were not met. Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables to avoid the need to call pkg-config. See the pkg-config man page for more details.])], [$4]) elif test $pkg_failed = untried; then ifelse([$4], , [AC_MSG_FAILURE(dnl [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see .])], [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS ifelse([$3], , :, [$3]) fi[]dnl ])# PKG_CHECK_MODULES gnet-2.0.8/missing0000755000175000017500000002540610535563747011024 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: gnet-2.0.8/gnet-2.0.pc.in0000644000175000017500000000065410751326732011575 00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: Gnet Description: A network compatibility layer library Version: @VERSION@ Libs: -L${libdir} -lgnet-@GNET_MAJOR_VERSION@.@GNET_MINOR_VERSION@ @GLIB_LIBS@ @GTHREAD_LIBS@ Cflags: -I${includedir}/gnet-@GNET_MAJOR_VERSION@.@GNET_MINOR_VERSION@ -I${libdir}/gnet-@GNET_MAJOR_VERSION@.@GNET_MINOR_VERSION@/include/ @GLIB_CFLAGS@ @GTHREAD_CFLAGS@ gnet-2.0.8/Makefile.in0000644000175000017500000006605710751327171011466 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/gnet-2.0.pc.in $(srcdir)/gnet.spec.in \ $(srcdir)/gnetconfig.h.in $(top_srcdir)/configure AUTHORS \ COPYING ChangeLog INSTALL NEWS TODO config.guess config.sub \ depcomp install-sh ltmain.sh missing subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/gnet-arch.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = gnetconfig.h gnet.spec gnet-2.0.pc SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(configincludedir)" \ "$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(pkgconfigdir)" configincludeDATA_INSTALL = $(INSTALL_DATA) m4dataDATA_INSTALL = $(INSTALL_DATA) pkgconfigDATA_INSTALL = $(INSTALL_DATA) DATA = $(configinclude_DATA) $(m4data_DATA) $(pkgconfig_DATA) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHECK_CFLAGS = @CHECK_CFLAGS@ CHECK_LIBS = @CHECK_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_GTK_DOC_FALSE = @ENABLE_GTK_DOC_FALSE@ ENABLE_GTK_DOC_TRUE = @ENABLE_GTK_DOC_TRUE@ ENABLE_NETWORK_TESTS_FALSE = @ENABLE_NETWORK_TESTS_FALSE@ ENABLE_NETWORK_TESTS_TRUE = @ENABLE_NETWORK_TESTS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GNET_BINARY_AGE = @GNET_BINARY_AGE@ GNET_DEBUG_FLAGS = @GNET_DEBUG_FLAGS@ GNET_GCOV_ENABLED_FALSE = @GNET_GCOV_ENABLED_FALSE@ GNET_GCOV_ENABLED_TRUE = @GNET_GCOV_ENABLED_TRUE@ GNET_INTERFACE_AGE = @GNET_INTERFACE_AGE@ GNET_MAJOR_VERSION = @GNET_MAJOR_VERSION@ GNET_MICRO_VERSION = @GNET_MICRO_VERSION@ GNET_MINOR_VERSION = @GNET_MINOR_VERSION@ GNET_VERSION = @GNET_VERSION@ GREP = @GREP@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ HAVE_CPU_ALPHA_FALSE = @HAVE_CPU_ALPHA_FALSE@ HAVE_CPU_ALPHA_TRUE = @HAVE_CPU_ALPHA_TRUE@ HAVE_CPU_ARM_FALSE = @HAVE_CPU_ARM_FALSE@ HAVE_CPU_ARM_TRUE = @HAVE_CPU_ARM_TRUE@ HAVE_CPU_CRISV32_FALSE = @HAVE_CPU_CRISV32_FALSE@ HAVE_CPU_CRISV32_TRUE = @HAVE_CPU_CRISV32_TRUE@ HAVE_CPU_CRIS_FALSE = @HAVE_CPU_CRIS_FALSE@ HAVE_CPU_CRIS_TRUE = @HAVE_CPU_CRIS_TRUE@ HAVE_CPU_HPPA_FALSE = @HAVE_CPU_HPPA_FALSE@ HAVE_CPU_HPPA_TRUE = @HAVE_CPU_HPPA_TRUE@ HAVE_CPU_I386_FALSE = @HAVE_CPU_I386_FALSE@ HAVE_CPU_I386_TRUE = @HAVE_CPU_I386_TRUE@ HAVE_CPU_IA64_FALSE = @HAVE_CPU_IA64_FALSE@ HAVE_CPU_IA64_TRUE = @HAVE_CPU_IA64_TRUE@ HAVE_CPU_M68K_FALSE = @HAVE_CPU_M68K_FALSE@ HAVE_CPU_M68K_TRUE = @HAVE_CPU_M68K_TRUE@ HAVE_CPU_MIPS_FALSE = @HAVE_CPU_MIPS_FALSE@ HAVE_CPU_MIPS_TRUE = @HAVE_CPU_MIPS_TRUE@ HAVE_CPU_PPC64_FALSE = @HAVE_CPU_PPC64_FALSE@ HAVE_CPU_PPC64_TRUE = @HAVE_CPU_PPC64_TRUE@ HAVE_CPU_PPC_FALSE = @HAVE_CPU_PPC_FALSE@ HAVE_CPU_PPC_TRUE = @HAVE_CPU_PPC_TRUE@ HAVE_CPU_S390_FALSE = @HAVE_CPU_S390_FALSE@ HAVE_CPU_S390_TRUE = @HAVE_CPU_S390_TRUE@ HAVE_CPU_SPARC_FALSE = @HAVE_CPU_SPARC_FALSE@ HAVE_CPU_SPARC_TRUE = @HAVE_CPU_SPARC_TRUE@ HAVE_CPU_X86_64_FALSE = @HAVE_CPU_X86_64_FALSE@ HAVE_CPU_X86_64_TRUE = @HAVE_CPU_X86_64_TRUE@ HAVE_VALGRIND_FALSE = @HAVE_VALGRIND_FALSE@ HAVE_VALGRIND_TRUE = @HAVE_VALGRIND_TRUE@ HTML_DIR = @HTML_DIR@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_WIN32_FALSE = @OS_WIN32_FALSE@ OS_WIN32_TRUE = @OS_WIN32_TRUE@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ VALGRIND_LIBS = @VALGRIND_LIBS@ VALGRIND_PATH = @VALGRIND_PATH@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ SUBDIRS = src examples macros tests doc EXTRA_DIST = \ TODO \ HACKING \ BUGS \ README.macosx \ gnetconfig.h.in \ README.win32 \ GNET.DSP \ config.h.win32 \ gnet.def \ gnet.spec \ gnet.spec.in \ examples/makefile.mingw \ src/makefile.mingw \ src/gnet-private.h \ src/socks-private.h \ src/usagi_ifaddrs.h \ tests/makefile.mingw \ tests/testfile \ tests/client_server_test.pl \ tests/dns_test.pl \ gnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).m4 \ gnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).pc.in # build documentation when doing distcheck DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc m4datadir = $(datadir)/aclocal m4data_DATA = gnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).m4 pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = gnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).pc configincludedir = $(pkglibdir)-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION)/include configinclude_DATA = gnetconfig.h WEBPATH = /home/web/gnetlibrary.org/data DOCS = README TODO NEWS ChangeLog COPYING AUTHORS HACKING MAINTAINERS TARBALL = gnet-$(VERSION).tar.gz DEBFILE = libgnet$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION)_$(VERSION)-*_i386.deb DEBFILEDEV = libgnet$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION)-dev_$(VERSION)-*_i386.deb DEBSRC = gnet_$(VERSION)-1.tar.gz RPMROOT = /usr/src/redhat RPMFILE = $(RPMROOT)/RPMS/i386/gnet-$(VERSION)-*.i386.rpm RPMFILEDEV = $(RPMROOT)/RPMS/i386/gnet-devel-$(VERSION)-*.i386.rpm RPMFILESRC = $(RPMROOT)/SRPMS/gnet-$(VERSION)-*.src.rpm all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ cd $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 gnetconfig.h: $(top_builddir)/config.status $(srcdir)/gnetconfig.h.in cd $(top_builddir) && $(SHELL) ./config.status $@ gnet.spec: $(top_builddir)/config.status $(srcdir)/gnet.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ gnet-2.0.pc: $(top_builddir)/config.status $(srcdir)/gnet-2.0.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: install-configincludeDATA: $(configinclude_DATA) @$(NORMAL_INSTALL) test -z "$(configincludedir)" || $(mkdir_p) "$(DESTDIR)$(configincludedir)" @list='$(configinclude_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(configincludeDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(configincludedir)/$$f'"; \ $(configincludeDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(configincludedir)/$$f"; \ done uninstall-configincludeDATA: @$(NORMAL_UNINSTALL) @list='$(configinclude_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(configincludedir)/$$f'"; \ rm -f "$(DESTDIR)$(configincludedir)/$$f"; \ done install-m4dataDATA: $(m4data_DATA) @$(NORMAL_INSTALL) test -z "$(m4datadir)" || $(mkdir_p) "$(DESTDIR)$(m4datadir)" @list='$(m4data_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(m4dataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(m4datadir)/$$f'"; \ $(m4dataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(m4datadir)/$$f"; \ done uninstall-m4dataDATA: @$(NORMAL_UNINSTALL) @list='$(m4data_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(m4datadir)/$$f'"; \ rm -f "$(DESTDIR)$(m4datadir)/$$f"; \ done install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) test -z "$(pkgconfigdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfigdir)" @list='$(pkgconfig_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) $(mkdir_p) $(distdir)/. $(distdir)/doc $(distdir)/examples $(distdir)/macros $(distdir)/src $(distdir)/tests @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(configincludedir)" "$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-configincludeDATA install-m4dataDATA \ install-pkgconfigDATA install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-configincludeDATA uninstall-info-am \ uninstall-m4dataDATA uninstall-pkgconfigDATA uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-libtool clean-recursive \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-recursive distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-configincludeDATA install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-m4dataDATA install-man \ install-pkgconfigDATA install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-generic mostlyclean-libtool \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-configincludeDATA \ uninstall-info-am uninstall-m4dataDATA uninstall-pkgconfigDATA @SET_MAKE@ $(pkgconfig_DATA): config.status snapshot: $(MAKE) dist distdir=$(PACKAGE)`date +"%y%m%d"` copyweb: -cp -f $(DOCS) $(WEBPATH) -(cd $(WEBPATH); chmod a+r $(DOCS)) -rm -f $(WEBPATH)/docs/* -cp -f doc/html/book1.html $(WEBPATH)/docs/index.html -cp -f doc/html/* $(WEBPATH)/docs -chmod a+r $(WEBPATH)/docs/* -cp -f $(TARBALL) $(WEBPATH)/src -cp -f $(RPMFILE) $(RPMFILEDEV) $(RPMFILESRC) $(WEBPATH)/rpm -chmod a+r $(WEBPATH)/src/* $(WEBPATH)/deb/* $(WEBPATH)/rpm/* # You don't need to be root, but make sure you # do 'make RPMROOT=/home/someone/redhat rpm' if # you do not use the default $(RPMROOT). rpm: rpm -ta $(TARBALL) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gnet-2.0.8/macros/0000777000175000017500000000000010751404362010751 500000000000000gnet-2.0.8/macros/Makefile.in0000644000175000017500000002635610751327171012750 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = macros DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/gnet-arch.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHECK_CFLAGS = @CHECK_CFLAGS@ CHECK_LIBS = @CHECK_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_GTK_DOC_FALSE = @ENABLE_GTK_DOC_FALSE@ ENABLE_GTK_DOC_TRUE = @ENABLE_GTK_DOC_TRUE@ ENABLE_NETWORK_TESTS_FALSE = @ENABLE_NETWORK_TESTS_FALSE@ ENABLE_NETWORK_TESTS_TRUE = @ENABLE_NETWORK_TESTS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GNET_BINARY_AGE = @GNET_BINARY_AGE@ GNET_DEBUG_FLAGS = @GNET_DEBUG_FLAGS@ GNET_GCOV_ENABLED_FALSE = @GNET_GCOV_ENABLED_FALSE@ GNET_GCOV_ENABLED_TRUE = @GNET_GCOV_ENABLED_TRUE@ GNET_INTERFACE_AGE = @GNET_INTERFACE_AGE@ GNET_MAJOR_VERSION = @GNET_MAJOR_VERSION@ GNET_MICRO_VERSION = @GNET_MICRO_VERSION@ GNET_MINOR_VERSION = @GNET_MINOR_VERSION@ GNET_VERSION = @GNET_VERSION@ GREP = @GREP@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ HAVE_CPU_ALPHA_FALSE = @HAVE_CPU_ALPHA_FALSE@ HAVE_CPU_ALPHA_TRUE = @HAVE_CPU_ALPHA_TRUE@ HAVE_CPU_ARM_FALSE = @HAVE_CPU_ARM_FALSE@ HAVE_CPU_ARM_TRUE = @HAVE_CPU_ARM_TRUE@ HAVE_CPU_CRISV32_FALSE = @HAVE_CPU_CRISV32_FALSE@ HAVE_CPU_CRISV32_TRUE = @HAVE_CPU_CRISV32_TRUE@ HAVE_CPU_CRIS_FALSE = @HAVE_CPU_CRIS_FALSE@ HAVE_CPU_CRIS_TRUE = @HAVE_CPU_CRIS_TRUE@ HAVE_CPU_HPPA_FALSE = @HAVE_CPU_HPPA_FALSE@ HAVE_CPU_HPPA_TRUE = @HAVE_CPU_HPPA_TRUE@ HAVE_CPU_I386_FALSE = @HAVE_CPU_I386_FALSE@ HAVE_CPU_I386_TRUE = @HAVE_CPU_I386_TRUE@ HAVE_CPU_IA64_FALSE = @HAVE_CPU_IA64_FALSE@ HAVE_CPU_IA64_TRUE = @HAVE_CPU_IA64_TRUE@ HAVE_CPU_M68K_FALSE = @HAVE_CPU_M68K_FALSE@ HAVE_CPU_M68K_TRUE = @HAVE_CPU_M68K_TRUE@ HAVE_CPU_MIPS_FALSE = @HAVE_CPU_MIPS_FALSE@ HAVE_CPU_MIPS_TRUE = @HAVE_CPU_MIPS_TRUE@ HAVE_CPU_PPC64_FALSE = @HAVE_CPU_PPC64_FALSE@ HAVE_CPU_PPC64_TRUE = @HAVE_CPU_PPC64_TRUE@ HAVE_CPU_PPC_FALSE = @HAVE_CPU_PPC_FALSE@ HAVE_CPU_PPC_TRUE = @HAVE_CPU_PPC_TRUE@ HAVE_CPU_S390_FALSE = @HAVE_CPU_S390_FALSE@ HAVE_CPU_S390_TRUE = @HAVE_CPU_S390_TRUE@ HAVE_CPU_SPARC_FALSE = @HAVE_CPU_SPARC_FALSE@ HAVE_CPU_SPARC_TRUE = @HAVE_CPU_SPARC_TRUE@ HAVE_CPU_X86_64_FALSE = @HAVE_CPU_X86_64_FALSE@ HAVE_CPU_X86_64_TRUE = @HAVE_CPU_X86_64_TRUE@ HAVE_VALGRIND_FALSE = @HAVE_VALGRIND_FALSE@ HAVE_VALGRIND_TRUE = @HAVE_VALGRIND_TRUE@ HTML_DIR = @HTML_DIR@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_WIN32_FALSE = @OS_WIN32_FALSE@ OS_WIN32_TRUE = @OS_WIN32_TRUE@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ VALGRIND_LIBS = @VALGRIND_LIBS@ VALGRIND_PATH = @VALGRIND_PATH@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ EXTRA_DIST = gnet-arch.m4 all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu macros/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu macros/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gnet-2.0.8/macros/Makefile.am0000644000175000017500000000003310751326731012720 00000000000000EXTRA_DIST = gnet-arch.m4 gnet-2.0.8/macros/gnet-arch.m40000644000175000017500000001061510751326731013005 00000000000000dnl AG_GNET_ARCH dnl sets up defines and automake conditionals for host architecture dnl checks endianness dnl defines HOST_CPU dnl (nicked from GStreamer) AC_DEFUN([AG_GNET_ARCH], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use host_ variables dnl Determine CPU case "x${host_cpu}" in xi?86 | xk? | xi?86_64) HAVE_CPU_I386=yes AC_DEFINE(HAVE_CPU_I386, 1, [Define if the host CPU is an x86]) dnl FIXME could use some better detection dnl (ie CPUID) case "x${host_cpu}" in xi386 | xi486) ;; *) AC_DEFINE(HAVE_RDTSC, 1, [Define if RDTSC is available]) ;; esac ;; xpowerpc) HAVE_CPU_PPC=yes AC_DEFINE(HAVE_CPU_PPC, 1, [Define if the host CPU is a PowerPC]) ;; xpowerpc64) HAVE_CPU_PPC64=yes AC_DEFINE(HAVE_CPU_PPC64, 1, [Define if the host CPU is a 64 bit PowerPC]) ;; xalpha*) HAVE_CPU_ALPHA=yes AC_DEFINE(HAVE_CPU_ALPHA, 1, [Define if the host CPU is an Alpha]) ;; xarm*) HAVE_CPU_ARM=yes AC_DEFINE(HAVE_CPU_ARM, 1, [Define if the host CPU is an ARM]) ;; xsparc*) HAVE_CPU_SPARC=yes AC_DEFINE(HAVE_CPU_SPARC, 1, [Define if the host CPU is a SPARC]) ;; xmips*) HAVE_CPU_MIPS=yes AC_DEFINE(HAVE_CPU_MIPS, 1, [Define if the host CPU is a MIPS]) ;; xhppa*) HAVE_CPU_HPPA=yes AC_DEFINE(HAVE_CPU_HPPA, 1, [Define if the host CPU is a HPPA]) ;; xs390*) HAVE_CPU_S390=yes AC_DEFINE(HAVE_CPU_S390, 1, [Define if the host CPU is a S390]) ;; xia64*) HAVE_CPU_IA64=yes AC_DEFINE(HAVE_CPU_IA64, 1, [Define if the host CPU is a IA64]) ;; xm68k*) HAVE_CPU_M68K=yes AC_DEFINE(HAVE_CPU_M68K, 1, [Define if the host CPU is a M68K]) ;; xx86_64) HAVE_CPU_X86_64=yes AC_DEFINE(HAVE_CPU_X86_64, 1, [Define if the host CPU is a x86_64]) ;; xcris) HAVE_CPU_CRIS=yes AC_DEFINE(HAVE_CPU_CRIS, 1, [Define if the host CPU is a CRIS]) ;; xcrisv32) HAVE_CPU_CRISV32=yes AC_DEFINE(HAVE_CPU_CRISV32, 1, [Define if the host CPU is a CRISv32]) ;; esac dnl Determine endianness AC_C_BIGENDIAN AM_CONDITIONAL(HAVE_CPU_I386, test "x$HAVE_CPU_I386" = "xyes") AM_CONDITIONAL(HAVE_CPU_PPC, test "x$HAVE_CPU_PPC" = "xyes") AM_CONDITIONAL(HAVE_CPU_PPC64, test "x$HAVE_CPU_PPC64" = "xyes") AM_CONDITIONAL(HAVE_CPU_ALPHA, test "x$HAVE_CPU_ALPHA" = "xyes") AM_CONDITIONAL(HAVE_CPU_ARM, test "x$HAVE_CPU_ARM" = "xyes") AM_CONDITIONAL(HAVE_CPU_SPARC, test "x$HAVE_CPU_SPARC" = "xyes") AM_CONDITIONAL(HAVE_CPU_HPPA, test "x$HAVE_CPU_HPPA" = "xyes") AM_CONDITIONAL(HAVE_CPU_MIPS, test "x$HAVE_CPU_MIPS" = "xyes") AM_CONDITIONAL(HAVE_CPU_S390, test "x$HAVE_CPU_S390" = "xyes") AM_CONDITIONAL(HAVE_CPU_IA64, test "x$HAVE_CPU_IA64" = "xyes") AM_CONDITIONAL(HAVE_CPU_M68K, test "x$HAVE_CPU_M68K" = "xyes") AM_CONDITIONAL(HAVE_CPU_X86_64, test "x$HAVE_CPU_X86_64" = "xyes") AM_CONDITIONAL(HAVE_CPU_CRIS, test "x$HAVE_CPU_CRIS" = "xyes") AM_CONDITIONAL(HAVE_CPU_CRISV32, test "x$HAVE_CPU_CRISV32" = "xyes") AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu", [the host CPU]) ]) dnl check if unaligned memory access works correctly AC_DEFUN([AG_GNET_UNALIGNED_ACCESS], [ AC_MSG_CHECKING([if unaligned memory access works correctly]) if test x"$as_cv_unaligned_access" = x ; then case $host in alpha*|arm*|hp*|mips*|sh*|sparc*|ia64*) _AS_ECHO_N([(blacklisted) ]) as_cv_unaligned_access=no ;; i?86*|powerpc*|m68k*|cris*) _AS_ECHO_N([(whitelisted) ]) as_cv_unaligned_access=yes ;; esac else _AS_ECHO_N([(cached) ]) fi if test x"$as_cv_unaligned_access" = x ; then AC_TRY_RUN([ int main(int argc, char **argv) { char array[] = "ABCDEFGH"; unsigned int iarray[2]; memcpy(iarray,array,8); #define GET(x) (*(unsigned int *)((char *)iarray + (x))) if(GET(0) != 0x41424344 && GET(0) != 0x44434241) return 1; if(GET(1) != 0x42434445 && GET(1) != 0x45444342) return 1; if(GET(2) != 0x43444546 && GET(2) != 0x46454443) return 1; if(GET(3) != 0x44454647 && GET(3) != 0x47464544) return 1; return 0; } ], as_cv_unaligned_access="yes", as_cv_unaligned_access="no") fi AC_MSG_RESULT($as_cv_unaligned_access) if test "$as_cv_unaligned_access" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_UNALIGNED_ACCESS, 1, [defined if unaligned memory access works correctly]) fi ]) gnet-2.0.8/TODO0000644000175000017500000000611410751326732010077 00000000000000 GNet TODO --------- Below are features we are interested in adding. Please see HACKING if you can help. Features -------- - Include more protocols The goal here is to add basic implementations of popular file transfer protocols (eg, HTTP, FTP). Just the basics - nothing fancy. I'm hesitant to include more complex protocols (eg, NNTP, SMTP, IRC) because they are more application-focused and have limited use outside their specific application. For example, someone who wants NNTP is probably implementing a new reader and would be better off implementing it from scratch for finer control of the protocol. On the other hand, if someone had a good implementation of NNTP with a good interface and there were demand for it, I would probably accept it. (An alternative would be start a gnet-protocol library which would include more complex protocols). I would also be more inclined to accept implementations that are in existing, working programs as opposed to from-scratch implementations (for complex protocols). This is because existing implementations have been tested both in functionality and in interface design. Moreover, we would be guaranteed at least one user. - Bindings for other languages The GTK doc folks are working on a new standard for describing interfaces. Use this when it's done. - Add gnet_tcp_socket_sendfile(GTcpSocket*, GIOChannel*). sendfile is available on Linux and Windows, but I'm sure the semantics are different (that's why having this function would be handy). - Consider adding gnet_io_channel_{readv/writev}. This is on most systems, but should support systems without. Internal Improvements --------------------- - 64-bit MDA/SHA. These modules cannot handle buffers longer than 4G. - Better asynchronous DNS * Add option to use GNU ADNS? (and update license) * Consider modifying glibc/BIND code? - use thread pools for async DNS stuff? - gnet_inetaddr_new will give you localhost if you give it an hostname of "" in Linux. Is this true on all systems? If not, we should do a return-on-fail when we get an empty string. Other ----- - More documentation and examples Add a beginners guide/tutorial. Show more code examples. Undecided (things discussed, but not decided on) --------- - Add more error types - Clean up GIOChannel usage. Seeking on a socket should raise an error. Reading/writing to a UDP socket should raise an error. Etc. We'd also like to support UDP/Mcast better. We use a channel for a UDP socket, though it's not really a channel. One solution would be to add a GIOMessageSource which supports descrete messages and has all the functions GIOChannel has. Another solution is to add a send_msg and recv_msg function to GIOChannel (or replace the vtable in GIOChannel with one that also includes these functions). - Support out-of-band data. How useful is this? How portable? Never (things that will probably never become part of GNet) ----- - Raw or low-level IP (use libpcap, libnet) gnet-2.0.8/Makefile.am0000644000175000017500000000433710751326732011450 00000000000000## Process this file with automake to produce Makefile.in SUBDIRS = src examples macros tests doc @SET_MAKE@ EXTRA_DIST= \ TODO \ HACKING \ BUGS \ README.macosx \ gnetconfig.h.in \ README.win32 \ GNET.DSP \ config.h.win32 \ gnet.def \ gnet.spec \ gnet.spec.in \ examples/makefile.mingw \ src/makefile.mingw \ src/gnet-private.h \ src/socks-private.h \ src/usagi_ifaddrs.h \ tests/makefile.mingw \ tests/testfile \ tests/client_server_test.pl \ tests/dns_test.pl \ gnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).m4 \ gnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).pc.in # build documentation when doing distcheck DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc m4datadir = $(datadir)/aclocal m4data_DATA = gnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).m4 pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = gnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).pc $(pkgconfig_DATA): config.status configincludedir = $(pkglibdir)-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION)/include configinclude_DATA = gnetconfig.h WEBPATH=/home/web/gnetlibrary.org/data DOCS=README TODO NEWS ChangeLog COPYING AUTHORS HACKING MAINTAINERS TARBALL=gnet-$(VERSION).tar.gz DEBFILE=libgnet$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION)_$(VERSION)-*_i386.deb DEBFILEDEV=libgnet$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION)-dev_$(VERSION)-*_i386.deb DEBSRC=gnet_$(VERSION)-1.tar.gz RPMROOT=/usr/src/redhat RPMFILE=$(RPMROOT)/RPMS/i386/gnet-$(VERSION)-*.i386.rpm RPMFILEDEV=$(RPMROOT)/RPMS/i386/gnet-devel-$(VERSION)-*.i386.rpm RPMFILESRC=$(RPMROOT)/SRPMS/gnet-$(VERSION)-*.src.rpm snapshot: $(MAKE) dist distdir=$(PACKAGE)`date +"%y%m%d"` copyweb: -cp -f $(DOCS) $(WEBPATH) -(cd $(WEBPATH); chmod a+r $(DOCS)) -rm -f $(WEBPATH)/docs/* -cp -f doc/html/book1.html $(WEBPATH)/docs/index.html -cp -f doc/html/* $(WEBPATH)/docs -chmod a+r $(WEBPATH)/docs/* -cp -f $(TARBALL) $(WEBPATH)/src -cp -f $(RPMFILE) $(RPMFILEDEV) $(RPMFILESRC) $(WEBPATH)/rpm -chmod a+r $(WEBPATH)/src/* $(WEBPATH)/deb/* $(WEBPATH)/rpm/* # You don't need to be root, but make sure you # do 'make RPMROOT=/home/someone/redhat rpm' if # you do not use the default $(RPMROOT). rpm: rpm -ta $(TARBALL) gnet-2.0.8/BUGS0000644000175000017500000000265410751326732010077 00000000000000 GNet BUGS ========= See our Bugzilla page for the last bugs: * gnet_tcp_socket_new_async can block when SOCKS is used The function will block during the SOCKS negotiation after the connection to the SOCKS server has been made. This shouldn't be too serious, so it hasn't been fixed. * Process uses 100% CPU [GLib bug 11059] On some systems GLib has problems if you use more than one watch on a file descriptor. The problem is GLib assumes descriptors can appear twice in the array passed to poll(), which is true on some systems but not others (e.g. newer versions of Linux). If GLib passes an array that's larger than than number of open decriptors, poll fails. This causes GLib to immediately try again, fail, try again, and so on, looping. (Newer versions of GLib may warn when this happens.) One solution is to not set more than one watch per iochannel. In many situations this is difficult to do. In newer versions of Jungle Monkey, there is a single demultiplexer function that acts as the only watch and calls the appropriate IO handler. A simpler alternative is to replace the limited poll with an unlimited poll. This requires distributing an additional file and some autoconf magic. See Jungle Monkey 0.1.10 for an example of how to do this. See GLib bug 11059 on http://bugs.gnome.org. (The original bug report is incorrect - the problem is with GLib, not Linux.) gnet-2.0.8/config.guess0000755000175000017500000012703510614436542011734 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-03-06' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa:Linux:*:*) echo xtensa-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: gnet-2.0.8/gnet.spec.in0000644000175000017500000000623310751326732011627 00000000000000# Note that this is NOT a relocatable package %define ver @VERSION@ %define libver @GNET_MAJOR_VERSION@.@GNET_MINOR_VERSION@ %define rel 1 %define prefix /usr Summary: Gnet, a network library Name: gnet2 Version: %ver Release: %rel Copyright: LGPL Group: Libraries/Network Source0: gnet-%{PACKAGE_VERSION}.tar.gz URL: http://www.gnetlibrary.org BuildRoot: /var/tmp/gnet-%{PACKAGE_VERSION}-root Docdir: %{prefix}/doc Packager: Xavier Nicolovici Requires: glib >= 1.2 %description Gnet is a simple network library. It is writen in C, object-oriented, and built upon GLib. It is intended to be small, fast, easy-to-use, and easy to port. Features: * TCP "client" and "server" sockets * UDP and IP Multicast * Internet address abstraction * Asynchronous socket IO * Asynchronous DNS lookup * Byte packing and unpacking * URLs (Experimental) * Server and Conn objects (Experimental) Comments and questions should be sent to gnet@gnetlibrary.org. The Gnet homepage is at . %package devel Summary: Header files for the Gnet library Group: Development/Libraries %description devel Gnet is a simple network library. It is writen in C, object-oriented, and built upon GLib. This package allows you to develop applications that use the Gnet library. %prep %setup -q -n gnet-%{version} %build %ifarch alpha CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="-s" ./configure --host=alpha-redhat-linux\ --prefix=%{prefix} \ --with-html-dir=/usr/share/gtk-doc/html \ --with-gnu-ld %else CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="-s" ./configure \ --prefix=%{prefix} \ --with-gnu-ld \ --with-html-dir=/usr/share/gtk-doc/html %endif make %{_smp_mflags} %install rm -rf $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT install %post /sbin/ldconfig %postun /sbin/ldconfig %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-, root, root) %doc README COPYING ChangeLog NEWS TODO AUTHORS INSTALL HACKING %{prefix}/lib/libgnet-%{libver}.so.* %files devel %defattr(-, root, root) %{prefix}/share/gtk-doc/* %{prefix}/share/aclocal/* %{prefix}/lib/pkgconfig/* %{prefix}/include/gnet-%{libver} %{prefix}/lib/gnet-%{libver} %{prefix}/lib/libgnet-%{libver}.*a %{prefix}/lib/libgnet-%{libver}.so %changelog * Sun Apr 27 2003 Bas Mevissen - Updated to coexist with gnet-1.x.x RPM's * Mon Mar 03 2003 Jeff Bonggren - Removed Docdir directive. - Updated the files section. - Changed 'prefix' to 'DESTDIR' in install to fix gtk-doc install. - Added %{_smp_mflags} for faster make on SMP machines. - Added --with-html-dir=/usr/share/gtk-doc/html to configure line. * Thu Oct 26 2000 Benjamin Kahn - Added missing file in lib/gnet * Mon Feb 28 2000 David Helder - Updated for version 1.0 * Sat Jan 15 2000 Xavier Nicolovici - Moved lib*.so and lib*a to the devel package - Creation of a gnet.spec.in for autoconf process * Wed Jan 14 2000 Xavier Nicolovici - HTML documentation has been move to /usr/doc/gnet-{version}/html * Thu Jan 13 2000 Xavier Nicolovici - First try at an RPM gnet-2.0.8/configure.ac0000644000175000017500000004434610751326732011706 00000000000000# Process this file with autoconf to produce a configure script. # # $Id: configure.ac,v 1.58 2006/09/11 13:11:45 tpm Exp $ # autoconf requirement AC_PREREQ([2.53]) # Init autoconf and automake AC_INIT([gnet], [2.0.8], [gnet@gnetlibrary.org]) AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) AM_MAINTAINER_MODE AC_REVISION([$Revision: 1.58 $]) AC_CONFIG_SRCDIR([src/gnet.c]) # On making releases: # GNET_MICRO_VERSION += 1; # GNET_INTERFACE_AGE += 1; # GNET_BINARY_AGE += 1; # if any functions have been added, set GNET_INTERFACE_AGE to 0. # if backwards compatibility has been broken, # set GNET_BINARY_AGE _and_ GNET_INTERFACE_AGE to 0. GNET_MAJOR_VERSION=2 GNET_MINOR_VERSION=0 GNET_MICRO_VERSION=8 GNET_INTERFACE_AGE=0 GNET_BINARY_AGE=8 GNET_VERSION=$GNET_MAJOR_VERSION.$GNET_MINOR_VERSION.$GNET_MICRO_VERSION AC_SUBST(GNET_MAJOR_VERSION) AC_SUBST(GNET_MINOR_VERSION) AC_SUBST(GNET_MICRO_VERSION) AC_SUBST(GNET_VERSION) AC_SUBST(GNET_INTERFACE_AGE) AC_SUBST(GNET_BINARY_AGE) # libtool versioning LT_RELEASE=$GNET_MAJOR_VERSION.$GNET_MINOR_VERSION LT_CURRENT=`expr $GNET_MICRO_VERSION - $GNET_INTERFACE_AGE` LT_REVISION=$GNET_INTERFACE_AGE LT_AGE=`expr $GNET_BINARY_AGE - $GNET_INTERFACE_AGE` LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE` AC_SUBST(LT_RELEASE) AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) AC_SUBST(LT_CURRENT_MINUS_AGE) # Define version stuff AC_DEFINE_UNQUOTED(GNET_MAJOR_VERSION, $GNET_MAJOR_VERSION, [GNet major version]) AC_DEFINE_UNQUOTED(GNET_MINOR_VERSION, $GNET_MINOR_VERSION, [GNet minor version] ) AC_DEFINE_UNQUOTED(GNET_MICRO_VERSION, $GNET_MICRO_VERSION, [GNet micro version]) AC_DEFINE_UNQUOTED(GNET_INTERFACE_AGE, $GNET_INTERFACE_AGE, [GNet interface age]) AC_DEFINE_UNQUOTED(GNET_BINARY_AGE, $GNET_BINARY_AGE, [GNet binary age]) AC_MSG_CHECKING([for Win32]) case "$host" in *-*-mingw*) gnet_native_win32=yes # Why not use G_OS_WIN32? AC_DEFINE_UNQUOTED(GNET_WIN32, 1, [Define when compiling on Windows]) AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 is potentially available]) ;; *) gnet_native_win32=no ;; esac AC_MSG_RESULT([$gnet_native_win32]) AM_CONDITIONAL(OS_WIN32, [test "$gnet_native_win32" = "yes"]) ############################################################### # Check Host CPU type (needed for abi test among other things) AG_GNET_ARCH #################### # Debug AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging (default=minimum],,enable_debug=minimum) AC_MSG_CHECKING([debug level]) if test "x$enable_debug" = "xyes"; then if test x$cflags_set != xset ; then case " $CFLAGS " in *[[\ \ ]]-g[[\ \ ]]*) ;; *) CFLAGS="$CFLAGS -g" ;; esac fi GNET_DEBUG_FLAGS="-DG_ENABLE_DEBUG" else if test "x$enable_debug" = "xno"; then GNET_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS" fi fi AC_SUBST(GNET_DEBUG_FLAGS) AC_MSG_RESULT($enable_debug) # Network tests AC_MSG_CHECKING([whether to run network tests]) AC_ARG_ENABLE(network_tests, AC_HELP_STRING([--enable-network-tests], [enable tests that use the network (default: yes)]), , [enable_network_tests=no]) if test "x${enable_network_tests}" = "xyes"; then AC_DEFINE(GNET_ENABLE_NETWORK_TESTS, 1, [Whether to run tests using the external network]) AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi AM_CONDITIONAL(ENABLE_NETWORK_TESTS, test "x${enable_network_tests}" = "xyes") if test "$gnet_native_win32" = "yes"; then if test x$enable_static = xyes -o x$enable_static = x; then AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.]) enable_static=no fi if test x$enable_shared = xno; then AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.]) fi enable_shared=yes fi ############################### # Check for programs AC_PROG_CC AM_PROG_CC_STDC AC_PROG_INSTALL AC_PROG_MAKE_SET AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(void*) #################### # Mac OS X # MacOSX doesn't define socklen_t, so we must define it to be an # 'int'. On all other systems, it's size_t. case $build in *-apple-darwin*) AC_DEFINE(GNET_APPLE_DARWIN, 1, [Define if building on Apple Darwin]) esac ############################### # Check for libraries AC_CHECK_LIB([socket], [main]) AC_CHECK_LIB([nsl], [main]) AC_CHECK_LIB([resolv], [main]) dnl Check for GLib 2.x GLIB_REQ=2.6.0 PKG_CHECK_MODULES(GLIB, [ glib-2.0 >= $GLIB_REQ ], , [ AC_MSG_ERROR( [ GLib-2.x development files not found (or version too old): Cannot find glib-2.0 >= $GLIB_REQ Please check the following: * Do you have the glib2 _development_ package installed? (usually called glib2-devel, libglib2.0-dev or similar) If ls -l /usr/lib/pkgconfig/glib-2.0.pc reports that the file does not exist, then you are missing the development package. If this is the case, you are most likely missing a whole bunch of other -devel packages as well (e.g. gtk2-devel, libglade2-devel, gstreamer-devel), so you might want to install them all in one go. If you installed glib2 from source, this point does not apply to you. * Do you have glib2 installed more than once, e.g. once from package and once from source? (if both ls /usr/lib/libglib-2.0* and ls /usr/local/lib/libglib-2.0* show results, you need to fix your installation. * Did you install glib from source? If yes, you might need to point pkg-config to the location of the glib-2.0.pc file by doing something like export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig and then running ./configure again. ]) ]) PKG_CHECK_MODULES(GTHREAD, [gthread-2.0 >= $GLIB_REQ], , [ AC_MSG_ERROR([The impossible happened]) ] ) # These SUBSTs are primarily for gnet-config and gnet.pc AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) AC_SUBST(GTHREAD_CFLAGS) AC_SUBST(GTHREAD_LIBS) # make double sure GLib was compiled with GThread support AC_MSG_CHECKING([if GLib was compiled with support for threads]) SAVED_CFLAGS="$CFLAGS" CFLAGS="$GTHREAD_CFLAGS" AC_TRY_COMPILE([#include ], [ #ifndef G_THREADS_ENABLED #error "GNet requires a GLib with support for threads" #endif ], [ AC_MSG_RESULT([yes]) ], [ AC_MSG_RESULT([no]) AC_MSG_ERROR([GNet requires a GLib with support for threads enabled!]) ]) CFLAGS="$SAVED_CFLAGS" # Check for IPv6 support on unix # (will be done at runtime on win32) if test "x$gnet_native_win32" != "xyes" then AC_MSG_CHECKING([for IPv6 availability]) AC_TRY_LINK([ #include #include #include ], [ struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0; ], [ AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 is potentially available]) AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) ] ) fi ############################### # Check for headers AC_HEADER_STDC AC_CHECK_HEADERS([sys/sockio.h sys/param.h ifaddrs.h]) AC_MSG_CHECKING([for linux/netlink.h]) AC_TRY_CPP([#include ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_LINUX_NETLINK_H, 1, [Define if linux/netlink.h header exists]) ],[ AC_MSG_RESULT(no) ]) ############################### # Check for types dnl check for Unix98 socklen_t (found on dnl xemacs-patches mailing list, written dnl by Martin Buchholz) dnl dnl On Darwin(MacOSX) socklen_t needs to be dnl an int (see accept man page), on all other dnl unix systems we need a size_t. AC_MSG_CHECKING(for socklen_t) AC_TRY_COMPILE([ #include #include socklen_t x; ], [],[ AC_MSG_RESULT(yes) ],[ AC_TRY_COMPILE([ #include #include int accept (int, struct sockaddr *, size_t *); ],[],[ AC_MSG_RESULT(size_t) AC_DEFINE(socklen_t,size_t,[Defined if system has no socklen_t type]) ], [ AC_MSG_RESULT(int) AC_DEFINE(socklen_t,int,[Defined if system has no socklen_t type]) ] ) ]) ############################### # Check for structures AC_CHECK_MEMBER([struct sockaddr.sa_len], AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if struct sockaddr has sa_len field]),, [#include #include ]) AC_MSG_CHECKING([for struct sockaddr_storage]) AC_TRY_COMPILE([ #include #include ], [struct sockaddr_storage s; s], have_sockaddr_storage=yes, have_sockaddr_storage=no) if test "$have_sockaddr_storage" = yes; then AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,[Whether you have struct sockaddr_storage]) AC_MSG_RESULT(yes) AC_MSG_CHECKING([for struct sockaddr_storage family field]) gnet_sockaddr_family_field_name="" AC_TRY_COMPILE([ #include #include ], [struct sockaddr_storage s; s.ss_family = AF_INET;], gnet_sockaddr_family_field_name=ss_family) if test -z "${gnet_sockaddr_family_field_name}" ; then AC_TRY_COMPILE([ #include #include ], [struct sockaddr_storage s; s.__ss_family = AF_INET;], gnet_sockaddr_family_field_name=__ss_family) fi if test -z "${gnet_sockaddr_family_field_name}" ; then AC_MSG_ERROR([can't figure out 'family' field of struct sockaddr_storage]) fi AC_MSG_RESULT($gnet_sockaddr_family_field_name) else AC_MSG_RESULT(no) gnet_sockaddr_family_field_name=ss_family fi AC_DEFINE_UNQUOTED(GNET_SOCKADDR_FAMILY_FIELD_NAME, [$gnet_sockaddr_family_field_name], [Name of sockaddr_storage family field]) dnl ####################################### dnl Check if abstract sockets are supported dnl ####################################### AC_LANG_PUSH(C) AC_CACHE_CHECK([for abstract socket namespace availability], ac_cv_gnet_have_abstract_sockets, [AC_RUN_IFELSE([AC_LANG_PROGRAM( [[ #include #include #include #include #include #include #include ]], [[ int listen_fd, len; struct sockaddr_un addr; listen_fd = socket (PF_UNIX, SOCK_STREAM, 0); if (listen_fd < 0) { perror ("socket() failed: "); exit (1); } memset (&addr, '\0', sizeof (addr)); addr.sun_family = AF_UNIX; strcpy (addr.sun_path, "X/tmp/gnet-fake-socket-path-used-in-configure-test"); len = SUN_LEN (&addr); /* calculate size before adding the \0 */ addr.sun_path[0] = '\0'; /* this is what makes it abstract */ if (bind (listen_fd, (struct sockaddr*) &addr, len) < 0) { perror ("Abstract socket namespace bind() failed: "); exit (1); } exit (0); ]])], [ac_cv_gnet_have_abstract_sockets=yes], [ac_cv_gnet_have_abstract_sockets=no] )]) AC_LANG_POP(C) if test x$ac_cv_gnet_have_abstract_sockets = xyes ; then AC_DEFINE(HAVE_ABSTRACT_SOCKETS,1,[Have abstract socket namespace]) fi ############################### # Compiler characteristics AC_C_CONST # Use reentract functions, and compile expiramental stuff CFLAGS="$CFLAGS -D_REENTRANT -DGNET_EXPERIMENTAL" ############################### # Check for library functions # Most of this code checks for variants of gethostbyname(). For # simplicity and curiosity, we check for all variants, though only one # working variant is needed. # Look for getifaddrs() AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS, 1, [Define if getifaddrs() is available])) # The user may be able to tell us if a function is thread-safe. We # know of no good way to test this programaticly. # On some systems, getaddrinfo() is thread-safe AC_ARG_ENABLE(threadsafe_getaddrinfo, AC_HELP_STRING([--enable-threadsafe-getaddrinfo], [assume getaddrinfo() is threadsafe])) # On some systems, gethostbyname() is thread-safe AC_ARG_ENABLE(threadsafe_gethostbyname, AC_HELP_STRING([--enable-threadsafe-gethostbyname], [assume gethostbyname() is threadsafe])) # Look for getaddrinfo(). If we have that, we don't need # gethostbyname(). We assume if the system has getaddrinfo(), they # have getnameinfo(). AC_CHECK_FUNC(getaddrinfo, [ # have getaddrinfo() HAVE_GETADDRINFO=yes AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo() is available]) # Check for threadsafe getaddrinfo() AC_MSG_CHECKING([for threadsafe getaddrinfo()]) if test "x$enable_threadsafe_getaddrinfo" = "xyes" ; then HAVE_GETADDRINFO_THREADSAFE=yes AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GETADDRINFO_THREADSAFE, 1, [Define if getaddrinfo is threadsafe]) else AC_MSG_RESULT(no) # If there is no threadsafe getaddrinfo, use a Glib mutex. if test "x$GTHREAD_CFLAGS" != "x"; then AC_DEFINE(HAVE_GETADDRINFO_GLIB_MUTEX, 1, [Define if getaddrinfo requires a mutex for thread-safety]) HAVE_GETADDRINFO_GLIB_MUTEX=yes else AC_MSG_WARN([ You do not have a thread-safe getaddrinfo() or GLib threads. Calls to getaddrinfo() (called by the GNet address functions) may not be thread-safe. This build of GNet could malfunction if used in programs that use threads. If your system has a thread-safe version of getaddrinfo(), pass the option --enable-threadsafe-getaddrinfo to configure. The function's manpage may be able to tell you whether it is thread-safe or not. ]) fi fi ], [ # no getaddrinfo() AC_MSG_RESULT(no) ]) # Check if the user told use gethostbyname() is thread-safe. AC_MSG_CHECKING([for threadsafe gethostbyname()]) if test "x$enable_threadsafe_gethostbyname" = "xyes" ; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GETHOSTBYNAME_THREADSAFE, 1, [Define if gethostbyname is threadsafe]) HAVE_GETHOSTBYNAME_THREADSAFE=yes else AC_MSG_RESULT(no) fi # Look for a gethostbyname_r() we can use. We assume that if the # system has gethostbyname_r(), they also have gethostbyaddr_r(). # First, look for the glibc varient AC_MSG_CHECKING([for glibc gethostbyname_r]) AC_TRY_LINK([#include ], [struct hostent result_buf; char buf[1024]; struct hostent *result; int h_erropp; gethostbyname_r("localhost", &result_buf, buf, sizeof(buf), &result, &h_erropp);], [AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC, 1, [Define if glibc variant of gethostbyname() is available]) HAVE_GETHOSTBYNAME_R=yes], [AC_MSG_RESULT([no])]) # Whups, maybe we're on Solaris or Irix AC_MSG_CHECKING([for Solaris/Irix gethostbyname_r]) AC_TRY_LINK([#include ], [struct hostent result; char buf[1024]; int h_errnop; gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop);], [AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS, 1, [Define if Solaris variant of gethostbyname() is available]) HAVE_GETHOSTBYNAME_R=yes], [AC_MSG_RESULT([no])]) # Or not. Perhaps we're on HP-UX? AC_MSG_CHECKING([for HP-UX gethostbyname_r]) AC_TRY_LINK([#include ], [struct hostent result; char buf[1024]; gethostbyname_r("localhost", &result, buf);], [AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX, 1, [Define if HPUX variant of gethostbyname() is available]) HAVE_GETHOSTBYNAME_R=yes], [AC_MSG_RESULT([no])]) # If there is no gethostbyname_r, use Glib threads. if test -z "$HAVE_GETHOSTBYNAME_THREADSAFE" -a -z "$HAVE_GETHOSTBYNAME_R" -a "$GTHREAD_CFLAGS"; then AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX, 1, [Define if gethostbyname requires a mutex for thread-safety]) HAVE_GETHOSTBYNAME_R=yes fi # Duh-oh. We don't have _any_ thread-safety, so warn the builder if test -z "$HAVE_GETADDRINFO_THREADSAFE" -a -z "$HAVE_GETHOSTBYNAME_THREADSAFE" -a -z "$HAVE_GETHOSTBYNAME_R"; then AC_MSG_WARN([ You do not have a thread-safe gethostbyname_r() or GLib threads. Calls to gethostbyname() (called by the GNet address functions) may not be thread-safe. This build of GNet could malfunction if used in programs that use threads. If your system has a thread-safe version of gethostbyname(), pass the option --enable-threadsafe-gethostbyname to configure. The function's manpage may be able to tell you whether it is thread-safe or not. ]) fi # If the compiler is gcc, turn on as many warnings as possible if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -Wall -Wstrict-prototypes \ -Wmissing-prototypes -Wmissing-declarations" if test "x$enable_debug" = "xyes"; then CFLAGS="$CFLAGS -Werror" fi if test "x$enable_ansi" = "xyes"; then CFLAGS="$CFLAGS -ansi" CFLAGS="$CFLAGS -pedantic" fi fi ############################### # GTK-DOC ############################### GTK_DOC_CHECK(1.2) ############################### # libcheck unit test framework ############################### #dnl check for "check", unit testing library/header #AM_PATH_CHECK([0.9.4], # [ # HAVE_CHECK=yes # AC_MSG_NOTICE(CHECK_CFLAGS: $CHECK_CFLAGS) # AC_MSG_NOTICE(CHECK_LIBS: $CHECK_LIBS) # ], [ # HAVE_CHECK=no # ]) #AM_CONDITIONAL(HAVE_CHECK, test "x$HAVE_CHECK" = "xyes") dnl pkg-config check that for libcheck that works for cross-compiling dnl but not normal compilation on Fedora & Ubuntu: PKG_CHECK_MODULES(CHECK, check >= 0.9.4, AM_CONDITIONAL(HAVE_CHECK, true), AM_CONDITIONAL(HAVE_CHECK, false) ) dnl check for valgrind AC_PATH_PROG(VALGRIND_PATH, valgrind, no) AC_MSG_CHECKING([whether valgrind.h is available]) AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno") PKG_CHECK_MODULES(VALGRIND, valgrind > 2.1, [ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_VALGRIND, 1, [Whether valgrind headers are available]) AC_SUBST(VALGRIND_CFLAGS) ], [ AC_MSG_RESULT([no]) ]) dnl just disable coverage stuff for now AM_CONDITIONAL(GNET_GCOV_ENABLED, test "xyes" = "xno") ############################### # Outputs ############################### AM_CONFIG_HEADER(config.h) AC_CONFIG_FILES([ Makefile src/Makefile examples/Makefile examples/xmlrpc/Makefile macros/Makefile tests/Makefile tests/check/Makefile doc/Makefile doc/version.xml gnetconfig.h gnet.spec gnet-2.0.pc]) AC_OUTPUT gnet-2.0.8/README.win320000644000175000017500000000476010751326732011235 00000000000000GNet README for Windows ----------------------- This document contains: - General Windows Specific Information - Compiling GNet on Windows General Windows Specific Information ---------------------------------- GNet 2.0 on Windows requires at least glib-2.2.3. See: http://www.gimp.org/~tml/gimp/win32/downloads.html For IPv6 support you need at least Windows XP SP1 or Windows 2003 (and both with the IPv6 stacks installed). GNet will automatically detect at runtime, not compile time, if IPv6 is supported and set the "IPv6 policy". Note that if IPv6 is installed, GNet will default to use IPv6. Since Windows is a dual stack operating system this may lead to your IPv4 only application to fail if the IPv6 stack is installed since the bind() default is IPv6. You should explicitly set the GNet "IPv6 policy with gnet_ipv6_set_policy(GIPV6_POLICY_IPV4_ONLY); after gnet_init(); if your application is IPv4 only. I used Windows 2000 SP4 and Windows XP SP1 to test GNet 2.0. I used Windows 98 and Windows NT 4 SP6a to test prior versions of GNet however these versions of Windows have reached end-of-life according to Microsoft. Theoretically all that is required is Windows 95 (with the Winsock2 patch) or better, or Windows NT (with Service Pack 4) or better. On Windows if you do not have IPv6 installed then gnet_inetaddr_list_interfaces() will return up to 10 interfaces. Reminder that on windows, text files have extra "\r" in them where as on UNIX they do not. This will throw off SHA & MD5 if you do not filter the extra characters out before calling those functions. Compiling GNet on Windows ------------------------- Microsoft Visual C++ .NET 2002, 2003 and Mingw/GCC should compile GNet 2.0 without any issues. The few warnings that appear can be ignored. Microsoft Visual C++ 6.0 users will have to upgrade to the latest Platform SDK. (Note that GNet is written in C, not C++.) A mingw/gcc makefile is provided. Microsoft Visual C++ users should look at and base their projects off this gcc makefile. A .dsp file may be in this distribution but it is likely out of date. You should compile GNet 2.0 on Windows with the -mno-cygwin, -mms-bitfields and -DGNET_EXPERIMENTAL=1 options for gcc and define GNET_EXPERIMENTAL when compiling with Microsoft Visual C++. Note that the Experimental code such as the Conn API has now stabilized on Windows. Also note that -mno-cygwin means do not link to the cygwin dll, link to MSVCRT when using cygwin tools. Linking to cygwin is not supported.gnet-2.0.8/gnet-2.0.m40000644000175000017500000001656110751326732011112 00000000000000# Configure paths for Gnet # A hacked up version of Owen Taylor's glib-2.0.m4 (Copyright 1997-2001) dnl AM_PATH_GNET_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for GNET, and define GNET_CFLAGS and GNET_LIBS, if gmodule, gobject or dnl gthread is specified in MODULES, pass to pkg-config dnl AC_DEFUN([AM_PATH_GNET_2_0], [dnl dnl Get the cflags and libraries from pkg-config dnl AC_ARG_ENABLE(gnettest, [ --disable-gnettest do not try to compile and run a test GNET program], , enable_gnettest=yes) pkg_config_args=gnet-2.0 AC_PATH_PROG(PKG_CONFIG, pkg-config, no) no_gnet="" if test x$PKG_CONFIG != xno ; then if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then : else echo *** pkg-config too old; version 0.7 or better required. no_gnet=yes PKG_CONFIG=no fi else no_gnet=yes fi min_gnet_version=ifelse([$1], , 2.0.0, $1) AC_MSG_CHECKING(for GNET - version >= $min_gnet_version) if test x$PKG_CONFIG != xno ; then ## don't try to run the test against uninstalled libtool libs if $PKG_CONFIG --uninstalled $pkg_config_args; then echo "Will use uninstalled version of GNet found in PKG_CONFIG_PATH" enable_gnettest=no fi if $PKG_CONFIG --atleast-version $min_gnet_version $pkg_config_args; then : else no_gnet=yes fi fi if test x"$no_gnet" = x ; then GNET_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` GNET_LIBS=`$PKG_CONFIG --libs $pkg_config_args` gnet_config_major_version=`$PKG_CONFIG --modversion gnet-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` gnet_config_minor_version=`$PKG_CONFIG --modversion gnet-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` gnet_config_micro_version=`$PKG_CONFIG --modversion gnet-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_gnettest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GNET_CFLAGS" LIBS="$GNET_LIBS $LIBS" dnl dnl Now check if the installed GNET is sufficiently new. (Also sanity dnl checks the results of pkg-config to some extent) dnl rm -f conf.gnettest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gnettest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gnet_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gnet_version"); exit(1); } if ((gnet_major_version != $gnet_config_major_version) || (gnet_minor_version != $gnet_config_minor_version) || (gnet_micro_version != $gnet_config_micro_version)) { printf("\n*** 'pkg-config --modversion gnet-2.0' returned %d.%d.%d, but GNET (%d.%d.%d)\n", $gnet_config_major_version, $gnet_config_minor_version, $gnet_config_micro_version, gnet_major_version, gnet_minor_version, gnet_micro_version); printf ("*** was found! If pkg-config was correct, then it is best\n"); printf ("*** to remove the old version of GNet. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); printf("*** to point to the correct configuration files\n"); } else if ((gnet_major_version != GNET_MAJOR_VERSION) || (gnet_minor_version != GNET_MINOR_VERSION) || (gnet_micro_version != GNET_MICRO_VERSION)) { printf("*** GNET header files (version %d.%d.%d) do not match\n", GNET_MAJOR_VERSION, GNET_MINOR_VERSION, GNET_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gnet_major_version, gnet_minor_version, gnet_micro_version); } else { if ((gnet_major_version > major) || ((gnet_major_version == major) && (gnet_minor_version > minor)) || ((gnet_major_version == major) && (gnet_minor_version == minor) && (gnet_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GNET (%d.%d.%d) was found.\n", gnet_major_version, gnet_minor_version, gnet_micro_version); printf("*** You need a version of GNET newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GNET is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GNET, but you can also set the PKG_CONFIG environment to point to the\n"); printf("*** correct copy of pkg-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_gnet=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gnet" = x ; then AC_MSG_RESULT(yes (version $gnet_config_major_version.$gnet_config_minor_version.$gnet_config_micro_version)) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$PKG_CONFIG" = "no" ; then echo "*** A new enough version of pkg-config was not found." echo "*** See http://www.freedesktop.org/software/pkgconfig/" else if test -f conf.gnettest ; then : else echo "*** Could not run GNET test program, checking why..." ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GNET_CFLAGS" LIBS="$LIBS $GNET_LIBS" AC_TRY_LINK([ #include #include ], [ return ((gnet_major_version) || (gnet_minor_version) || (gnet_micro_version)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GNET or finding the wrong" echo "*** version of GNET. If it is not finding GNET, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GNET is incorrectly installed."]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GNET_CFLAGS="" GNET_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GNET_CFLAGS) AC_SUBST(GNET_LIBS) rm -f conf.gnettest ]) gnet-2.0.8/gnet.def0000644000175000017500000001216510751326732011027 00000000000000EXPORTS ; DllMain@12 ; gnet_major_version gnet_minor_version gnet_micro_version gnet_interface_age gnet_binary_age ; gnet_init ; gnet_inetaddr_new; gnet_inetaddr_new_async; gnet_inetaddr_new_async_cancel; gnet_inetaddr_new_list; gnet_inetaddr_delete_list; gnet_inetaddr_new_list_async; gnet_inetaddr_new_list_async_cancel; gnet_inetaddr_new_nonblock; gnet_inetaddr_new_bytes; gnet_inetaddr_clone; gnet_inetaddr_delete; gnet_inetaddr_ref; gnet_inetaddr_unref; gnet_inetaddr_get_name; gnet_inetaddr_get_name_nonblock; gnet_inetaddr_get_name_async; gnet_inetaddr_get_name_async_cancel; gnet_inetaddr_get_length; gnet_inetaddr_get_bytes; gnet_inetaddr_set_bytes; gnet_inetaddr_get_canonical_name ; gnet_inetaddr_get_port; gnet_inetaddr_set_port; gnet_inetaddr_is_canonical; gnet_inetaddr_is_internet; gnet_inetaddr_is_private; gnet_inetaddr_is_reserved; gnet_inetaddr_is_loopback; gnet_inetaddr_is_multicast; gnet_inetaddr_is_broadcast; gnet_inetaddr_is_ipv4; gnet_inetaddr_is_ipv6; gnet_inetaddr_hash; gnet_inetaddr_equal; gnet_inetaddr_noport_equal; gnet_inetaddr_get_host_name; gnet_inetaddr_get_host_addr; gnet_inetaddr_autodetect_internet_interface; gnet_inetaddr_get_interface_to; gnet_inetaddr_get_internet_interface; gnet_inetaddr_is_internet_domainname; gnet_inetaddr_list_interfaces; ; gnet_conn_new; gnet_conn_new_inetaddr; gnet_conn_new_socket; gnet_conn_delete; gnet_conn_ref; gnet_conn_unref; gnet_conn_set_callback; gnet_conn_connect; gnet_conn_disconnect; gnet_conn_is_connected; gnet_conn_read; gnet_conn_readn; gnet_conn_readline; gnet_conn_write; gnet_conn_write_direct; gnet_conn_set_watch_error; gnet_conn_set_watch_readable; gnet_conn_set_watch_writable ; gnet_conn_timeout; ; gnet_io_channel_writen; gnet_io_channel_readn; gnet_io_channel_readline; gnet_io_channel_readline_strdup; ; gnet_base64_encode; gnet_base64_decode; ; gnet_ipv6_set_policy; gnet_ipv6_get_policy; ; gnet_mcast_socket_new; gnet_mcast_socket_new_with_port; gnet_mcast_socket_new_full; gnet_mcast_socket_delete; gnet_mcast_socket_ref; gnet_mcast_socket_unref; gnet_mcast_socket_get_io_channel; gnet_mcast_socket_get_local_inetaddr; gnet_mcast_socket_join_group; gnet_mcast_socket_leave_group; gnet_mcast_socket_get_ttl; gnet_mcast_socket_set_ttl; gnet_mcast_socket_send; gnet_mcast_socket_receive; gnet_mcast_socket_has_packet; gnet_mcast_socket_is_loopback; gnet_mcast_socket_set_loopback; ; gnet_md5_new; gnet_md5_new_string; gnet_md5_clone; gnet_md5_delete; gnet_md5_new_incremental; gnet_md5_update; gnet_md5_final; gnet_md5_equal; gnet_md5_hash; gnet_md5_get_digest; gnet_md5_get_string; gnet_md5_copy_string; ; gnet_pack; gnet_pack_strdup; gnet_vpack; gnet_calcsize; gnet_vcalcsize; gnet_unpack; gnet_vunpack; ; gnet_server_new; gnet_server_delete; gnet_server_ref; gnet_server_unref; ; gnet_sha_new; gnet_sha_new_string; gnet_sha_clone; gnet_sha_delete; gnet_sha_new_incremental; gnet_sha_update; gnet_sha_final; gnet_sha_equal; gnet_sha_hash; gnet_sha_get_digest; gnet_sha_get_string; gnet_sha_copy_string; ; gnet_socks_get_enabled; gnet_socks_set_enabled; gnet_socks_get_server; gnet_socks_set_server; gnet_socks_get_version; gnet_socks_set_version; ; gnet_tcp_socket_connect; gnet_tcp_socket_connect_async; gnet_tcp_socket_connect_async_cancel; gnet_tcp_socket_new; gnet_tcp_socket_new_async; gnet_tcp_socket_new_async_cancel; gnet_tcp_socket_delete; gnet_tcp_socket_ref; gnet_tcp_socket_unref; gnet_tcp_socket_get_io_channel; gnet_tcp_socket_get_remote_inetaddr; gnet_tcp_socket_get_local_inetaddr; gnet_tcp_socket_get_port; gnet_tcp_socket_set_tos; gnet_tcp_socket_server_new; gnet_tcp_socket_server_new_with_port; gnet_tcp_socket_server_new_full; gnet_tcp_socket_server_accept; gnet_tcp_socket_server_accept_nonblock; gnet_tcp_socket_server_accept_async; gnet_tcp_socket_server_accept_async_cancel; gnet_tcp_socket_new_direct; gnet_tcp_socket_new_async_direct; ; gnet_udp_socket_new; gnet_udp_socket_new_with_port; gnet_udp_socket_new_full; gnet_udp_socket_delete; gnet_udp_socket_ref; gnet_udp_socket_unref; gnet_udp_socket_send; gnet_udp_socket_receive; gnet_udp_socket_has_packet; gnet_udp_socket_get_io_channel; gnet_udp_socket_get_local_inetaddr; gnet_udp_socket_get_ttl; gnet_udp_socket_set_ttl; ; gnet_uri_new; gnet_uri_new_fields; gnet_uri_new_fields_all; gnet_uri_clone; gnet_uri_delete; gnet_uri_escape; gnet_uri_unescape; gnet_uri_get_string; gnet_uri_set_scheme; gnet_uri_set_userinfo; gnet_uri_set_hostname; gnet_uri_set_port; gnet_uri_set_path; gnet_uri_set_query; gnet_uri_set_fragment; gnet_uri_hash; gnet_uri_equal; ; gnet_conn_http_new; gnet_conn_http_set_uri; gnet_conn_http_set_header; gnet_conn_http_set_max_redirects; gnet_conn_http_set_timeout; gnet_conn_http_set_user_agent; gnet_conn_http_set_method; gnet_conn_http_run_async; gnet_conn_http_run; gnet_conn_http_steal_buffer; gnet_conn_http_cancel; gnet_conn_http_delete; gnet_http_get; gnet-2.0.8/NEWS0000644000175000017500000002165410751404033010103 00000000000000GNet NEWS --------- Changes in GNet 2.0.8 ----- * New API: gnet_conn_set_main_context gnet_conn_http_set_main_context gnet_inetaddr_new_async_full gnet_inetaddr_new_list_async_full gnet_inetaddr_get_name_async_full gnet_tcp_socket_connect_async_full gnet_tcp_socket_new_async_full gnet_tcp_socket_new_async_direct_full gnet_unix_socket_new_abstract gnet_unix_socket_server_new_abstract gnet_uri_parse_inplace * GConnHttp API is no longer marked as experimental * Fix major memory leak in GConnHttp * gnet_init() can now safely be called more than once now * Fix crash when gnet_conn_http_delete() is called from within the user callback. * GConnHttp: do not emit data events for pages that are being redirected to a new location. * GConnHttp: add gnet_conn_http_set_escaped_uri() (Samuel Cormier-Iijima) * Eliminate direct pthread usage on unix and use GLib GThreads instead (also fixes problems with gdb and valgrind) (Andreas Rottmann) * Dropped support for GLib-1.2 * Fix build on old systems that have a __ss_family member in struct sockaddr_storage instead of ss_family (Jeremy Denise) * GConnHttp: Documentation fixes * Fix compilation with --enable-debug on some 64-bit architectures like amd64 (Daniel Gryniewicz) * GConnHttp: fix several timeout issues (Steve Morris, Tim Muller). * GConnHttp: fix parsing of POST method response when there are optional headers after the 100-Continue response (#459895). * Relicense source code in examples/ directory from GPL to LGPL. * Add 'extern "C"' guards to pack.h to make things work with c++ compilers (thanks to Adriano Winter Bess). * New API: gnet_conn_write_direct() to write buffers asynchroneously without copying them (Jeff Garzik) * Fix for race condition and subsequent crash in asynchroneous DNS lookup (Steve Morris, Tim Müller) * Pass correct size parameters to bind() and connect() when creating unix sockets (Zeeshan Ali, #403197) * New API: gnet_unix_socket_new_abstract() and gnet_unix_socket_server_new_abstract() add support for abstract unix sockets on systems where this is supported (Zeeshan Ali, #404583) * Remove unused and pointless fork() fallback for asynchronous DNS lookups in cases where GLib has been compiled without threading support. It's 2007 - I think it's in order to require threading to be present; even my wrist watch can do that. Removs lots of unmaintained code and ugly #ifdefs. (Released Feb 3, 2008) 2.0.7 ----- * Ship API documentation pre-built as HTML * Build fixes for mingw on win32 (Gisle Vanem) (Released Feb 23, 2005) 2.0.6 ----- * New experimental HTTP Conn module (Tim Muller) * Misc bug fixes: - pthread detection - escaping of high Latin-1 characters - base64 encoding - doc fixes (gnet_base64_encode) - fix crash when doing dns lookup on ipv6-enabled win32 systems (only if gnet has been built using configure/autotools) (Released Feb 18, 2005) 2.0.5 ----- * Many Win32 fixes (thanks Andy Lanoix, Hans Petter Jansson, Tor Lillqvist, Tim Muller!) * Desciptor leak fixed in TCP sockets (thanks Hans!) * GConn 100% CPU bug fix (thanks Andreas Rottmann!) * Bug fix for URIs with high Latin-1 characters (thanks Emmanuel Saracco!) * IPv6 fix for inetaddr_get_canonical_name() * New echoserver-partyline example (thanks Andy!) * Miscellaneous clean-ups (thanks Michael Alger, Tim Muller, Stephane Loeuillet!) (Released March 1, 2004) 2.0.4 ----- * Minor memory leak fixed in internet addresses * Win32 fixes * Compile and regression test fixes for 64-bit systems * Compile fix for Solaris (Released July 28, 2003) 2.0.3 ----- * Minor bug fix in TCP connect * Win32 compile/bug fixes (note: additional work still needed) 2.0.2 ----- * RPM fixes (thanks Bas Mevissen!) * Compile fixes for Sun compiler (thanks Ives Aerts!) 2.0.1 ----- * Compile fixes for Solaris and systems with no IPv6 support (Released April 21, 2003) 2.0.0 ----- * Stable release of 1.3 series (Released April 13, 2003) 1.3.2 ("Sacrilicious" DEVELOPERS release) ----- * DNS bug fixes * FreeBSD compile fixes and UDP send bug fix * New functions: gnet_{udp,mcast}_socket_get_local_inetaddr * Build improvements: library is now named libglib-MAJOR.MINOR, favors GLib 2 over GLib 1.2 1.3.1 ("Tomacco 2" DEVELOPERS release) ----- * New Base64 module (by Alfred Reibenschuh) * Major documentation improvements * Some minor API renaming in Inetaddr and TcpSocket 1.3.0 ("Tomacco" DEVELOPERS release) ----- * IPv6 support * Server, Conn, URI, and Unix modules are no longer "experimental" * Header files are now in gnet-1.3 * gnet-config removed. Use pkg-config. * Many API changes * gnet_server_new() changed, but the prototype is the same. Make sure you are using the new version correctly. 1.1.9 (UNRELEASED) ----- * RPM compile fix * Minor leak fixed in the server module 1.1.8 ("Square meal 3" release) ----- * Compile fixes 1.1.7 ("Square meal 2" release) ----- * Fixed major bug in IO channel code from 1.1.6 1.1.6 ("Square meal" release) ----- * IOChannels are non-buffering, non-encoded by default (for GLib 2.0) * examples are now build by default * gnet_inetaddr_list_interfaces() bug fix * FreeBSD compile fix (affected gnet_inetaddr_list_interfaces()) 1.1.5 ("Bonemeal" release) ----- * New gnet_init() function. This should be called in main(). [1] * GNet now properly links to libgthread (if necessary) * More automated test cases * Several compile fixes and small bug fixes 1.1.4 ("Inchmeal" release) ----- * Several bugs fixed in the asynchronous DNS module * Objective C compile fixes 1.1.3 ("Fishmeal" release) ----- * Several small bugs and memory leaks fixed * HP compile fix 1.1.2 ("Cornmeal 2" release) ----- * gnet_inetaddr_get_name_async has pthread implementation * Asynchronous DNS bug fixes 1.1.1 ("Cornmeal" release) ----- * Experimental Unix sockets support * Experimental SOCKS support * URLs support username, password, query, and fragment * New gnet_tcp_socket_server_accept_async function * gnet_inetaddr_new_async has pthread implementation, no longer succeeds immediately * New gnet_{sha,md5}_clone functions * MacOSX port * read_async and write_async performance fixes * Various small compile and configuration fixes * Updated best-current-practice examples 1.1.0 ("Oatmeal" release) ----- * UDP supports broadcast * TCP/UDP supports multiple interfaces * Various new internet address helper functions (e.g. autodetect_internet_interface, list_interfaces) * New SHA and MD5 hash modules * New Perl/Python-style pack/unpack module * New experimental URL, "Server", and "Conn" modules * Full Windows port * Bug fixes in gnet_io_channel_readn, gnet_io_channel_readline_strdup, thread-safe DNS lookup 1.0.4 ----- * Small bug fixes * Partial Windows port 1.0.3 ----- * Fixed bug in gnet_inetaddr_new_async 1.0.2 ----- * Fixed bugs in Inetaddr async functions * Fixed memory leaks in inetaddr and tcp async functions * Portability fixes for OpenBSD and FreeBSD 4.0 1.0.1 ----- * Fixed bug in readline_strdup 1.0.0 ----- * Some renaming * Upgrade to libtool 1.3.4 * First stable release 0.1.9 ----- * async functions now cancelable * Added *_ref and *_unref functions * Added gnet_iochannel_readline_strdup * "nonblock" functions renamed to "async" * Jacques Fortier added to AUTHORS for gnet_iochannel_readline_strdup * Not binary compatable with 0.1.8 0.1.8 ----- * HP-UX and other portability fixes. * Fixed bug in gnet_inetaddr_new_nonblock where dotted decimal address caused a seg fault. * Fixed bug in Solaris version of gnet_inetaddr_get_name. * Deleting a NULL object is now allowed. * IOChannel semantics have changed - see documentation. 0.1.7 ----- * Fixed bugs in gnet_iochannel_{readn, writen, readline}. * Fixed bug in gnet_tcp_socket_server_accept (took up all CPU time in loop) * Fixed bug in echoserver (blocking) and hfetch example. We now close and unref the iochannel. * Portability fix - use g_snprintf, not snprintf * Binary compatable with 0.1.4 0.1.6 ----- * Fixed header files for C++ * Fixed header files for multiple inclusion * Binary compatable with 0.1.4 0.1.5 ----- * Library now reentrant (including calls to gethostbyname) * Portability fixes * Now build RPMS and DEBS * Xavier Nicolovici added to AUTHORS * Binary compatable with 0.1.4 0.1.4 ----- * Portability fixes * Fixed potential bugs in gnet_udp_socket_get_mcast_ttl and gnet_mcast_socket_is_loopback * Removed gnet_udp_socket_get_MTU until we can fix it and port it to Solaris. (It's commented out in gnet-private for now) 0.1.3 ----- * Added gnet_tcp_socket_connect and gnet_tcp_socket_connect_nonblock * Added gnet_inetaddr_get_name_nonblock * Added gnet_udp_socket_get_iochannel * Added ljoust (Network Llama Joust) example * Improved and cleaned-up inetaddr_new_nonblock 0.1.2 ----- * Functions now prefixed with "gnet_" * Some interfaces now hidden in gnet-private.[ch] * Added gnet.m4 and gnet-config files 0.1.1 ----- * Added inetaddr_new_nonblock, an asynchronous DNS lookup function. 0.1.0 ----- * Initial release gnet-2.0.8/config.h.win320000644000175000017500000000011210751326732011756 00000000000000#ifndef _GNET_CONFIG_H #define _GNET_CONFIG_H #define GNET_WIN32 #endif gnet-2.0.8/HACKING0000644000175000017500000001274310751326732010403 00000000000000 GNet HACKING ------------ Information for potential GNet hackers What to do (in general) ----------------------- We will always accept bug and portability fixes. If you are interested in doing something more major, please write gnet-dev@gnetlibrary.net first. This is so we know what people are doing and can offer advice. Also see the TODO file for ideas on the direction we want to take GNet. We _strongly_ recommend, if you are contributing a feature, that you fully implement and test the feature in your own program before submitting a patch. This ensures that the feature is tested the interface is reasonably mature. Mailing list ------------ gnet-dev@gnetlibrary.org is the development mailing list. See the README for information on how to subscribe. How to check out GNet anonymously --------------------------------- > cd > setenv CVSROOT :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome > cvs login [there is no password, hit return if it asks] > cvs -z3 checkout gnet Be warned that the repository version of GNet may be instable or may not even compile. Building GNet from CVS ---------------------- AUTOCONF 1.6 IS RECOMMENDED. It's the future, whether we like it or not. Run autogen.sh in the gnet directory to build GNet. This script requires aclocal, autoheader, libtoolize, automake, and autoconf. If aclocal isn't finding certain macros, use the environment variable ACLOCAL_FLAGS to included the needed directory. For example, if it's not picking up macros in /usr/local/share/aclocal, set ACLOCAL_FLAGS to "-I /usr/local/share/aclocal". Multiple include directories can be used. MIGRATING TO AUTOCONF 1.6 HINT. Create a macros directory and put the old glib.m4, libtool.m4, and pkg.m4 in it (from where ever those were before). How to make code contributions ------------------------------ We only accept code contributions in the form of a unified diff against the latest released version and, preferably, the version in CVS. If you have added to the API, you _must_ provide complete gtkdoc style comments in the source. When appropriate, you should also submit a test/example program. To make a unified diff, please follow these instructions: 1. Remove temporary files: make distclean 2. Rename your source tree: cd .. mv gnet-0.1.4 gnet-0.1.4-snazzy-feature 3. Unpack the original gnet library source alongside it: tar zxf /tmp/gnet-0.1.4.tar.gz 4. Generate the diffs: diff -urNb gnet-0.1.4 gnet-0.1.4-snazzy-feature > /tmp/gnet.patch 5. Check the patch and remove any unnecessary patches from the file. 6. If you've added several features, it's best to send them as several independent patches if you can. 7. Don't forget to add your name and email address to AUTHORS so that you assert copyright over GNet and help to keep GNet free! If you have just patched one or two files, then making patches is even easier. For each file, just do: cp file.c file.c.orig [Make changes to file.c ...] diff -u file.c.orig file.c > /tmp/file.c.patch and just send us the patch: /tmp/file.c.patch. Testing GNet ------------ Before submitting a patch, run the regression tests and make sure they pass. It's easy: > cd tests > make check [tests will compile and you will see something like this:] PASS: hash PASS: pack PASS: unpack PASS: inetaddr_test PASS: uri_test PASS: ipv6_test ================== All 6 tests passed ================== The above tests do not use the network. There are some tests that do use the network. To enable them, either run autogen.sh or pass --enable-network-tests=yes to configure. Please write automated tests for new modules when appropriate. Place the test in the tests directory and add it to the Makefile.am. Test programs should exit(0) if successful and exit(1) otherwise. Tests that use the network should Fork vs. Pthread in asynchronous DNS lookup ------------------------------------------- Running a simple benchmark on a Dual Pentium II running Linux 2.4.4, shows that pthreads outperforms forking slightly. The benchmark performs an asynchronous lookup of www.microsoft.com asynchronously 100 times in sequence. Results below. time ./dnstest www.microsoft.com async 100 > /dev/null Pthread 4.850u 0.490s 0:05.07 105.3% 0+0k 0+0io 1179pf+0w 4.840u 0.540s 0:05.08 105.9% 0+0k 0+0io 1179pf+0w 4.820u 0.420s 0:05.04 103.9% 0+0k 0+0io 1179pf+0w Fork 5.090u 0.810s 0:03.52 167.6% 0+0k 0+0io 6013pf+0w 4.750u 0.840s 0:03.24 172.5% 0+0k 0+0io 5492pf+0w 4.690u 0.890s 0:03.38 165.0% 0+0k 0+0io 5492pf+0w Pthread 4.810u 0.680s 0:05.30 103.5% 0+0k 0+0io 1700pf+0w 4.830u 0.550s 0:05.07 106.1% 0+0k 0+0io 1179pf+0w 4.880u 0.400s 0:05.03 104.9% 0+0k 0+0io 1179pf+0w Fork 5.050u 0.890s 0:03.50 169.7% 0+0k 0+0io 6013pf+0w 4.850u 0.910s 0:03.24 177.7% 0+0k 0+0io 5492pf+0w 5.160u 0.680s 0:03.30 176.9% 0+0k 0+0io 5492pf+0w In a different benchmark, where './dnstest www.microsoft.com async 1' is run 100 times, fork outperforms pthreads. I would hypothesize that the pthread library has an expensive initialization step. time ./dnsbench > /dev/null Fork 6.810u 6.080s 0:17.05 75.6% 0+0k 0+0io 113543pf+0w 6.120u 6.740s 0:17.11 75.1% 0+0k 0+0io 113543pf+0w 6.530u 6.490s 0:17.08 76.2% 0+0k 0+0io 113543pf+0w 6.180u 6.440s 0:17.09 73.8% 0+0k 0+0io 113543pf+0w Pthread 11.510u 6.920s 0:17.32 106.4% 0+0k 0+0io 118564pf+0w 11.370u 6.500s 0:17.10 104.5% 0+0k 0+0io 118043pf+0w 10.850u 7.290s 0:16.95 107.0% 0+0k 0+0io 118043pf+0w 10.810u 7.010s 0:17.08 104.3% 0+0k 0+0io 118043pf+0w gnet-2.0.8/tests/0000777000175000017500000000000010751404362010627 500000000000000gnet-2.0.8/tests/client_server_test.pl0000755000175000017500000001613010751326731015012 00000000000000#!/usr/bin/perl -w # client_server_test.pl: Runs echoclient/echoserver pairs. # # Also can do: client_server_test.pl # to run a specific test. my $bin_dir = '../examples'; my $port = 8174; my $unix_socket = '/tmp/gnet-unix-socket-test'; my $debug = 0; my $testfile = 'testfile'; my $pause = 3; my @pids = (); my $failed = 0; $| = 1; $SIG{'INT'} = 'on_sigint'; system ("rm -f .client* .server* core*"); if ($#ARGV == 2) { test ($ARGV[0], $ARGV[1], $ARGV[2]); exit $failed; } elsif ($#ARGV != -1) { usage(); } test ("echoserver", "echoclient", 1); test ("echoserver", "echoclient", 2); test ("echoserver", "echoclient", 16); test ("echoserver", "echoclient", 32); test ("echoserver", "echoclient-async", 1); test ("echoserver", "echoclient-async", 2); test ("echoserver", "echoclient-async", 16); test ("echoserver", "echoclient-async", 32); test ("echoserver", "echoclient-gconn", 1); test ("echoserver", "echoclient-gconn", 2); test ("echoserver", "echoclient-gconn", 16); test ("echoserver", "echoclient-gconn", 32); test ("echoserver-async", "echoclient", 1); test ("echoserver-async", "echoclient", 2); test ("echoserver-async", "echoclient", 16); test ("echoserver-async", "echoclient", 32); test ("echoserver-async", "echoclient-async", 1); test ("echoserver-async", "echoclient-async", 2); test ("echoserver-async", "echoclient-async", 16); test ("echoserver-async", "echoclient-async", 32); test ("echoserver-async", "echoclient-gconn", 1); test ("echoserver-async", "echoclient-gconn", 2); test ("echoserver-async", "echoclient-gconn", 16); test ("echoserver-async", "echoclient-gconn", 32); test ("echoserver-gserver", "echoclient", 1); test ("echoserver-gserver", "echoclient", 2); test ("echoserver-gserver", "echoclient", 16); test ("echoserver-gserver", "echoclient", 32); test ("echoserver-gserver", "echoclient-async", 1); test ("echoserver-gserver", "echoclient-async", 2); test ("echoserver-gserver", "echoclient-async", 16); test ("echoserver-gserver", "echoclient-async", 32); test ("echoserver-gserver", "echoclient-gconn", 1); test ("echoserver-gserver", "echoclient-gconn", 2); test ("echoserver-gserver", "echoclient-gconn", 16); test ("echoserver-gserver", "echoclient-gconn", 32); test ("echoserver-udp", "echoclient-udp", 1); test ("echoserver-udp", "echoclient-udp", 2); test ("echoserver-udp", "echoclient-udp", 16); test ("echoserver-udp", "echoclient-udp", 32); # now the tests that take a unix socket path argument $port = 0; test ("echoserver-unix", "echoclient-unix", 1); test ("echoserver-unix", "echoclient-unix", 2); test ("echoserver-unix", "echoclient-unix", 16); test ("echoserver-unix", "echoclient-unix", 32); # should fallback to normal unix sockets on systems that don't have # abstract unix sockets test ("echoserver-unix", "echoclient-unix", 1, '--abstract'); test ("echoserver-unix", "echoclient-unix", 2, '--abstract'); test ("echoserver-unix", "echoclient-unix", 16, '--abstract'); test ("echoserver-unix", "echoclient-unix", 32, '--abstract'); # the async echoserver/client isn't finished yet, so doesn't work #test ("echoserver-unix", "echoclient-unix", 1, '--async'); #test ("echoserver-unix", "echoclient-unix", 2, '--async'); #test ("echoserver-unix", "echoclient-unix", 16, '--async'); #test ("echoserver-unix", "echoclient-unix", 32, '--async'); exit $failed; ######################################## sub usage { print STDERR ("Usage: $0\n"); print STDERR (" - Runs all tests\n"); print STDERR (" $0 \n"); print STDERR (" - Runs a specific test\n"); exit 1; } sub test { my $server = $_[0]; my $client = $_[1]; my $num_clients = $_[2]; my $extra_args = $_[3]; my $tempfile = "$server.$client.$num_clients"; my $fail = 0; printf "%-40s ", "$server $client $num_clients"; system ("rm -f core*"); sleep($pause); # Launch server server ($server, $tempfile, $extra_args); sleep (2); # Launch client(s) my $i; for ($i = 0; $i < $num_clients; $i++) { client ($client, $i, $tempfile, $extra_args); } # Wait for all but one (the server) to finish my $fail_reason = ""; while ($#pids > 0 && (my $kid = wait) != -1) { if ($?) { $fail = 1; my $rv = $? >> 8; if ($rv == 2) { $fail_reason = $fail_reason . " (server failed)"; } elsif ($rv == 3) { $fail_reason = $fail_reason . " (client failed)"; } elsif ($rv == 4) { $fail_reason = $fail_reason . " (bad client output)"; } elsif ($rv == 5) { $fail_reason = $fail_reason . " (client timeout)"; } } print STDERR "KID $kid DONE (status $?)\n" if $debug; if (-f 'core') { print STDERR "KID $kid dumped core\n" if $debug; system ("rm -f core"); $fail = 1; } for ($i = 0; $i <= $#pids; $i++) { if ($pids[$i] == $kid) { splice (@pids, $i, 1); last; } } } kill_processes(); if ($fail) { print "FAIL$fail_reason\n"; $failed = 1; } else { print "PASS\n"; } return $fail; } #################### sub server { my $server = $_[0]; my $tempfile = ".server." . $_[1] . ".out"; my $extra_args = $_[2]; my $pid; print STDERR "start $tempfile server\n" if $debug; if ($pid = fork) # Parent { print STDERR "server pid $pid\n" if $debug; push (@pids, $pid); } elsif (defined $pid) # Child { if (!defined ($extra_args)) { $extra_args = ''; } setpgrp (0, $$); if ($port == 0) { system ("$bin_dir/$server $extra_args $unix_socket > $tempfile 2>&1"); } else { system ("$bin_dir/$server $extra_args $port > $tempfile 2>&1"); } exit 2; # This shouldn't happen } else # Error { die ("Fork error: $!\n"); } } sub client { my $client = $_[0]; my $num = $_[1]; my $tempfile = ".client.$num." . $_[2] . ".out"; my $difffile = ".client.$num." . $_[2] . ".diff"; my $extra_args = $_[3]; my $pid; print STDERR "start $tempfile client $num\n" if $debug; if ($pid = fork) # Parent { print STDERR "client pid $pid\n" if $debug; push (@pids, $pid); } elsif (defined $pid) # Child { $SIG{'ALRM'} = sub { exit 5; }; if (!defined ($extra_args)) { $extra_args = ''; } setpgrp (0, $$); alarm 15; if ($port == 0) { system ("$bin_dir/$client $extra_args $unix_socket < $testfile > $tempfile 2>&1"); } else { system ("$bin_dir/$client $extra_args localhost $port < $testfile > $tempfile 2>&1"); } exit 3 if $? != 0; alarm 0; system ("diff -a $tempfile $testfile > $difffile 2>&1"); exit 4 if $? != 0; exit 0; } else # Error { die ("Fork error: $!\n"); } } sub on_sigint { print STDERR "on_sigint()\n" if $debug; kill_processes (); exit 0; } sub kill_processes { print STDERR "kill_processes()\n" if $debug; # Kill all children foreach $pid (@pids) { kill (-9, $pid); waitpid ($pid, 0); } @pids = (); } gnet-2.0.8/tests/dns_test.pl0000755000175000017500000001271010751326731012732 00000000000000#!/usr/bin/perl -w use Socket; use Net::DNS; my $failed = 0; my $verbose = 0; my $bin_dir = "../examples/"; my $dnslookup = $bin_dir . "dnslookup"; sub main() { test_args(""); # Blocking, list test_args("-a"); # Asynchronous, list test_args("-s"); # Blocking, single test_args("-a -s"); # Asynchronous, single test_args("-n 25"); # Blocking, list, x25 test_args("-n 25 -a"); # Asynchronous, list, x25 test_args("-n 25 -s"); # Blocking, single, x25 test_args("-n 25 -a -s"); # Blocking, list, x25 rtest_args("-r"); # Blocking, reverse rtest_args("-r -a"); # Asynchronous, reverse rtest_args("-r -n 25"); # Blocking, reverse, x25 rtest_args("-r -a -n 25"); # Asynchronous, reverse, x25 exit 1 if ($failed); exit 0; } sub test_args { my ($args) = @_; test("141.213.11.124", "A", $args); test("141.213.11.124", "AAAA", $args); test("DEAD::BEEF", "A", $args); test("DEAD::BEEF", "AAAA", $args); test("www.gnetlibrary.org", "A", $args); test("www.yahoo.com", "A", $args); test("www.kame.net", "A", $args); test("www.gnetlibrary.org", "AAAA", $args); test("www.kame.net", "AAAA", $args); } sub rtest_args { my ($args) = @_; test("141.213.11.124", "PTR", $args); test("64.58.76.223", "PTR", $args); test("3FFE:501:4819:2000:210:F3FF:FE03:4D0", "PTR", $args); } sub test { my ($hostname, $type, $args) = @_; my $name = $hostname . " " . $type . " (" . $args . ")"; my $gnet_res = gnet_dns_lookup($hostname, $type, $args); my $good_res = good_dns_lookup($hostname, $type); if ($args !~ /-r/) { check ($name, $good_res, $gnet_res, $args); } else { rcheck ($name, $good_res, $gnet_res, $args); } } sub check { my ($name, $good_res, $gnet_res, $args) = @_; printf("%-50s", $name . ":"); if (defined($good_res) && defined($gnet_res)) { @sgood_res = sort(@$good_res); @sgnet_res = sort(@$gnet_res); my $pass = 0; if ($args =~ /-s/) { my $gnet_res = pop(@$gnet_res); foreach my $goodr (@sgood_res) { $pass = 1 if $goodr = $gnet_res; } } elsif (@sgood_res == @sgnet_res) { $pass = 1; } if ($pass) { print "PASS\n"; if ($verbose) { print " Good:\n ", join("\n ", @sgood_res), "\n"; print " GNet:\n ", join("\n ", @sgnet_res), "\n"; } } else { print "FAIL (result mismatch)\n"; print " Good:\n ", join("\n ", @sgood_res), "\n"; print " GNet:\n ", join("\n ", @sgnet_res), "\n"; $failed = 1; } } elsif (!defined($good_res) && !defined($gnet_res)) { print "PASS (both lookups failed)\n"; } elsif (defined($good_res) && !defined($gnet_res)) { print "FAIL (GNet lookup failed)\n"; print " Good:\n ", join("\n ", @$good_res), "\n"; } elsif (!defined($good_res) && defined($gnet_res)) { print "FAIL? (good lookup failed)\n"; print " GNet:\n ", join("\n ", @$gnet_res), "\n"; } } sub rcheck { my ($name, $good_res, $gnet_res, $args) = @_; printf("%-50s", $name . ":"); if (defined($good_res) && defined($gnet_res)) { if ($good_res eq $gnet_res) { print "PASS\n"; if ($verbose) { print " Good: $good_res\n"; print " GNet: $gnet_res\n"; } } else { print "FAIL (result mismatch)\n"; print " Good: $good_res\n"; print " GNet: $gnet_res\n"; $failed = 1; } } elsif (!defined($good_res) && !defined($gnet_res)) { print "PASS (both lookups failed)\n"; } elsif (defined($good_res) && !defined($gnet_res)) { print "FAIL (GNet lookup failed)\n"; print " Good: $good_res\n"; } elsif (!defined($good_res) && defined($gnet_res)) { print "PASS? (good lookup failed)\n"; print " GNet: $gnet_res\n" if $verbose; } } sub good_dns_lookup { my $hostname = shift; my $type = shift; my @res = (); if ($type eq "PTR") { my $res = Net::DNS::Resolver->new; my $query = $res->search($hostname, "PTR"); if ($query) { foreach my $rr ($query->answer) { next unless $rr->type eq "PTR"; return $rr->ptrdname; } } return undef; } # GNet will resolve 141.213.11.124 in IPv6 mode. So will we. if ($hostname =~ /\d+\.\d+.\d+.\d+/) { push (@res, $hostname); return \@res; } elsif ($hostname =~ /:/) { push (@res, $hostname); return \@res; } my $resolver = Net::DNS::Resolver->new; my $query = $resolver->search($hostname, $type); if ($query) { foreach my $rr ($query->answer) { next unless $rr->type eq $type; push(@res, $rr->address); } return undef if ($#res == -1); return \@res; } return undef; } sub gnet_dns_lookup { my ($hostname, $type, $args) = @_; my @res = (); $args = "" if !defined($args); # Set type if ($type eq 'A') { $ENV{'GNET_IPV6_POLICY'} = "4"; } elsif ($type eq 'AAAA') { $ENV{'GNET_IPV6_POLICY'} = "6"; } # Set num (for using -n option) $num = 0; $num = 23 if ($args =~ /-n/); my @lines = `$dnslookup $args $hostname`; return undef if $?; foreach my $line (@lines) { if ($line =~ /^$num: \S+ -> (\S+)/) { push(@res, $1); } elsif ($line =~ /DNS lookup failed/) { return undef; } } return $res[0] if ($type eq "PTR" && $#res > -1); return \@res; } main(); gnet-2.0.8/tests/Makefile.in0000644000175000017500000004704510751327171012624 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ check_PROGRAMS = subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/gnet-arch.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHECK_CFLAGS = @CHECK_CFLAGS@ CHECK_LIBS = @CHECK_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_GTK_DOC_FALSE = @ENABLE_GTK_DOC_FALSE@ ENABLE_GTK_DOC_TRUE = @ENABLE_GTK_DOC_TRUE@ ENABLE_NETWORK_TESTS_FALSE = @ENABLE_NETWORK_TESTS_FALSE@ ENABLE_NETWORK_TESTS_TRUE = @ENABLE_NETWORK_TESTS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GNET_BINARY_AGE = @GNET_BINARY_AGE@ GNET_DEBUG_FLAGS = @GNET_DEBUG_FLAGS@ GNET_GCOV_ENABLED_FALSE = @GNET_GCOV_ENABLED_FALSE@ GNET_GCOV_ENABLED_TRUE = @GNET_GCOV_ENABLED_TRUE@ GNET_INTERFACE_AGE = @GNET_INTERFACE_AGE@ GNET_MAJOR_VERSION = @GNET_MAJOR_VERSION@ GNET_MICRO_VERSION = @GNET_MICRO_VERSION@ GNET_MINOR_VERSION = @GNET_MINOR_VERSION@ GNET_VERSION = @GNET_VERSION@ GREP = @GREP@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ HAVE_CPU_ALPHA_FALSE = @HAVE_CPU_ALPHA_FALSE@ HAVE_CPU_ALPHA_TRUE = @HAVE_CPU_ALPHA_TRUE@ HAVE_CPU_ARM_FALSE = @HAVE_CPU_ARM_FALSE@ HAVE_CPU_ARM_TRUE = @HAVE_CPU_ARM_TRUE@ HAVE_CPU_CRISV32_FALSE = @HAVE_CPU_CRISV32_FALSE@ HAVE_CPU_CRISV32_TRUE = @HAVE_CPU_CRISV32_TRUE@ HAVE_CPU_CRIS_FALSE = @HAVE_CPU_CRIS_FALSE@ HAVE_CPU_CRIS_TRUE = @HAVE_CPU_CRIS_TRUE@ HAVE_CPU_HPPA_FALSE = @HAVE_CPU_HPPA_FALSE@ HAVE_CPU_HPPA_TRUE = @HAVE_CPU_HPPA_TRUE@ HAVE_CPU_I386_FALSE = @HAVE_CPU_I386_FALSE@ HAVE_CPU_I386_TRUE = @HAVE_CPU_I386_TRUE@ HAVE_CPU_IA64_FALSE = @HAVE_CPU_IA64_FALSE@ HAVE_CPU_IA64_TRUE = @HAVE_CPU_IA64_TRUE@ HAVE_CPU_M68K_FALSE = @HAVE_CPU_M68K_FALSE@ HAVE_CPU_M68K_TRUE = @HAVE_CPU_M68K_TRUE@ HAVE_CPU_MIPS_FALSE = @HAVE_CPU_MIPS_FALSE@ HAVE_CPU_MIPS_TRUE = @HAVE_CPU_MIPS_TRUE@ HAVE_CPU_PPC64_FALSE = @HAVE_CPU_PPC64_FALSE@ HAVE_CPU_PPC64_TRUE = @HAVE_CPU_PPC64_TRUE@ HAVE_CPU_PPC_FALSE = @HAVE_CPU_PPC_FALSE@ HAVE_CPU_PPC_TRUE = @HAVE_CPU_PPC_TRUE@ HAVE_CPU_S390_FALSE = @HAVE_CPU_S390_FALSE@ HAVE_CPU_S390_TRUE = @HAVE_CPU_S390_TRUE@ HAVE_CPU_SPARC_FALSE = @HAVE_CPU_SPARC_FALSE@ HAVE_CPU_SPARC_TRUE = @HAVE_CPU_SPARC_TRUE@ HAVE_CPU_X86_64_FALSE = @HAVE_CPU_X86_64_FALSE@ HAVE_CPU_X86_64_TRUE = @HAVE_CPU_X86_64_TRUE@ HAVE_VALGRIND_FALSE = @HAVE_VALGRIND_FALSE@ HAVE_VALGRIND_TRUE = @HAVE_VALGRIND_TRUE@ HTML_DIR = @HTML_DIR@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_WIN32_FALSE = @OS_WIN32_FALSE@ OS_WIN32_TRUE = @OS_WIN32_TRUE@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ VALGRIND_LIBS = @VALGRIND_LIBS@ VALGRIND_PATH = @VALGRIND_PATH@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ @ENABLE_NETWORK_TESTS_FALSE@NETWORK_TESTS = @ENABLE_NETWORK_TESTS_TRUE@NETWORK_TESTS = client_server_test.pl dns_test.pl TESTS = $(NETWORK_TESTS) check_SCRIPTS = $(NETWORK_TESTS) EXTRA_SCRIPTS = client_server_test.pl dns_test.pl CLEANFILES = $(check_PROGRAMS) .client*out .server*out .client*diff .server*diff INCLUDES = -I$(top_srcdir)/src $(GLIB_CFLAGS) LDADD = $(GLIB_LIBS) $(GTHREAD_LIBS) $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la @HAVE_CHECK_FALSE@SUBDIRS_CHECK = @HAVE_CHECK_TRUE@SUBDIRS_CHECK = check SUBDIRS = $(SUBDIRS_CHECK) DIST_SUBDIRS = check all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list='$(TESTS)'; \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ echo "XPASS: $$tst"; \ ;; \ *) \ echo "PASS: $$tst"; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xfail=`expr $$xfail + 1`; \ echo "XFAIL: $$tst"; \ ;; \ *) \ failed=`expr $$failed + 1`; \ echo "FAIL: $$tst"; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ echo "SKIP: $$tst"; \ fi; \ done; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="All $$all tests passed"; \ else \ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all tests failed"; \ else \ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ skipped="($$skip tests were not run)"; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-TESTS \ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ clean-recursive ctags ctags-recursive distclean \ distclean-generic distclean-libtool distclean-recursive \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am uninstall-info-am @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gnet-2.0.8/tests/Makefile.am0000644000175000017500000000122110751326731012576 00000000000000## Process this file with automake to produce Makefile.in @SET_MAKE@ if ENABLE_NETWORK_TESTS NETWORK_TESTS = client_server_test.pl dns_test.pl else NETWORK_TESTS = endif TESTS = $(NETWORK_TESTS) check_PROGRAMS = check_SCRIPTS= $(NETWORK_TESTS) EXTRA_SCRIPTS = client_server_test.pl dns_test.pl CLEANFILES = $(check_PROGRAMS) .client*out .server*out .client*diff .server*diff INCLUDES = -I$(top_srcdir)/src $(GLIB_CFLAGS) LDADD = $(GLIB_LIBS) $(GTHREAD_LIBS) $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la if HAVE_CHECK SUBDIRS_CHECK = check else SUBDIRS_CHECK = endif SUBDIRS = $(SUBDIRS_CHECK) DIST_SUBDIRS = check gnet-2.0.8/tests/check/0000777000175000017500000000000010751404362011704 500000000000000gnet-2.0.8/tests/check/gnetcheck.h0000644000175000017500000002447410751326731013742 00000000000000/* Common code for GNet unittests (based on GStreamer's libgstcheck) * * Copyright (C) 2004 Thomas Vander Stichele * Copyright (C) 2007 Tim-Philipp Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef __GNET_CHECK_H__ #define __GNET_CHECK_H__ #include #include #include #include #include #include G_BEGIN_DECLS /* GNET_DEBUG_CATEGORY_EXTERN (check_debug); #define GST_CAT_DEFAULT check_debug */ /* logging function for tests * a test uses g_message() to log a debug line * a gst unit test can be run with GNET_TEST_DEBUG env var set to see the * messages */ extern gboolean _gnet_check_threads_running; extern gboolean _gnet_check_raised_critical; extern gboolean _gnet_check_raised_warning; extern gboolean _gnet_check_expecting_log; /* global variables used in test methods */ GMutex *check_mutex; GCond *check_cond; gint gnet_check_run_suite (Suite *suite, const gchar *name, const gchar *fname); /*** * wrappers for START_TEST and END_TEST */ #define GNET_START_TEST(__testname) \ static void __testname (int __i__)\ {\ /* GNET_DEBUG ("test start"); */ \ tcase_fn_start (""# __testname, __FILE__, __LINE__); #define GNET_END_TEST END_TEST /* additional fail macros */ /** * fail_unless_equals_int: * @a: a #gint value or expression * @b: a #gint value or expression * * This macro checks that @a and @b are equal and aborts if this is not the * case, printing both expressions and the values they evaluated to. This * macro is for use in unit tests. */ #define fail_unless_equals_int(a, b) \ G_STMT_START { \ int first = a; \ int second = b; \ fail_unless(first == second, \ "'" #a "' (%d) is not equal to '" #b"' (%d)", first, second); \ } G_STMT_END; /** * assert_equals_int: * @a: a #gint value or expression * @b: a #gint value or expression * * This macro checks that @a and @b are equal and aborts if this is not the * case, printing both expressions and the values they evaluated to. This * macro is for use in unit tests. */ #define assert_equals_int(a, b) fail_unless_equals_int(a, b) /** * fail_unless_equals_uint64: * @a: a #guint64 value or expression * @b: a #guint64 value or expression * * This macro checks that @a and @b are equal and aborts if this is not the * case, printing both expressions and the values they evaluated to. This * macro is for use in unit tests. */ #define fail_unless_equals_uint64(a, b) \ G_STMT_START { \ guint64 first = a; \ guint64 second = b; \ fail_unless(first == second, \ "'" #a "' (%" G_GUINT64_FORMAT ") is not equal to '" #b"' (%" \ G_GUINT64_FORMAT ")", first, second); \ } G_STMT_END; /** * assert_equals_uint64: * @a: a #guint64 value or expression * @b: a #guint64 value or expression * * This macro checks that @a and @b are equal and aborts if this is not the * case, printing both expressions and the values they evaluated to. This * macro is for use in unit tests. */ #define assert_equals_uint64(a, b) fail_unless_equals_uint64(a, b) /** * fail_unless_equals_string: * @a: a string literal or expression * @b: a string literal or expression * * This macro checks that @a and @b are equal (as per strcmp) and aborts if * this is not the case, printing both expressions and the values they * evaluated to. This macro is for use in unit tests. */ #define fail_unless_equals_string(a, b) \ G_STMT_START { \ const gchar * first = a; \ const gchar * second = b; \ fail_unless(strcmp (first, second) == 0, \ "'" #a "' (%s) is not equal to '" #b"' (%s)", first, second); \ } G_STMT_END; /** * assert_equals_string: * @a: a string literal or expression * @b: a string literal or expression * * This macro checks that @a and @b are equal (as per strcmp) and aborts if * this is not the case, printing both expressions and the values they * evaluated to. This macro is for use in unit tests. */ #define assert_equals_string(a, b) fail_unless_equals_string(a, b) /** * fail_unless_equals_float: * @a: a #gdouble or #gfloat value or expression * @b: a #gdouble or #gfloat value or expression * * This macro checks that @a and @b are (almost) equal and aborts if this * is not the case, printing both expressions and the values they evaluated * to. This macro is for use in unit tests. * * Since: 0.10.14 */ #define fail_unless_equals_float(a, b) \ G_STMT_START { \ double first = a; \ double second = b; \ /* This will only work for 'normal' values and values around 0, \ * which should be good enough for our purposes here */ \ fail_unless(fabs (first - second) < 0.0000001, \ "'" #a "' (%g) is not equal to '" #b "' (%g)", first, second);\ } G_STMT_END; /** * assert_equals_float: * @a: a #gdouble or #gfloat value or expression * @b: a #gdouble or #gfloat value or expression * * This macro checks that @a and @b are (almost) equal and aborts if this * is not the case, printing both expressions and the values they evaluated * to. This macro is for use in unit tests. * * Since: 0.10.14 */ #define assert_equals_float(a, b) fail_unless_equals_float(a, b) /*** * thread test macros and variables */ extern GList *thread_list; extern GMutex *mutex; extern GCond *start_cond; /* used to notify main thread of thread startups */ extern GCond *sync_cond; /* used to synchronize all threads and main thread */ #define MAIN_START_THREADS(count, function, data) \ MAIN_INIT(); \ MAIN_START_THREAD_FUNCTIONS(count, function, data); \ MAIN_SYNCHRONIZE(); #define MAIN_INIT() \ G_STMT_START { \ _gnet_check_threads_running = TRUE; \ \ mutex = g_mutex_new (); \ start_cond = g_cond_new (); \ sync_cond = g_cond_new (); \ } G_STMT_END; #define MAIN_START_THREAD_FUNCTIONS(count, function, data) \ G_STMT_START { \ int i; \ for (i = 0; i < count; ++i) { \ MAIN_START_THREAD_FUNCTION (i, function, data); \ } \ } G_STMT_END; #define MAIN_START_THREAD_FUNCTION(i, function, data) \ G_STMT_START { \ GThread *thread = NULL; \ /* GNET_DEBUG ("MAIN: creating thread %d", i); */ \ g_mutex_lock (mutex); \ thread = g_thread_create ((GThreadFunc) function, data, \ TRUE, NULL); \ /* wait for thread to signal us that it's ready */ \ /* GNET_DEBUG ("MAIN: waiting for thread %d", i); */ \ g_cond_wait (start_cond, mutex); \ g_mutex_unlock (mutex); \ \ thread_list = g_list_append (thread_list, thread); \ } G_STMT_END; #define MAIN_SYNCHRONIZE() \ G_STMT_START { \ /* GNET_DEBUG ("MAIN: synchronizing"); */ \ g_cond_broadcast (sync_cond); \ /* GNET_DEBUG ("MAIN: synchronized"); */ \ } G_STMT_END; #define MAIN_STOP_THREADS() \ G_STMT_START { \ _gnet_check_threads_running = FALSE; \ \ /* join all threads */ \ /* GNET_DEBUG ("MAIN: joining"); */ \ g_list_foreach (thread_list, (GFunc) g_thread_join, NULL); \ /* GNET_DEBUG ("MAIN: joined"); */ \ } G_STMT_END; #define THREAD_START() \ THREAD_STARTED(); \ THREAD_SYNCHRONIZE(); #define THREAD_STARTED() \ G_STMT_START { \ /* signal main thread that we started */ \ /* GNET_DEBUG ("THREAD %p: started", g_thread_self ()); */ \ g_mutex_lock (mutex); \ g_cond_signal (start_cond); \ } G_STMT_END; #define THREAD_SYNCHRONIZE() \ G_STMT_START { \ /* synchronize everyone */ \ /* GNET_DEBUG ("THREAD %p: syncing", g_thread_self ()); */ \ g_cond_wait (sync_cond, mutex); \ /* GNET_DEBUG ("THREAD %p: synced", g_thread_self ()); */ \ g_mutex_unlock (mutex); \ } G_STMT_END; #define THREAD_SWITCH() \ G_STMT_START { \ /* a minimal sleep is a context switch */ \ g_usleep (1); \ } G_STMT_END; #define THREAD_TEST_RUNNING() (_gnet_check_threads_running == TRUE) /* additional assertions */ #define ASSERT_CRITICAL(code) \ G_STMT_START { \ _gnet_check_expecting_log = TRUE; \ _gnet_check_raised_critical = FALSE; \ code; \ _fail_unless (_gnet_check_raised_critical, __FILE__, __LINE__, \ "Expected g_critical, got nothing", NULL); \ _gnet_check_expecting_log = FALSE; \ } G_STMT_END #define ASSERT_WARNING(code) \ G_STMT_START { \ _gnet_check_expecting_log = TRUE; \ _gnet_check_raised_warning = FALSE; \ code; \ _fail_unless (_gnet_check_raised_warning, __FILE__, __LINE__, \ "Expected g_warning, got nothing", NULL); \ _gnet_check_expecting_log = FALSE; \ } G_STMT_END #define GNET_CHECK_MAIN(name) \ int main (int argc, char **argv) \ { \ Suite *s = name ## _suite (); \ return gnet_check_run_suite (s, # name, __FILE__); \ } /* This is a bit of a hack to allow filtering of which tests to run * at run-time, without recompiling, via the GNET_CHECKS environment * variable (specify test case function names, comma-separated) */ gboolean _gnet_check_run_test_func (const gchar * func_name); static inline void __gnet_tcase_add_test (TCase * tc, TFun tf, const gchar * func_name, int sig, int start, int end) { if (_gnet_check_run_test_func (func_name)) { _tcase_add_test (tc, tf, func_name, sig, start, end); } } #define _tcase_add_test __gnet_tcase_add_test G_END_DECLS #endif /* __GNET_CHECK_H__ */ gnet-2.0.8/tests/check/Makefile.in0000644000175000017500000015501110751327171013672 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ ############################################################################## # The following is from GStreamer's magnificent check.mak ############################################################################## srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ check_PROGRAMS = $(am__EXEEXT_1) gnet/gnetabi$(EXEEXT) \ gnet/gnetbase64$(EXEEXT) gnet/gnetconn$(EXEEXT) \ gnet/gnetconnhttp$(EXEEXT) gnet/gnethash$(EXEEXT) \ gnet/gnetinetaddr$(EXEEXT) gnet/gnetipv6$(EXEEXT) \ gnet/gnetmisc$(EXEEXT) gnet/gnetpack$(EXEEXT) \ gnet/gnetunpack$(EXEEXT) gnet/gneturi$(EXEEXT) noinst_PROGRAMS = subdir = tests/check DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/gnet-arch.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru libgnetcheck_a_AR = $(AR) $(ARFLAGS) libgnetcheck_a_LIBADD = am_libgnetcheck_a_OBJECTS = gnetcheck.$(OBJEXT) libgnetcheck_a_OBJECTS = $(am_libgnetcheck_a_OBJECTS) @ENABLE_NETWORK_TESTS_TRUE@am__EXEEXT_1 = gnet/gnettcpsocket$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) gnet_gnetabi_SOURCES = gnet/gnetabi.c gnet_gnetabi_OBJECTS = gnetabi.$(OBJEXT) gnet_gnetabi_LDADD = $(LDADD) am__DEPENDENCIES_1 = gnet_gnetabi_DEPENDENCIES = \ $(top_builddir)/tests/check/libgnetcheck.a \ $(top_builddir)/src/libgnet-2.0.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am__dirstamp = $(am__leading_dot)dirstamp gnet_gnetbase64_SOURCES = gnet/gnetbase64.c gnet_gnetbase64_OBJECTS = gnetbase64.$(OBJEXT) gnet_gnetbase64_LDADD = $(LDADD) gnet_gnetbase64_DEPENDENCIES = \ $(top_builddir)/tests/check/libgnetcheck.a \ $(top_builddir)/src/libgnet-2.0.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) gnet_gnetconn_SOURCES = gnet/gnetconn.c gnet_gnetconn_OBJECTS = gnetconn.$(OBJEXT) gnet_gnetconn_LDADD = $(LDADD) gnet_gnetconn_DEPENDENCIES = \ $(top_builddir)/tests/check/libgnetcheck.a \ $(top_builddir)/src/libgnet-2.0.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) gnet_gnetconnhttp_SOURCES = gnet/gnetconnhttp.c gnet_gnetconnhttp_OBJECTS = gnetconnhttp.$(OBJEXT) gnet_gnetconnhttp_LDADD = $(LDADD) gnet_gnetconnhttp_DEPENDENCIES = \ $(top_builddir)/tests/check/libgnetcheck.a \ $(top_builddir)/src/libgnet-2.0.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) gnet_gnethash_SOURCES = gnet/gnethash.c gnet_gnethash_OBJECTS = gnethash.$(OBJEXT) gnet_gnethash_LDADD = $(LDADD) gnet_gnethash_DEPENDENCIES = \ $(top_builddir)/tests/check/libgnetcheck.a \ $(top_builddir)/src/libgnet-2.0.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) gnet_gnetinetaddr_SOURCES = gnet/gnetinetaddr.c gnet_gnetinetaddr_OBJECTS = gnetinetaddr.$(OBJEXT) gnet_gnetinetaddr_LDADD = $(LDADD) gnet_gnetinetaddr_DEPENDENCIES = \ $(top_builddir)/tests/check/libgnetcheck.a \ $(top_builddir)/src/libgnet-2.0.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) gnet_gnetipv6_SOURCES = gnet/gnetipv6.c gnet_gnetipv6_OBJECTS = gnetipv6.$(OBJEXT) gnet_gnetipv6_LDADD = $(LDADD) gnet_gnetipv6_DEPENDENCIES = \ $(top_builddir)/tests/check/libgnetcheck.a \ $(top_builddir)/src/libgnet-2.0.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) gnet_gnetmisc_SOURCES = gnet/gnetmisc.c gnet_gnetmisc_OBJECTS = gnetmisc.$(OBJEXT) gnet_gnetmisc_LDADD = $(LDADD) gnet_gnetmisc_DEPENDENCIES = \ $(top_builddir)/tests/check/libgnetcheck.a \ $(top_builddir)/src/libgnet-2.0.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) gnet_gnetpack_SOURCES = gnet/gnetpack.c gnet_gnetpack_OBJECTS = gnetpack.$(OBJEXT) gnet_gnetpack_LDADD = $(LDADD) gnet_gnetpack_DEPENDENCIES = \ $(top_builddir)/tests/check/libgnetcheck.a \ $(top_builddir)/src/libgnet-2.0.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) gnet_gnettcpsocket_SOURCES = gnet/gnettcpsocket.c gnet_gnettcpsocket_OBJECTS = gnettcpsocket.$(OBJEXT) gnet_gnettcpsocket_LDADD = $(LDADD) gnet_gnettcpsocket_DEPENDENCIES = \ $(top_builddir)/tests/check/libgnetcheck.a \ $(top_builddir)/src/libgnet-2.0.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) gnet_gnetunpack_SOURCES = gnet/gnetunpack.c gnet_gnetunpack_OBJECTS = gnetunpack.$(OBJEXT) gnet_gnetunpack_LDADD = $(LDADD) gnet_gnetunpack_DEPENDENCIES = \ $(top_builddir)/tests/check/libgnetcheck.a \ $(top_builddir)/src/libgnet-2.0.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) gnet_gneturi_SOURCES = gnet/gneturi.c gnet_gneturi_OBJECTS = gneturi.$(OBJEXT) gnet_gneturi_LDADD = $(LDADD) gnet_gneturi_DEPENDENCIES = \ $(top_builddir)/tests/check/libgnetcheck.a \ $(top_builddir)/src/libgnet-2.0.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libgnetcheck_a_SOURCES) gnet/gnetabi.c gnet/gnetbase64.c \ gnet/gnetconn.c gnet/gnetconnhttp.c gnet/gnethash.c \ gnet/gnetinetaddr.c gnet/gnetipv6.c gnet/gnetmisc.c \ gnet/gnetpack.c gnet/gnettcpsocket.c gnet/gnetunpack.c \ gnet/gneturi.c DIST_SOURCES = $(libgnetcheck_a_SOURCES) gnet/gnetabi.c \ gnet/gnetbase64.c gnet/gnetconn.c gnet/gnetconnhttp.c \ gnet/gnethash.c gnet/gnetinetaddr.c gnet/gnetipv6.c \ gnet/gnetmisc.c gnet/gnetpack.c gnet/gnettcpsocket.c \ gnet/gnetunpack.c gnet/gneturi.c HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHECK_CFLAGS = @CHECK_CFLAGS@ CHECK_LIBS = @CHECK_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_GTK_DOC_FALSE = @ENABLE_GTK_DOC_FALSE@ ENABLE_GTK_DOC_TRUE = @ENABLE_GTK_DOC_TRUE@ ENABLE_NETWORK_TESTS_FALSE = @ENABLE_NETWORK_TESTS_FALSE@ ENABLE_NETWORK_TESTS_TRUE = @ENABLE_NETWORK_TESTS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GNET_BINARY_AGE = @GNET_BINARY_AGE@ GNET_DEBUG_FLAGS = @GNET_DEBUG_FLAGS@ GNET_GCOV_ENABLED_FALSE = @GNET_GCOV_ENABLED_FALSE@ GNET_GCOV_ENABLED_TRUE = @GNET_GCOV_ENABLED_TRUE@ GNET_INTERFACE_AGE = @GNET_INTERFACE_AGE@ GNET_MAJOR_VERSION = @GNET_MAJOR_VERSION@ GNET_MICRO_VERSION = @GNET_MICRO_VERSION@ GNET_MINOR_VERSION = @GNET_MINOR_VERSION@ GNET_VERSION = @GNET_VERSION@ GREP = @GREP@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ HAVE_CPU_ALPHA_FALSE = @HAVE_CPU_ALPHA_FALSE@ HAVE_CPU_ALPHA_TRUE = @HAVE_CPU_ALPHA_TRUE@ HAVE_CPU_ARM_FALSE = @HAVE_CPU_ARM_FALSE@ HAVE_CPU_ARM_TRUE = @HAVE_CPU_ARM_TRUE@ HAVE_CPU_CRISV32_FALSE = @HAVE_CPU_CRISV32_FALSE@ HAVE_CPU_CRISV32_TRUE = @HAVE_CPU_CRISV32_TRUE@ HAVE_CPU_CRIS_FALSE = @HAVE_CPU_CRIS_FALSE@ HAVE_CPU_CRIS_TRUE = @HAVE_CPU_CRIS_TRUE@ HAVE_CPU_HPPA_FALSE = @HAVE_CPU_HPPA_FALSE@ HAVE_CPU_HPPA_TRUE = @HAVE_CPU_HPPA_TRUE@ HAVE_CPU_I386_FALSE = @HAVE_CPU_I386_FALSE@ HAVE_CPU_I386_TRUE = @HAVE_CPU_I386_TRUE@ HAVE_CPU_IA64_FALSE = @HAVE_CPU_IA64_FALSE@ HAVE_CPU_IA64_TRUE = @HAVE_CPU_IA64_TRUE@ HAVE_CPU_M68K_FALSE = @HAVE_CPU_M68K_FALSE@ HAVE_CPU_M68K_TRUE = @HAVE_CPU_M68K_TRUE@ HAVE_CPU_MIPS_FALSE = @HAVE_CPU_MIPS_FALSE@ HAVE_CPU_MIPS_TRUE = @HAVE_CPU_MIPS_TRUE@ HAVE_CPU_PPC64_FALSE = @HAVE_CPU_PPC64_FALSE@ HAVE_CPU_PPC64_TRUE = @HAVE_CPU_PPC64_TRUE@ HAVE_CPU_PPC_FALSE = @HAVE_CPU_PPC_FALSE@ HAVE_CPU_PPC_TRUE = @HAVE_CPU_PPC_TRUE@ HAVE_CPU_S390_FALSE = @HAVE_CPU_S390_FALSE@ HAVE_CPU_S390_TRUE = @HAVE_CPU_S390_TRUE@ HAVE_CPU_SPARC_FALSE = @HAVE_CPU_SPARC_FALSE@ HAVE_CPU_SPARC_TRUE = @HAVE_CPU_SPARC_TRUE@ HAVE_CPU_X86_64_FALSE = @HAVE_CPU_X86_64_FALSE@ HAVE_CPU_X86_64_TRUE = @HAVE_CPU_X86_64_TRUE@ HAVE_VALGRIND_FALSE = @HAVE_VALGRIND_FALSE@ HAVE_VALGRIND_TRUE = @HAVE_VALGRIND_TRUE@ HTML_DIR = @HTML_DIR@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_WIN32_FALSE = @OS_WIN32_FALSE@ OS_WIN32_TRUE = @OS_WIN32_TRUE@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ VALGRIND_LIBS = @VALGRIND_LIBS@ VALGRIND_PATH = @VALGRIND_PATH@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ LOOPS = 10 ############################################################################## # Our helper lib for unit tests ############################################################################## noinst_LIBRARIES = libgnetcheck.a libgnetcheck_a_SOURCES = gnetcheck.c gnetcheck.h ############################################################################## # Details for GNet tests ############################################################################## TESTS_ENVIRONMENT = # the core dumps of some machines have PIDs appended and profiling data CLEANFILES = core core.* *.gcno *.gcda SUPPRESSIONS = $(top_srcdir)/tests/check/gnet-valgrind.supp EXTRA_DIST = $(SUPPRESSIONS) @ENABLE_NETWORK_TESTS_FALSE@NETWORK_CHECKS = @ENABLE_NETWORK_TESTS_TRUE@NETWORK_CHECKS = gnet/gnettcpsocket TESTS = $(check_PROGRAMS) noinst_HEADERS = \ gnet/struct_i386.h \ gnet/struct_ppc32.h \ gnet/struct_x86_64.h AM_CFLAGS = \ -I$(top_srcdir)/src -I$(top_builddir) \ $(GLIB_CFLAGS) \ $(CHECK_CFLAGS) LDADD = \ $(top_builddir)/tests/check/libgnetcheck.a \ $(top_builddir)/src/libgnet-2.0.la \ $(GLIB_LIBS) \ $(CHECK_LIBS) # valgrind testing # these just need valgrind fixing, period VALGRIND_TO_FIX = # these should never be run with valgrind VALGRIND_IGNORE = # these need fixing because the threads cause segfaults under valgrind TESTS_THREADED = VALGRIND_TESTS_DISABLE = \ $(TESTS_THREADED) \ $(VALGRIND_IGNORE) \ $(VALGRIND_TO_FIX) # directories with source files for coverage tests (relativ to toplevel dir) COVERAGE_DIRS = \ src COVERAGE_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov)) COVERAGE_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_FILES)) COVERAGE_OUT_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov.out)) COVERAGE_OUT_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_OUT_FILES)) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/check/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/check/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libgnetcheck.a: $(libgnetcheck_a_OBJECTS) $(libgnetcheck_a_DEPENDENCIES) -rm -f libgnetcheck.a $(libgnetcheck_a_AR) libgnetcheck.a $(libgnetcheck_a_OBJECTS) $(libgnetcheck_a_LIBADD) $(RANLIB) libgnetcheck.a clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done gnet/$(am__dirstamp): @$(mkdir_p) gnet @: > gnet/$(am__dirstamp) gnet/gnetabi$(EXEEXT): $(gnet_gnetabi_OBJECTS) $(gnet_gnetabi_DEPENDENCIES) gnet/$(am__dirstamp) @rm -f gnet/gnetabi$(EXEEXT) $(LINK) $(gnet_gnetabi_LDFLAGS) $(gnet_gnetabi_OBJECTS) $(gnet_gnetabi_LDADD) $(LIBS) gnet/gnetbase64$(EXEEXT): $(gnet_gnetbase64_OBJECTS) $(gnet_gnetbase64_DEPENDENCIES) gnet/$(am__dirstamp) @rm -f gnet/gnetbase64$(EXEEXT) $(LINK) $(gnet_gnetbase64_LDFLAGS) $(gnet_gnetbase64_OBJECTS) $(gnet_gnetbase64_LDADD) $(LIBS) gnet/gnetconn$(EXEEXT): $(gnet_gnetconn_OBJECTS) $(gnet_gnetconn_DEPENDENCIES) gnet/$(am__dirstamp) @rm -f gnet/gnetconn$(EXEEXT) $(LINK) $(gnet_gnetconn_LDFLAGS) $(gnet_gnetconn_OBJECTS) $(gnet_gnetconn_LDADD) $(LIBS) gnet/gnetconnhttp$(EXEEXT): $(gnet_gnetconnhttp_OBJECTS) $(gnet_gnetconnhttp_DEPENDENCIES) gnet/$(am__dirstamp) @rm -f gnet/gnetconnhttp$(EXEEXT) $(LINK) $(gnet_gnetconnhttp_LDFLAGS) $(gnet_gnetconnhttp_OBJECTS) $(gnet_gnetconnhttp_LDADD) $(LIBS) gnet/gnethash$(EXEEXT): $(gnet_gnethash_OBJECTS) $(gnet_gnethash_DEPENDENCIES) gnet/$(am__dirstamp) @rm -f gnet/gnethash$(EXEEXT) $(LINK) $(gnet_gnethash_LDFLAGS) $(gnet_gnethash_OBJECTS) $(gnet_gnethash_LDADD) $(LIBS) gnet/gnetinetaddr$(EXEEXT): $(gnet_gnetinetaddr_OBJECTS) $(gnet_gnetinetaddr_DEPENDENCIES) gnet/$(am__dirstamp) @rm -f gnet/gnetinetaddr$(EXEEXT) $(LINK) $(gnet_gnetinetaddr_LDFLAGS) $(gnet_gnetinetaddr_OBJECTS) $(gnet_gnetinetaddr_LDADD) $(LIBS) gnet/gnetipv6$(EXEEXT): $(gnet_gnetipv6_OBJECTS) $(gnet_gnetipv6_DEPENDENCIES) gnet/$(am__dirstamp) @rm -f gnet/gnetipv6$(EXEEXT) $(LINK) $(gnet_gnetipv6_LDFLAGS) $(gnet_gnetipv6_OBJECTS) $(gnet_gnetipv6_LDADD) $(LIBS) gnet/gnetmisc$(EXEEXT): $(gnet_gnetmisc_OBJECTS) $(gnet_gnetmisc_DEPENDENCIES) gnet/$(am__dirstamp) @rm -f gnet/gnetmisc$(EXEEXT) $(LINK) $(gnet_gnetmisc_LDFLAGS) $(gnet_gnetmisc_OBJECTS) $(gnet_gnetmisc_LDADD) $(LIBS) gnet/gnetpack$(EXEEXT): $(gnet_gnetpack_OBJECTS) $(gnet_gnetpack_DEPENDENCIES) gnet/$(am__dirstamp) @rm -f gnet/gnetpack$(EXEEXT) $(LINK) $(gnet_gnetpack_LDFLAGS) $(gnet_gnetpack_OBJECTS) $(gnet_gnetpack_LDADD) $(LIBS) gnet/gnettcpsocket$(EXEEXT): $(gnet_gnettcpsocket_OBJECTS) $(gnet_gnettcpsocket_DEPENDENCIES) gnet/$(am__dirstamp) @rm -f gnet/gnettcpsocket$(EXEEXT) $(LINK) $(gnet_gnettcpsocket_LDFLAGS) $(gnet_gnettcpsocket_OBJECTS) $(gnet_gnettcpsocket_LDADD) $(LIBS) gnet/gnetunpack$(EXEEXT): $(gnet_gnetunpack_OBJECTS) $(gnet_gnetunpack_DEPENDENCIES) gnet/$(am__dirstamp) @rm -f gnet/gnetunpack$(EXEEXT) $(LINK) $(gnet_gnetunpack_LDFLAGS) $(gnet_gnetunpack_OBJECTS) $(gnet_gnetunpack_LDADD) $(LIBS) gnet/gneturi$(EXEEXT): $(gnet_gneturi_OBJECTS) $(gnet_gneturi_DEPENDENCIES) gnet/$(am__dirstamp) @rm -f gnet/gneturi$(EXEEXT) $(LINK) $(gnet_gneturi_LDFLAGS) $(gnet_gneturi_OBJECTS) $(gnet_gneturi_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnetabi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnetbase64.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnetcheck.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnetconn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnetconnhttp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnethash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnetinetaddr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnetipv6.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnetmisc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnetpack.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnettcpsocket.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnetunpack.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gneturi.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< gnetabi.o: gnet/gnetabi.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetabi.o -MD -MP -MF "$(DEPDIR)/gnetabi.Tpo" -c -o gnetabi.o `test -f 'gnet/gnetabi.c' || echo '$(srcdir)/'`gnet/gnetabi.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetabi.Tpo" "$(DEPDIR)/gnetabi.Po"; else rm -f "$(DEPDIR)/gnetabi.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetabi.c' object='gnetabi.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetabi.o `test -f 'gnet/gnetabi.c' || echo '$(srcdir)/'`gnet/gnetabi.c gnetabi.obj: gnet/gnetabi.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetabi.obj -MD -MP -MF "$(DEPDIR)/gnetabi.Tpo" -c -o gnetabi.obj `if test -f 'gnet/gnetabi.c'; then $(CYGPATH_W) 'gnet/gnetabi.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetabi.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetabi.Tpo" "$(DEPDIR)/gnetabi.Po"; else rm -f "$(DEPDIR)/gnetabi.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetabi.c' object='gnetabi.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetabi.obj `if test -f 'gnet/gnetabi.c'; then $(CYGPATH_W) 'gnet/gnetabi.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetabi.c'; fi` gnetbase64.o: gnet/gnetbase64.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetbase64.o -MD -MP -MF "$(DEPDIR)/gnetbase64.Tpo" -c -o gnetbase64.o `test -f 'gnet/gnetbase64.c' || echo '$(srcdir)/'`gnet/gnetbase64.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetbase64.Tpo" "$(DEPDIR)/gnetbase64.Po"; else rm -f "$(DEPDIR)/gnetbase64.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetbase64.c' object='gnetbase64.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetbase64.o `test -f 'gnet/gnetbase64.c' || echo '$(srcdir)/'`gnet/gnetbase64.c gnetbase64.obj: gnet/gnetbase64.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetbase64.obj -MD -MP -MF "$(DEPDIR)/gnetbase64.Tpo" -c -o gnetbase64.obj `if test -f 'gnet/gnetbase64.c'; then $(CYGPATH_W) 'gnet/gnetbase64.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetbase64.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetbase64.Tpo" "$(DEPDIR)/gnetbase64.Po"; else rm -f "$(DEPDIR)/gnetbase64.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetbase64.c' object='gnetbase64.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetbase64.obj `if test -f 'gnet/gnetbase64.c'; then $(CYGPATH_W) 'gnet/gnetbase64.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetbase64.c'; fi` gnetconn.o: gnet/gnetconn.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetconn.o -MD -MP -MF "$(DEPDIR)/gnetconn.Tpo" -c -o gnetconn.o `test -f 'gnet/gnetconn.c' || echo '$(srcdir)/'`gnet/gnetconn.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetconn.Tpo" "$(DEPDIR)/gnetconn.Po"; else rm -f "$(DEPDIR)/gnetconn.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetconn.c' object='gnetconn.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetconn.o `test -f 'gnet/gnetconn.c' || echo '$(srcdir)/'`gnet/gnetconn.c gnetconn.obj: gnet/gnetconn.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetconn.obj -MD -MP -MF "$(DEPDIR)/gnetconn.Tpo" -c -o gnetconn.obj `if test -f 'gnet/gnetconn.c'; then $(CYGPATH_W) 'gnet/gnetconn.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetconn.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetconn.Tpo" "$(DEPDIR)/gnetconn.Po"; else rm -f "$(DEPDIR)/gnetconn.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetconn.c' object='gnetconn.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetconn.obj `if test -f 'gnet/gnetconn.c'; then $(CYGPATH_W) 'gnet/gnetconn.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetconn.c'; fi` gnetconnhttp.o: gnet/gnetconnhttp.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetconnhttp.o -MD -MP -MF "$(DEPDIR)/gnetconnhttp.Tpo" -c -o gnetconnhttp.o `test -f 'gnet/gnetconnhttp.c' || echo '$(srcdir)/'`gnet/gnetconnhttp.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetconnhttp.Tpo" "$(DEPDIR)/gnetconnhttp.Po"; else rm -f "$(DEPDIR)/gnetconnhttp.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetconnhttp.c' object='gnetconnhttp.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetconnhttp.o `test -f 'gnet/gnetconnhttp.c' || echo '$(srcdir)/'`gnet/gnetconnhttp.c gnetconnhttp.obj: gnet/gnetconnhttp.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetconnhttp.obj -MD -MP -MF "$(DEPDIR)/gnetconnhttp.Tpo" -c -o gnetconnhttp.obj `if test -f 'gnet/gnetconnhttp.c'; then $(CYGPATH_W) 'gnet/gnetconnhttp.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetconnhttp.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetconnhttp.Tpo" "$(DEPDIR)/gnetconnhttp.Po"; else rm -f "$(DEPDIR)/gnetconnhttp.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetconnhttp.c' object='gnetconnhttp.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetconnhttp.obj `if test -f 'gnet/gnetconnhttp.c'; then $(CYGPATH_W) 'gnet/gnetconnhttp.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetconnhttp.c'; fi` gnethash.o: gnet/gnethash.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnethash.o -MD -MP -MF "$(DEPDIR)/gnethash.Tpo" -c -o gnethash.o `test -f 'gnet/gnethash.c' || echo '$(srcdir)/'`gnet/gnethash.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnethash.Tpo" "$(DEPDIR)/gnethash.Po"; else rm -f "$(DEPDIR)/gnethash.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnethash.c' object='gnethash.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnethash.o `test -f 'gnet/gnethash.c' || echo '$(srcdir)/'`gnet/gnethash.c gnethash.obj: gnet/gnethash.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnethash.obj -MD -MP -MF "$(DEPDIR)/gnethash.Tpo" -c -o gnethash.obj `if test -f 'gnet/gnethash.c'; then $(CYGPATH_W) 'gnet/gnethash.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnethash.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnethash.Tpo" "$(DEPDIR)/gnethash.Po"; else rm -f "$(DEPDIR)/gnethash.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnethash.c' object='gnethash.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnethash.obj `if test -f 'gnet/gnethash.c'; then $(CYGPATH_W) 'gnet/gnethash.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnethash.c'; fi` gnetinetaddr.o: gnet/gnetinetaddr.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetinetaddr.o -MD -MP -MF "$(DEPDIR)/gnetinetaddr.Tpo" -c -o gnetinetaddr.o `test -f 'gnet/gnetinetaddr.c' || echo '$(srcdir)/'`gnet/gnetinetaddr.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetinetaddr.Tpo" "$(DEPDIR)/gnetinetaddr.Po"; else rm -f "$(DEPDIR)/gnetinetaddr.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetinetaddr.c' object='gnetinetaddr.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetinetaddr.o `test -f 'gnet/gnetinetaddr.c' || echo '$(srcdir)/'`gnet/gnetinetaddr.c gnetinetaddr.obj: gnet/gnetinetaddr.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetinetaddr.obj -MD -MP -MF "$(DEPDIR)/gnetinetaddr.Tpo" -c -o gnetinetaddr.obj `if test -f 'gnet/gnetinetaddr.c'; then $(CYGPATH_W) 'gnet/gnetinetaddr.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetinetaddr.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetinetaddr.Tpo" "$(DEPDIR)/gnetinetaddr.Po"; else rm -f "$(DEPDIR)/gnetinetaddr.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetinetaddr.c' object='gnetinetaddr.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetinetaddr.obj `if test -f 'gnet/gnetinetaddr.c'; then $(CYGPATH_W) 'gnet/gnetinetaddr.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetinetaddr.c'; fi` gnetipv6.o: gnet/gnetipv6.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetipv6.o -MD -MP -MF "$(DEPDIR)/gnetipv6.Tpo" -c -o gnetipv6.o `test -f 'gnet/gnetipv6.c' || echo '$(srcdir)/'`gnet/gnetipv6.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetipv6.Tpo" "$(DEPDIR)/gnetipv6.Po"; else rm -f "$(DEPDIR)/gnetipv6.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetipv6.c' object='gnetipv6.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetipv6.o `test -f 'gnet/gnetipv6.c' || echo '$(srcdir)/'`gnet/gnetipv6.c gnetipv6.obj: gnet/gnetipv6.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetipv6.obj -MD -MP -MF "$(DEPDIR)/gnetipv6.Tpo" -c -o gnetipv6.obj `if test -f 'gnet/gnetipv6.c'; then $(CYGPATH_W) 'gnet/gnetipv6.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetipv6.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetipv6.Tpo" "$(DEPDIR)/gnetipv6.Po"; else rm -f "$(DEPDIR)/gnetipv6.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetipv6.c' object='gnetipv6.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetipv6.obj `if test -f 'gnet/gnetipv6.c'; then $(CYGPATH_W) 'gnet/gnetipv6.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetipv6.c'; fi` gnetmisc.o: gnet/gnetmisc.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetmisc.o -MD -MP -MF "$(DEPDIR)/gnetmisc.Tpo" -c -o gnetmisc.o `test -f 'gnet/gnetmisc.c' || echo '$(srcdir)/'`gnet/gnetmisc.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetmisc.Tpo" "$(DEPDIR)/gnetmisc.Po"; else rm -f "$(DEPDIR)/gnetmisc.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetmisc.c' object='gnetmisc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetmisc.o `test -f 'gnet/gnetmisc.c' || echo '$(srcdir)/'`gnet/gnetmisc.c gnetmisc.obj: gnet/gnetmisc.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetmisc.obj -MD -MP -MF "$(DEPDIR)/gnetmisc.Tpo" -c -o gnetmisc.obj `if test -f 'gnet/gnetmisc.c'; then $(CYGPATH_W) 'gnet/gnetmisc.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetmisc.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetmisc.Tpo" "$(DEPDIR)/gnetmisc.Po"; else rm -f "$(DEPDIR)/gnetmisc.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetmisc.c' object='gnetmisc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetmisc.obj `if test -f 'gnet/gnetmisc.c'; then $(CYGPATH_W) 'gnet/gnetmisc.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetmisc.c'; fi` gnetpack.o: gnet/gnetpack.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetpack.o -MD -MP -MF "$(DEPDIR)/gnetpack.Tpo" -c -o gnetpack.o `test -f 'gnet/gnetpack.c' || echo '$(srcdir)/'`gnet/gnetpack.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetpack.Tpo" "$(DEPDIR)/gnetpack.Po"; else rm -f "$(DEPDIR)/gnetpack.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetpack.c' object='gnetpack.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetpack.o `test -f 'gnet/gnetpack.c' || echo '$(srcdir)/'`gnet/gnetpack.c gnetpack.obj: gnet/gnetpack.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetpack.obj -MD -MP -MF "$(DEPDIR)/gnetpack.Tpo" -c -o gnetpack.obj `if test -f 'gnet/gnetpack.c'; then $(CYGPATH_W) 'gnet/gnetpack.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetpack.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetpack.Tpo" "$(DEPDIR)/gnetpack.Po"; else rm -f "$(DEPDIR)/gnetpack.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetpack.c' object='gnetpack.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetpack.obj `if test -f 'gnet/gnetpack.c'; then $(CYGPATH_W) 'gnet/gnetpack.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetpack.c'; fi` gnettcpsocket.o: gnet/gnettcpsocket.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnettcpsocket.o -MD -MP -MF "$(DEPDIR)/gnettcpsocket.Tpo" -c -o gnettcpsocket.o `test -f 'gnet/gnettcpsocket.c' || echo '$(srcdir)/'`gnet/gnettcpsocket.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnettcpsocket.Tpo" "$(DEPDIR)/gnettcpsocket.Po"; else rm -f "$(DEPDIR)/gnettcpsocket.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnettcpsocket.c' object='gnettcpsocket.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnettcpsocket.o `test -f 'gnet/gnettcpsocket.c' || echo '$(srcdir)/'`gnet/gnettcpsocket.c gnettcpsocket.obj: gnet/gnettcpsocket.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnettcpsocket.obj -MD -MP -MF "$(DEPDIR)/gnettcpsocket.Tpo" -c -o gnettcpsocket.obj `if test -f 'gnet/gnettcpsocket.c'; then $(CYGPATH_W) 'gnet/gnettcpsocket.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnettcpsocket.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnettcpsocket.Tpo" "$(DEPDIR)/gnettcpsocket.Po"; else rm -f "$(DEPDIR)/gnettcpsocket.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnettcpsocket.c' object='gnettcpsocket.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnettcpsocket.obj `if test -f 'gnet/gnettcpsocket.c'; then $(CYGPATH_W) 'gnet/gnettcpsocket.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnettcpsocket.c'; fi` gnetunpack.o: gnet/gnetunpack.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetunpack.o -MD -MP -MF "$(DEPDIR)/gnetunpack.Tpo" -c -o gnetunpack.o `test -f 'gnet/gnetunpack.c' || echo '$(srcdir)/'`gnet/gnetunpack.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetunpack.Tpo" "$(DEPDIR)/gnetunpack.Po"; else rm -f "$(DEPDIR)/gnetunpack.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetunpack.c' object='gnetunpack.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetunpack.o `test -f 'gnet/gnetunpack.c' || echo '$(srcdir)/'`gnet/gnetunpack.c gnetunpack.obj: gnet/gnetunpack.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gnetunpack.obj -MD -MP -MF "$(DEPDIR)/gnetunpack.Tpo" -c -o gnetunpack.obj `if test -f 'gnet/gnetunpack.c'; then $(CYGPATH_W) 'gnet/gnetunpack.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetunpack.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gnetunpack.Tpo" "$(DEPDIR)/gnetunpack.Po"; else rm -f "$(DEPDIR)/gnetunpack.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gnetunpack.c' object='gnetunpack.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gnetunpack.obj `if test -f 'gnet/gnetunpack.c'; then $(CYGPATH_W) 'gnet/gnetunpack.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gnetunpack.c'; fi` gneturi.o: gnet/gneturi.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gneturi.o -MD -MP -MF "$(DEPDIR)/gneturi.Tpo" -c -o gneturi.o `test -f 'gnet/gneturi.c' || echo '$(srcdir)/'`gnet/gneturi.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gneturi.Tpo" "$(DEPDIR)/gneturi.Po"; else rm -f "$(DEPDIR)/gneturi.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gneturi.c' object='gneturi.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gneturi.o `test -f 'gnet/gneturi.c' || echo '$(srcdir)/'`gnet/gneturi.c gneturi.obj: gnet/gneturi.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gneturi.obj -MD -MP -MF "$(DEPDIR)/gneturi.Tpo" -c -o gneturi.obj `if test -f 'gnet/gneturi.c'; then $(CYGPATH_W) 'gnet/gneturi.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gneturi.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gneturi.Tpo" "$(DEPDIR)/gneturi.Po"; else rm -f "$(DEPDIR)/gneturi.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnet/gneturi.c' object='gneturi.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gneturi.obj `if test -f 'gnet/gneturi.c'; then $(CYGPATH_W) 'gnet/gneturi.c'; else $(CYGPATH_W) '$(srcdir)/gnet/gneturi.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list='$(TESTS)'; \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ echo "XPASS: $$tst"; \ ;; \ *) \ echo "PASS: $$tst"; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xfail=`expr $$xfail + 1`; \ echo "XFAIL: $$tst"; \ ;; \ *) \ failed=`expr $$failed + 1`; \ echo "FAIL: $$tst"; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ echo "SKIP: $$tst"; \ fi; \ done; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="All $$all tests passed"; \ else \ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all tests failed"; \ else \ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ skipped="($$skip tests were not run)"; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) $(mkdir_p) $(distdir)/$(top_srcdir)/tests/check $(distdir)/gnet @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -rm -f gnet/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ clean-noinstLIBRARIES clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool clean-local \ clean-noinstLIBRARIES clean-noinstPROGRAMS ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-info-am clean-local-check: for i in `find . -name ".libs" -type d`; do \ rm -rf $$i; \ done # hangs spectacularly on some machines, so let's not do this by default yet @HAVE_VALGRIND_TRUE@check-valgrind: @HAVE_VALGRIND_TRUE@ make valgrind @HAVE_VALGRIND_FALSE@check-valgrind: @HAVE_VALGRIND_FALSE@ @true # run any given test by running make test.check # if the test fails, run it again at at least debug level 2 %.check: % @$(TESTS_ENVIRONMENT) \ CK_DEFAULT_TIMEOUT=20 \ $* || \ $(TESTS_ENVIRONMENT) \ GNET_DEBUG=$$GNET_DEBUG,*:2 \ CK_DEFAULT_TIMEOUT=20 \ $* # run any given test in a loop %.torture: % @for i in `seq 1 $(LOOPS)`; do \ $(TESTS_ENVIRONMENT) \ CK_DEFAULT_TIMEOUT=20 \ $*; done # run any given test in an infinite loop %.forever: % @while true; do \ $(TESTS_ENVIRONMENT) \ CK_DEFAULT_TIMEOUT=20 \ $* || break; done # valgrind any given test by running make test.valgrind %.valgrind: % $(TESTS_ENVIRONMENT) \ CK_DEFAULT_TIMEOUT=360 \ G_SLICE=always-malloc \ libtool --mode=execute \ $(VALGRIND_PATH) -q \ $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \ --tool=memcheck --leak-check=full --trace-children=yes \ --leak-resolution=high --num-callers=20 \ ./$* 2>&1 | tee valgrind.log @if grep "==" valgrind.log > /dev/null 2>&1; then \ rm valgrind.log; \ exit 1; \ fi @rm valgrind.log # valgrind any given test and generate suppressions for it %.valgrind.gen-suppressions: % $(TESTS_ENVIRONMENT) \ CK_DEFAULT_TIMEOUT=360 \ G_SLICE=always-malloc \ libtool --mode=execute \ $(VALGRIND_PATH) -q \ $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \ --tool=memcheck --leak-check=full --trace-children=yes \ --leak-resolution=high --num-callers=20 \ --gen-suppressions=all \ ./$* 2>&1 | tee suppressions.log # valgrind any given test until failure by running make test.valgrind-forever %.valgrind-forever: % @while make $*.valgrind; do \ true; done # gdb any given test by running make test.gdb %.gdb: % $(TESTS_ENVIRONMENT) \ CK_FORK=no \ libtool --mode=execute \ gdb $* # torture tests torture: $(TESTS) @echo "Torturing tests ..." for i in `seq 1 $(LOOPS)`; do \ make check || \ (echo "Failure after $$i runs"; exit 1) || \ exit 1; \ done @banner="All $(LOOPS) loops passed"; \ dashes=`echo "$$banner" | sed s/./=/g`; \ echo $$dashes; echo $$banner; echo $$dashes # forever tests forever: $(TESTS) @echo "Forever tests ..." while true; do \ make check || \ (echo "Failure"; exit 1) || \ exit 1; \ done # valgrind all tests valgrind: $(TESTS) @echo "Valgrinding tests ..." @failed=0; \ for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \ make $$t.valgrind; \ if test "$$?" -ne 0; then \ echo "Valgrind error for test $$t"; \ failed=`expr $$failed + 1`; \ whicht="$$whicht $$t"; \ fi; \ done; \ if test "$$failed" -ne 0; then \ echo "$$failed tests had leaks or errors under valgrind:"; \ echo "$$whicht"; \ false; \ fi help: @echo "make check -- run all checks" @echo "make torture -- run all checks $(LOOPS) times" @echo "make (dir)/(test).check -- run the given check once" @echo "make (dir)/(test).forever -- run the given check forever" @echo "make (dir)/(test).torture -- run the given check $(LOOPS) times" @echo @echo "make (dir)/(test).gdb -- start up gdb for the given test" @echo @echo "make valgrind -- valgrind all tests" @echo "make (dir)/(test).valgrind -- valgrind the given test" @echo "make (dir)/(test).valgrind-forever -- valgrind the given test forever" @echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions" @echo " and save to suppressions.log" # override to _not_ install the test plugins install-pluginLTLIBRARIES: clean-local: clean-local-check debug: echo $(COVERAGE_FILES) echo $(COVERAGE_FILES_REL) .PHONY: coverage @GNET_GCOV_ENABLED_TRUE@coverage: @GNET_GCOV_ENABLED_TRUE@ for file in `find $(top_builddir) -name '*.gcda'`; do rm $$file; done @GNET_GCOV_ENABLED_TRUE@ make check @GNET_GCOV_ENABLED_TRUE@ make coverage-report @GNET_GCOV_ENABLED_FALSE@coverage: @GNET_GCOV_ENABLED_FALSE@ echo "You need to configure with --enable-gcov to get coverage data" @GNET_GCOV_ENABLED_FALSE@ exit 1 coverage-report: rm -r coverage for dir in $(COVERAGE_DIRS); do \ mkdir -p coverage/$$dir; \ make -C $(top_builddir)/$$dir gcov; \ done for dir in $(COVERAGE_DIRS); do \ files="`ls $(top_builddir)/$$dir/*.gcov.out 2> /dev/null`"; \ if test ! -z "$$files"; then \ perl $(top_srcdir)/common/coverage/coverage-report.pl \ $(top_builddir)/$$dir/*.gcov.out > \ coverage/$$dir/index.xml; \ xsltproc $(top_srcdir)/common/coverage/coverage-report.xsl \ coverage/$$dir/index.xml > coverage/$$dir/index.html; \ fi; \ done for file in $(COVERAGE_FILES_REL); do \ echo Generating coverage/$$file.html; \ perl $(top_srcdir)/common/coverage/coverage-report-entry.pl \ $(top_builddir)/$$file > coverage/$$file.html; \ done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gnet-2.0.8/tests/check/Makefile.am0000644000175000017500000001712110751326731013661 00000000000000############################################################################## # The following is from GStreamer's magnificent check.mak ############################################################################## clean-local-check: for i in `find . -name ".libs" -type d`; do \ rm -rf $$i; \ done if HAVE_VALGRIND # hangs spectacularly on some machines, so let's not do this by default yet check-valgrind: make valgrind else check-valgrind: @true endif LOOPS = 10 # run any given test by running make test.check # if the test fails, run it again at at least debug level 2 %.check: % @$(TESTS_ENVIRONMENT) \ CK_DEFAULT_TIMEOUT=20 \ $* || \ $(TESTS_ENVIRONMENT) \ GNET_DEBUG=$$GNET_DEBUG,*:2 \ CK_DEFAULT_TIMEOUT=20 \ $* # run any given test in a loop %.torture: % @for i in `seq 1 $(LOOPS)`; do \ $(TESTS_ENVIRONMENT) \ CK_DEFAULT_TIMEOUT=20 \ $*; done # run any given test in an infinite loop %.forever: % @while true; do \ $(TESTS_ENVIRONMENT) \ CK_DEFAULT_TIMEOUT=20 \ $* || break; done # valgrind any given test by running make test.valgrind %.valgrind: % $(TESTS_ENVIRONMENT) \ CK_DEFAULT_TIMEOUT=360 \ G_SLICE=always-malloc \ libtool --mode=execute \ $(VALGRIND_PATH) -q \ $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \ --tool=memcheck --leak-check=full --trace-children=yes \ --leak-resolution=high --num-callers=20 \ ./$* 2>&1 | tee valgrind.log @if grep "==" valgrind.log > /dev/null 2>&1; then \ rm valgrind.log; \ exit 1; \ fi @rm valgrind.log # valgrind any given test and generate suppressions for it %.valgrind.gen-suppressions: % $(TESTS_ENVIRONMENT) \ CK_DEFAULT_TIMEOUT=360 \ G_SLICE=always-malloc \ libtool --mode=execute \ $(VALGRIND_PATH) -q \ $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \ --tool=memcheck --leak-check=full --trace-children=yes \ --leak-resolution=high --num-callers=20 \ --gen-suppressions=all \ ./$* 2>&1 | tee suppressions.log # valgrind any given test until failure by running make test.valgrind-forever %.valgrind-forever: % @while make $*.valgrind; do \ true; done # gdb any given test by running make test.gdb %.gdb: % $(TESTS_ENVIRONMENT) \ CK_FORK=no \ libtool --mode=execute \ gdb $* # torture tests torture: $(TESTS) @echo "Torturing tests ..." for i in `seq 1 $(LOOPS)`; do \ make check || \ (echo "Failure after $$i runs"; exit 1) || \ exit 1; \ done @banner="All $(LOOPS) loops passed"; \ dashes=`echo "$$banner" | sed s/./=/g`; \ echo $$dashes; echo $$banner; echo $$dashes # forever tests forever: $(TESTS) @echo "Forever tests ..." while true; do \ make check || \ (echo "Failure"; exit 1) || \ exit 1; \ done # valgrind all tests valgrind: $(TESTS) @echo "Valgrinding tests ..." @failed=0; \ for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \ make $$t.valgrind; \ if test "$$?" -ne 0; then \ echo "Valgrind error for test $$t"; \ failed=`expr $$failed + 1`; \ whicht="$$whicht $$t"; \ fi; \ done; \ if test "$$failed" -ne 0; then \ echo "$$failed tests had leaks or errors under valgrind:"; \ echo "$$whicht"; \ false; \ fi help: @echo "make check -- run all checks" @echo "make torture -- run all checks $(LOOPS) times" @echo "make (dir)/(test).check -- run the given check once" @echo "make (dir)/(test).forever -- run the given check forever" @echo "make (dir)/(test).torture -- run the given check $(LOOPS) times" @echo @echo "make (dir)/(test).gdb -- start up gdb for the given test" @echo @echo "make valgrind -- valgrind all tests" @echo "make (dir)/(test).valgrind -- valgrind the given test" @echo "make (dir)/(test).valgrind-forever -- valgrind the given test forever" @echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions" @echo " and save to suppressions.log" ############################################################################## # Our helper lib for unit tests ############################################################################## noinst_LIBRARIES = libgnetcheck.a libgnetcheck_a_SOURCES = gnetcheck.c gnetcheck.h ############################################################################## # Details for GNet tests ############################################################################## TESTS_ENVIRONMENT = # override to _not_ install the test plugins install-pluginLTLIBRARIES: # the core dumps of some machines have PIDs appended and profiling data CLEANFILES = core core.* *.gcno *.gcda SUPPRESSIONS = $(top_srcdir)/tests/check/gnet-valgrind.supp EXTRA_DIST = $(SUPPRESSIONS) clean-local: clean-local-check if ENABLE_NETWORK_TESTS NETWORK_CHECKS = gnet/gnettcpsocket else NETWORK_CHECKS = endif check_PROGRAMS = \ $(NETWORK_CHECKS) \ gnet/gnetabi \ gnet/gnetbase64 \ gnet/gnetconn \ gnet/gnetconnhttp \ gnet/gnethash \ gnet/gnetinetaddr \ gnet/gnetipv6 \ gnet/gnetmisc \ gnet/gnetpack \ gnet/gnetunpack \ gnet/gneturi # failing tests noinst_PROGRAMS = TESTS = $(check_PROGRAMS) noinst_HEADERS = \ gnet/struct_i386.h \ gnet/struct_ppc32.h \ gnet/struct_x86_64.h AM_CFLAGS = \ -I$(top_srcdir)/src -I$(top_builddir) \ $(GLIB_CFLAGS) \ $(CHECK_CFLAGS) LDADD = \ $(top_builddir)/tests/check/libgnetcheck.a \ $(top_builddir)/src/libgnet-2.0.la \ $(GLIB_LIBS) \ $(CHECK_LIBS) # valgrind testing # these just need valgrind fixing, period VALGRIND_TO_FIX = # these should never be run with valgrind VALGRIND_IGNORE = # these need fixing because the threads cause segfaults under valgrind TESTS_THREADED = VALGRIND_TESTS_DISABLE = \ $(TESTS_THREADED) \ $(VALGRIND_IGNORE) \ $(VALGRIND_TO_FIX) # directories with source files for coverage tests (relativ to toplevel dir) COVERAGE_DIRS = \ src COVERAGE_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov)) COVERAGE_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_FILES)) COVERAGE_OUT_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov.out)) COVERAGE_OUT_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_OUT_FILES)) debug: echo $(COVERAGE_FILES) echo $(COVERAGE_FILES_REL) .PHONY: coverage if GNET_GCOV_ENABLED coverage: for file in `find $(top_builddir) -name '*.gcda'`; do rm $$file; done make check make coverage-report else coverage: echo "You need to configure with --enable-gcov to get coverage data" exit 1 endif coverage-report: rm -r coverage for dir in $(COVERAGE_DIRS); do \ mkdir -p coverage/$$dir; \ make -C $(top_builddir)/$$dir gcov; \ done for dir in $(COVERAGE_DIRS); do \ files="`ls $(top_builddir)/$$dir/*.gcov.out 2> /dev/null`"; \ if test ! -z "$$files"; then \ perl $(top_srcdir)/common/coverage/coverage-report.pl \ $(top_builddir)/$$dir/*.gcov.out > \ coverage/$$dir/index.xml; \ xsltproc $(top_srcdir)/common/coverage/coverage-report.xsl \ coverage/$$dir/index.xml > coverage/$$dir/index.html; \ fi; \ done for file in $(COVERAGE_FILES_REL); do \ echo Generating coverage/$$file.html; \ perl $(top_srcdir)/common/coverage/coverage-report-entry.pl \ $(top_builddir)/$$file > coverage/$$file.html; \ done gnet-2.0.8/tests/check/gnet/0000777000175000017500000000000010751404362012641 500000000000000gnet-2.0.8/tests/check/gnet/gnettcpsocket.c0000644000175000017500000001362310751326731015606 00000000000000/* GNet GTcpSocket unit test * Copyright (C) 2006 Tim-Philipp Müller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "config.h" #include "gnetcheck.h" typedef enum { TEST_STATE_IDLE = 0, TEST_STATE_CONNECTING, TEST_STATE_CONNECTED } GNetTestState; static GTcpSocketConnectAsyncID cur_id; /* NULL */ static GTcpSocket *cur_socket; /* NULL */ static GNetTestState cur_state = TEST_STATE_IDLE; static gint counter = 0; static void default_log_handler (const gchar *domain, GLogLevelFlags level, const gchar * msg, gpointer data) { if (g_getenv ("GNET_DEBUG") != NULL) { g_print ("%s%s%s", (domain) ? domain: "", (domain) ? ": " : "", msg); } else { static gint counter = 0; if (++counter % 25 == 0) g_print ("."); } } static void sock_cb (GTcpSocket * socket, GTcpSocketConnectAsyncStatus status, gpointer data) { gint c = GPOINTER_TO_INT (data); g_debug ("%p (%03d) socket=%p, status=%d\n", g_thread_self (), c, socket, status); g_assert (cur_id != NULL); g_assert (cur_socket == NULL); switch (status) { case GTCP_SOCKET_CONNECT_ASYNC_STATUS_OK: { cur_state = TEST_STATE_CONNECTED; g_debug ("%p (%03d) connected!\n", g_thread_self (), c); cur_socket = socket; cur_id = NULL; break; } case GTCP_SOCKET_CONNECT_ASYNC_STATUS_INETADDR_ERROR: { g_debug ("%p (%03d) lookup failed!?\n", g_thread_self (), c); gnet_tcp_socket_delete (socket); /* does nothing, socket is NULL */ cur_socket = NULL; cur_id = NULL; cur_state = TEST_STATE_IDLE; break; } case GTCP_SOCKET_CONNECT_ASYNC_STATUS_TCP_ERROR: { g_debug ("%p (%03d) connection refused! (tcp error)\n", g_thread_self (), c); gnet_tcp_socket_delete (socket); /* does nothing, socket is NULL */ cur_socket = NULL; cur_id = NULL; cur_state = TEST_STATE_IDLE; break; } default: g_assert_not_reached (); } } static gboolean idle_cb (gpointer data) { #ifdef GNET_ENABLE_NETWORK_TESTS const gchar *hostnames[] = { "localhost", "127.0.0.1", "www.google.com", "www.gnome.org", "www.yahoo.com", "www.ebay.com", "www.amazon.co.jp" }; #else const gchar *hostnames[] = { "localhost", "127.0.0.1" }; #endif switch (cur_state) { case TEST_STATE_IDLE: { const gchar *hostname; g_assert (cur_id == NULL); g_assert (cur_socket == NULL); hostname = hostnames[counter % G_N_ELEMENTS (hostnames)]; ++counter; g_debug ("%p (%03d) idle: connecting to %s ...\n", g_thread_self (), counter, hostname); cur_id = gnet_tcp_socket_connect_async ("hostname", 1500, sock_cb, GINT_TO_POINTER (counter)); if (cur_id != NULL) { cur_state = TEST_STATE_CONNECTING; } else { g_debug ("%p (%03d) idle: connecting attempt FAILED!\n", g_thread_self (), counter); } break; } case TEST_STATE_CONNECTING: { g_assert (cur_id != NULL); g_assert (cur_socket == NULL); g_debug ("%p (%03d) connecting: cancelling connect ... \n", g_thread_self (), counter); gnet_tcp_socket_connect_async_cancel (cur_id); cur_state = TEST_STATE_IDLE; cur_id = NULL; break; } case TEST_STATE_CONNECTED: { g_assert (cur_id == NULL); g_assert (cur_socket != NULL); g_debug ("%p (%03d) connected: disconnecting ...\n", g_thread_self (), counter); gnet_tcp_socket_delete (cur_socket); cur_socket = NULL; cur_state = TEST_STATE_IDLE; break; } default: g_assert_not_reached (); } /* try to make it a bit less deterministic, also to avoid us creating too * many threads and pthread aborting because of that */ if (((g_random_int () & (3 << 15)) >> 15) == 3) { g_usleep (G_USEC_PER_SEC/4); } return TRUE; /* call again */ } static gboolean stop_connecting (gpointer id) { g_source_remove (GPOINTER_TO_INT (id)); return FALSE; } /* Do lots of connection attemps/cancelling thereof in quick order and * make sure nothing funny is happening. Run in valgrind for extra fun. * (see http://bugzilla.gnome.org/show_bug.cgi?id=305854) * * NOTE: this _might_ abort at some point if we create too many threads, * that's kind of to be expected and depends a lot on the environment. * We should use thread pools for DNS lookups. */ GNET_START_TEST (test_tcp_socket_async_connect_cancel) { GMainLoop *loop; gint idle_id; g_log_set_default_handler (default_log_handler, NULL); loop = g_main_loop_new (NULL, FALSE); idle_id = g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc) idle_cb, NULL, NULL); /* stop connecting after 15 seconds */ g_timeout_add (15 * 1000, (GSourceFunc) stop_connecting, GINT_TO_POINTER (idle_id)); /* stop test after 16 seconds */ g_timeout_add (16 * 1000, (GSourceFunc) g_main_loop_quit, loop); g_main_loop_run (loop); g_main_loop_unref (loop); g_print ("%u attempts\n", counter); } GNET_END_TEST; static Suite * gnettcpsocket_suite (void) { Suite *s = suite_create ("GTcpSocket"); TCase *tc_chain = tcase_create ("tcpsocket"); tcase_set_timeout (tc_chain, 0); suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_tcp_socket_async_connect_cancel); return s; } GNET_CHECK_MAIN (gnettcpsocket); gnet-2.0.8/tests/check/gnet/struct_i386.h0000644000175000017500000000100010751326731015015 00000000000000GNetCheckABIStruct list[] = { {"GConnEvent", sizeof (GConnEvent), 0}, {"GConnHttpEvent", sizeof (GConnHttpEvent), 0}, {"GConnHttpEventResolved", sizeof (GConnHttpEventResolved), 0}, {"GConnHttpEventRedirect", sizeof (GConnHttpEventRedirect), 0}, {"GConnHttpEventResponse", sizeof (GConnHttpEventResponse), 0}, {"GConnHttpEventData", sizeof (GConnHttpEventData), 0}, {"GConnHttpEventError", sizeof (GConnHttpEventError), 0}, {"GServer", sizeof (GServer), 0}, {"GURI", sizeof (GURI), 0}, {NULL, 0, 0} }; gnet-2.0.8/tests/check/gnet/gnetbase64.c0000644000175000017500000001002210751326731014661 00000000000000/* GNet Base64 unit test (deterministic, computation-based tests only) * Copyright (C) 2003 Alfred Reibenschuh * Copyright (C) 2007 Tim-Philipp Müller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "gnetcheck.h" const gchar sesame[] = "Aladdin:open sesame and many many more so come here and see the gold"; const gchar aladin[] = "QWxhZGRpbjpvcGVuIHNlc2FtZSBhbmQgbWFueSBtYW55IG1vcmUgc28gY29tZSBoZXJlIGFuZCBzZWUgdGhlIGdvbGQ="; const gchar aladin_cr[] = "QWxhZGRpbjpvcGVuIHNlc2FtZSBhbmQgbWFueSBtYW55IG1vcmUgc28gY29tZSBoZXJlIGFu\n" "ZCBzZWUgdGhlIGdvbGQ="; GNET_START_TEST (test_base64) { gchar *buf1; gchar *buf2; gint len1, len2; ASSERT_CRITICAL (gnet_base64_encode (NULL, 1, &len1, FALSE)); ASSERT_CRITICAL (gnet_base64_encode (sesame, 1, NULL, FALSE)); ASSERT_CRITICAL (gnet_base64_encode (sesame, -1, NULL, FALSE)); ASSERT_CRITICAL (gnet_base64_decode (NULL, 1, &len1)); ASSERT_CRITICAL (gnet_base64_decode (aladin, 1, NULL)); len1 = 0; buf1 = gnet_base64_encode (sesame, strlen (sesame), &len1, FALSE); fail_unless (buf1 != NULL); /* length includes the final \0 */ fail_unless_equals_int (len1, strlen (aladin) + 1); fail_unless_equals_string (buf1, aladin); g_free (buf1); len1 = 0; buf1 = gnet_base64_encode (sesame, strlen (sesame), &len1, TRUE); fail_unless (buf1 != NULL); /* length includes the final \0 */ fail_unless_equals_int (len1, strlen (aladin_cr) + 1); fail_unless_equals_string (buf1, aladin_cr); g_free (buf1); len2 = 0; buf2 = gnet_base64_decode (aladin, strlen (aladin), &len2); fail_unless (buf2 != NULL); fail_unless_equals_int (len2, strlen (sesame)); fail_unless_equals_string (buf2, sesame); g_free (buf2); /* and the same with -1 as length */ len2 = 0; buf2 = gnet_base64_decode (aladin, -1, &len2); fail_unless (buf2 != NULL); fail_unless_equals_int (len2, strlen (sesame)); fail_unless_equals_string (buf2, sesame); g_free (buf2); len2 = 0; buf2 = gnet_base64_decode (aladin_cr, strlen (aladin_cr), &len2); fail_unless (buf2 != NULL); fail_unless_equals_int (len2, strlen (sesame)); fail_unless_equals_string (buf2, sesame); g_free (buf2); /* and the same with -1 as length */ len2 = 0; buf2 = gnet_base64_decode (aladin_cr, -1, &len2); fail_unless (buf2 != NULL); fail_unless_equals_int (len2, strlen (sesame)); fail_unless_equals_string (buf2, sesame); g_free (buf2); } GNET_END_TEST; /* to test for bug reported on mailing list around 24 Oct 2004: */ GNET_START_TEST (test_base64_8bit) { gchar *buf1; gchar *buf2; gint len1, len2; /* encode ... */ len2 = 0; buf2 = gnet_base64_encode ("A\x84\0", 3, &len2, TRUE); fail_unless (buf2 != NULL); fail_unless_equals_int (len2, strlen ("QYQA") + 1); fail_unless_equals_string (buf2, "QYQA"); /* ... and decode */ len1 = 0; buf1 = gnet_base64_decode (buf2, len2, &len1); fail_unless (buf1 != NULL); fail_unless_equals_int (len1, 3); fail_unless (memcmp (buf1, "A\x84\0", 3) == 0); g_free (buf1); g_free (buf2); } GNET_END_TEST; static Suite * gnetbase64_suite (void) { Suite *s = suite_create ("GNetBase64"); TCase *tc_chain = tcase_create ("base64"); tcase_set_timeout (tc_chain, 0); suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_base64); tcase_add_test (tc_chain, test_base64_8bit); return s; } GNET_CHECK_MAIN (gnetbase64); gnet-2.0.8/tests/check/gnet/gneturi.c0000644000175000017500000002414610751326731014410 00000000000000/* GNet URI parser unit test * Copyright (C) 2001 David Helder * Copyright (C) 2007 Tim-Philipp Müller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "gnetcheck.h" #include #if 0 #define SAFESTRCMP(A,B) (((A)&&(B))?(strcmp((A),(B))):((A)||(B))) #endif GNET_START_TEST (test_uri_errors) { GURI guri; gchar *uri; /* Empty string is an error */ fail_unless (gnet_uri_new("") == NULL); uri = g_strdup (""); fail_unless (!gnet_uri_parse_inplace (&guri, uri, NULL, 0)); g_free (uri); /* String of whitespace is an error */ fail_unless (gnet_uri_new(" \n\t\r") == NULL); uri = g_strdup (" \n\t\r"); fail_unless (!gnet_uri_parse_inplace (&guri, uri, NULL, 0)); g_free (uri); } GNET_END_TEST; /*** test parsing */ struct URITest { gchar* str; gchar* pretty; struct { gchar* scheme; gchar* userinfo; gchar* hostname; gint port; gchar* path; gchar* query; gchar* fragment; } uri; }; struct URITest tests[] = { /* VALID URIS. PARSING AND PRINTING OF THESE SHOULD NOT CHANGE */ /* scheme/path */ { "scheme:", NULL, {"scheme", NULL, NULL, 0, NULL, NULL, NULL}}, { "scheme:path", NULL, {"scheme", NULL, NULL, 0, "path", NULL, NULL}}, { "path", NULL, {NULL, NULL, NULL, 0, "path", NULL, NULL}}, { "/path", NULL, {NULL, NULL, NULL, 0, "/path", NULL, NULL}}, /* hostname/port */ { "scheme://hostname/path", NULL, {"scheme", NULL, "hostname", 0, "/path", NULL, NULL}}, { "scheme://hostname:123/path", NULL, {"scheme", NULL, "hostname", 123, "/path", NULL, NULL}}, /* ipv6 hostname/port */ { "scheme://[01:23:45:67:89:ab:cd:ef]/path", NULL, {"scheme", NULL, "01:23:45:67:89:ab:cd:ef", 0, "/path", NULL, NULL}}, { "scheme://[01:23:45:67:89:ab:cd:ef]:123/path", NULL, {"scheme", NULL, "01:23:45:67:89:ab:cd:ef", 123, "/path", NULL, NULL}}, /* query/fragment */ { "path?query", NULL, {NULL, NULL, NULL, 0, "path", "query", NULL}}, { "path?query#fragment", NULL, {NULL, NULL, NULL, 0, "path", "query", "fragment"}}, { "scheme:path?query#fragment", NULL, {"scheme", NULL, NULL, 0, "path", "query", "fragment"}}, /* full */ { "scheme://hostname:123/path?query#fragment", NULL, {"scheme", NULL, "hostname", 123, "/path", "query", "fragment"}}, /* user/pass */ { "scheme://userinfo@hostname", NULL, {"scheme", "userinfo", "hostname", 0, NULL, NULL, NULL }}, { "scheme://userinfo@hostname:123/path?query#fragment", NULL, {"scheme", "userinfo", "hostname", 123, "/path", "query", "fragment"}}, { "scheme://user:pass@hostname", NULL, {"scheme", "user:pass", "hostname", 0, NULL, NULL, NULL}}, { "scheme://user:pass@hostname:123/path?query#fragment", NULL, {"scheme", "user:pass", "hostname", 123, "/path", "query", "fragment"}}, /* FUNNY URIS. PARSING AND PRINTING OF THESE MAY CHANGE */ { "scheme://hostname:123path?query#fragment", "scheme://hostname:123/path?query#fragment", /* PRETTY */ {"scheme", NULL, "hostname", 123, "path", "query", "fragment"}}, { "scheme:hostname:123/path?query#fragment", NULL, {"scheme", NULL, NULL, 0, "hostname:123/path", "query", "fragment"}}, { "scheme://:pass@hostname:123/path?query#fragment", NULL, {"scheme", ":pass", "hostname", 123, "/path", "query", "fragment"}}, /* IPv6 hostname without brackets */ { "scheme://01:23:45:67:89:ab:cd:ef:123/path", "scheme://01:23/:45:67:89:ab:cd:ef:123/path", /* PRETTY */ {"scheme", NULL, "01", 23, ":45:67:89:ab:cd:ef:123/path", NULL, NULL}}, /* Brackets that don't close - hostname will be everything */ { "scheme://[01:23:45:67:89:ab:cd:ef:123/path", "scheme://[01:23:45:67:89:ab:cd:ef:123/path]", {"scheme", NULL, "01:23:45:67:89:ab:cd:ef:123/path", 0, NULL, NULL, NULL}}, /* Skip initial white space */ { " \f\n\r\t\vscheme:", "scheme:", {"scheme", NULL, NULL, 0, NULL, NULL, NULL}}, { " \f\n\r\t\vpath", "path", {NULL, NULL, NULL, 0, "path", NULL, NULL}}, /* file URI */ { "file://host/home/joe/foo.txt", NULL, {"file", NULL, "host", 0, "/home/joe/foo.txt", NULL, NULL}}, { "file:///home/joe/foo.txt", NULL, {"file", NULL, NULL, 0, "/home/joe/foo.txt", NULL, NULL}} }; static void test_single_uri (struct URITest * test, GURI * uri, gboolean test_escape_unescape) { gchar *pretty; if (g_getenv ("GNET_DEBUG")) { g_printerr ("%s: uri='%s'\n", __FUNCTION__, test->str); } pretty = gnet_uri_get_string (uri); fail_unless (pretty != NULL, "no pretty string for '%s'", test->str); if (test->pretty) { fail_unless_equals_string (pretty, test->pretty); } else { fail_unless_equals_string (pretty, test->str); } #define fail_unless_equals_string_safe(a,b) \ { \ fail_unless (((a) != NULL && (b) != NULL) || ((a) == NULL && (b) == NULL)); \ if ((a) && (b)) { \ fail_unless_equals_string ((a), (b)); \ } \ } fail_unless_equals_string_safe (uri->scheme, test->uri.scheme); fail_unless_equals_string_safe (uri->userinfo, test->uri.userinfo); fail_unless_equals_string_safe (uri->hostname, test->uri.hostname); fail_unless_equals_string_safe (uri->scheme, test->uri.scheme); fail_unless_equals_int (uri->port, test->uri.port); fail_unless_equals_string_safe (uri->path, test->uri.path); fail_unless_equals_string_safe (uri->query, test->uri.query); fail_unless_equals_string_safe (uri->fragment, test->uri.fragment); if (test_escape_unescape) { gchar *unescape; gchar *escape; gnet_uri_escape (uri); escape = gnet_uri_get_string (uri); fail_unless (escape != NULL, "gnet_uri_escape() failed for %s", test->str); gnet_uri_unescape (uri); unescape = gnet_uri_get_string (uri); fail_unless (unescape != NULL, "gnet_uri_unescape() failed for %s after escape", test->str); fail_unless_equals_string (pretty, unescape); g_free (escape); g_free (unescape); } g_free (pretty); } GNET_START_TEST (test_uri_parsing) { guint i; for (i = 0; i < G_N_ELEMENTS (tests); ++i) { /* first the normal heap allocated one */ { GURI *uri; uri = gnet_uri_new (tests[i].str); fail_unless (uri != NULL, "gnet_uri_new(%s) failed", tests[i].str); test_single_uri (&tests[i], uri, TRUE); gnet_uri_delete (uri); } /* and the same with a stack-allocated one */ { GURI uri; gchar hostname[100], *uricpy; uricpy = g_strdup (tests[i].str); fail_unless (gnet_uri_parse_inplace (&uri, uricpy, hostname, 100), "gnet_uri_parse_inplace(%s) failed", tests[i].str); test_single_uri (&tests[i], &uri, FALSE); g_free (uricpy); } } } GNET_END_TEST; /*** test escaping ***/ struct { gchar* escaped; gchar* unescaped; gchar* escaped2; } escape_tests[] = { { "http://userinfo@www.example.com:80/path?query#fragment", "http://userinfo@www.example.com:80/path?query#fragment" , NULL}, { "http://userinfo@www.example.com:80/~path?query#fragment", "http://userinfo@www.example.com:80/~path?query#fragment" , NULL}, { "http://%5euser%5einfo%5e@www.example.com:80/~%5epa%5eth%5e?%5equ%5eery%5e#%5efra%5egment%5e", "http://^user^info^@www.example.com:80/~^pa^th^?^qu^ery^#^fra^gment^" , NULL}, { "http://%5e%5e%5euser%5e%5e%5einfo%5e%5e%5e@www.example.com:80/~%5e%5e%5epa%5e%5e%5eth%5e%5e%5e?%5e%5e%5equ%5e%5e%5eery%5e%5e%5e#%5e%5e%5efra%5e%5e%5egment%5e%5e%5e", "http://^^^user^^^info^^^@www.example.com:80/~^^^pa^^^th^^^?^^^qu^^^ery^^^#^^^fra^^^gment^^^" , NULL}, { "http://user%40info@www.example.com:80/path?query#fragment", "http://user@info@www.example.com:80/path?query#fragment" , NULL}, { "http://user%40info@www.example.com:80/path?query#fragment", "http://user@info@www.example.com:80/path?query#fragment" , NULL}, { "http://www.example.com/pa%th", "http://www.example.com/pa%th", "http://www.example.com/pa%25th"}, { "http://www.example.com/%e9%e9.html", "http://www.example.com/\xe9\xe9.html", NULL } }; GNET_START_TEST (test_uri_escaping) { guint i; for (i = 0; i < G_N_ELEMENTS (escape_tests); ++i) { gchar *escape; gchar *unescape; GURI *uri; uri = gnet_uri_new (escape_tests[i].escaped); fail_unless (uri != NULL, "gnet_uri_new(%s) failed", escape_tests[i].escaped); gnet_uri_unescape (uri); unescape = gnet_uri_get_string (uri); fail_unless (unescape != NULL, "Couldn't unescape '%s'", escape_tests[i].escaped); fail_unless_equals_string (unescape, escape_tests[i].unescaped); g_free (unescape); gnet_uri_escape (uri); escape = gnet_uri_get_string (uri); fail_unless (escape != NULL, "Couldn't re-escape '%s'", escape_tests[i].unescaped); /* and check that the escape is correct */ if (escape_tests[i].escaped2) { fail_unless_equals_string (escape, escape_tests[i].escaped2); } else { fail_unless_equals_string (escape, escape_tests[i].escaped); } g_free (escape); gnet_uri_delete (uri); } } GNET_END_TEST; static Suite * gneturi_suite (void) { Suite *s = suite_create ("GURI"); TCase *tc_chain = tcase_create ("uri"); tcase_set_timeout (tc_chain, 0); suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_uri_errors); tcase_add_test (tc_chain, test_uri_escaping); tcase_add_test (tc_chain, test_uri_parsing); return s; } GNET_CHECK_MAIN (gneturi); gnet-2.0.8/tests/check/gnet/struct_ppc32.h0000644000175000017500000000102410751326731015261 00000000000000 GNetCheckABIStruct list[] = { {"GConnEvent", sizeof (GConnEvent), 12}, {"GConnHttpEvent", sizeof (GConnHttpEvent), 24}, {"GConnHttpEventResolved", sizeof (GConnHttpEventResolved), 44}, {"GConnHttpEventRedirect", sizeof (GConnHttpEventRedirect), 56}, {"GConnHttpEventResponse", sizeof (GConnHttpEventResponse), 68}, {"GConnHttpEventData", sizeof (GConnHttpEventData), 80}, {"GConnHttpEventError", sizeof (GConnHttpEventError), 48}, {"GServer", sizeof (GServer), 24}, {"GURI", sizeof (GURI), 28}, {NULL, 0, 0} }; gnet-2.0.8/tests/check/gnet/gnetpack.c0000644000175000017500000005554510751326731014536 00000000000000/* GNet packing unit test * Copyright (C) 2000, 2002 David Helder * Copyright (C) 2007 Tim-Philipp Müller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "config.h" /* for SIZEOF_VOIDP */ #include "gnetcheck.h" #define PTR_CONSTANT(p) ((void*)((gulong)(p))) static void test_bytes (int line_num, char * s_binary, int len, char * answer_ascii); static const gchar bits2hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; static void test_bytes (int line_num, char * s_binary, int len, char * answer_ascii) { char *s = s_binary; char *answer = answer_ascii; int i; for (i = 0; i < len; ++i) { if (!answer[2 * i] || !answer[(2 * i) + 1] || (bits2hex[(s[i] & 0xf0) >> 4] != answer[2 * i]) || (bits2hex[(s[i] & 0xf) ] != answer[(2 * i) + 1])) { int j; g_printerr ("FAILURE: test at line %u at byte %d\n", line_num, i); g_printerr ("\toutput : "); for (j = 0; j < len; ++j) g_printerr ("%c%c", bits2hex[(s[j] & 0xf0) >> 4], bits2hex[s[j] & 0xf]); g_printerr ("\n\tshould be: %s\n", answer); g_assert (0); /* abort */ } } } /* macros to test format with N arguments (not all compilers support varargs * in macros); We don't use the test number NUM any longer, but keep it around * for now */ #define TEST0(NUM, ANSWER, FORMAT, SIZE) \ G_STMT_START { \ char buffer[SIZE]; \ char *str; \ int len, calclen; \ g_assert (SIZE == strlen(ANSWER)/2); \ calclen = gnet_calcsize (FORMAT); \ fail_unless (calclen == strlen (ANSWER)/2, \ "Calculated length %u for format '%s', but " \ "answer is only %u bytes", calclen, FORMAT, \ strlen (ANSWER) / 2); \ len = gnet_pack (FORMAT, buffer, SIZE); \ fail_unless_equals_int (len, calclen); \ test_bytes (__LINE__, buffer, SIZE, ANSWER); \ len = gnet_pack_strdup (FORMAT, &str); \ test_bytes (__LINE__, buffer, SIZE, ANSWER); \ g_free (str); \ } G_STMT_END; #define TEST1(NUM, ANSWER, FORMAT, SIZE, ARG1) \ G_STMT_START { \ char buffer[SIZE]; \ char *str; \ int len, calclen; \ g_assert (SIZE == strlen(ANSWER)/2); \ calclen = gnet_calcsize (FORMAT, ARG1); \ fail_unless (calclen == strlen (ANSWER)/2, \ "Calculated length %u for format '%s', but " \ "answer is only %u bytes", calclen, FORMAT, \ strlen (ANSWER) / 2); \ len = gnet_pack (FORMAT, buffer, SIZE, ARG1); \ fail_unless_equals_int (len, calclen); \ test_bytes (__LINE__, buffer, SIZE, ANSWER); \ len = gnet_pack_strdup (FORMAT, &str, ARG1); \ test_bytes (__LINE__, buffer, SIZE, ANSWER); \ g_free (str); \ } G_STMT_END; #define TEST2(NUM, ANSWER, FORMAT, SIZE, ARG1, ARG2) \ G_STMT_START { \ char buffer[SIZE]; \ char *str; \ int len, calclen; \ g_assert (SIZE == strlen(ANSWER)/2); \ calclen = gnet_calcsize (FORMAT, ARG1, ARG2); \ fail_unless (calclen == strlen (ANSWER)/2, \ "Calculated length %u for format '%s', but " \ "answer is only %u bytes", calclen, FORMAT, \ strlen (ANSWER) / 2); \ len = gnet_pack (FORMAT, buffer, SIZE, ARG1, ARG2);\ fail_unless_equals_int (len, calclen); \ test_bytes (__LINE__, buffer, SIZE, ANSWER); \ len = gnet_pack_strdup (FORMAT, &str, ARG1, ARG2);\ test_bytes (__LINE__, buffer, SIZE, ANSWER); \ g_free (str); \ } G_STMT_END; #define TEST3(NUM, ANSWER, FORMAT, SIZE, ARG1, ARG2, ARG3) \ G_STMT_START { \ char buffer[SIZE]; \ char *str; \ int len, calclen; \ g_assert (SIZE == strlen(ANSWER)/2); \ calclen = gnet_calcsize (FORMAT, ARG1, ARG2, ARG3);\ fail_unless (calclen == strlen (ANSWER)/2, \ "Calculated length %u for format '%s', but " \ "answer is only %u bytes", calclen, FORMAT, \ strlen (ANSWER) / 2); \ len = gnet_pack (FORMAT, buffer, SIZE, ARG1, ARG2, ARG3);\ fail_unless_equals_int (len, calclen); \ test_bytes (__LINE__, buffer, SIZE, ANSWER); \ len = gnet_pack_strdup (FORMAT, &str, ARG1, ARG2, ARG3);\ test_bytes (__LINE__, buffer, SIZE, ANSWER); \ g_free (str); \ } G_STMT_END; #define TEST4(NUM, ANSWER, FORMAT, SIZE, ARG1, ARG2, ARG3, ARG4) \ G_STMT_START { \ char buffer[SIZE]; \ char *str; \ int len, calclen; \ g_assert (SIZE == strlen(ANSWER)/2); \ calclen = gnet_calcsize (FORMAT, ARG1, ARG2, ARG3, ARG4);\ fail_unless (calclen == strlen (ANSWER)/2, \ "Calculated length %u for format '%s', but " \ "answer is only %u bytes", calclen, FORMAT, \ strlen (ANSWER) / 2); \ len = gnet_pack (FORMAT, buffer, SIZE, ARG1, ARG2, ARG3, ARG4);\ fail_unless_equals_int (len, calclen); \ test_bytes (__LINE__, buffer, SIZE, ANSWER); \ len = gnet_pack_strdup (FORMAT, &str, ARG1, ARG2, ARG3, ARG4);\ test_bytes (__LINE__, buffer, SIZE, ANSWER); \ g_free (str); \ } G_STMT_END; #define MEMTEST1(NUM, FORMAT, SIZE, ARG1) \ G_STMT_START { \ char buffer[SIZE]; \ char *str; \ int len, calclen; \ calclen = gnet_calcsize (FORMAT, ARG1); \ fail_unless_equals_int (SIZE, calclen); \ len = gnet_pack (FORMAT, buffer, SIZE, ARG1); \ fail_unless_equals_int (len, calclen); \ len = gnet_pack_strdup (FORMAT, &str, ARG1); \ fail_unless_equals_int (len, calclen); \ g_free (str); \ } G_STMT_END; /*** FAILURES (these cause warnings) ***/ GNET_START_TEST (test_pack_failures) { gchar buffer[256]; ASSERT_CRITICAL (gnet_pack ("b", buffer, 0, 0)); ASSERT_CRITICAL (gnet_pack ("B", buffer, 0, 0)); ASSERT_CRITICAL (gnet_pack ("h", buffer, sizeof(short) - 1, 0)); ASSERT_CRITICAL (gnet_pack ("H", buffer, sizeof(unsigned short) - 1, 0)); ASSERT_CRITICAL (gnet_pack ("i", buffer, sizeof(int) - 1, 0)); ASSERT_CRITICAL (gnet_pack ("I", buffer, sizeof(unsigned int) - 1, 0)); ASSERT_CRITICAL (gnet_pack ("l", buffer, sizeof(long) - 1, 0)); ASSERT_CRITICAL (gnet_pack ("L", buffer, sizeof (gulong) - 1, 0)); ASSERT_CRITICAL (gnet_pack ("f", buffer, sizeof(float) - 1, 0)); ASSERT_CRITICAL (gnet_pack ("d", buffer, sizeof(double) - 1, 0)); ASSERT_CRITICAL (gnet_pack ("s", buffer, 5, "hello")); ASSERT_CRITICAL (gnet_pack ("ss", buffer, 11, "hello", "world")); ASSERT_CRITICAL (gnet_pack ("12S", buffer, 11, "booger")); ASSERT_CRITICAL (gnet_pack ("4S", buffer, 3, "david")); ASSERT_CRITICAL (gnet_pack ("6S", buffer, 5, "helder")); ASSERT_CRITICAL (gnet_pack ("2r", buffer, 7, "abcd", 4, "efgh", 4)); ASSERT_CRITICAL (gnet_pack ("4R", buffer, 3, "dcba")); ASSERT_CRITICAL (gnet_pack ("4R4R", buffer, 7, "efgh", "abcd")); ASSERT_CRITICAL (gnet_pack ("p", buffer, 4, "abcd")); ASSERT_CRITICAL (gnet_pack ("2p", buffer, 9, "efgh", "abcd")); } GNET_END_TEST; /*** STRINGS ***/ GNET_START_TEST (test_pack_strings) { TEST2 (40000, "68656c6c6f00746865726500", "ss", 12, "hello", "there"); TEST2 (40010, "74686572650068656c6c6f00", "2s", 12, "there", "hello"); TEST1 (40020, "626f6f676572000000000000", "12S", 12, "booger"); TEST1 (40030, "64617669", "4S", 4, "david"); TEST1 (40040, "68656c646572", "6S", 6, "helder"); TEST2 (40050, "64636261", "r", 4, "dcba", 4); TEST4 (40060, "6162636465666768", "2r", 8, "abcd", 4, "efgh", 4); TEST1 (40070, "64636261", "4R", 4, "dcba"); TEST2 (40080, "6566676861626364", "4R4R", 8, "efgh", "abcd"); TEST1 (40090, "0461626364", "p", 5, "abcd"); TEST2 (40100, "04656667680461626364", "2p", 10, "efgh", "abcd"); } GNET_END_TEST; /*** LITTLE ENDIAN, STANDARD SIZES ***/ GNET_START_TEST (test_pack_little_endian) { TEST0 (20100, "00", "x", 1); TEST1 (30200, "17", ">b", 1, 0x17); TEST1 (30210, "f1", ">b", 1, 0xf1); TEST1 (30300, "17", ">B", 1, 0x17); TEST1 (30310, "f1", ">B", 1, 0xf1); TEST1 (30400, "0102", ">h", 2, 0x0102); TEST1 (30410, "f001", ">h", 2, 0xf001); TEST1 (30420, "01f0", ">h", 2, 0x01f0); TEST1 (30500, "0102", ">H", 2, 0x0102); TEST1 (30510, "f001", ">H", 2, 0xf001); TEST1 (30520, "01f0", ">H", 2, 0x01f0); TEST1 (30600, "01020304", ">i", 4, 0x01020304); TEST1 (30610, "f1020304", ">i", 4, 0xf1020304); TEST1 (30620, "010203f4", ">i", 4, 0x010203f4); TEST1 (30700, "01020304", ">I", 4, 0x01020304); TEST1 (30710, "f1020304", ">I", 4, 0xf1020304); TEST1 (30720, "010203f4", ">I", 4, 0x010203f4); TEST1 (30800, "01020304", ">l", 4, 0x01020304); TEST1 (30810, "f1020304", ">l", 4, 0xf1020304); TEST1 (30820, "010203f4", ">l", 4, 0x010203f4); TEST1 (30900, "01020304", ">L", 4, 0x01020304); TEST1 (30910, "f1020304", ">L", 4, 0xf1020304); TEST1 (30920, "010203f4", ">L", 4, 0x010203f4); /* these should always be native size and endianness */ /* CHECKME: do floats not get promoted to doubles in vararg functions?! */ MEMTEST1 (31000, ">f", sizeof(float), 23.43); MEMTEST1 (31010, ">d", sizeof(double), 43.21); TEST3 (31200, "00000102", ">bhb", 4, 0x00, 0x0001, 0x02); TEST2 (31210, "0102030405060708", ">ii", 8, 0x01020304, 0x05060708); TEST2 (31220, "0102030405060708", ">2i", 8, 0x01020304, 0x05060708); } GNET_END_TEST; /*** NATIVE MODE, NATIVE SIZES ***/ GNET_START_TEST (test_pack_native_common) { TEST0 (10100, "00", "x", 1); TEST1 (10200, "17", "b", 1, 0x17); TEST1 (10210, "f1", "b", 1, 0xf1); TEST1 (10300, "17", "B", 1, 0x17); TEST1 (10310, "f1", "B", 1, 0xf1); MEMTEST1 (11000, "f", sizeof(float), 23.43); MEMTEST1 (11010, "d", sizeof(double), 43.21); } GNET_END_TEST; GNET_START_TEST (test_pack_native_little_endian) { /* NATIVE LITTLE ENDIAN */ TEST1 (10400, "0201", "h", sizeof(short), 0x0102); TEST1 (10410, "01f0", "h", sizeof(short), 0xf001); TEST1 (10420, "f001", "h", sizeof(short), 0x01f0); TEST1 (10500, "0201", "H", sizeof(short), 0x0102); TEST1 (10510, "01f0", "H", sizeof(short), 0xf001); TEST1 (10520, "f001", "H", sizeof(short), 0x01f0); TEST1 (10600, "04030201", "i", sizeof(int), 0x01020304); TEST1 (10610, "040302f1", "i", sizeof(int), 0xf1020304); TEST1 (10620, "f4030201", "i", sizeof(int), 0x010203f4); TEST1 (10700, "04030201", "I", sizeof(unsigned int), 0x01020304); TEST1 (10710, "040302f1", "I", sizeof(unsigned int), 0xf1020304); TEST1 (10720, "f4030201", "I", sizeof(unsigned int), 0x010203f4); /* 'native mode' - should replicate full size of long, ie. 4 or 8 bytes * depending on architecture */ if (sizeof (long) == 4) { TEST1 (10800, "04030201", "l", sizeof (glong), (glong) 0x01020304); TEST1 (10810, "040302f1", "l", sizeof (glong), (glong) 0xf1020304); TEST1 (10820, "f4030201", "l", sizeof (glong), (glong) 0x010203f4); TEST1 (10900, "04030201", "L", sizeof (gulong), (gulong) 0x01020304); TEST1 (10910, "040302f1", "L", sizeof (gulong), (gulong) 0xf1020304); TEST1 (10920, "f4030201", "L", sizeof (gulong), (gulong) 0x010203f4); } else if (sizeof (long) == 8) { TEST1 (10800, "0403020100000000", "l", sizeof (glong), (glong) 0x01020304); TEST1 (10810, "040302f100000000", "l", sizeof (glong), (glong) 0xf1020304); TEST1 (10820, "f403020100000000", "l", sizeof (glong), (glong) 0x010203f4); TEST1 (10900, "0403020100000000", "L", sizeof (gulong), (gulong) 0x01020304); TEST1 (10910, "040302f100000000", "L", sizeof (gulong), (gulong) 0xf1020304); TEST1 (10920, "f403020100000000", "L", sizeof (gulong), (gulong) 0x010203f4); } /* in little-endian or big-endian 'standard mode' the sizes are independent * of the architecture (ie. always 4 bytes for long); we know we're little * endian here */ TEST1 (10800, "04030201", "v", sizeof(void*), PTR_CONSTANT (0x01020304)); TEST1 (11110, "f1020304", ">v", sizeof(void*), PTR_CONSTANT (0xf1020304)); TEST1 (11120, "010203f4", ">v", sizeof(void*), PTR_CONSTANT (0x010203f4)); #elif SIZEOF_VOIDP == 8 TEST1 (11100, "0807060504030201", "v", sizeof(void*), PTR_CONSTANT (0x0102030405060708)); TEST1 (11110, "08070605040302f1", "v", sizeof(void*), PTR_CONSTANT (0xf102030405060708)); TEST1 (11120, "f8070605f4030201", "v", sizeof(void*), PTR_CONSTANT (0x010203f4050607f8)); /* with little endian modifier */ TEST1 (11100, "0807060504030201", "v", sizeof(void*), PTR_CONSTANT (0x0102030405060708)); TEST1 (11110, "f102030405060708", ">v", sizeof(void*), PTR_CONSTANT (0xf102030405060708)); TEST1 (11120, "010203f4050607f8", ">v", sizeof(void*), PTR_CONSTANT (0x010203f4050607f8)); #else # error "sizeof(void *) neither 4 nor 8!?" #endif TEST3 (11200, "00010002", "bhb", 4, 0x00, 0x0001, 0x02); TEST2 (11210, "0403020108070605", "ii", 8, 0x01020304, 0x05060708); TEST2 (11220, "0403020108070605", "2i", 8, 0x01020304, 0x05060708); } GNET_END_TEST; GNET_START_TEST (test_pack_native_big_endian) { /* NATIVE BIG ENDIAN */ TEST1 (10400, "0102", "h", sizeof(short), 0x0102); TEST1 (10410, "f001", "h", sizeof(short), 0xf001); TEST1 (10420, "01f0", "h", sizeof(short), 0x01f0); TEST1 (10500, "0102", "H", sizeof(short), 0x0102); TEST1 (10510, "f001", "H", sizeof(short), 0xf001); TEST1 (10520, "01f0", "H", sizeof(short), 0x01f0); TEST1 (10600, "01020304", "i", sizeof(int), 0x01020304); TEST1 (10610, "f1020304", "i", sizeof(int), 0xf1020304); TEST1 (10620, "010203f4", "i", sizeof(int), 0x010203f4); TEST1 (10700, "01020304", "I", sizeof(unsigned int), 0x01020304); TEST1 (10710, "f1020304", "I", sizeof(unsigned int), 0xf1020304); TEST1 (10720, "010203f4", "I", sizeof(unsigned int), 0x010203f4); /* 'native mode' - should replicate full size of long, ie. 4 or 8 bytes * depending on architecture */ if (sizeof (long) == 4) { TEST1 (10800, "01020304", "l", sizeof (glong), (glong) 0x01020304); TEST1 (10810, "f1020304", "l", sizeof (glong), (glong) 0xf1020304); TEST1 (10820, "010203f4", "l", sizeof (glong), (glong) 0x010203f4); TEST1 (10900, "01020304", "L", sizeof (gulong), (gulong) 0x01020304); TEST1 (10910, "f1020304", "L", sizeof (gulong), (gulong) 0xf1020304); TEST1 (10920, "010203f4", "L", sizeof (gulong), (gulong) 0x010203f4); } else if (sizeof (long) == 8) { TEST1 (10800, "0000000001020304", "l", sizeof (glong), (glong) 0x01020304); TEST1 (10810, "00000000f1020304", "l", sizeof (glong), (glong) 0xf1020304); TEST1 (10820, "00000000010203f4", "l", sizeof (glong), (glong) 0x010203f4); TEST1 (10900, "0000000001020304", "L", sizeof (gulong), (gulong) 0x01020304); TEST1 (10910, "00000000f1020304", "L", sizeof (gulong), (gulong) 0xf1020304); TEST1 (10920, "00000000010203f4", "L", sizeof (gulong), (gulong) 0x010203f4); } /* in little-endian or big-endian 'standard mode' the sizes are independent * of the architecture (ie. always 4 bytes for long); we know we're little * endian here */ TEST1 (10800, "01020304", ">l", sizeof (guint32), (glong) 0x01020304); TEST1 (10810, "f1020304", ">l", sizeof (guint32), (glong) 0xf1020304); TEST1 (10820, "010203f4", ">l", sizeof (guint32), (glong) 0x010203f4); TEST1 (10900, "01020304", ">L", sizeof (guint32), (gulong) 0x01020304); TEST1 (10910, "f1020304", ">L", sizeof (guint32), (gulong) 0xf1020304); TEST1 (10920, "010203f4", ">L", sizeof (guint32), (gulong) 0x010203f4); /* pointers are always in native size, but endianness modifiers should * still work (as it hasn't been documented otherwise) */ #if SIZEOF_VOIDP == 4 TEST1 (11100, "01020304", "v", sizeof(void*), PTR_CONSTANT (0x01020304)); TEST1 (11110, "f1020304", "v", sizeof(void*), PTR_CONSTANT (0xf1020304)); TEST1 (11120, "010203f4", "v", sizeof(void*), PTR_CONSTANT (0x010203f4)); /* with little endian modifier */ TEST1 (11100, "04030201", "v", sizeof(void*), PTR_CONSTANT (0x01020304)); TEST1 (11110, "f1020304", ">v", sizeof(void*), PTR_CONSTANT (0xf1020304)); TEST1 (11120, "010203f4", ">v", sizeof(void*), PTR_CONSTANT (0x010203f4)); #elif SIZEOF_VOIDP == 8 TEST1 (11100, "0102030405060708", "v", sizeof(void*), PTR_CONSTANT(0x0102030405060708)); TEST1 (11110, "f1020304f5f6f7f8", "v", sizeof(void*), PTR_CONSTANT(0xf1020304f5f6f7f8)); TEST1 (11120, "010203f4050607f8", "v", sizeof(void*), PTR_CONSTANT(0x010203f4050607f8)); /* with little endian modifier */ TEST1 (11100, "0807060504030201", "v", sizeof(void*), PTR_CONSTANT(0x0102030405060708)); TEST1 (11110, "f1020304f5f6f7f8", ">v", sizeof(void*), PTR_CONSTANT(0xf1020304f5f6f7f8)); TEST1 (11120, "010203f4050607f8", ">v", sizeof(void*), PTR_CONSTANT(0x010203f4050607f8)); #else # error "sizeof(void *) neither 4 nor 8!?" #endif TEST3 (11200, "00000102", "bhb", 4, 0x00, 0x0001, 0x02); TEST2 (11201, "0102030405060708", "ii", 8, 0x01020304, 0x05060708); TEST2 (11202, "0102030405060708", "2i", 8, 0x01020304, 0x05060708); } GNET_END_TEST; static Suite * gnetpack_suite (void) { Suite *s = suite_create ("GNetPacking"); TCase *tc_chain = tcase_create ("packing"); tcase_set_timeout (tc_chain, 0); suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_pack_strings); tcase_add_test (tc_chain, test_pack_native_common); if (G_BYTE_ORDER == G_LITTLE_ENDIAN) { tcase_add_test (tc_chain, test_pack_native_little_endian); } else { tcase_add_test (tc_chain, test_pack_native_big_endian); } tcase_add_test (tc_chain, test_pack_big_endian); tcase_add_test (tc_chain, test_pack_little_endian); tcase_add_test (tc_chain, test_pack_failures); return s; } GNET_CHECK_MAIN (gnetpack); gnet-2.0.8/tests/check/gnet/gnetunpack.c0000644000175000017500000003147610751326731015076 00000000000000/* GNet packing unpack unit test * Copyright (C) 2000, 2002 David Helder * Copyright (C) 2007 Tim-Philipp Müller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "config.h" #include "gnetcheck.h" #include #define PTR_CONSTANT(p) ((void*)((gulong)(p))) #define TEST1(NUM, ANS, FORMAT, ADDR, LEN, ARG1) do {\ ARG1 = 0; \ gnet_unpack (FORMAT, ADDR, LEN, &ARG1); \ fail_unless (ARG1 == ANS); } while (0) #define TEST2(NUM, ANS, ANS2, FORMAT, ADDR, LEN, ARG1, ARG2) do {\ ARG1 = 0; \ ARG2 = 0; \ gnet_unpack (FORMAT, ADDR, LEN, &ARG1, &ARG2); \ fail_unless (ARG1 == ANS); \ fail_unless (ARG2 == ANS2); } while (0) #define TEST3(NUM, ANS, ANS2, ANS3, FORMAT, ADDR, LEN, ARG1, ARG2, ARG3) do {\ ARG1 = 0; \ ARG2 = 0; \ ARG3 = 0; \ gnet_unpack (FORMAT, ADDR, LEN, &ARG1, &ARG2, &ARG3); \ fail_unless (ARG1 == ANS); \ fail_unless (ARG2 == ANS2); \ fail_unless (ARG3 == ANS3); } while (0) const char buf[12] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b}; const char bufh[12] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb}; /*** STRINGS ***/ #define TEST1S(NUM, ANS, FORMAT, BUF, LEN, ARG1) do { \ ARG1 = NULL; \ gnet_unpack (FORMAT, BUF, LEN, &ARG1); \ fail_unless_equals_string (ARG1, ANS); \ g_free(ARG1); } while (0) #define TEST2S(NUM, ANS, ANS2, FORMAT, BUF, LEN, ARG1, ARG2) do {\ ARG1 = NULL; \ ARG2 = NULL; \ gnet_unpack (FORMAT, BUF, LEN, &ARG1, &ARG2); \ fail_unless_equals_string (ARG1, ANS); g_free(ARG1); \ fail_unless_equals_string (ARG2, ANS2); g_free(ARG2); \ } while (0) GNET_START_TEST (test_unpack_strings) { char hello[20] = "hello\0there"; char hellop[12] = {0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x05, 0x74, 0x68, 0x65, 0x72, 0x65 }; gchar *s1, *s2; TEST2S (40000, "hello", "there", "ss", hello, 12, s1, s2); TEST2S (40010, "hello", "there", "2s", hello, 12, s1, s2); s1 = NULL; gnet_unpack ("8S", hello, 6, &s1); fail_unless_equals_string (s1, "hello"); fail_unless_equals_int (s1[6], 0); g_free (s1); TEST1S (40110, "hello", "6S", hello, 6, s1); TEST1S (40120, "hell", "4S", hello, 6, s1); TEST2S (40200, "hello", "there", "6S6S", hello, 12, s1, s2); s1 = s2 = NULL; gnet_unpack ("r", hello, 6, &s1, 6); fail_unless_equals_string (s1, "hello"); g_free (s1); s1 = s2 = NULL; gnet_unpack ("2r", hello, 12, &s1, 6, &s2, 6); fail_unless_equals_string (s1, "hello"); fail_unless_equals_string (s2, "there"); g_free (s1); g_free (s2); TEST1S (40400, "hello", "6R", hello, 6, s1); TEST2S (40410, "hello", "there", "6R6R", hello, 12, s1, s2); TEST1S (40500, "hello", "p", hellop, 6, s1); TEST2S (40510, "hello", "there", "pp", hellop, 12, s1, s2); TEST2S (40520, "hello", "there", "2p", hellop, 12, s1, s2); } GNET_END_TEST; /*** NATIVE ***/ GNET_START_TEST (test_unpack_native_common) { unsigned char iguint8; double doubley; float floaty; char igint8; /* use variable here for answer to avoid 'comparison always false due to * limited range of variable' compiler warnings (gcc-4.1.3) when just using * a simple cast and passing that into the comparison directly */ char agint8; gnet_unpack ("x", buf, 1); fail_unless_equals_int (0, 0); TEST1 (10100, 0x01, "b", &buf[1], sizeof(igint8), igint8); agint8 = (gint8) 0xf1; TEST1 (10110, agint8, "b", &bufh[1], sizeof(igint8), igint8); TEST1 (10200, 0x01, "B", &buf[1], sizeof(iguint8), iguint8); TEST1 (10210, 0xf1, "B", &bufh[1], sizeof(iguint8), iguint8); gnet_unpack ("f", &buf[1], sizeof(float), &floaty); gnet_unpack ("d", &bufh[1], sizeof(double), &doubley); } GNET_END_TEST; /*** NATIVE LITTLE ENDIAN ***/ GNET_START_TEST (test_unpack_native_little_endian) { char igint8, igint8_2; short igint16; unsigned short iguint16; int igint32, igint32_2; unsigned int iguint32; long lgint32; unsigned long lguint32; void* voidp; TEST1 (10300, 0x0201, "h", &buf[1], sizeof(igint16), igint16); TEST1 (10310, 0xfffff2f1, "h", &bufh[1], sizeof(igint16), igint16); TEST1 (10400, 0x0201, "H", &buf[1], sizeof(iguint16), iguint16); TEST1 (10410, 0xf2f1, "H", &bufh[1], sizeof(iguint16), iguint16); TEST1 (10500, 0x4030201, "i", &buf[1], sizeof(igint32), igint32); TEST1 (10510, 0xf4f3f2f1, "i", &bufh[1], sizeof(igint32), igint32); TEST1 (10600, 0x04030201, "I", &buf[1], sizeof(iguint32), iguint32); TEST1 (10610, 0xf4f3f2f1, "I", &bufh[1], sizeof(iguint32), iguint32); #if (SIZEOF_LONG == 8) TEST1 (10700, 0x0807060504030201, "l", &buf[1], sizeof(lgint32), lgint32); TEST1 (10710, 0xf8f7f6f5f4f3f2f1, "l", &bufh[1], sizeof(lgint32), lgint32); TEST1 (10800, 0x0807060504030201, "L", &buf[1], sizeof(lguint32), lguint32); TEST1 (10810, 0xf8f7f6f5f4f3f2f1, "L", &bufh[1], sizeof(lguint32), lguint32); #else TEST1 (10700, 0x4030201, "l", &buf[1], sizeof(lgint32), lgint32); TEST1 (10710, 0xf4f3f2f1, "l", &bufh[1], sizeof(lgint32), lgint32); TEST1 (10800, 0x04030201, "L", &buf[1], sizeof(lguint32), lguint32); TEST1 (10810, 0xf4f3f2f1, "L", &bufh[1], sizeof(lguint32), lguint32); #endif #if (SIZEOF_VOIDP == 4) TEST1 (11000, PTR_CONSTANT (0x04030201), "v", &buf[1], sizeof(void*), voidp); TEST1 (11010, PTR_CONSTANT (0xf4f3f2f1), "v", &bufh[1], sizeof(void*), voidp); #else TEST1 (11000, PTR_CONSTANT (0x0807060504030201), "v", &buf[1], sizeof(void*), voidp); TEST1 (11010, PTR_CONSTANT (0xf8f7f6f5f4f3f2f1), "v", &bufh[1], sizeof(void*), voidp); #endif TEST3 (12000, 0x01, 0x0302, 0x04, "bhb", &buf[1], 4, igint8, igint16, igint8_2); TEST2 (12010, 0x04030201, 0x08070605, "ii", &buf[1], 8, igint32, igint32_2); TEST2 (12020, 0x04030201, 0x08070605, "2i", &buf[1], 8, igint32, igint32_2); } GNET_END_TEST; GNET_START_TEST (test_unpack_native_big_endian) { char igint8, igint8_2; short igint16; unsigned short iguint16; int igint32, igint32_2; unsigned int iguint32; long lgint32; unsigned long lguint32; void* voidp; /* NATIVE BIG ENDIAN */ TEST1 (10300, 0x0102, "h", &buf[1], sizeof(igint16), igint16); TEST1 (10310, 0xfffff1f2, "h", &bufh[1], sizeof(igint16), igint16); TEST1 (10400, 0x0102, "H", &buf[1], sizeof(iguint16), iguint16); TEST1 (10410, 0xf1f2, "H", &bufh[1], sizeof(iguint16), iguint16); TEST1 (10500, 0x01020304, "i", &buf[1], sizeof(igint32), igint32); TEST1 (10510, 0xf1f2f3f4, "i", &bufh[1], sizeof(igint32), igint32); TEST1 (10600, 0x01020304, "I", &buf[1], sizeof(iguint32), iguint32); TEST1 (10610, 0xf1f2f3f4, "I", &bufh[1], sizeof(iguint32), iguint32); #if (SIZEOF_LONG == 8) TEST1 (10700, 0x0102030405060708, "l", &buf[1], sizeof(lgint32), lgint32); TEST1 (10710, 0xf1f2f3f4f5f6f7f8, "l", &bufh[1], sizeof(lgint32), lgint32); TEST1 (10800, 0x0102030405060708, "L", &buf[1], sizeof(lguint32), lguint32); TEST1 (10810, 0xf1f2f3f4f5f6f7f8, "L", &bufh[1], sizeof(lguint32), lguint32); #else TEST1 (10700, 0x01020304, "l", &buf[1], sizeof(lgint32), lgint32); TEST1 (10710, 0xf1f2f3f4, "l", &bufh[1], sizeof(lgint32), lgint32); TEST1 (10800, 0x01020304, "L", &buf[1], sizeof(lguint32), lguint32); TEST1 (10810, 0xf1f2f3f4, "L", &bufh[1], sizeof(lguint32), lguint32); #endif #if (SIZEOF_VOIDP == 4) TEST1 (11000, PTR_CONSTANT (0x01020304), "v", &buf[1], sizeof(void*), voidp); TEST1 (11010, PTR_CONSTANT (0xf1f2f3f4), "v", &bufh[1], sizeof(void*), voidp); #else TEST1 (11000, PTR_CONSTANT (0x0102030405060708), "v", &buf[1], sizeof(void*), voidp); TEST1 (11010, PTR_CONSTANT (0xf1f2f3f4f5f6f7f8), "v", &bufh[1], sizeof(void*), voidp); #endif TEST3 (12000, 0x01, 0x0203, 0x04, "bhb", &buf[1], 4, igint8, igint16, igint8_2); TEST2 (12010, 0x01020304, 0x05060708, "ii", &buf[1], 8, igint32, igint32_2); TEST2 (12020, 0x01020304, 0x05060708, "2i", &buf[1], 8, igint32, igint32_2); } GNET_END_TEST; /*** LITTLE ENDIAN ***/ GNET_START_TEST (test_unpack_little_endian) { unsigned char iguint8; char igint8, igint8_2; short igint16; unsigned short iguint16; int igint32, igint32_2; unsigned int iguint32; double doubley; float floaty; /* use variable here for answer to avoid 'comparison always false due to * limited range of variable' compiler warnings (gcc-4.1.3) when just using * a simple cast and passing that into the comparison directly */ char agint8; gnet_unpack ("x", buf, 1); TEST1 (30100, 0x01, ">b", &buf[1], 1, igint8); agint8 = (gint8) 0xf1; TEST1 (30110, agint8, ">b", &bufh[1], 1, igint8); TEST1 (30200, 0x01, ">B", &buf[1], 1, iguint8); TEST1 (30210, 0xf1, ">B", &bufh[1], 1, iguint8); TEST1 (30300, 0x0102, ">h", &buf[1], 2, igint16); TEST1 (30310, 0xfffff1f2, ">h", &bufh[1], 2, igint16); TEST1 (30400, 0x0102, ">H", &buf[1], 2, iguint16); TEST1 (30410, 0xf1f2, ">H", &bufh[1], 2, iguint16); TEST1 (30500, 0x01020304, ">i", &buf[1], 4, igint32); TEST1 (30510, 0xf1f2f3f4, ">i", &bufh[1], 4, igint32); TEST1 (30600, 0x01020304, ">I", &buf[1], 4, iguint32); TEST1 (30610, 0xf1f2f3f4, ">I", &bufh[1], 4, iguint32); TEST1 (30700, 0x01020304, ">l", &buf[1], 4, igint32); TEST1 (30710, 0xf1f2f3f4, ">l", &bufh[1], 4, igint32); TEST1 (30800, 0x01020304, ">L", &buf[1], 4, iguint32); TEST1 (30810, 0xf1f2f3f4, ">L", &bufh[1], 4, iguint32); gnet_unpack (">f", &buf[1], sizeof(float), &floaty); gnet_unpack (">d", &bufh[1], sizeof(double), &doubley); TEST3 (32000, 0x01, 0x0203, 0x04, ">bhb", &buf[1], 4, igint8, igint16, igint8_2); TEST2 (32010, 0x01020304, 0x05060708, ">ii", &buf[1], 8, igint32, igint32_2); TEST2 (32020, 0x01020304, 0x05060708, ">2i", &buf[1], 8, igint32, igint32_2); } GNET_END_TEST; static Suite * gnetunpack_suite (void) { Suite *s = suite_create ("GNetUnpacking"); TCase *tc_chain = tcase_create ("unpacking"); tcase_set_timeout (tc_chain, 0); suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_unpack_strings); tcase_add_test (tc_chain, test_unpack_native_common); if (G_BYTE_ORDER == G_LITTLE_ENDIAN) { tcase_add_test (tc_chain, test_unpack_native_little_endian); } else { tcase_add_test (tc_chain, test_unpack_native_big_endian); } tcase_add_test (tc_chain, test_unpack_big_endian); tcase_add_test (tc_chain, test_unpack_little_endian); return s; } GNET_CHECK_MAIN (gnetunpack); gnet-2.0.8/tests/check/gnet/gnetconnhttp.c0000644000175000017500000004757410751326731015460 00000000000000/* GNet GConnHttp unit test * Copyright (C) 2004, 2007 Tim-Philipp Müller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define GNET_EXPERIMENTAL 1 #include "config.h" #include "gnetcheck.h" #include static gboolean verbose; /* FALSE */ /* Print some information along the way (only for debugging purposes) */ static void http_dbg_callback (GConnHttp *http, GConnHttpEvent *event, gpointer baz) { if (!verbose) return; switch (event->type) { case GNET_CONN_HTTP_RESOLVED: { GConnHttpEventResolved *ev_resolved = (GConnHttpEventResolved*)event; if (ev_resolved->ia) { gchar *cname; cname = gnet_inetaddr_get_canonical_name (ev_resolved->ia); g_printerr ("RESOLVED: %s\n\n", cname); g_free (cname); } else { g_printerr ("RESOLVED: FAILED TO RESOLVE HOSTNAME.\n"); } } break; case GNET_CONN_HTTP_RESPONSE: { GConnHttpEventResponse *ev_response = (GConnHttpEventResponse*)event; guint n; g_printerr ("RESPONSE: %u\n", ev_response->response_code); for (n = 0; ev_response->header_fields[n] != NULL; ++n) { g_printerr ("HEADER: %s: %s\n", ev_response->header_fields[n], ev_response->header_values[n]); } g_printerr ("\n"); } break; case GNET_CONN_HTTP_DATA_PARTIAL: { GConnHttpEventData *ev_data = (GConnHttpEventData*)event; if (ev_data->content_length > 0) g_printerr ("PARTIAL DATA: %" G_GUINT64_FORMAT " bytes (%.1f%%)\n", ev_data->data_received, ((gfloat)ev_data->data_received/(gfloat)ev_data->content_length) * 100.0); else g_printerr ("PARTIAL DATA: %" G_GUINT64_FORMAT " bytes (content length unknown)\n", ev_data->data_received); } break; case GNET_CONN_HTTP_DATA_COMPLETE: { GConnHttpEventData *ev_data = (GConnHttpEventData*)event; g_printerr ("\n"); g_printerr ("COMPLETE: %" G_GUINT64_FORMAT " bytes received.\n", ev_data->data_received); } break; case GNET_CONN_HTTP_REDIRECT: { GConnHttpEventRedirect *ev_redir = (GConnHttpEventRedirect*)event; if (!ev_redir->auto_redirect) g_printerr ("REDIRECT: New location => '%s' (not automatic)\n", ev_redir->new_location); else g_printerr ("REDIRECT: New location => '%s' (automatic)\n", ev_redir->new_location); } break; case GNET_CONN_HTTP_CONNECTED: g_printerr ("CONNECTED\n"); break; /* Internal GConnHttp error */ case GNET_CONN_HTTP_ERROR: { GConnHttpEventError *ev_error = (GConnHttpEventError*)event; g_printerr ("ERROR #%u: %s.\n", ev_error->code, ev_error->message); } break; case GNET_CONN_HTTP_TIMEOUT: { g_printerr ("GNET_CONN_HTTP_TIMEOUT.\n"); } break; default: g_assert_not_reached(); } } GNET_START_TEST (test_conn_http_run) { /* at least some of these should lead to a redirect; sf.net is a redirect * to the same host */ const gchar *uris[] = { "http://www.google.com", "http://www.google.co.uk", "http://www.google.de", "http://www.google.fr", "http://www.google.es", "http://www.gnome.org", "http://www.amazon.com", "http://sf.net", "http://news.bbc.co.uk" }; guint i; for (i = 0; i < G_N_ELEMENTS (uris); ++i) { const gchar *uri = uris[i]; GConnHttp *httpconn; gchar *buf; gsize len; httpconn = gnet_conn_http_new (); fail_unless (httpconn != NULL); fail_unless (gnet_conn_http_set_uri (httpconn, uri), "Couldn't set URI '%s' on GConnHttp", uri); g_print ("Getting %s ... ", uri); fail_unless (gnet_conn_http_run (httpconn, http_dbg_callback, NULL)); gnet_conn_http_steal_buffer (httpconn, &buf, &len); g_print ("%s, received %d bytes.\n", (len > 0) ? "ok" : "FAILED", (int) len); fail_unless (len > 0); fail_unless (buf != NULL); gnet_conn_http_delete (httpconn); g_free (buf); } } GNET_END_TEST; /*** GET ASYNC ***/ typedef struct { GMainLoop *loop; gboolean got_error; guint64 len; } AsyncHelper; static void http_async_callback (GConnHttp *http, GConnHttpEvent *event, gpointer userdata) { AsyncHelper *helper = (AsyncHelper *) userdata; if (verbose) { g_printerr ("%s: event->type = %u\n", __FUNCTION__, event->type); http_dbg_callback (http, event, NULL); } switch (event->type) { case GNET_CONN_HTTP_RESOLVED: case GNET_CONN_HTTP_RESPONSE: case GNET_CONN_HTTP_REDIRECT: case GNET_CONN_HTTP_CONNECTED: break; case GNET_CONN_HTTP_DATA_PARTIAL: { GConnHttpEventData *data_event = (GConnHttpEventData*) event; /* we received data, make sure these values are set */ g_assert (data_event->buffer != NULL); g_assert (data_event->buffer_length > 0); g_assert (data_event->data_received > 0); helper->len = data_event->data_received; break; } case GNET_CONN_HTTP_ERROR: { GConnHttpEventError *err_event = (GConnHttpEventError*) event; if (verbose) { g_printerr ("Error: %s (code=%u)\n", err_event->message, err_event->code); } helper->got_error = TRUE; } /* fallthrough */ case GNET_CONN_HTTP_DATA_COMPLETE: case GNET_CONN_HTTP_TIMEOUT: if (verbose) g_printerr ("%s: done. Deleting http object.\n", __FUNCTION__); /* make sure we can call _delete() from the callback */ gnet_conn_http_delete (http); g_main_loop_quit (helper->loop); break; default: g_assert_not_reached(); } } /* This mainly tests whether we can do gnet_conn_http_delete() * from within the async callback when we have the data. */ static gboolean test_get_async (const gchar *uri) { AsyncHelper helper; GConnHttp *httpconn; httpconn = gnet_conn_http_new (); if (!gnet_conn_http_set_uri (httpconn, uri)) { g_printerr ("Couldn't set URI '%s' on GConnHttp", uri); return FALSE; } g_print ("Getting (async) '%s' ... ", uri); helper.loop = g_main_loop_new (NULL, FALSE); helper.got_error = FALSE; helper.len = 0; gnet_conn_http_run_async (httpconn, http_async_callback, &helper); g_main_loop_run (helper.loop); g_print ("done, received %u bytes.\n", (guint) helper.len); g_main_loop_unref (helper.loop); helper.loop = NULL; /* http conn object has been deleted in callback */ return (!helper.got_error); } GNET_START_TEST (test_conn_http_get_async) { /* If this test returns, it went ok (check that an error event gets sent). * It should return FALSE though, since we should have gotten an error */ fail_if (test_get_async ("http://non-exist.ant")); /* If this test returns and doesn't crash, it went ok * (the httpconn is deleted from within callback, which should work) */ fail_unless (test_get_async ("http://www.google.com")); fail_unless (test_get_async ("http://www.google.co.uk")); fail_unless (test_get_async ("http://www.google.de")); fail_unless (test_get_async ("http://www.google.fr")); fail_unless (test_get_async ("http://www.google.es")); } GNET_END_TEST; /*** POST ***/ /* PLEASE do not use this developer ID in * your own code, get your own one */ #define AWS_DEV_ID "1BXDDWFYXTVWC8WQXF02" #define POST_ARTIST "Massive Attack" #define POST_ALBUM "Blue lines" static gchar * do_post_for_uri (const gchar * uri) { GConnHttp *http; gchar *postdata, *buf, *artist_esc, *album_esc; gsize buflen; /* g_markup_printf_escaped() only exists in Glib-2.4 and later */ artist_esc = g_markup_escape_text (POST_ARTIST, -1); album_esc = g_markup_escape_text (POST_ALBUM, -1); postdata = g_strdup_printf ( "" "" "" "" "" "" "" "%s" /* <----------- */ "1" "music" "webservices-20" "lite" "%s" "%s" /* <----------- */ "" "" "", artist_esc, AWS_DEV_ID, album_esc); g_free (artist_esc); g_free (album_esc); http = gnet_conn_http_new(); fail_unless (gnet_conn_http_set_uri (http, uri), "Could not set URI '%s'", uri); fail_unless (gnet_conn_http_set_method (http, GNET_CONN_HTTP_METHOD_POST, postdata, strlen(postdata))); fail_unless (gnet_conn_http_set_header (http, "SOAPAction", "\"http://soap.amazon.com\"", GNET_CONN_HTTP_FLAG_SKIP_HEADER_CHECK)); fail_unless (gnet_conn_http_set_header (http, "Content-Type", "text/xml; charset=utf-8", GNET_CONN_HTTP_FLAG_SKIP_HEADER_CHECK)); fail_unless (gnet_conn_http_run (http, http_dbg_callback, postdata)); gnet_conn_http_steal_buffer(http, &buf, &buflen); g_print ("POST operation ok, received %u bytes.\n", (guint) buflen); gnet_conn_http_delete(http); g_free(postdata); return buf; } GNET_START_TEST (test_conn_http_post) { gchar *buf, *tag; buf = do_post_for_uri ("http://soap.amazon.com/onca/soap3"); /* now parse result */ tag = strstr(buf, ""); if (tag) { *tag = 0x00; while (tag > buf && *tag != '>') --tag; ++tag; } if (tag && *tag == '$') g_print ("%s, %s - ListPrice = %s\n", POST_ARTIST, POST_ALBUM, tag); else g_print ("Could not find ListPrice for CD %s, %s in data returned :|\n", POST_ARTIST, POST_ALBUM); g_free(buf); } GNET_END_TEST; static void http_post_conn_func (GConn * conn, GConnEvent * event, gpointer data) { guint *p_written = (guint *) data; if (event->type == GNET_CONN_WRITE) *p_written += 1; } static GConn *last_conn = NULL; /* save here so we can delete it d'oh */ static void http_post_server_func (GServer * srv, GConn * conn, gpointer user_data) { const gchar **lines = (const gchar **) user_data; gint num_lines = 0, lines_written = 0; last_conn = conn; fail_unless (conn != NULL, "Can't set up server, some error occured"); fail_unless (gnet_conn_is_connected (conn)); gnet_conn_set_callback (conn, http_post_conn_func, &lines_written); /* don't parse or check what the server sends us, just assume it does what * we expect it to and send out data as would be appropriate as response */ while (lines != NULL && lines[0] != NULL) { gnet_conn_write (conn, (gchar *) lines[0], strlen (lines[0])); ++lines; ++num_lines; } /* can't disconnect/close here yet, or the pending data might not actually * be sent (see open bug about this); work around this by iterating the * main context until there are no more pending events, ie. the * writable-watch set up by gnet_conn_write() has been removed */ while (lines_written < num_lines) { g_main_context_iteration (NULL, TRUE); } /* FIXME: gnet_conn_disconnect (conn); */ /* FIXME: gnet_conn_unref (conn); */ } GNET_START_TEST (test_conn_http_post_local) { const gchar *lines[] = { "HTTP/1.1 100 Continue\r\n", "Connection: Keep-Alive\r\n", "\r\n", "HTTP/1.1 200 OK\r\n", "Date: Mon, 15 Oct 2007 14:40:20 GMT\r\n", "Server: Server\r\n", "nnCoection: close\r\n", "Content-Type: text/xml; charset=UTF-8\r\n", "Vary: Accept-Encoding,User-Agent\r\n", "nnCoection: close\r\n", "Transfer-Encoding: chunked\r\n", "Connection: Keep-Alive\r\n", "\r\n", "d\r\n", "\r\n", "0\r\n", NULL }; const gchar *lines2[] = { "HTTP/1.1 100 Continue\r\n", "\r\n", "HTTP/1.1 200 OK\r\n", "Date: Mon, 15 Oct 2007 14:40:20 GMT\r\n", "Server: Server\r\n", "nnCoection: close\r\n", "Content-Type: text/xml; charset=UTF-8\r\n", "Vary: Accept-Encoding,User-Agent\r\n", "nnCoection: close\r\n", "Transfer-Encoding: chunked\r\n", "Connection: Keep-Alive\r\n", "\r\n", "d\r\n", "\r\n", "0\r\n", NULL }; GInetAddr *ia; GServer *srv; gchar *uri; gchar *buf; /* Disable any SOCKS proxies if enabled, since this test works locally */ gnet_socks_set_enabled (FALSE); /* Test case where we get headers after the HTTP/1.1 100 Continue */ ia = gnet_inetaddr_new ("127.0.0.1", 0); fail_unless (ia != NULL); srv = gnet_server_new (ia, 0, http_post_server_func, lines); gnet_inetaddr_unref (ia); fail_unless (srv != NULL, "Could not bind to 127.0.0.1, check your setup"); uri = g_strdup_printf ("http://127.0.0.1:%d", srv->port); buf = do_post_for_uri (uri); g_free (uri); fail_unless_equals_string (buf, ""); g_free (buf); gnet_conn_unref (last_conn); last_conn = NULL; /* Test case where we get no headers after the HTTP/1.1 100 Continue */ ia = gnet_inetaddr_new ("127.0.0.1", 0); fail_unless (ia != NULL); srv = gnet_server_new (ia, 0, http_post_server_func, lines2); gnet_inetaddr_unref (ia); fail_unless (srv != NULL, "Could not bind to 127.0.0.1, check your setup"); uri = g_strdup_printf ("http://127.0.0.1:%d", srv->port); buf = do_post_for_uri (uri); g_free (uri); fail_unless_equals_string (buf, ""); g_free (buf); gnet_conn_unref (last_conn); last_conn = NULL; } GNET_END_TEST; GNET_START_TEST (test_gnet_http_get) { const gchar *urls[] = {"http://www.gnetlibrary.org/src/", "http://www.heise.de" }; guint i; for (i = 0; i < G_N_ELEMENTS (urls); ++i) { gchar *buf = NULL; gsize buflen = 0; guint code = 0; g_print ("gnet_http_get %s ... ", urls[i]); fail_unless (gnet_http_get (urls[i], &buf, &buflen, &code), "buflen = %u, code = %u", (guint) buflen, code); g_print ("done - buflen = %u, code = %u\n", (guint) buflen, code); fail_unless (code == 200); fail_unless (buflen > 0); fail_unless (buf != NULL); /* make sure we can access it */ fail_unless (buf[buflen-1] == 0 || buf[buflen-1] != 0); g_free (buf); } } GNET_END_TEST; GNET_START_TEST (test_get_binary) { gchar *uris[] = { "http://www.gnetlibrary.org/gnet.png" }; guint i; for (i = 0; i < G_N_ELEMENTS (uris); ++i) { GConnHttp *httpconn; gchar *buf; gsize len; httpconn = gnet_conn_http_new (); g_print ("Getting binary file %s ... ", uris[i]); fail_unless (gnet_conn_http_set_uri (httpconn, uris[i]), "Can't set URI '%s' on GConnHttp!", uris[i]); fail_unless (gnet_conn_http_run (httpconn, NULL, NULL)); gnet_conn_http_steal_buffer (httpconn, &buf, &len); fail_unless (len > 0); fail_unless (buf != NULL); /* check that we can access the data */ fail_unless (buf[len-1] == 0 || buf[len-1] != 0); g_print ("ok, received %u bytes.\n", (guint) len); /* now check the data we've received, should be PNG */ if (!buf || len < 8 || strncmp(buf, "\211PNG\r\n\032\n", 8) != 0) g_error ("missing PNG signature?!"); if (len < (8+(4+4)) || strncmp(buf+8+4, "IHDR", 4) != 0) g_error ("missing IHDR chunk?!"); g_print ("PNG image width x height = %u x %u\n", GUINT32_FROM_BE(*((guint32*)(buf+8+4+4))), GUINT32_FROM_BE(*((guint32*)(buf+8+4+4+4)))); gnet_conn_http_delete(httpconn); g_free(buf); } } GNET_END_TEST; static void icy_async_cb (GConnHttp * http, GConnHttpEvent * event, gpointer data) { GMainLoop *loop = (GMainLoop *) data; if (verbose) { g_printerr ("%s: event->type = %u\n", __FUNCTION__, event->type); http_dbg_callback (http, event, NULL); } switch (event->type) { case GNET_CONN_HTTP_RESPONSE: { GConnHttpEventResponse *r = (GConnHttpEventResponse *) event; if (r->response_code == 200) { gboolean found_icy_name = FALSE; gchar **keys, **vals; keys = r->header_fields; vals = r->header_values; while (keys != NULL && *keys != NULL) { if (verbose) g_printerr ("%s: %20s: %s\n", __FUNCTION__, *keys, *vals); if (strcmp (*keys, "icy-name") == 0) { g_print ("icy name: %s\n", *vals); found_icy_name = TRUE; break; } ++keys; ++vals; } fail_unless (found_icy_name); } /* wait for data */ break; } case GNET_CONN_HTTP_RESOLVED: case GNET_CONN_HTTP_REDIRECT: case GNET_CONN_HTTP_CONNECTED: break; case GNET_CONN_HTTP_DATA_COMPLETE: case GNET_CONN_HTTP_DATA_PARTIAL: g_main_loop_quit (loop); break; case GNET_CONN_HTTP_ERROR: case GNET_CONN_HTTP_TIMEOUT: g_print ("shoutcast test: timeout or error"); g_main_loop_quit (loop); break; default: g_error ("Unexpected GConnHttpEventType value %d\n", event->type); } } /* we test that we accept an ICY response too here, and that things work * okay if we specify our own main context */ GNET_START_TEST (test_shoutcast) { GMainContext *ctx; const gchar *uri; GConnHttp *httpconn; GMainLoop *loop; ctx = g_main_context_new (); loop = g_main_loop_new (ctx, FALSE); fail_if (g_main_context_pending (ctx)); fail_if (g_main_context_pending (NULL)); httpconn = gnet_conn_http_new (); uri = "http://mp3-gr-128.smgradio.com:80/"; /* uri = "http://mp3-vr-128.smgradio.com:80/"; */ fail_unless (gnet_conn_http_set_uri (httpconn, uri)); fail_unless (gnet_conn_http_set_main_context (httpconn, ctx)); fail_if (g_main_context_pending (ctx)); fail_if (g_main_context_pending (NULL)); gnet_conn_http_run_async (httpconn, icy_async_cb, loop); g_main_loop_run (loop); gnet_conn_http_delete (httpconn); fail_if (g_main_context_pending (NULL)); g_main_loop_unref (loop); g_main_context_unref (ctx); } GNET_END_TEST; static Suite * gnetconnhttp_suite (void) { Suite *s = suite_create ("GConnHttp"); TCase *tc_chain = tcase_create ("connhttp"); gboolean run_network_checks; verbose = (g_getenv ("GNET_DEBUG") != NULL); tcase_set_timeout (tc_chain, 0); suite_add_tcase (s, tc_chain); #ifdef GNET_ENABLE_NETWORK_TESTS run_network_checks = TRUE; #else run_network_checks = FALSE; #endif if (run_network_checks) { tcase_add_test (tc_chain, test_conn_http_run); tcase_add_test (tc_chain, test_conn_http_get_async); tcase_add_test (tc_chain, test_conn_http_post); tcase_add_test (tc_chain, test_gnet_http_get); tcase_add_test (tc_chain, test_get_binary); tcase_add_test (tc_chain, test_shoutcast); } tcase_add_test (tc_chain, test_conn_http_post_local); return s; } GNET_CHECK_MAIN (gnetconnhttp); gnet-2.0.8/tests/check/gnet/gnetabi.c0000644000175000017500000000630610751326731014342 00000000000000/* GNet unit test for ABI compatibility * Copyright (C) 2007 Tim-Philipp Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include "gnetcheck.h" #include typedef struct { char *name; int size; int abi_size; } GNetCheckABIStruct; #ifdef HAVE_CPU_X86_64 #include "struct_x86_64.h" #define HAVE_ABI_SIZES TRUE #else #ifdef __powerpc__ #include "struct_ppc32.h" #define HAVE_ABI_SIZES TRUE /* #else #ifdef HAVE_CPU_I386 #include "struct_i386.h" #define HAVE_ABI_SIZES TRUE #else #ifdef __powerpc64__ #include "struct_ppc64.h" #define HAVE_ABI_SIZES TRUE #else #ifdef HAVE_CPU_HPPA #include "struct_hppa.h" #define HAVE_ABI_SIZES TRUE */ #else /* in case someone wants to generate a new arch */ #include "struct_x86_64.h" #define HAVE_ABI_SIZES FALSE #endif #endif /* #endif #endif #endif */ static void gnet_check_abi_list (GNetCheckABIStruct list[], gboolean have_abi_sizes) { if (have_abi_sizes) { gboolean ok = TRUE; gint i; for (i = 0; list[i].name; i++) { if (list[i].size != list[i].abi_size) { ok = FALSE; g_print ("sizeof(%s) is %d, expected %d\n", list[i].name, list[i].size, list[i].abi_size); } } fail_unless (ok, "failed ABI check"); } else { const gchar *fn; if ((fn = g_getenv ("GNET_ABI"))) { GError *err = NULL; GString *s; gint i; s = g_string_new ("\nGNetCheckABIStruct list[] = {\n"); for (i = 0; list[i].name; i++) { g_string_append_printf (s, " {\"%s\", sizeof (%s), %d},\n", list[i].name, list[i].name, list[i].size); } g_string_append (s, " {NULL, 0, 0}\n"); g_string_append (s, "};\n"); if (!g_file_set_contents (fn, s->str, s->len, &err)) { g_print ("%s", s->str); g_printerr ("\nFailed to write ABI information: %s\n", err->message); } else { g_print ("\nWrote ABI information to '%s'.\n", fn); } g_string_free (s, TRUE); } else { g_print ("No structure size list was generated for this architecture.\n"); g_print ("Run with GNET_ABI environment variable set to output header.\n"); } } } GNET_START_TEST (test_ABI) { gnet_check_abi_list (list, HAVE_ABI_SIZES); } GNET_END_TEST; static Suite * gnetabi_suite (void) { Suite *s = suite_create ("GNetABI"); TCase *tc_chain = tcase_create ("size check"); tcase_set_timeout (tc_chain, 0); suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_ABI); return s; } GNET_CHECK_MAIN (gnetabi); gnet-2.0.8/tests/check/gnet/gnetinetaddr.c0000644000175000017500000006732310751326731015407 00000000000000/* GNet GInetAddr unit test (deterministic, computation-based tests only) * Copyright (C) 2002 David Helder * Copyright (C) 2007 Tim-Philipp Müller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "config.h" #include "gnetcheck.h" #ifdef HAVE_VALGRIND #include #endif #include #include /*** IPv4 tests */ GNET_START_TEST (test_inetaddr_ipv4) { GInetAddr* inetaddr; GInetAddr* inetaddr2; gchar* cname; gchar* cname2; gchar bytes[GNET_INETADDR_MAX_LEN]; /* new (canonical, IPv4) */ inetaddr = gnet_inetaddr_new ("141.213.11.124", 23); fail_unless (inetaddr != NULL); /* get_port */ fail_unless_equals_int (gnet_inetaddr_get_port (inetaddr), 23); /* set_port */ gnet_inetaddr_set_port (inetaddr, 42); fail_unless_equals_int (gnet_inetaddr_get_port (inetaddr), 42); /* get_canonical_name */ cname = gnet_inetaddr_get_canonical_name (inetaddr); fail_unless (cname != NULL); fail_unless_equals_string (cname, "141.213.11.124"); g_free (cname); /* clone */ inetaddr2 = gnet_inetaddr_clone (inetaddr); fail_unless (inetaddr2 != NULL); cname2 = gnet_inetaddr_get_canonical_name (inetaddr2); fail_unless (cname2 != NULL); fail_unless_equals_string (cname2, "141.213.11.124"); fail_unless_equals_int (gnet_inetaddr_get_port (inetaddr2), 42); g_free(cname2); /* equal, noport_equal */ fail_unless (gnet_inetaddr_equal (inetaddr, inetaddr2)); fail_unless (gnet_inetaddr_noport_equal (inetaddr, inetaddr2)); gnet_inetaddr_set_port (inetaddr2, 23); fail_if (gnet_inetaddr_equal (inetaddr, inetaddr2)); fail_unless (gnet_inetaddr_noport_equal (inetaddr, inetaddr2)); /* hash */ fail_unless_equals_int (gnet_inetaddr_hash (inetaddr), 2379549526u); /* hash port */ fail_unless (gnet_inetaddr_hash (inetaddr) != gnet_inetaddr_hash (inetaddr2)); gnet_inetaddr_delete (inetaddr); gnet_inetaddr_delete (inetaddr2); /* bytes */ inetaddr = gnet_inetaddr_new_bytes ("\x8d\xd5\xb\x7c", 4); fail_unless (inetaddr != NULL); cname = gnet_inetaddr_get_canonical_name (inetaddr); fail_unless (cname != NULL); fail_unless_equals_string ("141.213.11.124", cname); g_free (cname); fail_unless_equals_int (gnet_inetaddr_get_port (inetaddr), 0); gnet_inetaddr_set_port (inetaddr, 2345); fail_unless_equals_int (gnet_inetaddr_get_port (inetaddr), 2345); fail_unless_equals_int (gnet_inetaddr_get_length (inetaddr), 4); gnet_inetaddr_set_bytes (inetaddr, "\x7c\xb\xd5\x8d", 4); cname = gnet_inetaddr_get_canonical_name (inetaddr); fail_unless (cname != NULL); fail_unless_equals_string ("124.11.213.141", cname); fail_unless_equals_int (gnet_inetaddr_get_port (inetaddr), 2345); g_free (cname); fail_unless_equals_int (gnet_inetaddr_get_length (inetaddr), 4); gnet_inetaddr_get_bytes (inetaddr, bytes); fail_unless (memcmp(bytes, "\x7c\xb\xd5\x8d", 4) == 0); #ifdef HAVE_IPV6 /* IPv4 -> IPv6 via set_bytes */ gnet_inetaddr_set_bytes (inetaddr, "\x3f\xfe\x0b\x00" "\x0c\x18\x1f\xff" "\0\0\0\0" "\0\0\0\x6f", 16); cname = gnet_inetaddr_get_canonical_name (inetaddr); fail_unless (cname != NULL); fail_unless (!strcasecmp("3ffe:b00:c18:1fff::6f", cname)); g_free (cname); fail_unless_equals_int (gnet_inetaddr_get_port (inetaddr), 2345); fail_unless_equals_int (gnet_inetaddr_get_length (inetaddr), 16); gnet_inetaddr_get_bytes (inetaddr, bytes); fail_unless (!memcmp(bytes, "\x3f\xfe\x0b\x00\x0c\x18\x1f\xff\0\0\0\0\0\0\0\x6f", 16)); #endif gnet_inetaddr_delete (inetaddr); } GNET_END_TEST; #define IS_TEST(S,A,F) do { \ GInetAddr* _inetaddr; \ gchar* _cname; \ _inetaddr = gnet_inetaddr_new_nonblock (A, 0); \ fail_unless (_inetaddr != NULL); \ _cname = gnet_inetaddr_get_canonical_name (_inetaddr); \ fail_unless (_cname != NULL); \ fail_unless_equals_string (_cname, (A)); \ fail_unless (F (_inetaddr)); \ g_free (_cname); \ gnet_inetaddr_delete (_inetaddr); \ } while (0) GNET_START_TEST (test_inetaddr_is_ipv4) { /* IPv4 */ IS_TEST ("IPv4", "141.213.11.124", gnet_inetaddr_is_ipv4); /* IPv4 Loopback */ IS_TEST ("IPv4 Loopback", "127.0.0.1", gnet_inetaddr_is_loopback); IS_TEST ("IPv4 Loopback2", "127.23.42.129", gnet_inetaddr_is_loopback); IS_TEST ("IPv4 !Loopback", "128.23.42.129", !gnet_inetaddr_is_loopback); /* IPv4 Multicast */ IS_TEST ("IPv4 Multicast", "224.0.0.0", gnet_inetaddr_is_multicast); IS_TEST ("IPv4 Multicast2", "224.0.0.1", gnet_inetaddr_is_multicast); IS_TEST ("IPv4 Multicast3", "239.255.255.255", gnet_inetaddr_is_multicast); IS_TEST ("IPv4 !Multicast", "223.255.255.255", !gnet_inetaddr_is_multicast); IS_TEST ("IPv4 !Multicast2", "240.0.0.0", !gnet_inetaddr_is_multicast); /* IPv4 Private */ IS_TEST ("IPv4 Private", "10.0.0.0", gnet_inetaddr_is_private); IS_TEST ("IPv4 Private2", "10.255.255.255", gnet_inetaddr_is_private); IS_TEST ("IPv4 !Private", "9.255.255.255", !gnet_inetaddr_is_private); IS_TEST ("IPv4 !Private2", "11.0.0.0", !gnet_inetaddr_is_private); IS_TEST ("IPv4 Private3", "172.16.0.0", gnet_inetaddr_is_private); IS_TEST ("IPv4 Private4", "172.31.255.255", gnet_inetaddr_is_private); IS_TEST ("IPv4 !Private3", "172.15.255.255", !gnet_inetaddr_is_private); IS_TEST ("IPv4 !Private4", "172.32.0.0", !gnet_inetaddr_is_private); IS_TEST ("IPv4 Private5", "192.168.0.0", gnet_inetaddr_is_private); IS_TEST ("IPv4 Private6", "192.168.255.255", gnet_inetaddr_is_private); IS_TEST ("IPv4 !Private5", "192.167.255.255", !gnet_inetaddr_is_private); IS_TEST ("IPv4 !Private6", "192.169.0.0", !gnet_inetaddr_is_private); /* IPv4 Reserved */ IS_TEST ("IPv4 Reserved", "0.0.0.0", gnet_inetaddr_is_reserved); IS_TEST ("IPv4 Reserved2", "0.0.255.255", gnet_inetaddr_is_reserved); IS_TEST ("IPv4 !Reserved2", "1.0.0.0", !gnet_inetaddr_is_reserved); IS_TEST ("IPv4 Reserved3", "240.0.0.0", gnet_inetaddr_is_reserved); IS_TEST ("IPv4 Reserved4", "247.255.255.255", gnet_inetaddr_is_reserved); IS_TEST ("IPv4 !Reserved3", "239.255.255.255", !gnet_inetaddr_is_reserved); IS_TEST ("IPv4 !Reserved4", "248.0.0.0", !gnet_inetaddr_is_reserved); /* Internet */ IS_TEST ("Internet1", "141.213.11.124", gnet_inetaddr_is_internet); } GNET_END_TEST; #if HAVE_IPV6 GNET_START_TEST (test_inetaddr_is_ipv6) { /* IPv6 */ IS_TEST ("!IPv4", "3ffe:b00:c18:1fff::6f", !gnet_inetaddr_is_ipv4); IS_TEST ("IPv6", "3ffe:b00:c18:1fff::6f", gnet_inetaddr_is_ipv6); IS_TEST ("!IPv6", "141.213.11.124", !gnet_inetaddr_is_ipv6); /* IPv6 Loopback */ IS_TEST ("IPv6 Loopback", "::1", gnet_inetaddr_is_loopback); IS_TEST ("IPv6 !Loopback", "::", !gnet_inetaddr_is_loopback); IS_TEST ("IPv6 !Loopback2", "::201", !gnet_inetaddr_is_loopback); /* IPv6 Multicast */ IS_TEST ("IPv6 Multicast", "ffff::1", gnet_inetaddr_is_multicast); IS_TEST ("IPv6 !Multicast", "feff::1", !gnet_inetaddr_is_multicast); /* IPv6 Broadcast */ IS_TEST ("IPv6 Broadcast", "255.255.255.255", gnet_inetaddr_is_broadcast); IS_TEST ("IPv6 !Broadcast", "255.255.255.254", !gnet_inetaddr_is_broadcast); /* IPv6 Private */ IS_TEST ("IPv6 Private", "fe80::", gnet_inetaddr_is_private); IS_TEST ("IPv6 Private2", "fecf:ffff::", gnet_inetaddr_is_private); IS_TEST ("IPv6 !Private", "fe7f:ffff::", !gnet_inetaddr_is_private); IS_TEST ("IPv6 !Private2", "ff00::", !gnet_inetaddr_is_private); /* IPv6 Reserved */ IS_TEST ("IPv6 Reserved", "::", gnet_inetaddr_is_reserved); IS_TEST ("IPv6 !Reserved", "1::", !gnet_inetaddr_is_reserved); /* Internet */ IS_TEST ("Internet2", "3ffe:b00:c18:1fff::6f", gnet_inetaddr_is_internet); IS_TEST ("!Internet1", "255.255.255.255", !gnet_inetaddr_is_internet); IS_TEST ("!Internet2", "ffff::1", !gnet_inetaddr_is_internet); } GNET_END_TEST; #endif /* HAVE_IPV6 */ /*** IPv6 tests ***/ #if HAVE_IPV6 GNET_START_TEST (test_inetaddr_ipv6) { GInetAddr* inetaddr; GInetAddr* inetaddr2; gchar* cname; gchar* cname2; /* new (canonical, IPv6) */ inetaddr = gnet_inetaddr_new ("3ffe:b00:c18:1fff::6f", 23); fail_unless (inetaddr != NULL); /* get_port */ fail_unless_equals_int (gnet_inetaddr_get_port (inetaddr), 23); /* set_port */ gnet_inetaddr_set_port (inetaddr, 42); fail_unless_equals_int (gnet_inetaddr_get_port (inetaddr), 42); /* get_canonical_name */ cname = gnet_inetaddr_get_canonical_name (inetaddr); fail_unless (cname != NULL); fail_unless (!strcasecmp(cname, "3ffe:b00:c18:1fff::6f")); g_free (cname); /* clone */ inetaddr2 = gnet_inetaddr_clone (inetaddr); fail_unless (inetaddr != NULL); cname2 = gnet_inetaddr_get_canonical_name (inetaddr2); fail_unless (cname2 != NULL); fail_unless (!strcasecmp(cname2, "3ffe:b00:c18:1fff::6f")); fail_unless_equals_int (gnet_inetaddr_get_port (inetaddr2), 42); g_free(cname2); /* equal, noport_equal */ fail_unless (gnet_inetaddr_equal (inetaddr, inetaddr2)); fail_unless (gnet_inetaddr_noport_equal (inetaddr, inetaddr2)); gnet_inetaddr_set_port (inetaddr2, 23); fail_if (gnet_inetaddr_equal (inetaddr, inetaddr2)); fail_unless (gnet_inetaddr_noport_equal (inetaddr, inetaddr2)); /* hash */ fail_unless_equals_int (gnet_inetaddr_hash (inetaddr), 870716602u); /* hash port */ fail_unless (gnet_inetaddr_hash (inetaddr) != gnet_inetaddr_hash (inetaddr2)); gnet_inetaddr_delete (inetaddr); gnet_inetaddr_delete (inetaddr2); /* bytes */ inetaddr = gnet_inetaddr_new_bytes ("\x3f\xfe\x0b\x00" "\x0c\x18\x1f\xff" "\0\0\0\0" "\0\0\0\x6f", 16); fail_unless (inetaddr != NULL); cname = gnet_inetaddr_get_canonical_name (inetaddr); fail_unless (cname != NULL); fail_unless (!strcasecmp("3ffe:b00:c18:1fff::6f", cname)); fail_unless_equals_int (gnet_inetaddr_get_port (inetaddr), 0); gnet_inetaddr_delete (inetaddr); g_free (cname); } GNET_END_TEST; #endif /* HAVE_IPV6 */ GNET_START_TEST (test_inetaddr_is_internet_domainname) { fail_unless (gnet_inetaddr_is_internet_domainname ("speak.eecs.umich.edu")); fail_unless (gnet_inetaddr_is_internet_domainname ("141.213.11.124")); fail_if (gnet_inetaddr_is_internet_domainname ("localhost")); fail_if (gnet_inetaddr_is_internet_domainname ("localhost.localdomain")); fail_if (gnet_inetaddr_is_internet_domainname ("speak")); } GNET_END_TEST; static void lookup_list_cb (GList * list, gpointer data) { gboolean *p_called = (gboolean *) data; GList *l; *p_called = TRUE; /* g_print ("%d results\n", g_list_length (list)); */ fail_unless (list != NULL); for (l = list; l != NULL; l = l->next) { GInetAddr *ia; gchar *name; ia = (GInetAddr *) l->data; name = gnet_inetaddr_get_canonical_name (ia); fail_unless (name != NULL); fail_unless_equals_int (gnet_inetaddr_get_port (ia), 80); g_free (name); } g_list_foreach (list, (GFunc) gnet_inetaddr_unref, NULL); g_list_free (list); } static void lookup_list_cb_do_nothing (GList * list, gpointer data) { g_list_foreach (list, (GFunc) gnet_inetaddr_unref, NULL); g_list_free (list); } static gboolean do_nothing_timeout (gpointer foo) { return FALSE; /* don't call again */ } static void destroy_notify (gpointer data) { gboolean *p_bool = (gboolean *) data; *p_bool = TRUE; } static void do_test_inetaddr_list_async (const gchar * hostname) { GInetAddrNewListAsyncID list_async_id; GMainContext *ctx; gboolean called, destroyed; gint id; /* g_print ("list async: looking up %s ... ", hostname); */ /* list async (default main context) */ called = FALSE; list_async_id = gnet_inetaddr_new_list_async (hostname, 80, lookup_list_cb, &called); id = g_timeout_add (5 * 1000, (GSourceFunc) do_nothing_timeout, NULL); g_main_context_iteration (NULL, TRUE); fail_unless (called); g_source_remove (id); /* list async + cancel (default main context) */ called = FALSE; list_async_id = gnet_inetaddr_new_list_async (hostname, 80, lookup_list_cb, &called); fail_unless (list_async_id != NULL); gnet_inetaddr_new_list_async_cancel (list_async_id); while (g_main_context_iteration (NULL, FALSE)) { ; } fail_unless (!called); /* list async (destroy notify) */ destroyed = FALSE; list_async_id = gnet_inetaddr_new_list_async_full (hostname, 80, lookup_list_cb_do_nothing, &destroyed, destroy_notify, NULL, G_PRIORITY_HIGH); fail_unless (list_async_id != NULL); g_main_context_iteration (NULL, TRUE); fail_unless (destroyed); /* list async + cancel (destroy notify; thread unlikely to start) */ destroyed = FALSE; list_async_id = gnet_inetaddr_new_list_async_full (hostname, 80, lookup_list_cb_do_nothing, &destroyed, destroy_notify, NULL, G_PRIORITY_HIGH); fail_unless (list_async_id != NULL); gnet_inetaddr_new_list_async_cancel (list_async_id); /* give thread a chance to execute and act on the cancelled flag */ g_usleep (1 * G_USEC_PER_SEC); fail_unless (destroyed); /* list async + cancel (destroy notify II) */ destroyed = FALSE; list_async_id = gnet_inetaddr_new_list_async_full (hostname, 80, lookup_list_cb_do_nothing, &destroyed, destroy_notify, NULL, G_PRIORITY_HIGH); fail_unless (list_async_id != NULL); /* give thread a chance to execute and block before we cancel it */ g_usleep (1 * G_USEC_PER_SEC); gnet_inetaddr_new_list_async_cancel (list_async_id); fail_unless (destroyed); /* list async + cancel (destroy notify III) */ destroyed = FALSE; list_async_id = gnet_inetaddr_new_list_async_full (hostname, 80, lookup_list_cb_do_nothing, &destroyed, destroy_notify, NULL, G_PRIORITY_HIGH); fail_unless (list_async_id != NULL); /* give thread a chance to execute and block and be done before cancelling */ g_usleep (3 * G_USEC_PER_SEC); gnet_inetaddr_new_list_async_cancel (list_async_id); fail_unless (destroyed); /* list async (custom main context) */ called = FALSE; ctx = g_main_context_new (); list_async_id = gnet_inetaddr_new_list_async_full (hostname, 80, lookup_list_cb, &called, (GDestroyNotify) NULL, ctx, G_PRIORITY_HIGH); /* give thread a chance to execute and block and be done */ g_usleep (3 * G_USEC_PER_SEC); fail_unless (!called); /* there shouldn't be anyhing pending in the default context */ fail_unless (!g_main_context_pending (NULL)); /* but there should be something pending in OUR context now */ fail_unless (g_main_context_pending (ctx)); fail_unless (!called); /* let's iterate it and dispatch the callback */ fail_unless (g_main_context_iteration (ctx, FALSE)); fail_unless (called); g_main_context_unref (ctx); } GNET_START_TEST (test_inetaddr_list_async) { do_test_inetaddr_list_async ("localhost"); /* FIXME: these might not work right yet because of the timings in the test #ifdef GNET_ENABLE_NETWORK_TESTS do_test_inetaddr_list_async ("www.google.com"); do_test_inetaddr_list_async ("www.heise.de"); #endif */ #ifdef HAVE_VALGRIND if (RUNNING_ON_VALGRIND) { g_print ("Sleeping for a while to let cancelled threads finish ...\n"); /* sleep a while to give any cancelled threads a chance to quit, otherwise * valgrind will think the threads were leaked */ g_usleep (60 * G_USEC_PER_SEC); } #endif } GNET_END_TEST; static void lookup_name_cb (GInetAddr * ia, gpointer data) { gboolean *p_called = (gboolean *) data; gchar *name; *p_called = TRUE; fail_unless (ia != NULL); name = gnet_inetaddr_get_canonical_name (ia); fail_unless (name != NULL); fail_unless_equals_int (gnet_inetaddr_get_port (ia), 80); g_free (name); gnet_inetaddr_unref (ia); } static void lookup_name_cb_do_nothing (GInetAddr * ia, gpointer data) { gnet_inetaddr_unref (ia); } static void do_test_inetaddr_name_async (const gchar * hostname) { GInetAddrNewAsyncID async_id; GMainContext *ctx; gboolean called, destroyed; gint id; /* name async (default main context) */ called = FALSE; async_id = gnet_inetaddr_new_async (hostname, 80, lookup_name_cb, &called); fail_unless (async_id != NULL); id = g_timeout_add (5 * 1000, (GSourceFunc) do_nothing_timeout, NULL); g_main_context_iteration (NULL, TRUE); fail_unless (called); g_source_remove (id); /* name async + cancel (default main context) */ called = FALSE; async_id = gnet_inetaddr_new_async (hostname, 80, lookup_name_cb, &called); fail_unless (async_id != NULL); gnet_inetaddr_new_async_cancel (async_id); while (g_main_context_iteration (NULL, FALSE)) { ; } fail_unless (!called); /* name async (destroy notify) */ destroyed = FALSE; async_id = gnet_inetaddr_new_async_full (hostname, 80, lookup_name_cb_do_nothing, &destroyed, destroy_notify, NULL, G_PRIORITY_HIGH); fail_unless (async_id != NULL); g_main_context_iteration (NULL, TRUE); fail_unless (destroyed); /* name async + cancel (destroy notify; thread unlikely to start) */ destroyed = FALSE; async_id = gnet_inetaddr_new_async_full (hostname, 80, lookup_name_cb_do_nothing, &destroyed, destroy_notify, NULL, G_PRIORITY_HIGH); fail_unless (async_id != NULL); gnet_inetaddr_new_async_cancel (async_id); /* give thread a chance to execute and act on the cancelled flag */ g_usleep (1 * G_USEC_PER_SEC); fail_unless (destroyed); /* name async + cancel (destroy notify II) */ destroyed = FALSE; async_id = gnet_inetaddr_new_async_full (hostname, 80, lookup_name_cb_do_nothing, &destroyed, destroy_notify, NULL, G_PRIORITY_HIGH); fail_unless (async_id != NULL); /* give thread a chance to execute and block before we cancel it */ g_usleep (1 * G_USEC_PER_SEC); gnet_inetaddr_new_async_cancel (async_id); fail_unless (destroyed); /* name async + cancel (destroy notify III) */ destroyed = FALSE; async_id = gnet_inetaddr_new_async_full (hostname, 80, lookup_name_cb_do_nothing, &destroyed, destroy_notify, NULL, G_PRIORITY_HIGH); fail_unless (async_id != NULL); /* give thread a chance to execute and block and be done before cancelling */ g_usleep (3 * G_USEC_PER_SEC); gnet_inetaddr_new_async_cancel (async_id); fail_unless (destroyed); /* name async (custom main context) */ called = FALSE; ctx = g_main_context_new (); async_id = gnet_inetaddr_new_async_full (hostname, 80, lookup_name_cb, &called, (GDestroyNotify) NULL, ctx, G_PRIORITY_HIGH); /* give thread a chance to execute and block and be done */ g_usleep (3 * G_USEC_PER_SEC); fail_unless (!called); /* there shouldn't be anyhing pending in the default context */ fail_unless (!g_main_context_pending (NULL)); /* but there should be something pending in OUR context now */ fail_unless (g_main_context_pending (ctx)); fail_unless (!called); /* let's iterate it and dispatch the callback */ fail_unless (g_main_context_iteration (ctx, FALSE)); fail_unless (called); g_main_context_unref (ctx); } GNET_START_TEST (test_inetaddr_name_async) { do_test_inetaddr_name_async ("localhost"); /* FIXME: these might not work right yet because of the timings in the test #ifdef GNET_ENABLE_NETWORK_TESTS do_test_inetaddr_name_async ("www.google.com"); #endif */ #ifdef HAVE_VALGRIND if (RUNNING_ON_VALGRIND) { g_print ("Sleeping for a while to let cancelled threads finish ...\n"); /* sleep a while to give any cancelled threads a chance to quit, otherwise * valgrind will think the threads were leaked */ g_usleep (60 * G_USEC_PER_SEC); } #endif } GNET_END_TEST; static void reverse_lookup_func (gchar * hostname, gpointer data) { /* should never be called, since we don't iterate the default main context */ g_assert_not_reached (); } static void do_test_inetaddr_reverse_async_ipv4_cancel (const gchar * ip_string) { GInetAddrGetNameAsyncID async_id; GInetAddr *ia; g_print ("Starting reverse lookup for %s ...", ip_string); fflush (stdout); ia = gnet_inetaddr_new_nonblock (ip_string, 80); fail_unless (ia != NULL); ASSERT_CRITICAL (gnet_inetaddr_get_name_async (ia, NULL, NULL)); async_id = gnet_inetaddr_get_name_async (ia, reverse_lookup_func, NULL); fail_unless (async_id != NULL); gnet_inetaddr_delete (ia); g_usleep (g_random_int_range (0, G_USEC_PER_SEC * 2)); gnet_inetaddr_get_name_async_cancel (async_id); g_print (" cancelled.\n"); } GNET_START_TEST (test_inetaddr_reverse_async_ipv4_cancel) { ASSERT_CRITICAL ( gnet_inetaddr_get_name_async (NULL, reverse_lookup_func, NULL) ); do_test_inetaddr_reverse_async_ipv4_cancel ("127.0.0.1"); #ifdef GNET_ENABLE_NETWORK_TESTS { gint i; for (i = 0; i < 10; ++i) { if (i == 1) { do_test_inetaddr_reverse_async_ipv4_cancel ("217.155.155.155"); } else if (i == 2) { do_test_inetaddr_reverse_async_ipv4_cancel ("91.189.93.3"); } else { gchar *ip_string; ip_string = g_strdup_printf ("%u.%u.%u.%u", g_random_int_range (4, 250), g_random_int_range (0, 255), g_random_int_range (0, 255), g_random_int_range (0, 255)); do_test_inetaddr_reverse_async_ipv4_cancel (ip_string); g_free (ip_string); } } } #endif #ifdef HAVE_VALGRIND if (RUNNING_ON_VALGRIND) { g_print ("Sleeping for a while to let cancelled threads finish ...\n"); /* sleep a while to give any cancelled threads a chance to quit, otherwise * valgrind will think the threads were leaked */ g_usleep (60 * G_USEC_PER_SEC); } #endif } GNET_END_TEST; static GInetAddr *current_ia; /* NULL */ static void lookup_reverse_cb (gchar * hostname, gpointer data) { gboolean *p_called = (gboolean *) data; *p_called = TRUE; fail_unless (hostname != NULL); g_free (hostname); } static void lookup_reverse_cb_do_nothing (gchar * hostname, gpointer data) { if (current_ia != NULL && hostname != NULL) { gchar *can_name; can_name = gnet_inetaddr_get_canonical_name (current_ia); g_print ("%s --> %s\n", can_name, hostname); g_free (can_name); } g_free (hostname); } static void do_test_inetaddr_reverse_async (const gchar * hostname) { GInetAddrGetNameAsyncID async_id; GMainContext *ctx; GInetAddr *ia; gboolean called, destroyed; gchar *ip_string; gint id; /* we assume the given host has a 1:1 IP<->hostname mapping */ ia = gnet_inetaddr_new (hostname, 80); fail_unless (ia != NULL); ip_string = gnet_inetaddr_get_canonical_name (ia); fail_unless (ip_string != NULL); gnet_inetaddr_unref (ia); ia = NULL; g_print ("%s --> %s\n", hostname, ip_string); ia = gnet_inetaddr_new_nonblock (ip_string, 80); fail_unless (ia != NULL); current_ia = ia; /* name async (default main context) */ called = FALSE; async_id = gnet_inetaddr_get_name_async (ia, lookup_reverse_cb, &called); fail_unless (async_id != NULL); id = g_timeout_add (10 * 1000, (GSourceFunc) do_nothing_timeout, NULL); g_main_context_iteration (NULL, TRUE); fail_unless (called); g_source_remove (id); /* name async + cancel (default main context) */ called = FALSE; async_id = gnet_inetaddr_get_name_async (ia, lookup_reverse_cb, &called); fail_unless (async_id != NULL); gnet_inetaddr_get_name_async_cancel (async_id); while (g_main_context_iteration (NULL, FALSE)) { ; } fail_unless (!called); /* name async (destroy notify) */ destroyed = FALSE; async_id = gnet_inetaddr_get_name_async_full (ia, lookup_reverse_cb_do_nothing, &destroyed, destroy_notify, NULL, G_PRIORITY_HIGH); fail_unless (async_id != NULL); g_main_context_iteration (NULL, TRUE); fail_unless (destroyed); /* name async + cancel (destroy notify; thread unlikely to start) */ destroyed = FALSE; async_id = gnet_inetaddr_get_name_async_full (ia, lookup_reverse_cb_do_nothing, &destroyed, destroy_notify, NULL, G_PRIORITY_HIGH); fail_unless (async_id != NULL); gnet_inetaddr_get_name_async_cancel (async_id); /* give thread a chance to execute and act on the cancelled flag */ g_usleep (1 * G_USEC_PER_SEC); fail_unless (destroyed); /* name async + cancel (destroy notify II) */ destroyed = FALSE; async_id = gnet_inetaddr_get_name_async_full (ia, lookup_reverse_cb_do_nothing, &destroyed, destroy_notify, NULL, G_PRIORITY_HIGH); fail_unless (async_id != NULL); /* give thread a chance to execute and block before we cancel it */ g_usleep (1 * G_USEC_PER_SEC); gnet_inetaddr_get_name_async_cancel (async_id); fail_unless (destroyed); /* name async + cancel (destroy notify III) */ destroyed = FALSE; async_id = gnet_inetaddr_get_name_async_full (ia, lookup_reverse_cb_do_nothing, &destroyed, destroy_notify, NULL, G_PRIORITY_HIGH); fail_unless (async_id != NULL); /* give thread a chance to execute and block and be done before cancelling */ g_usleep (3 * G_USEC_PER_SEC); gnet_inetaddr_get_name_async_cancel (async_id); fail_unless (destroyed); /* name async (custom main context) */ called = FALSE; ctx = g_main_context_new (); async_id = gnet_inetaddr_get_name_async_full (ia, lookup_reverse_cb, &called, (GDestroyNotify) NULL, ctx, G_PRIORITY_HIGH); /* give thread a chance to execute and block and be done */ g_usleep (10 * G_USEC_PER_SEC); fail_unless (!called); /* there shouldn't be anyhing pending in the default context */ fail_unless (!g_main_context_pending (NULL)); /* but there should be something pending in OUR context now */ fail_unless (g_main_context_pending (ctx)); fail_unless (!called); /* let's iterate it and dispatch the callback */ fail_unless (g_main_context_iteration (ctx, FALSE)); fail_unless (called); g_main_context_unref (ctx); g_free (ip_string); gnet_inetaddr_unref (ia); current_ia = NULL; } GNET_START_TEST (test_inetaddr_reverse_async) { do_test_inetaddr_reverse_async ("localhost"); #ifdef GNET_ENABLE_NETWORK_TESTS do_test_inetaddr_reverse_async ("gabe.freedesktop.org"); #endif #ifdef HAVE_VALGRIND if (RUNNING_ON_VALGRIND) { g_print ("Sleeping for a while to let cancelled threads finish ...\n"); /* sleep a while to give any cancelled threads a chance to quit, otherwise * valgrind will think the threads were leaked */ g_usleep (60 * G_USEC_PER_SEC); } #endif } GNET_END_TEST; static Suite * gnetinetaddr_suite (void) { Suite *s = suite_create ("GInetAddr"); TCase *tc_chain = tcase_create ("inetaddr"); tcase_set_timeout (tc_chain, 0); suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_inetaddr_is_internet_domainname); tcase_add_test (tc_chain, test_inetaddr_ipv4); tcase_add_test (tc_chain, test_inetaddr_is_ipv4); tcase_add_test (tc_chain, test_inetaddr_list_async); tcase_add_test (tc_chain, test_inetaddr_name_async); tcase_add_test (tc_chain, test_inetaddr_reverse_async); tcase_add_test (tc_chain, test_inetaddr_reverse_async_ipv4_cancel); #if HAVE_IPV6 tcase_add_test (tc_chain, test_inetaddr_ipv6); tcase_add_test (tc_chain, test_inetaddr_is_ipv6); #endif return s; } GNET_CHECK_MAIN (gnetinetaddr); gnet-2.0.8/tests/check/gnet/gnetmisc.c0000644000175000017500000000441010751326731014534 00000000000000/* GNet unit test * Copyright (C) 2007 Tim-Philipp Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include "gnetcheck.h" #include GNET_START_TEST (test_versions) { fail_unless (GNET_MAJOR_VERSION > 0); fail_unless (GNET_MINOR_VERSION >= 0); fail_unless (GNET_MICRO_VERSION >= 0); fail_unless (GNET_CHECK_VERSION (GNET_MAJOR_VERSION, GNET_MINOR_VERSION, GNET_MICRO_VERSION)); fail_unless (GNET_CHECK_VERSION (GNET_MAJOR_VERSION - 1, GNET_MINOR_VERSION, GNET_MICRO_VERSION)); if (GNET_MINOR_VERSION > 0) { fail_unless (GNET_CHECK_VERSION (GNET_MAJOR_VERSION, GNET_MINOR_VERSION - 1, GNET_MICRO_VERSION)); } fail_unless (!GNET_CHECK_VERSION (GNET_MAJOR_VERSION, GNET_MINOR_VERSION, GNET_MICRO_VERSION + 1)); fail_unless (!GNET_CHECK_VERSION (GNET_MAJOR_VERSION, GNET_MINOR_VERSION + 1, GNET_MICRO_VERSION)); fail_unless (!GNET_CHECK_VERSION (GNET_MAJOR_VERSION + 1, GNET_MINOR_VERSION, GNET_MICRO_VERSION)); fail_unless_equals_int (GNET_MAJOR_VERSION, gnet_major_version); fail_unless_equals_int (GNET_MINOR_VERSION, gnet_minor_version); fail_unless_equals_int (GNET_MICRO_VERSION, gnet_micro_version); fail_unless (GNET_CHECK_VERSION (gnet_major_version, gnet_minor_version, gnet_micro_version)); } GNET_END_TEST; static Suite * gnetmisc_suite (void) { Suite *s = suite_create ("GNetMisc"); TCase *tc_chain = tcase_create ("init and version checks"); tcase_set_timeout (tc_chain, 0); suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_versions); return s; } GNET_CHECK_MAIN (gnetmisc); gnet-2.0.8/tests/check/gnet/gnethash.c0000644000175000017500000000463310751326731014533 00000000000000/* GNet unit test for MD5/SHA routines * Copyright (C) 2000, 2002 David Helder * Copyright (C) 2007 Tim-Philipp Müller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "gnetcheck.h" #include #include GNET_START_TEST (test_md5) { gchar *buffer; gchar *str; GMD5 *md5; GMD5 *md5b; buffer = g_malloc (20000); memset (buffer, 'A', 20000); /* Create MD5 */ md5 = gnet_md5_new (buffer, 20000); g_assert (md5); /* Get string */ str = gnet_md5_get_string (md5); g_assert (str); g_free (str); /* Create MD5 from string */ md5b = gnet_md5_new_string ("0af181fb57f1eefb62b74081bbddb155"); g_assert (md5b); /* Check if equal */ g_assert (gnet_md5_equal (md5, md5b)); gnet_md5_delete (md5); gnet_md5_delete (md5b); g_free (buffer); } GNET_END_TEST; GNET_START_TEST (test_sha1) { gchar *buffer; gchar *str; GSHA *sha; GSHA *shab; buffer = g_malloc (20000); g_assert (buffer); memset (buffer, 'A', 20000); /* Create SHA */ sha = gnet_sha_new (buffer, 20000); g_assert (sha); /* Get string */ str = gnet_sha_get_string (sha); g_assert (str); g_free (str); /* Create SHA from string */ shab = gnet_sha_new_string ("b9624c14586d4668cba0b2759229a49f1ea355b6"); g_assert (shab); /* Check if equal */ g_assert (gnet_sha_equal (sha, shab)); gnet_sha_delete (sha); gnet_sha_delete (shab); g_free (buffer); } GNET_END_TEST; static Suite * gnethash_suite (void) { Suite *s = suite_create ("GNetHashes"); TCase *tc_chain = tcase_create ("hashes"); tcase_set_timeout (tc_chain, 0); suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_md5); tcase_add_test (tc_chain, test_sha1); return s; } GNET_CHECK_MAIN (gnethash); gnet-2.0.8/tests/check/gnet/struct_x86_64.h0000644000175000017500000000102710751326731015273 00000000000000 GNetCheckABIStruct list[] = { {"GConnEvent", sizeof (GConnEvent), 24}, {"GConnHttpEvent", sizeof (GConnHttpEvent), 48}, {"GConnHttpEventResolved", sizeof (GConnHttpEventResolved), 88}, {"GConnHttpEventRedirect", sizeof (GConnHttpEventRedirect), 104}, {"GConnHttpEventResponse", sizeof (GConnHttpEventResponse), 136}, {"GConnHttpEventData", sizeof (GConnHttpEventData), 144}, {"GConnHttpEventError", sizeof (GConnHttpEventError), 96}, {"GServer", sizeof (GServer), 48}, {"GURI", sizeof (GURI), 56}, {NULL, 0, 0} }; gnet-2.0.8/tests/check/gnet/gnetipv6.c0000644000175000017500000000431110751326731014465 00000000000000/* GNet IPv6 unit test * Copyright (C) 2002 David Helder * Copyright (C) 2007 Tim-Philipp Müller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "config.h" #include "gnetcheck.h" GNET_START_TEST (test_ipv6_policy) { GIPv6Policy ipv6_policy; const gchar *policy_str = NULL; ipv6_policy = gnet_ipv6_get_policy(); switch (ipv6_policy) { case GIPV6_POLICY_IPV4_THEN_IPV6: policy_str = "GIPV6_POLICY_IPV4_THEN_IPV6"; break; case GIPV6_POLICY_IPV6_THEN_IPV4: policy_str = "GIPV6_POLICY_IPV6_THEN_IPV4"; break; case GIPV6_POLICY_IPV4_ONLY: policy_str = "GIPV6_POLICY_IPV4_ONLY"; break; case GIPV6_POLICY_IPV6_ONLY: policy_str = "GIPV6_POLICY_IPV6_ONLY"; break; default: /* this aborts */ g_error ("Invalid IPv6 policy %d", ipv6_policy); break; } g_print ("GNet IPv6 default policy: %s\n", policy_str); /* not that it will do anything, but just try to set all of these */ gnet_ipv6_set_policy (GIPV6_POLICY_IPV4_THEN_IPV6); gnet_ipv6_set_policy (GIPV6_POLICY_IPV6_THEN_IPV4); gnet_ipv6_set_policy (GIPV6_POLICY_IPV4_ONLY); gnet_ipv6_set_policy (GIPV6_POLICY_IPV6_ONLY); gnet_ipv6_set_policy (ipv6_policy); } GNET_END_TEST; static Suite * gnetipv6_suite (void) { Suite *s = suite_create ("GNetIPv6"); TCase *tc_chain = tcase_create ("ipv6"); tcase_set_timeout (tc_chain, 0); suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_ipv6_policy); /* TODO: more tests */ return s; } GNET_CHECK_MAIN (gnetipv6); gnet-2.0.8/tests/check/gnet/gnetconn.c0000644000175000017500000001527610751326731014552 00000000000000/* GNet GConn unit tests * Copyright (C) 2007 Tim-Philipp Müller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "config.h" #include "gnetcheck.h" #ifdef HAVE_VALGRIND #include #endif #include static void conn_fail_cb (GConn * conn, GConnEvent * event, gpointer data) { GMainLoop *loop = (GMainLoop *) data; /* the domain doesn't exist, it should give us an error */ fail_unless_equals_int (event->type, GNET_CONN_ERROR); /* test that we can delete the connection in the callback */ gnet_conn_delete (conn); g_main_loop_quit (loop); } static void conn_cb (GConn * conn, GConnEvent * event, gpointer data) { GMainLoop *loop = (GMainLoop *) data; switch (event->type) { case GNET_CONN_CONNECT: { const gchar req[] = "GET / HTTP/1.0\r\n" "Accept: */*\r\nConnection: Close\r\n" "\r\n"; g_print ("Connected.\n"); /* using _write_direct() here on purpose to test that code path too */ gnet_conn_write_direct (conn, g_strdup (req), strlen (req), (GDestroyNotify) g_free); break; } case GNET_CONN_WRITE: g_print ("Sent request.\n"); gnet_conn_read (conn); break; case GNET_CONN_READ: g_print ("."); /* write (1, event->buffer, event->length); */ gnet_conn_read (conn); break; case GNET_CONN_READABLE: g_error ("READABLE event shouldn't have happened without explicit watch"); break; case GNET_CONN_WRITABLE: g_error ("WRITABLE event shouldn't have happened without explicit watch"); break; case GNET_CONN_CLOSE: g_print ("\nConnection closed by server.\n"); g_main_loop_quit (loop); break; case GNET_CONN_TIMEOUT: g_print ("Timeout.\n"); g_main_loop_quit (loop); break; case GNET_CONN_ERROR: g_print ("Connection error.\n"); g_main_loop_quit (loop); break; default: g_error ("Unexpected event type %d", event->type); break; } } GNET_START_TEST (test_conn_new) { GMainContext *ctx; GMainLoop *loop; GConn *conn; ctx = g_main_context_new (); loop = g_main_loop_new (ctx, FALSE); conn = gnet_conn_new ("www.microsoft.com", 80, conn_cb, loop); /* should always succeed, we're not doing any lookups or connecting yet */ fail_unless (conn != NULL); gnet_conn_timeout (conn, 5 * 1000); gnet_conn_set_main_context (conn, ctx); fail_if (g_main_context_pending (ctx)); gnet_conn_connect (conn); g_main_loop_run (loop); gnet_conn_disconnect (conn); gnet_conn_delete (conn); fail_if (g_main_context_pending (NULL)); fail_if (g_main_context_pending (ctx)); /* test failure case too */ conn = gnet_conn_new ("does.not.exist", 80, conn_fail_cb, loop); /* should always succeed, we're not doing any lookups or connecting yet */ fail_unless (conn != NULL); gnet_conn_timeout (conn, 5 * 1000); gnet_conn_set_main_context (conn, ctx); fail_if (g_main_context_pending (ctx)); gnet_conn_connect (conn); g_main_loop_run (loop); /* we've deleted the connection in the callback */ g_main_context_unref (ctx); g_main_loop_unref (loop); #ifdef HAVE_VALGRIND if (RUNNING_ON_VALGRIND) { /* give DNS lookup thread a chance to finish, it's not stuck in a blocking * operation, so a short sleep should be fine; valgrind will think the * thread was leaked if we don't do this */ g_usleep (1 * G_USEC_PER_SEC); } #endif } GNET_END_TEST; GNET_START_TEST (test_conn_new_inetaddr) { GMainContext *ctx; GMainLoop *loop; GInetAddr *ia; GConn *conn; ia = gnet_inetaddr_new ("www.sun.com", 80); /* it's not fatal if this doesn't work, it's not what we're testing here */ if (ia == NULL) { g_print ("Failed to resolve www.sun.com, skipping test.\n"); return; } ctx = g_main_context_new (); loop = g_main_loop_new (ctx, FALSE); ASSERT_CRITICAL (fail_if (gnet_conn_new_inetaddr (NULL, conn_cb, loop))); conn = gnet_conn_new_inetaddr (ia, conn_cb, loop); gnet_inetaddr_unref (ia); /* should always succeed, we're not connecting yet */ fail_unless (conn != NULL); gnet_conn_timeout (conn, 5 * 1000); gnet_conn_set_main_context (conn, ctx); fail_if (g_main_context_pending (ctx)); gnet_conn_connect (conn); g_main_loop_run (loop); gnet_conn_disconnect (conn); gnet_conn_delete (conn); fail_if (g_main_context_pending (NULL)); g_main_context_unref (ctx); g_main_loop_unref (loop); } GNET_END_TEST; GNET_START_TEST (test_conn_new_socket) { GMainContext *ctx; GMainLoop *loop; GTcpSocket *socket; GConn *conn; socket = gnet_tcp_socket_connect ("www.oracle.com", 80); /* it's not fatal if this doesn't work, it's not what we're testing here */ if (socket == NULL) { g_print ("Failed to resolve+connect to www.oracole.com, skipping test.\n"); return; } ctx = g_main_context_new (); loop = g_main_loop_new (ctx, FALSE); ASSERT_CRITICAL (fail_if (gnet_conn_new_socket (NULL, conn_cb, loop))); conn = gnet_conn_new_socket (socket, conn_cb, loop); /* conn took ownership of the socket */ socket = NULL; /* should always succeed */ fail_unless (conn != NULL); gnet_conn_timeout (conn, 5 * 1000); gnet_conn_set_main_context (conn, ctx); fail_if (g_main_context_pending (ctx)); /* we're already connected, so do fake call to callback so request is sent */ { GConnEvent event = { GNET_CONN_CONNECT, NULL, 0 }; conn_cb (conn, &event, loop); } g_main_loop_run (loop); gnet_conn_disconnect (conn); gnet_conn_delete (conn); fail_if (g_main_context_pending (NULL)); g_main_context_unref (ctx); g_main_loop_unref (loop); } GNET_END_TEST; static Suite * gnetconn_suite (void) { Suite *s = suite_create ("GConn"); TCase *tc_chain = tcase_create ("conn"); tcase_set_timeout (tc_chain, 0); suite_add_tcase (s, tc_chain); #ifdef GNET_ENABLE_NETWORK_TESTS tcase_add_test (tc_chain, test_conn_new); tcase_add_test (tc_chain, test_conn_new_inetaddr); tcase_add_test (tc_chain, test_conn_new_socket); #endif return s; } GNET_CHECK_MAIN (gnetconn); gnet-2.0.8/tests/check/gnet-valgrind.supp0000644000175000017500000000000010751326731015263 00000000000000gnet-2.0.8/tests/check/gnetcheck.c0000644000175000017500000001100410751326731013716 00000000000000/* Common code for GNet unittests (based on GStreamer's libgstcheck) * * Copyright (C) 2004,2006 Thomas Vander Stichele * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "gnetcheck.h" #include /* GST_DEBUG_CATEGORY (check_debug); */ /* logging function for tests * a test uses g_message() to log a debug line * a gst unit test can be run with GNET_TEST_DEBUG env var set to see the * messages */ gboolean _gnet_check_threads_running = FALSE; GList *thread_list = NULL; GMutex *mutex; GCond *start_cond; /* used to notify main thread of thread startups */ GCond *sync_cond; /* used to synchronize all threads and main thread */ gboolean _gnet_check_debug = FALSE; gboolean _gnet_check_raised_critical = FALSE; gboolean _gnet_check_raised_warning = FALSE; gboolean _gnet_check_expecting_log = FALSE; static void gnet_check_log_message_func (const gchar * log_domain, GLogLevelFlags log_level, const gchar * message, gpointer user_data) { if (_gnet_check_debug) { g_print ("%s", message); } } static void gnet_check_log_critical_func (const gchar * log_domain, GLogLevelFlags log_level, const gchar * message, gpointer user_data) { if (!_gnet_check_expecting_log) { g_print ("\n\nUnexpected critical/warning: %s\n", message); fail ("Unexpected critical/warning: %s", message); } if (_gnet_check_debug) { g_print ("\nExpected critical/warning: %s\n", message); } if (log_level & G_LOG_LEVEL_CRITICAL) _gnet_check_raised_critical = TRUE; if (log_level & G_LOG_LEVEL_WARNING) _gnet_check_raised_warning = TRUE; } /* initialize GNet testing */ static void gnet_check_init (int *argc, char **argv[]) { gnet_init (); /* GST_DEBUG_CATEGORY_INIT (check_debug, "check", 0, "check regression tests"); */ if (g_getenv ("GNET_TEST_DEBUG")) _gnet_check_debug = TRUE; if (g_getenv ("SOCKS_SERVER")) { GInetAddr *ia; ia = gnet_socks_get_server (); if (ia) { gchar *name; name = gnet_inetaddr_get_canonical_name (ia); g_print ("\nUsing SOCKS %u proxy: %s\n", gnet_socks_get_version(), name); g_free (name); gnet_inetaddr_unref (ia); gnet_socks_set_enabled (TRUE); } } g_log_set_handler (NULL, G_LOG_LEVEL_MESSAGE, gnet_check_log_message_func, NULL); g_log_set_handler (NULL, G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING, gnet_check_log_critical_func, NULL); g_log_set_handler ("GNet", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING, gnet_check_log_critical_func, NULL); g_log_set_handler ("GLib", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING, gnet_check_log_critical_func, NULL); g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING, gnet_check_log_critical_func, NULL); check_cond = g_cond_new (); check_mutex = g_mutex_new (); } gint gnet_check_run_suite (Suite * suite, const gchar * name, const gchar * fname) { gint nf; SRunner *sr = srunner_create (suite); gnet_check_init (NULL, NULL); if (g_getenv ("GNET_CHECK_XML")) { /* how lucky we are to have __FILE__ end in .c */ gchar *xmlfilename = g_strdup_printf ("%sheck.xml", fname); srunner_set_xml (sr, xmlfilename); } srunner_run_all (sr, CK_NORMAL); nf = srunner_ntests_failed (sr); srunner_free (sr); return nf; } gboolean _gnet_check_run_test_func (const gchar * func_name) { const gchar *gnet_checks; gboolean res = FALSE; gchar **funcs, **f; gnet_checks = g_getenv ("GNET_CHECKS"); /* no filter specified => run all checks */ if (gnet_checks == NULL || *gnet_checks == '\0') return TRUE; /* only run specified functions */ funcs = g_strsplit (gnet_checks, ",", -1); for (f = funcs; f != NULL && *f != NULL; ++f) { if (strcmp (*f, func_name) == 0) { res = TRUE; break; } } g_strfreev (funcs); return res; } gnet-2.0.8/tests/makefile.mingw0000644000175000017500000000100710751326731013364 00000000000000CC = gcc FLAGS = -g -Wall -mno-cygwin -mcpu=pentium -DGNET_EXPERIMENTAL=1 LINK = -lgnet-2.0 -lglib-2.0-0 -lws2_32 INC = -I../glib -I. -I../gnet -L../glib -L../gnet all: $(CC) $(FLAGS) $(INC) base64_test.c -o base64_test $(LINK) $(CC) $(FLAGS) $(INC) hash_test.c -o hash_test $(LINK) $(CC) $(FLAGS) $(INC) inetaddr_test.c -o inetaddr_test $(LINK) $(CC) $(FLAGS) $(INC) unpack_test.c -o unpack_test $(LINK) $(CC) $(FLAGS) $(INC) uri_test.c -o uri_test $(LINK) $(CC) $(FLAGS) $(INC) pack_test.c -o pack_test $(LINK)gnet-2.0.8/tests/testfile0000644000175000017500000000217410751326731012314 00000000000000a bc def fghi jkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll m no pqrs tuvwtuvwtuvwtuvw23 gnet-2.0.8/doc/0000777000175000017500000000000010751404362010232 500000000000000gnet-2.0.8/doc/version.xml0000644000175000017500000000000610751404362012351 000000000000002.0.8 gnet-2.0.8/doc/Makefile.in0000644000175000017500000004500110751327170012214 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = doc DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/version.xml.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/gnet-arch.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = version.xml SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHECK_CFLAGS = @CHECK_CFLAGS@ CHECK_LIBS = @CHECK_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_GTK_DOC_FALSE = @ENABLE_GTK_DOC_FALSE@ ENABLE_GTK_DOC_TRUE = @ENABLE_GTK_DOC_TRUE@ ENABLE_NETWORK_TESTS_FALSE = @ENABLE_NETWORK_TESTS_FALSE@ ENABLE_NETWORK_TESTS_TRUE = @ENABLE_NETWORK_TESTS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GNET_BINARY_AGE = @GNET_BINARY_AGE@ GNET_DEBUG_FLAGS = @GNET_DEBUG_FLAGS@ GNET_GCOV_ENABLED_FALSE = @GNET_GCOV_ENABLED_FALSE@ GNET_GCOV_ENABLED_TRUE = @GNET_GCOV_ENABLED_TRUE@ GNET_INTERFACE_AGE = @GNET_INTERFACE_AGE@ GNET_MAJOR_VERSION = @GNET_MAJOR_VERSION@ GNET_MICRO_VERSION = @GNET_MICRO_VERSION@ GNET_MINOR_VERSION = @GNET_MINOR_VERSION@ GNET_VERSION = @GNET_VERSION@ GREP = @GREP@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ HAVE_CPU_ALPHA_FALSE = @HAVE_CPU_ALPHA_FALSE@ HAVE_CPU_ALPHA_TRUE = @HAVE_CPU_ALPHA_TRUE@ HAVE_CPU_ARM_FALSE = @HAVE_CPU_ARM_FALSE@ HAVE_CPU_ARM_TRUE = @HAVE_CPU_ARM_TRUE@ HAVE_CPU_CRISV32_FALSE = @HAVE_CPU_CRISV32_FALSE@ HAVE_CPU_CRISV32_TRUE = @HAVE_CPU_CRISV32_TRUE@ HAVE_CPU_CRIS_FALSE = @HAVE_CPU_CRIS_FALSE@ HAVE_CPU_CRIS_TRUE = @HAVE_CPU_CRIS_TRUE@ HAVE_CPU_HPPA_FALSE = @HAVE_CPU_HPPA_FALSE@ HAVE_CPU_HPPA_TRUE = @HAVE_CPU_HPPA_TRUE@ HAVE_CPU_I386_FALSE = @HAVE_CPU_I386_FALSE@ HAVE_CPU_I386_TRUE = @HAVE_CPU_I386_TRUE@ HAVE_CPU_IA64_FALSE = @HAVE_CPU_IA64_FALSE@ HAVE_CPU_IA64_TRUE = @HAVE_CPU_IA64_TRUE@ HAVE_CPU_M68K_FALSE = @HAVE_CPU_M68K_FALSE@ HAVE_CPU_M68K_TRUE = @HAVE_CPU_M68K_TRUE@ HAVE_CPU_MIPS_FALSE = @HAVE_CPU_MIPS_FALSE@ HAVE_CPU_MIPS_TRUE = @HAVE_CPU_MIPS_TRUE@ HAVE_CPU_PPC64_FALSE = @HAVE_CPU_PPC64_FALSE@ HAVE_CPU_PPC64_TRUE = @HAVE_CPU_PPC64_TRUE@ HAVE_CPU_PPC_FALSE = @HAVE_CPU_PPC_FALSE@ HAVE_CPU_PPC_TRUE = @HAVE_CPU_PPC_TRUE@ HAVE_CPU_S390_FALSE = @HAVE_CPU_S390_FALSE@ HAVE_CPU_S390_TRUE = @HAVE_CPU_S390_TRUE@ HAVE_CPU_SPARC_FALSE = @HAVE_CPU_SPARC_FALSE@ HAVE_CPU_SPARC_TRUE = @HAVE_CPU_SPARC_TRUE@ HAVE_CPU_X86_64_FALSE = @HAVE_CPU_X86_64_FALSE@ HAVE_CPU_X86_64_TRUE = @HAVE_CPU_X86_64_TRUE@ HAVE_VALGRIND_FALSE = @HAVE_VALGRIND_FALSE@ HAVE_VALGRIND_TRUE = @HAVE_VALGRIND_TRUE@ HTML_DIR = @HTML_DIR@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_WIN32_FALSE = @OS_WIN32_FALSE@ OS_WIN32_TRUE = @OS_WIN32_TRUE@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ VALGRIND_LIBS = @VALGRIND_LIBS@ VALGRIND_PATH = @VALGRIND_PATH@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ # We require automake 1.6 at least. AUTOMAKE_OPTIONS = 1.6 # The name of the module. DOC_MODULE = gnet # The top-level SGML file. DOC_MAIN_SGML_FILE = gnet-docs.sgml # The directory containing the source code. Relative to $(srcdir) DOC_SOURCE_DIR = $(top_srcdir)/src # Extra options to supply to gtkdoc-scan SCAN_OPTIONS = # Extra options to supply to gtkdoc-mkdb MKDB_OPTIONS = --sgml-mode --output-format=xml # Extra options to supply to gtkdoc-fixref FIXXREF_OPTIONS = # Used for dependencies HFILE_GLOB = $(top_srcdir)/src/*.h CFILE_GLOB = $(top_srcdir)/src/*.c # Headers to ignore IGNORE_HFILES = \ acconfig.h \ config.h \ gnetconfig.h \ gnet-private.h \ socks-private.h \ scheduler.h \ usagi_ifaddrs.h # Extra files to add when scanning EXTRA_HFILES = # Images to copy into HTML directory HTML_IMAGES = # Extra SGML files that are included by $(DOC_MAIN_SGML_FILE) # Need adding in one way or another to EXTRA_DIST as well (tpm) content_files = \ version.xml # Other files to distribute extra_files = # CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. # Only needed if you are using gtkdoc-scangobj to dynamically query widget # signals and properties. # e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) GTKDOC_CFLAGS = GTKDOC_LIBS = @GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) #################################### # Everything below here is generic # #################################### @GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) @GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) @GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) # We set GPATH here; this gives us semantics for GNU make # which are more like other make's VPATH, when it comes to # whether a source that is a target of one rule is then # searched for in VPATH/GPATH. # GPATH = $(srcdir) TARGET_DIR = $(HTML_DIR)/$(DOC_MODULE) # took content_files out of EXTRA_DIST and added # version.xml.in directly (tpm) EXTRA_DIST = \ $(HTML_IMAGES) \ $(DOC_MAIN_SGML_FILE) \ $(DOC_MODULE).types \ $(DOC_MODULE)-sections.txt \ $(DOC_MODULE)-overrides.txt \ version.xml.in DOC_STAMPS = scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \ $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp SCANOBJ_FILES = \ $(DOC_MODULE).args \ $(DOC_MODULE).hierarchy \ $(DOC_MODULE).interfaces \ $(DOC_MODULE).prerequisites \ $(DOC_MODULE).signals CLEANFILES = $(SCANOBJ_FILES) $(DOC_MODULE)-unused.txt $(DOC_STAMPS) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh version.xml: $(top_builddir)/config.status $(srcdir)/version.xml.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: check-am all-am: Makefile all-local installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-data-local install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-local .PHONY: all all-am all-local check check-am clean clean-generic \ clean-libtool clean-local dist-hook distclean \ distclean-generic distclean-libtool distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-data-local install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic \ maintainer-clean-local mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ uninstall-info-am uninstall-local @ENABLE_GTK_DOC_TRUE@all-local: html-build.stamp #### scan #### @ENABLE_GTK_DOC_TRUE@scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) @ENABLE_GTK_DOC_TRUE@ @echo '*** Scanning header files ***' @ENABLE_GTK_DOC_TRUE@ @-chmod -R u+w $(srcdir) @ENABLE_GTK_DOC_TRUE@ if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null ; then \ @ENABLE_GTK_DOC_TRUE@ CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \ @ENABLE_GTK_DOC_TRUE@ else \ @ENABLE_GTK_DOC_TRUE@ cd $(srcdir) ; \ @ENABLE_GTK_DOC_TRUE@ for i in $(SCANOBJ_FILES) ; do \ @ENABLE_GTK_DOC_TRUE@ test -f $$i || touch $$i ; \ @ENABLE_GTK_DOC_TRUE@ done \ @ENABLE_GTK_DOC_TRUE@ fi @ENABLE_GTK_DOC_TRUE@ cd $(srcdir) && \ @ENABLE_GTK_DOC_TRUE@ gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES) @ENABLE_GTK_DOC_TRUE@ touch scan-build.stamp @ENABLE_GTK_DOC_TRUE@$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp @ENABLE_GTK_DOC_TRUE@ @true #### templates #### @ENABLE_GTK_DOC_TRUE@tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt @ENABLE_GTK_DOC_TRUE@ @echo '*** Rebuilding template files ***' @ENABLE_GTK_DOC_TRUE@ @-chmod -R u+w $(srcdir) @ENABLE_GTK_DOC_TRUE@ cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) @ENABLE_GTK_DOC_TRUE@ touch tmpl-build.stamp @ENABLE_GTK_DOC_TRUE@tmpl.stamp: tmpl-build.stamp @ENABLE_GTK_DOC_TRUE@ @true #### xml #### @ENABLE_GTK_DOC_TRUE@sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml @ENABLE_GTK_DOC_TRUE@ @echo '*** Building XML ***' @ENABLE_GTK_DOC_TRUE@ @-chmod -R u+w $(srcdir) @ENABLE_GTK_DOC_TRUE@ cd $(srcdir) && \ @ENABLE_GTK_DOC_TRUE@ gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml $(MKDB_OPTIONS) @ENABLE_GTK_DOC_TRUE@ touch sgml-build.stamp @ENABLE_GTK_DOC_TRUE@sgml.stamp: sgml-build.stamp @ENABLE_GTK_DOC_TRUE@ @true #### html #### @ENABLE_GTK_DOC_TRUE@html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) @ENABLE_GTK_DOC_TRUE@ @echo '*** Building HTML ***' @ENABLE_GTK_DOC_TRUE@ @-chmod -R u+w $(srcdir) @ENABLE_GTK_DOC_TRUE@ rm -rf $(srcdir)/html @ENABLE_GTK_DOC_TRUE@ mkdir $(srcdir)/html @ENABLE_GTK_DOC_TRUE@ cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) @ENABLE_GTK_DOC_TRUE@ test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html ) @ENABLE_GTK_DOC_TRUE@ @echo '-- Fixing Crossreferences' @ENABLE_GTK_DOC_TRUE@ cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) @ENABLE_GTK_DOC_TRUE@ touch html-build.stamp @ENABLE_GTK_DOC_FALSE@all-local: ############## clean-local: rm -f *~ *.bak rm -rf .libs maintainer-clean-local: clean cd $(srcdir) && rm -rf xml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt install-data-local: installfiles=`echo $(srcdir)/html/*`; \ if test "$$installfiles" = '$(srcdir)/html/*'; \ then echo '-- Nothing to install' ; \ else \ $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \ for i in $$installfiles; do \ echo '-- Installing '$$i ; \ $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \ done; \ echo '-- Installing $(srcdir)/html/index.sgml' ; \ $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR) || :; \ fi uninstall-local: rm -f $(DESTDIR)$(TARGET_DIR)/* # # Require gtk-doc when making dist # @ENABLE_GTK_DOC_TRUE@dist-check-gtkdoc: @ENABLE_GTK_DOC_FALSE@dist-check-gtkdoc: @ENABLE_GTK_DOC_FALSE@ @echo "*** gtk-doc must be installed and enabled in order to make dist" @ENABLE_GTK_DOC_FALSE@ @false dist-hook: dist-check-gtkdoc dist-hook-local mkdir $(distdir)/tmpl mkdir $(distdir)/xml mkdir $(distdir)/html -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl -cp $(srcdir)/xml/*.xml $(distdir)/xml -cp $(srcdir)/html/* $(distdir)/html # dist-hook-local added as hack to fix make distcheck (tpm) dist-hook-local: version.xml files='version.xml'; \ for f in $$files; do \ if test -f $$f; then d=.; else d=$(srcdir); fi; \ cp $$d/$$f $(distdir) || exit 1; done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gnet-2.0.8/doc/Makefile.am0000644000175000017500000001357710751326731012222 00000000000000## Process this file with automake to produce Makefile.in # We require automake 1.6 at least. AUTOMAKE_OPTIONS = 1.6 # The name of the module. DOC_MODULE=gnet # The top-level SGML file. DOC_MAIN_SGML_FILE=gnet-docs.sgml # The directory containing the source code. Relative to $(srcdir) DOC_SOURCE_DIR=$(top_srcdir)/src # Extra options to supply to gtkdoc-scan SCAN_OPTIONS= # Extra options to supply to gtkdoc-mkdb MKDB_OPTIONS=--sgml-mode --output-format=xml # Extra options to supply to gtkdoc-fixref FIXXREF_OPTIONS= # Used for dependencies HFILE_GLOB=$(top_srcdir)/src/*.h CFILE_GLOB=$(top_srcdir)/src/*.c # Headers to ignore IGNORE_HFILES= \ acconfig.h \ config.h \ gnetconfig.h \ gnet-private.h \ socks-private.h \ scheduler.h \ usagi_ifaddrs.h # Extra files to add when scanning EXTRA_HFILES= # Images to copy into HTML directory HTML_IMAGES = # Extra SGML files that are included by $(DOC_MAIN_SGML_FILE) # Need adding in one way or another to EXTRA_DIST as well (tpm) content_files = \ version.xml # Other files to distribute extra_files = # CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. # Only needed if you are using gtkdoc-scangobj to dynamically query widget # signals and properties. # e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) GTKDOC_CFLAGS = GTKDOC_LIBS = #################################### # Everything below here is generic # #################################### if GTK_DOC_USE_LIBTOOL GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) else GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) endif # We set GPATH here; this gives us semantics for GNU make # which are more like other make's VPATH, when it comes to # whether a source that is a target of one rule is then # searched for in VPATH/GPATH. # GPATH = $(srcdir) TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE) # took content_files out of EXTRA_DIST and added # version.xml.in directly (tpm) EXTRA_DIST = \ $(HTML_IMAGES) \ $(DOC_MAIN_SGML_FILE) \ $(DOC_MODULE).types \ $(DOC_MODULE)-sections.txt \ $(DOC_MODULE)-overrides.txt \ version.xml.in DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \ $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp SCANOBJ_FILES = \ $(DOC_MODULE).args \ $(DOC_MODULE).hierarchy \ $(DOC_MODULE).interfaces \ $(DOC_MODULE).prerequisites \ $(DOC_MODULE).signals CLEANFILES = $(SCANOBJ_FILES) $(DOC_MODULE)-unused.txt $(DOC_STAMPS) if ENABLE_GTK_DOC all-local: html-build.stamp #### scan #### scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) @echo '*** Scanning header files ***' @-chmod -R u+w $(srcdir) if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null ; then \ CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \ else \ cd $(srcdir) ; \ for i in $(SCANOBJ_FILES) ; do \ test -f $$i || touch $$i ; \ done \ fi cd $(srcdir) && \ gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES) touch scan-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp @true #### templates #### tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt @echo '*** Rebuilding template files ***' @-chmod -R u+w $(srcdir) cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) touch tmpl-build.stamp tmpl.stamp: tmpl-build.stamp @true #### xml #### sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml @echo '*** Building XML ***' @-chmod -R u+w $(srcdir) cd $(srcdir) && \ gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml $(MKDB_OPTIONS) touch sgml-build.stamp sgml.stamp: sgml-build.stamp @true #### html #### html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) @echo '*** Building HTML ***' @-chmod -R u+w $(srcdir) rm -rf $(srcdir)/html mkdir $(srcdir)/html cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html ) @echo '-- Fixing Crossreferences' cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) touch html-build.stamp else all-local: endif ############## clean-local: rm -f *~ *.bak rm -rf .libs maintainer-clean-local: clean cd $(srcdir) && rm -rf xml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt install-data-local: installfiles=`echo $(srcdir)/html/*`; \ if test "$$installfiles" = '$(srcdir)/html/*'; \ then echo '-- Nothing to install' ; \ else \ $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \ for i in $$installfiles; do \ echo '-- Installing '$$i ; \ $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \ done; \ echo '-- Installing $(srcdir)/html/index.sgml' ; \ $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR) || :; \ fi uninstall-local: rm -f $(DESTDIR)$(TARGET_DIR)/* # # Require gtk-doc when making dist # if ENABLE_GTK_DOC dist-check-gtkdoc: else dist-check-gtkdoc: @echo "*** gtk-doc must be installed and enabled in order to make dist" @false endif dist-hook: dist-check-gtkdoc dist-hook-local mkdir $(distdir)/tmpl mkdir $(distdir)/xml mkdir $(distdir)/html -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl -cp $(srcdir)/xml/*.xml $(distdir)/xml -cp $(srcdir)/html/* $(distdir)/html # dist-hook-local added as hack to fix make distcheck (tpm) dist-hook-local: version.xml files='version.xml'; \ for f in $$files; do \ if test -f $$f; then d=.; else d=$(srcdir); fi; \ cp $$d/$$f $(distdir) || exit 1; done gnet-2.0.8/doc/gnet.types0000644000175000017500000000000010751326731012162 00000000000000gnet-2.0.8/doc/version.xml.in0000644000175000017500000000001710751326731012763 00000000000000@GNET_VERSION@ gnet-2.0.8/doc/gnet-overrides.txt0000644000175000017500000000000010751326731013635 00000000000000gnet-2.0.8/doc/gnet-sections.txt0000644000175000017500000001504510751326731013501 00000000000000gnet.h
gnet GNET_EXPORT GNET_CHECK_VERSION gnet_init
inetaddr GInetAddr gnet_inetaddr_new GInetAddrNewAsyncID GInetAddrNewAsyncFunc gnet_inetaddr_new_async gnet_inetaddr_new_async_full gnet_inetaddr_new_async_cancel gnet_inetaddr_new_list gnet_inetaddr_delete_list GInetAddrNewListAsyncID GInetAddrNewListAsyncFunc gnet_inetaddr_new_list_async gnet_inetaddr_new_list_async_full gnet_inetaddr_new_list_async_cancel gnet_inetaddr_new_nonblock gnet_inetaddr_new_bytes gnet_inetaddr_clone gnet_inetaddr_delete gnet_inetaddr_ref gnet_inetaddr_unref gnet_inetaddr_get_name gnet_inetaddr_get_name_nonblock GInetAddrGetNameAsyncID GInetAddrGetNameAsyncFunc gnet_inetaddr_get_name_async gnet_inetaddr_get_name_async_full gnet_inetaddr_get_name_async_cancel GNET_INETADDR_MAX_LEN gnet_inetaddr_get_length gnet_inetaddr_get_bytes gnet_inetaddr_set_bytes gnet_inetaddr_get_canonical_name gnet_inetaddr_get_port gnet_inetaddr_set_port gnet_inetaddr_is_canonical gnet_inetaddr_is_internet gnet_inetaddr_is_private gnet_inetaddr_is_reserved gnet_inetaddr_is_loopback gnet_inetaddr_is_multicast gnet_inetaddr_is_broadcast gnet_inetaddr_is_ipv4 gnet_inetaddr_is_ipv6 gnet_inetaddr_hash gnet_inetaddr_equal gnet_inetaddr_noport_equal gnet_inetaddr_get_host_name gnet_inetaddr_get_host_addr gnet_inetaddr_autodetect_internet_interface gnet_inetaddr_get_interface_to gnet_inetaddr_get_internet_interface gnet_inetaddr_is_internet_domainname gnet_inetaddr_list_interfaces
mcast GMcastSocket gnet_mcast_socket_new gnet_mcast_socket_new_with_port gnet_mcast_socket_new_full gnet_mcast_socket_delete gnet_mcast_socket_ref gnet_mcast_socket_unref gnet_mcast_socket_get_io_channel gnet_mcast_socket_get_local_inetaddr gnet_mcast_socket_join_group gnet_mcast_socket_leave_group gnet_mcast_socket_get_ttl gnet_mcast_socket_set_ttl gnet_mcast_socket_send gnet_mcast_socket_receive gnet_mcast_socket_has_packet gnet_mcast_socket_is_loopback gnet_mcast_socket_set_loopback gnet_mcast_socket_to_udp_socket
tcp GTcpSocket GTcpSocketConnectAsyncID GTcpSocketConnectAsyncStatus GTcpSocketConnectAsyncFunc GTcpSocketNewAsyncID GTcpSocketNewAsyncFunc gnet_tcp_socket_connect gnet_tcp_socket_connect_async gnet_tcp_socket_connect_async_full gnet_tcp_socket_connect_async_cancel gnet_tcp_socket_new gnet_tcp_socket_new_async gnet_tcp_socket_new_async_full gnet_tcp_socket_new_async_cancel gnet_tcp_socket_delete gnet_tcp_socket_ref gnet_tcp_socket_unref gnet_tcp_socket_get_io_channel gnet_tcp_socket_get_remote_inetaddr gnet_tcp_socket_get_local_inetaddr gnet_tcp_socket_get_port GNetTOS gnet_tcp_socket_set_tos gnet_tcp_socket_server_new gnet_tcp_socket_server_new_with_port gnet_tcp_socket_server_new_full gnet_tcp_socket_server_accept gnet_tcp_socket_server_accept_nonblock GTcpSocketAcceptFunc gnet_tcp_socket_server_accept_async gnet_tcp_socket_server_accept_async_cancel gnet_tcp_socket_new_direct gnet_tcp_socket_new_async_direct gnet_tcp_socket_new_async_direct_full
udp GUdpSocket gnet_udp_socket_new gnet_udp_socket_new_with_port gnet_udp_socket_new_full gnet_udp_socket_delete gnet_udp_socket_ref gnet_udp_socket_unref gnet_udp_socket_send gnet_udp_socket_receive gnet_udp_socket_has_packet gnet_udp_socket_get_io_channel gnet_udp_socket_get_local_inetaddr gnet_udp_socket_get_ttl gnet_udp_socket_set_ttl
conn GConn GConnEvent GConnEventType GConnFunc gnet_conn_new gnet_conn_new_inetaddr gnet_conn_new_socket gnet_conn_delete gnet_conn_ref gnet_conn_unref gnet_conn_set_callback gnet_conn_set_main_context gnet_conn_connect gnet_conn_disconnect gnet_conn_is_connected gnet_conn_read gnet_conn_readn gnet_conn_readline gnet_conn_write gnet_conn_write_direct gnet_conn_set_watch_error gnet_conn_set_watch_readable gnet_conn_set_watch_writable gnet_conn_timeout
conn-http GConnHttp GConnHttpMethod GConnHttpError GConnHttpEventType GConnHttpEvent GConnHttpEventResolved GConnHttpEventResponse GConnHttpEventRedirect GConnHttpEventData GConnHttpEventError GConnHttpFunc GConnHttpHeaderFlags gnet_conn_http_new gnet_conn_http_set_uri gnet_conn_http_set_escaped_uri gnet_conn_http_set_header gnet_conn_http_set_max_redirects gnet_conn_http_set_timeout gnet_conn_http_set_user_agent gnet_conn_http_set_method gnet_conn_http_set_main_context gnet_conn_http_run_async gnet_conn_http_run gnet_conn_http_steal_buffer gnet_conn_http_cancel gnet_conn_http_delete gnet_http_get
iochannel gnet_io_channel_writen gnet_io_channel_readn gnet_io_channel_readline gnet_io_channel_readline_strdup
md5 GMD5 GNET_MD5_HASH_LENGTH gnet_md5_new gnet_md5_new_string gnet_md5_clone gnet_md5_delete gnet_md5_new_incremental gnet_md5_update gnet_md5_final gnet_md5_equal gnet_md5_hash gnet_md5_get_digest gnet_md5_get_string gnet_md5_copy_string
pack gnet_pack gnet_pack_strdup gnet_vpack gnet_calcsize gnet_vcalcsize gnet_unpack gnet_vunpack
server GServer GServerFunc gnet_server_new gnet_server_delete gnet_server_ref gnet_server_unref
sha GSHA GNET_SHA_HASH_LENGTH gnet_sha_new gnet_sha_new_string gnet_sha_clone gnet_sha_delete gnet_sha_new_incremental gnet_sha_update gnet_sha_final gnet_sha_equal gnet_sha_hash gnet_sha_get_digest gnet_sha_get_string gnet_sha_copy_string
base64 gnet_base64_encode gnet_base64_decode
uri GURI gnet_uri_new gnet_uri_new_fields gnet_uri_new_fields_all gnet_uri_clone gnet_uri_delete gnet_uri_escape gnet_uri_unescape gnet_uri_get_string gnet_uri_set_scheme gnet_uri_set_userinfo gnet_uri_set_hostname gnet_uri_set_port gnet_uri_set_path gnet_uri_set_query gnet_uri_set_fragment gnet_uri_hash gnet_uri_equal gnet_uri_parse_inplace
socks GNET_SOCKS_PORT GNET_SOCKS_VERSION gnet_socks_get_enabled gnet_socks_set_enabled gnet_socks_get_server gnet_socks_set_server gnet_socks_get_version gnet_socks_set_version
unix GUnixSocket gnet_unix_socket_new gnet_unix_socket_new_abstract gnet_unix_socket_delete gnet_unix_socket_ref gnet_unix_socket_unref gnet_unix_socket_get_io_channel gnet_unix_socket_get_path gnet_unix_socket_server_new gnet_unix_socket_server_new_abstract gnet_unix_socket_server_accept gnet_unix_socket_server_accept_nonblock
ipv6 GIPv6Policy gnet_ipv6_set_policy gnet_ipv6_get_policy
gnet-2.0.8/doc/tmpl/0000777000175000017500000000000010751404362011206 500000000000000gnet-2.0.8/doc/tmpl/iochannel.sgml0000644000175000017500000000160410751404362013747 00000000000000 IOChannel GIOChannel utility functions The IOChannel module provides utility functions for reading from and writing to GIOChannels. @channel: @buffer: @length: @bytes_writtenp: @Returns: @channel: @buffer: @length: @bytes_readp: @Returns: @channel: @buffer: @length: @bytes_readp: @Returns: @channel: @bufferp: @bytes_readp: @Returns: gnet-2.0.8/doc/tmpl/unix.sgml0000644000175000017500000000375510751404362013003 00000000000000 Unix Unix socket The Unix module provides support for Unix sockets. Unix sockets are used to communicate between processes. Unix sockets are for Unix operating systems only and are not supported in Windows. GNet's Unix sockets are stream-based (like TCP), not datagram-based (like UDP). Unix socket addresses are file names, like "/tmp/my_unix_socket". To connect to a existing Unix socket, call gnet_unix_socket_new(). To create a new Unix socket other processes will connect to, call gnet_unix_socket_server_new(). The functions in this module are similar to those in the TCP module. See the documentation on TCP sockets for more information. @path: @Returns: @path: @Returns: @socket: @socket: @socket: @socket: @Returns: @socket: @Returns: @path: @Returns: @path: @Returns: @socket: @Returns: @socket: @Returns: gnet-2.0.8/doc/tmpl/conn-http.sgml0000644000175000017500000001263610751404362013730 00000000000000 GConnHttp HTTP connection object A #GConnHttp represents a HTTP client connection. A #GConnHttp is created directly by calling gnet_conn_http_new(). After that set the URI to retrieve using gnet_conn_http_set_uri(). A connection is made and the HTTP request sent only once either gnet_conn_http_run_async() or gnet_conn_http_run() is called. Use the asynchroneous variant if you want the function to return immediately and prefer to receive data and status information in the background via the callback function. gnet_conn_http_run_async() assumes that there is already a GLib main loop running (e.g. the Gtk main loop). You can decide for yourself how much information you would like to receive during the HTTP operation. All status information is communicated to the caller via the optional callback function. The easiest way to just retrieve some data via HTTP is to use the convenience function gnet_http_get(). Here is a small example how to retrieve a file with the least amount of effort and error checking (this is more or less what gnet_http_get() does internally): Simple <structname>GConnHttp</structname> usage. &hash;define GNET_EXPERIMENTAL &hash;include <gnet.h> void fetch_and_print_url (const gchar *url) { GConnHttp *conn; conn = gnet_conn_http_new(); gnet_conn_http_set_uri(conn, url); if (gnet_conn_http_run(conn, NULL, NULL)) { gchar *buf; gsize buflen; if (gnet_conn_http_steal_buffer(conn, &buf, &buflen)) { g_print ("Received %%u bytes of data:\n%%s\n", buflen, buf); g_free(buf); } } gnet_conn_http_delete(conn); } ... fetch_and_print_url ("http://www.google.com"); ... #GConnHttp is still considered less mature than other parts of GNet, even though it should generall work just fine. It just has not received as much testing as other parts of GNet yet. You should not use it in production level code without thoroughly testing it for your purposes. Because of that, you need to define GNET_EXPERIMENTAL in your source code before including the GNet headers (otherwise you will get compiler errors when trying to use it). @GNET_CONN_HTTP_METHOD_GET: @GNET_CONN_HTTP_METHOD_POST: @GNET_CONN_HTTP_ERROR_UNSPECIFIED: @GNET_CONN_HTTP_ERROR_PROTOCOL_UNSUPPORTED: @GNET_CONN_HTTP_ERROR_HOSTNAME_RESOLUTION: @GNET_CONN_HTTP_RESOLVED: @GNET_CONN_HTTP_CONNECTED: @GNET_CONN_HTTP_RESPONSE: @GNET_CONN_HTTP_REDIRECT: @GNET_CONN_HTTP_DATA_PARTIAL: @GNET_CONN_HTTP_DATA_COMPLETE: @GNET_CONN_HTTP_TIMEOUT: @GNET_CONN_HTTP_ERROR: @type: @ia: @response_code: @header_fields: @header_values: @num_redirects: @max_redirects: @new_location: @auto_redirect: @content_length: @data_received: @buffer: @buffer_length: @code: @message: @conn: @event: @user_data: @GNET_CONN_HTTP_FLAG_SKIP_HEADER_CHECK: @Returns: @conn: @uri: @Returns: @conn: @uri: @Returns: @conn: @field: @value: @flags: @Returns: @conn: @num: @conn: @timeout: @conn: @agent: @Returns: @conn: @method: @post_data: @post_data_len: @Returns: @conn: @context: @Returns: @conn: @func: @user_data: @conn: @func: @user_data: @Returns: @conn: @buffer: @length: @Returns: @conn: @conn: @url: @buffer: @length: @response: @Returns: gnet-2.0.8/doc/tmpl/inetaddr.sgml0000644000175000017500000001561310751404362013606 00000000000000 InetAddr Internet Address A #GInetAddr represents an internet address. This module provides functions for making DNS and reverse DNS lookups (blocking and asynchronously) and for working with #GInetAddr's. Create a #GInetAddr by calling gnet_inetaddr_new(). This function will perform a DNS lookup and creates a #GInetAddr representing the address. This function blocks. The function gnet_inetaddr_new_async() performs the lookup asynchronously and calls a callback with the #GInetAddr when the lookup completes. An asynchronous lookup can be canceled by calling gnet_inetaddr_new_async_cancel(). Technically a DNS lookup can map a name to several addresses. Use gnet_inetaddr_new_list() or gnet_inetaddr_new_list_async() to get this list. Use gnet_inetaddr_delete_list() to delete the list. This module can also make reverse DNS lookups (i.e., map an address to a hostname). Call gnet_inetaddr_get_name() to get the hostname from an address. This function blocks. Its asynchronous counterpart is gnet_inetadr_get_name_async(). To get the canonical name, or dotted decimal address, call gnet_inetaddr_get_canonical_name(). To get the host's address, call gnet_inetaddr_gethostaddr(). This creates a #GInetAddr by performing a DNS lookup on the host's name. To get the list of all the host's interfaces, call gnet_inetaddr_list_interfaces(). The function gnet_inetaddr_autodetect_internet_interface() uses this function and heuristics to find an interface connected to the internet. This can be used to automatically configure peer-to-peer applications. @hostname: @port: @Returns: @inetaddr: @data: @hostname: @port: @func: @data: @Returns: @hostname: @port: @func: @data: @notify: @context: @priority: @Returns: @id: @hostname: @port: @Returns: @list: @list: @data: @hostname: @port: @func: @data: @Returns: @hostname: @port: @func: @data: @notify: @context: @priority: @Returns: @id: @hostname: @port: @Returns: @bytes: @length: @Returns: @inetaddr: @Returns: @inetaddr: @inetaddr: @inetaddr: @inetaddr: @Returns: @inetaddr: @Returns: @hostname: @data: @inetaddr: @func: @data: @Returns: @inetaddr: @func: @data: @notify: @context: @priority: @Returns: @id: @inetaddr: @Returns: @inetaddr: @buffer: @inetaddr: @bytes: @length: @inetaddr: @Returns: @inetaddr: @Returns: @inetaddr: @port: @hostname: @Returns: @inetaddr: @Returns: @inetaddr: @Returns: @inetaddr: @Returns: @inetaddr: @Returns: @inetaddr: @Returns: @inetaddr: @Returns: @inetaddr: @Returns: @inetaddr: @Returns: @p: @Returns: @p1: @p2: @Returns: @p1: @p2: @Returns: @Returns: @Returns: @Returns: @inetaddr: @Returns: @Returns: @name: @Returns: @Returns: gnet-2.0.8/doc/tmpl/conn.sgml0000644000175000017500000001217710751404362012753 00000000000000 Conn TCP connection object A #GConn represents a TCP connection. A #GConn is usually created directly by the user by calling gnet_conn_new() or gnet_conn_new_inetaddr(). To connect to the remote host, call gnet_conn_connect() and to disconnect call gnet_conn_disconnect(). You may use the same #GConn to connect again to the host after you disconnected. Free the #GConn with gnet_conn_unref() or gnet_conn_delete() when no longer needed. #GConns are also created by a #GServer when a client connects. You will need to call gnet_conn_set_callback() to set the #GConn callback after it is created by the #GServer. A #GConn that has been created by a #GServer is already connect, you don't have to call gnet_conn_connect() in this case. Call gnet_conn_unref() or gnet_conn_delete() to disconnect the remote client and free the #GConn. The iochannel field and #GIOChannel functions can be used to read from or write to the socket. #GIOChannel functions block. To make an asynchronous read call gnet_conn_read() and to make an asynchronous write call gnet_conn_write(). The callback is called whenever a read or write completes. Special use cases (you usually do not need this): use gnet_conn_set_watch_error() to get an event if an error occurs. Use gnet_conn_set_watch_readable() and gnet_conn_set_watch_writable() to get events when the connection is readable or writable. These can be used to implement custom I/O handling for cases where gnet_conn_read(), gnet_conn_write() and gnet_conn_write_direct() are not suitable. For example, consider writing from a mmap()'ed file. gnet_conn_write() will allocate memory for a buffer and copy part of the file into the buffer. To avoid the copy, use gnet_conn_set_watch_writable() to catch the writable event and then write directly from memory to the socket (note: this is obsolete, you can now use gnet_conn_write_direct() for this). gnet_conn_timeout() sets a timeout on the GConn. The %GNET_CONN_TIMEOUT event occurs when the timer expires. For example, the timer may be set before connecting to the host. If the connection is made, the %GNET_CONN_CONNECT event occurs. The timer can then be reset by setting the timeout to 0. Otherwise, the %GNET_CONN_TIMEOUT event will eventually occur. See also GServer and the echoclient-gconn example. @hostname: @port: @iochannel: @socket: @inetaddr: @ref_count: @ref_count_internal: @connect_id: @new_id: @write_queue: @bytes_written: @buffer: @length: @bytes_read: @read_eof: @read_queue: @process_buffer_timeout: @watch_readable: @watch_writable: @watch_flags: @watch: @timer: @func: @user_data: @context: @priority: @type: @buffer: @length: @GNET_CONN_ERROR: @GNET_CONN_CONNECT: @GNET_CONN_CLOSE: @GNET_CONN_TIMEOUT: @GNET_CONN_READ: @GNET_CONN_WRITE: @GNET_CONN_READABLE: @GNET_CONN_WRITABLE: @conn: @event: @user_data: @hostname: @port: @func: @user_data: @Returns: @inetaddr: @func: @user_data: @Returns: @socket: @func: @user_data: @Returns: @conn: @conn: @conn: @conn: @func: @user_data: @conn: @context: @Returns: @conn: @conn: @conn: @Returns: @conn: @conn: @length: @conn: @conn: @buffer: @length: @conn: @buffer: @length: @buffer_destroy_cb: @conn: @enable: @conn: @enable: @conn: @enable: @conn: @timeout: gnet-2.0.8/doc/tmpl/tcp.sgml0000644000175000017500000001172310751404362012600 00000000000000 TCP TCP socket TCP is an internet protocol that transfers data reliably and in-order. This module provides support for TCP sockets. To create a #GTcpSocket and connect to a host, call gnet_tcp_socket_new(). This function will block. The asynchronous version is gnet_tcp_socket_new_async(). Each TCP socket has a #GIOChannel which can be used to read and write from the socket. A watch can be set on the #GIOChannel by calling g_io_add_watch() (a GLib function). To create a TCP server, call gnet_tcp_socket_server_new(). The socket will be bound to all interfaces. To bind to a specific interface, call gnet_tcp_socket_server_new_interface(). To accept a new connection, call gnet_tcp_socket_server_accept(). This function returns a #GTcpSocket representing the client connection. This function can block. To prevent blocking, call either gnet_tcp_socket_server_accept_nonblock() or gnet_tcp_socket_server_accept_async(). The former returns NULL immediately if there is no new connection. The latter calls a callback whenever there is a new connection. We recommend this function. This module will use SOCKS if enabled. @GTCP_SOCKET_CONNECT_ASYNC_STATUS_OK: @GTCP_SOCKET_CONNECT_ASYNC_STATUS_INETADDR_ERROR: @GTCP_SOCKET_CONNECT_ASYNC_STATUS_TCP_ERROR: @socket: @status: @data: @socket: @data: @hostname: @port: @Returns: @hostname: @port: @func: @data: @Returns: @hostname: @port: @func: @data: @notify: @context: @priority: @Returns: @id: @addr: @Returns: @addr: @func: @data: @Returns: @addr: @func: @data: @notify: @context: @priority: @Returns: @id: @socket: @socket: @socket: @socket: @Returns: @socket: @Returns: @socket: @Returns: @socket: @Returns: @GNET_TOS_NONE: @GNET_TOS_LOWDELAY: @GNET_TOS_THROUGHPUT: @GNET_TOS_RELIABILITY: @GNET_TOS_LOWCOST: @socket: @tos: @Returns: @port: @Returns: @iface: @port: @Returns: @socket: @Returns: @socket: @Returns: @server: @client: @data: @socket: @accept_func: @user_data: @socket: @addr: @Returns: @addr: @func: @data: @Returns: @addr: @func: @data: @notify: @context: @priority: @Returns: gnet-2.0.8/doc/tmpl/sha.sgml0000644000175000017500000000542410751404362012566 00000000000000 SHA SHA hash The SHA module provide support for computing and manipulating SHA hashes. SHA is a hash function with a very low probability of collision. SHA is considered stronger than MD5. A SHA can be calculated at one time or incrementally. To create a SHA at one time, call gnet_sha_new() with the data. To create a SHA incrementally, call gnet_sha_new_incremental() to create the SHA object, then gnet_sha_update() one or more times with data to hash, and finally call gnet_sha_final(). To get the digest, or hash value, call gnet_sha_get_digest(). This returns the raw digest as an array of %GNET_SHA_HASH_LENGTH bytes. To get the digest as a human-readable string, call gnet_sha_get_string() or gnet_sha_copy_string(). gchar buffer[] = "Hello world!"; gchar buffer2[] = "Second line"; GSHA* sha; gchar* sha_str; &comstart; Compute an SHA at one time &comend; sha = gnet_sha_new (buffer, strlen(buffer)); sha_str = gnet_sha_get_string (sha); g_print ("The SHA of %s is %s\n", buffer, sha_str); &comstart; Use SHA... &comend; g_free (sha_str); gnet_sha_delete (sha); &comstart; Compute an SHA incrementally &comend; sha = gnet_sha_new_incremental (); gnet_sha_update (sha, buffer, strlen(buffer)); gnet_sha_update (sha, buffer2, strlen(buffer2)); gnet_sha_final (sha); &comstart; Use SHA... &comend; gnet_sha_delete (sha); @buffer: @length: @Returns: @str: @Returns: @sha: @Returns: @sha: @Returns: @sha: @buffer: @length: @sha: @p1: @p2: @Returns: @p: @Returns: @sha: @Returns: @sha: @Returns: @sha: @buffer: gnet-2.0.8/doc/tmpl/server.sgml0000644000175000017500000000240610751404362013316 00000000000000 Server TCP server object A #GServer represents a TCP server. #GServer is a thin wrapper around a TCP server socket. To create a new #GServer, call gnet_server_new(). One of the arguments is a callback function that is called with a new #GConn whenever a new client connects. Remember to call gnet_conn_set_callback() on the new #GConn to set the #GConn callback. To delete a #GServer, call gnet_server_delete(). See also #GConn and the echoserver-gserver example. @iface: @port: @socket: @ref_count: @func: @user_data: @server: @conn: @user_data: @iface: @port: @func: @user_data: @Returns: @server: @server: @server: gnet-2.0.8/doc/tmpl/mcast.sgml0000644000175000017500000000545010751404362013121 00000000000000 Mcast IP Multicast socket The Mcast module provides support for IP Multicast sockets. IP Multicast allows you to send one packet to many receivers at once. Unfortunately, IP Multicast is not widely available. IP Multicast is built on UDP. An IP Multicast socket is represented by a #GMcastSocket stucture. To create a #GMcastSocket, call gnet_mcast_socket_new(), gnet_mcast_socket_new_with_port(), or gnet_mcast_socket_new_full(). Then call gnet_mcast_socket_join_group() to join a multicast group. To leave the group, call gnet_mcast_socket_leave_group(). Use gnet_mcast_socket_set_loopback() to set whether packets sent by the host will also be received by the host. Applications typically disable loopback. @Returns: @port: @Returns: @iface: @port: @Returns: @socket: @socket: @socket: @socket: @Returns: @socket: @Returns: @socket: @inetaddr: @Returns: @socket: @inetaddr: @Returns: @socket: @Returns: @socket: @ttl: @Returns: @socket: @buffer: @length: @dst: @Returns: @socket: @buffer: @length: @src: @Returns: @socket: @Returns: @socket: @Returns: @socket: @enable: @Returns: @MS: gnet-2.0.8/doc/tmpl/uri.sgml0000644000175000017500000000475410751404362012617 00000000000000 URI Uniform Resource Identifier (URI) A URI is a Uniform Resource Identifier, similar to a URL. This module provides functions for creating and manipulating URIs. A URI is represented by #GURI. All fields in the #GURI structure are publicly readable. Create a URI from a string by calling gnet_uri_new(). To get the string representation back, call gnet_uri_get_string(). To escape a URI call gnet_uri_escape(), and to unescape it call gnet_uri_unescape(). Network protocols use escaped URIs. People use unescaped URIs. @scheme: @userinfo: @hostname: @port: @path: @query: @fragment: @uri: @Returns: @scheme: @hostname: @port: @path: @Returns: @scheme: @userinfo: @hostname: @port: @path: @query: @fragment: @Returns: @uri: @Returns: @uri: @uri: @uri: @uri: @Returns: @uri: @scheme: @uri: @userinfo: @uri: @hostname: @uri: @port: @uri: @path: @uri: @query: @uri: @fragment: @p: @Returns: @p1: @p2: @Returns: @guri: @uri: @hostname: @len: @Returns: gnet-2.0.8/doc/tmpl/socks.sgml0000644000175000017500000000316410751404362013134 00000000000000 SOCKS SOCKS proxy SOCKS is a TCP proxy protocol. Typically, a host behind a firewall uses SOCKS to connect to hosts outside the firewall via a SOCKS proxy server. To open a TCP connection, a SOCKS client connects to a SOCKS server and the SOCKS server connects to the destination. Data is then forwarded between the client and the destination by the SOCKS server. GNet supports SOCKS versions 4 and 5. Version 5 includes support for server sockets. SOCKS is used if the SOCKS_SERVER environment variable is set or gnet_socks_set_server() is called to set the SOCKS server's address. To disable SOCKS support, call gnet_socks_set_enabled() and pass FALSE. The SOCKS_VERSION environment variable controls which SOCKS version is used. The default is version 5. @Returns: @enabled: @Returns: @inetaddr: @Returns: @version: gnet-2.0.8/doc/tmpl/gnet-unused.sgml0000644000175000017500000001634610751404362014256 00000000000000 gnet-private scheduler socks-private url @GNET_CONN_STATUS_CONNECT: @GNET_CONN_STATUS_CLOSE: @GNET_CONN_STATUS_READ: @GNET_CONN_STATUS_WRITE: @GNET_CONN_STATUS_TIMEOUT: @GNET_CONN_STATUS_ERROR: @GINETADDR_ASYNC_STATUS_OK: @GINETADDR_ASYNC_STATUS_ERROR: @buffer: @length: @user_data: @Returns: @iochannel: @status: @buffer: @length: @user_data: @Returns: @GNET_IOCHANNEL_READ_ASYNC_STATUS_OK: @GNET_IOCHANNEL_READ_ASYNC_STATUS_TIMEOUT: @GNET_IOCHANNEL_READ_ASYNC_STATUS_ERROR: @iochannel: @buffer: @length: @bytes_writen: @status: @user_data: @GNET_IOCHANNEL_WRITE_ASYNC_STATUS_OK: @GNET_IOCHANNEL_WRITE_ASYNC_STATUS_TIMEOUT: @GNET_IOCHANNEL_WRITE_ASYNC_STATUS_ERROR: @GNET_SERVER_STATUS_CONNECT: @GNET_SERVER_STATUS_ERROR: @GTCP_SOCKET_NEW_ASYNC_STATUS_OK: @GTCP_SOCKET_NEW_ASYNC_STATUS_ERROR: @data: @length: @addr: @conn: @buffer: @length: @timeout: @conn: @enable: @Returns: @Returns: @Returns: @iochannel: @buffer: @length: @timeout: @read_one_byte_at_a_time: @check_func: @check_user_data: @func: @user_data: @Returns: @id: @IO: @BUF: @LEN: @TO: @FUNC: @UD: @buffer: @length: @data: @Returns: @IO: @BUF: @LEN: @TO: @FUNC: @UD: @buffer: @length: @data: @Returns: @iochannel: @buffer: @length: @timeout: @func: @user_data: @Returns: @id: @delete_buffer: @ia: @Returns: @port: @Returns: @socket: @Returns: @socket: @Returns: @iface: @port: @Returns: @packet: @data: @length: @Returns: @data: @length: @addr: @Returns: @socket: @Returns: @us: @Returns: @iface: @Returns: @port: @Returns: @us: @val: @Returns: @path: @Returns: @socket: @Returns: @uri: @Returns: @url: @Returns: @url: @p1: @p2: @Returns: @url: @Returns: @p: @Returns: @url: @Returns: @protocol: @hostname: @port: @resource: @Returns: @protocol: @user: @password: @hostname: @port: @resource: @query: @fragment: @Returns: @url: @fragment: @url: @hostname: @url: @password: @url: @port: @url: @protocol: @url: @query: @url: @resource: @url: @user: gnet-2.0.8/doc/tmpl/base64.sgml0000644000175000017500000000241410751404362013073 00000000000000 Base64 Base64 encoding and decoding gchar* binary_stream = "Hello World!"; gchar* base64_stream; gint base64_len; gchar* newbin_stream; gint newbin_len; base64_stream = gnet_base64_encode(binary_stream,strlen(binary_stream), &base64_len, FALSE); newbin_stream = gnet_base64_decode(base64_stream, base64_len, &newbin_len); This module provides functions to encode and decode strings into the Base64 encoding specified in "RFC 2045 - MIME (Multipurpose Internet Mail Extensions)". The Base64 encoding is designed to represent arbitrary sequences of octets in a form that need not be humanly readable. A 65-character subset ([A-Za-z0-9+/=]) of US-ASCII is used, enabling 6 bits to be represented per printable character. @src: @srclen: @dstlenp: @strict: @Returns: @src: @srclen: @dstlenp: @Returns: gnet-2.0.8/doc/tmpl/md5.sgml0000644000175000017500000000543710751404362012504 00000000000000 MD5 MD5 hash The MD5 module provide support for computing and manipulating MD5 hashes. MD5 is a hash function with a very low probability of collision. MD5 is considered weaker than SHA. An MD5 can be calculated at one time or incrementally. To create a MD5 at one time, call gnet_md5_new() with the data. To create a MD5 incrementally, call gnet_md5_new_incremental() to create the MD5 object, then gnet_md5_update() one or more times with data to hash, and finally call gnet_md5_final(). To get the digest, or hash value, call gnet_md5_get_digest(). This returns the raw digest as an array of %GNET_MD5_HASH_LENGTH bytes. To get the digest as a human-readable hexidecimal string, call gnet_md5_get_string() or gnet_md5_copy_string(). gchar buffer[] = "Hello world!"; gchar buffer2[] = "Second line"; GMD5* md5; gchar* md5_str; &comstart; Compute an MD5 at one time &comend; md5 = gnet_md5_new (buffer, strlen(buffer)); md5_str = gnet_md5_get_string (md5); g_print ("The MD5 of %s is %s\n", buffer, md5_str); &comstart; Use MD5... &comend; g_free (md5_str); gnet_md5_delete (md5); &comstart; Compute an MD5 incrementally &comend; md5 = gnet_md5_new_incremental (); gnet_md5_update (md5, buffer, strlen(buffer)); gnet_md5_update (md5, buffer2, strlen(buffer2)); gnet_md5_final (md5); &comstart; Use MD5... &comend; gnet_md5_delete (md5); @buffer: @length: @Returns: @str: @Returns: @md5: @Returns: @md5: @Returns: @md5: @buffer: @length: @md5: @p1: @p2: @Returns: @p: @Returns: @md5: @Returns: @md5: @Returns: @md5: @buffer: gnet-2.0.8/doc/tmpl/ipv6.sgml0000644000175000017500000000572210751404362012700 00000000000000 IPv6 IPv6 policy functions The IPv6 module provides functions for setting and getting the "IPv6 policy". The IPv6 policy affects domain name resolution and server binding. The possible policies are: IPv4 only, IPv6 only, IPv4 then IPv6, and IPv6 then IPv4. GNet attempts to set the policy when gnet_init() is called based on two environment variables (if set) or on the host's interfaces. This can be overridden by calling gnet_ipv6_set_policy(). IPv6 policy affects domain name resolution. A domain name can be resolved to several addresses. Most programs will only use the first address in the list. The problem then is what order the addresses should be in. For example, if there are both IPv4 and IPv6 addresses in the list and the system cannot connect to IPv6 hosts then an IPv6 address should not be first in the list. Otherwise, the host will attempt to connect to it and fail. IPv6 policy determines the order of the list. If the policy is "IPv4 only", only IPv4 addresses will be returned. If the policy is "IPv6 then IPv4", IPv6 addresses will come before IPv4 addresses in the list. IPv6 policy also affects server binding. When a server socket is created, GNet binds to the "any" address by default. There are IPv4 and IPv6 "any" addresses. GNet needs to know which one to use. If the IPv6 policy allows IPv6, GNet will use the IPv6 "any" address. If the IPv6 policy allows only IPv4, GNet will use the IPv4 "any" address. GNet sets IPv6 policy in gnet_init(). First it checks two environment variables: GNET_IPV6_POLICY and IPV6_POLICY. If either is set, it uses the value to set IPv6 policy. Set the value to "4" for %GIPV6_POLICY_IPV4_ONLY, "6" for %GIPV6_POLICY_IPV6_ONLY, "46" for %GIPV6_POLICY_IPV4_THEN_IPV6, or "64" for %GIPV6_POLICY_IPV6_THEN_IPV4. If neither environment variable is set, GNet sets the policy based on the host's interfaces. If there are only IPv4 interfaces, the policy is set to %GIPV6_POLICY_IPV4_ONLY. If there are only IPv6 interfaces, the policy is set to %GIPV6_POLICY_IPV6_ONLY. If there are both, the policy is set to %GIPV6_POLICY_IPV4_THEN_IPV6. At runtime on Windows, GNet will check to see the computer can support IPv6. If so it will set the policy to %GIPV6_POLICY_IPV4_THEN_IPV6. If not it will set the policy to %GIPV6_POLICY_IPV4_ONLY. Environment variables are not checked on Windows. @GIPV6_POLICY_IPV4_THEN_IPV6: @GIPV6_POLICY_IPV6_THEN_IPV4: @GIPV6_POLICY_IPV4_ONLY: @GIPV6_POLICY_IPV6_ONLY: @policy: @Returns: gnet-2.0.8/doc/tmpl/gnet.sgml0000644000175000017500000000115610751404362012746 00000000000000 GNet GNet utility functions and macros The main GNet module provides the function gnet_init(). This function should be called at the beginning of any GNet program. @major: @minor: @micro: gnet-2.0.8/doc/tmpl/udp.sgml0000644000175000017500000000555610751404362012611 00000000000000 UDP UDP socket This module provides support for UDP sockets. UDP is an internet protocol that transfers packets by best-effort delivery. Packets may be lost or arrive out-of-order. Use TCP if your protocol requires data transfered reliably and in-order -- most do. A UDP socket is represented by a #GUdpSocket structure. To create a #GUdpSocket, call gnet_udp_socket_new(), gnet_udp_socket_new_with_port(), or gnet_udp_socket_new_full(). To send a packet, call gnet_udp_socket_send(). To receive a packet, call gnet_udp_socket_receive(). gnet_udp_socket_send() will block if the OS cannot buffer the packet immediately. gnet_udp_socket_receive() will block until there is a packet available to receive. Call gnet_udp_socket_has_packet() to determine whether a packet is available immediately. A more elegant method is to get the #GIOChannel and add a read watch. A callback will be called when a packet is available. Note that a UDP socket's #GIOChannel is not a normal #GIOChannel -- it should not be written to or read from directly. Packets have a time-to-live (TTL) field. This field is decremented before a router forwards the packet. If the TTL reaches zero, the packet is dropped. The TTL can be set by calling gnet_udp_socket_get_ttl(). The default value is sufficient for most applications. @Returns: @port: @Returns: @iface: @port: @Returns: @socket: @socket: @socket: @socket: @buffer: @length: @dst: @Returns: @socket: @buffer: @length: @src: @Returns: @socket: @Returns: @socket: @Returns: @socket: @Returns: @socket: @Returns: @socket: @ttl: @Returns: gnet-2.0.8/doc/tmpl/pack.sgml0000644000175000017500000000244510751404362012731 00000000000000 Pack Byte packing and unpacking functions The pack module provides functions for converting data into bytes ("packing") and converting bytes to data ("unpacking"). For example, two integers and a string may be packed into a buffer to be transfered over the network. These functions are similar to the ones in Python and Perl. @format: @buffer: @length: @Varargs: @Returns: @format: @bufferp: @Varargs: @Returns: @format: @buffer: @length: @args: @Returns: @format: @Varargs: @Returns: @format: @args: @Returns: @format: @buffer: @length: @Varargs: @Returns: @format: @buffer: @length: @args: @Returns: gnet-2.0.8/doc/tmpl/url.sgml0000644000175000017500000000323410751404362012612 00000000000000 url @url: @Returns: @protocol: @hostname: @port: @resource: @Returns: @protocol: @user: @password: @hostname: @port: @resource: @query: @fragment: @Returns: @url: @Returns: @url: @p: @Returns: @p1: @p2: @Returns: @url: @protocol: @url: @user: @url: @password: @url: @hostname: @url: @port: @url: @resource: @url: @query: @url: @fragment: @url: @Returns: gnet-2.0.8/doc/README0000644000175000017500000000401110751326731011025 00000000000000========================== GNet Documentation notes ========================== gtk-doc is required to build the documentation. Only developers would need to build the docs. All distributions should include the docs pre-built. This will be the case if you create the distribution tarball with 'make distcheck'. If gtk-doc is available and the version requirements are met, the documentation will be built automatically when make descends into the doc directory. ===================================== Style notes for inline documentation ====================================== * Arguments @arg: argument argument - The first word is not capitalized. - There is no period. - If the first argument is a "this" pointer, the description can be "a #Type" most of the time. - hostname should be described as "host name" Also note: - Parameter names should be as descriptive as possible. Use words instead of abbreviations. E.g.: * "buffer" instead of "buf" * "length" instead of "len" Exceptions: * "src" and "dst" are ok. * Use "iface" instead of "interface". "interface" is a reserved word for some compilers. (We break these rules a lot.) * Return values Returns: something. Something else happens. - The first word is not capitalized - There is a period so that the first sentence reads as a sentence - There can be more than one sentence. * Descriptions The first sentence should be in the form: "Does something to a #X." Examples: x_new: Creates a #X [from ...]. Returns: a new #X. x_clone: Copies a #X. Returns: a copy of @x. x_delete: Deletes a #X. x_hash: Creates a hash code for a #X for use with GHashTable. Returns: the hash code for @x. x_equal: Compares two #Xs for equality. Returns: TRUE if they are equal; FALSE otherwise. (args are "a #X" and "another #X" x_ref: Adds a reference to a #X. x_unref: Removes a reference from a #X. A #X is deleted when the reference count reaches 0. TODO: failure vs. error - is there a difference? gnet-2.0.8/doc/gnet-docs.sgml0000644000175000017500000002614510751326731012730 00000000000000 ]> GNet Network Library Reference Manual for GNet &version; David Helder
dhelder@umich.edu
2000-2005 David Helder Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions. This manual documents GNet, a network library. It gives an overview of GNet, discusses examples that come with GNet, and includes detailed documentation of the GNet API.
GNet Overview GNet is a network library. It is written in C, object-oriented, and built upon GLib. It is intended to be easy to use and port. Features: TCP "client" and "server" sockets UDP and IP Multicast sockets High-level TCP connection and server objects Asynchronous socket IO HTTP client object Internet address abstraction Asynchronous DNS lookup IPv4 and IPv6 support Byte packing and unpacking URI parsing SHA and MD5 hashes Base64 encoding and decoding SOCKS support GNet is licensed under the GNU Lesser General Public License. Read COPYING for information on the license (this file comes with the GNet distribution). GNet for developers Compiling programs with GNet If you are a developer and you want to use GNet in your program, you can use the pkg-config script to figure out which flags need to set when compiling. For example, type gcc main.c `pkg-config --cflags --libs gnet-2.0` to compile the program main.c with GNet and link it to GNet. Note that those are backticks, not apostrophes. If you use autoconf and automake, you can the pkg-config macros to set the appropriate variables. Just add this to your configure.in: PKG_CHECK_MODULES(GNET, gnet-2.0 > 2.0.0, [LIBS="$LIBS $GNET_LIBS" CFLAGS="$CFLAGS $GNET_CFLAGS"], AC_MSG_ERROR(Cannot find GNet: do you have the GNet development packages installed?)) Tips and tricks GNet was designed so that most of the implementation is hidden from the programmer. You should not have to include any network header files other than gnet.h. By convention, integers are usually transfered in big-endian, or network-byte, order. GLib has conversion functions for shorts and ints: g_ntohs (network-to-host short), g_htons (host-to network short), g_ntohl (network-to-host long), and g_htonl (host-to-network long). Hiding blocking Many GNet functions block. That is, they do not return immediately. For example gnet_inetaddr_new performs a DNS lookup that may take several seconds. This is acceptable for many programs. But, it is not tolerable in interactive GUI programs or high-performance servers. There are two ways to hide blocking. The first is to use threads. GLib 2.0 includes thread support (GThread). The second method is to use asynchronous functions. Asynchronous functions return immediately and call a callback when the operation is completed. For example, gnet_inetaddr_new_async begins an asynchronous DNS lookup and returns immediately. When the lookup is complete, a callback is called with the GInetAddr. Most blocking function in GNet have an asynchronous counterpart. To use GNet's asynchronous functions, you must also use the GLib main event loop. Most GTK and Gnome program already do this. Another common blocking operation is reading or writing to a GIOChannel (a GLib object). g_io_channel_read blocks until there is data available to read. g_io_channel_write blocks until there is OS buffer space to write to. To determine when a GIOChannel can be read to or written from without blocking, use GLib's g_io_add_watch to set a watch. A callback is called when the GIOChannel becomes readable or writable. See the GLib documentation for more information and GNet's echoclient-async and echoserver-async for an example. GNet Examples GNet comes with several example programs. They are intended to be used by developers as examples of how to use GNet. The example programs are in the examples directory that comes with the source code. The tests in the tests directory also demonstrate to use several modules: MD5/SHA, InetAddr, IPv6, Pack/Unpack, and URI. echoclient and echoserver The echoclient connects to the echoserver and sends data it reads in from the user. echoserver then sends it back and echoclient prints it out. These programs demonstrate how to write a basic client and server. There are three versions of the TCP echoclient and echoserver. Each demonstrates a different method of using GNet: blocking, asynchronous, and object GConn/GServer. There is also a blocking UDP example and a Unix sockets example. echoclient/echoserver. The blocking echoserver accepts a connection and reads and writes to the socket until the socket is closed. No more than one echoclient can be connected at once. A good, robust server wouldn't use this method, but it is suitable for many simple applications. echoclient-async/echoserver-async. The asynchronous server does not block while reading or writing to a socket or waiting for a connect. Since it's never blocked, it can accept new connections when it isn't reading or writing to another socket. The advantage of the this method is that multiple clients can be served at once. echoclient-gconn/echoserver-gserver. echoclient-gconn uses GNet's GConn object. echoserver-gserver uses GNet's GServer object. GConn and GServer are high-level wrappers around GTcpSocket. Using GConn and GServer is not as flexible as using GTcpSocket directly, but it is much easier and is flexible enough for most applications. There is no example using threads. If you would like to contribute one, please send it to us. dnslookup, hash, hfetch, hostinfo, and SDR dnslookup. dnslookup performs a DNS lookup of a hostname or a reverse DNS lookup of an address. It demonstrates how to use both the blocking and asynchronous methods of DNS lookups. hash. hash computes the MD5 and SHA hashes of a file. hfetch. hfetch is a simple HTTP file fetcher. hostinfo. hostinfo prints information about the host including it's domain name and interfaces. SDR. SDR prints multimedia session announcements. It demonstrates how to use multicast sockets in GNet. SDR will only work if your network supports IP Multicast. In fact, SDR is a good test for this. If the network supports multicast, SDR will print announcements after a few seconds, otherwise, it will print nothing. GNet Library Reference This section contains the API reference for gnet. All the public interfaces are documented here. This reference guide is built by extracting comments from the code sources. &gnet-gnet; &gnet-inetaddr; &gnet-tcp; &gnet-udp; &gnet-mcast; &gnet-conn-http; &gnet-conn; &gnet-server; &gnet-iochannel; &gnet-uri; &gnet-base64; &gnet-pack; &gnet-md5; &gnet-sha; &gnet-unix; &gnet-ipv6; &gnet-socks;
gnet-2.0.8/doc/xml/0000777000175000017500000000000010751404362011032 500000000000000gnet-2.0.8/doc/xml/udp.xml0000644000175000017500000005221110751404362012261 00000000000000 UDP 3 GNET Library UDP UDP socket Synopsis #include <gnet.h> GUdpSocket; GUdpSocket* gnet_udp_socket_new (void); GUdpSocket* gnet_udp_socket_new_with_port (gint port); GUdpSocket* gnet_udp_socket_new_full (const GInetAddr *iface, gint port); void gnet_udp_socket_delete (GUdpSocket *socket); void gnet_udp_socket_ref (GUdpSocket *socket); void gnet_udp_socket_unref (GUdpSocket *socket); gint gnet_udp_socket_send (GUdpSocket *socket, const gchar *buffer, gint length, const GInetAddr *dst); gint gnet_udp_socket_receive (GUdpSocket *socket, gchar *buffer, gint length, GInetAddr **src); gboolean gnet_udp_socket_has_packet (const GUdpSocket *socket); GIOChannel* gnet_udp_socket_get_io_channel (GUdpSocket *socket); GInetAddr* gnet_udp_socket_get_local_inetaddr (const GUdpSocket *socket); gint gnet_udp_socket_get_ttl (const GUdpSocket *socket); gint gnet_udp_socket_set_ttl (GUdpSocket *socket, gint ttl); Description This module provides support for UDP sockets. UDP is an internet protocol that transfers packets by best-effort delivery. Packets may be lost or arrive out-of-order. Use TCP if your protocol requires data transfered reliably and in-order -- most do. A UDP socket is represented by a GUdpSocket structure. To create a GUdpSocket, call gnet_udp_socket_new(), gnet_udp_socket_new_with_port(), or gnet_udp_socket_new_full(). To send a packet, call gnet_udp_socket_send(). To receive a packet, call gnet_udp_socket_receive(). gnet_udp_socket_send() will block if the OS cannot buffer the packet immediately. gnet_udp_socket_receive() will block until there is a packet available to receive. Call gnet_udp_socket_has_packet() to determine whether a packet is available immediately. A more elegant method is to get the GIOChannel and add a read watch. A callback will be called when a packet is available. Note that a UDP socket's GIOChannel is not a normal GIOChannel -- it should not be written to or read from directly. Packets have a time-to-live (TTL) field. This field is decremented before a router forwards the packet. If the TTL reaches zero, the packet is dropped. The TTL can be set by calling gnet_udp_socket_get_ttl(). The default value is sufficient for most applications. Details <anchor id="GUdpSocket" role="struct"/>GUdpSocket GUdpSockettypedef struct _GUdpSocket GUdpSocket; A GUdpSocket structure represents a UDP socket. The implementation is hidden. <anchor id="gnet-udp-socket-new" role="function"/>gnet_udp_socket_new () gnet_udp_socket_newGUdpSocket* gnet_udp_socket_new (void); Creates a GUdpSocket bound to all interfaces and an arbitrary port. Returns : a new GUdpSocket; NULL on error. <anchor id="gnet-udp-socket-new-with-port" role="function"/>gnet_udp_socket_new_with_port () gnet_udp_socket_new_with_portGUdpSocket* gnet_udp_socket_new_with_port (gint port); Creates a GUdpSocket bound to all interfaces and port port. If port is 0, an arbitrary port will be used. port : port to bind to (0 for an arbitrary port) Returns : a new GUdpSocket; NULL on error. <anchor id="gnet-udp-socket-new-full" role="function"/>gnet_udp_socket_new_full () gnet_udp_socket_new_fullGUdpSocket* gnet_udp_socket_new_full (const GInetAddr *iface, gint port); Creates a GUdpSocket bound to interface iface and port port. If iface is NULL, all interfaces will be used. If port is 0, an arbitrary port will be used. iface : interface to bind to (NULL for all interfaces) port : port to bind to (0 for an arbitrary port) Returns : a new GUdpSocket; NULL on error. <anchor id="gnet-udp-socket-delete" role="function"/>gnet_udp_socket_delete () gnet_udp_socket_deletevoid gnet_udp_socket_delete (GUdpSocket *socket); Deletes a GUdpSocket. Does nothing if socket is NULL. socket : a GUdpSocket, or NULL <anchor id="gnet-udp-socket-ref" role="function"/>gnet_udp_socket_ref () gnet_udp_socket_refvoid gnet_udp_socket_ref (GUdpSocket *socket); Adds a reference to a GUdpSocket. socket : GUdpSocket to reference <anchor id="gnet-udp-socket-unref" role="function"/>gnet_udp_socket_unref () gnet_udp_socket_unrefvoid gnet_udp_socket_unref (GUdpSocket *socket); Removes a reference from a GUdpScoket. A GUdpSocket is deleted when the reference count reaches 0. socket : a GUdpSocket <anchor id="gnet-udp-socket-send" role="function"/>gnet_udp_socket_send () gnet_udp_socket_sendgint gnet_udp_socket_send (GUdpSocket *socket, const gchar *buffer, gint length, const GInetAddr *dst); Sends data to a host using a GUdpSocket. socket : a GUdpSocket buffer : buffer to send length : length of buffer dst : destination address Returns : 0 if successful; something else on error. <anchor id="gnet-udp-socket-receive" role="function"/>gnet_udp_socket_receive () gnet_udp_socket_receivegint gnet_udp_socket_receive (GUdpSocket *socket, gchar *buffer, gint length, GInetAddr **src); Receives data using a GUdpSocket. If src is set, the source address is stored in the location src points to. The address is caller owned. socket : a GUdpSocket buffer : buffer to write to length : length of buffer src : pointer to source address (optional) Returns : the number of bytes received, -1 on error. <anchor id="gnet-udp-socket-has-packet" role="function"/>gnet_udp_socket_has_packet () gnet_udp_socket_has_packetgboolean gnet_udp_socket_has_packet (const GUdpSocket *socket); Tests if a GUdpSocket has a packet waiting to be received. socket : a GUdpSocket Returns : TRUE if there is packet waiting, FALSE otherwise. <anchor id="gnet-udp-socket-get-io-channel" role="function"/>gnet_udp_socket_get_io_channel () gnet_udp_socket_get_io_channelGIOChannel* gnet_udp_socket_get_io_channel (GUdpSocket *socket); Gets the GIOChannel of a GUdpSocket. Use the channel with g_io_add_watch() to check if the socket is readable or writable. If the channel is readable, call gnet_udp_socket_receive() to receive a packet. If the channel is writable, call gnet_udp_socket_send() to send a packet. This is not a normal giochannel - do not read from or write to it. Every GUdpSocket has one and only one GIOChannel. If you ref the channel, then you must unref it eventually. Do not close the channel. The channel is closed by GNet when the socket is deleted. Before deleting the UDP socket, make sure to remove any watches you have added with g_io_add_watch() again with g_source_remove() using the integer id returned by g_io_add_watch(). You may find your program stuck in a busy loop at 100% CPU utilisation if you forget to do this. socket : a GUdpSocket Returns : a GIOChannel. <anchor id="gnet-udp-socket-get-local-inetaddr" role="function"/>gnet_udp_socket_get_local_inetaddr () gnet_udp_socket_get_local_inetaddrGInetAddr* gnet_udp_socket_get_local_inetaddr (const GUdpSocket *socket); Gets the local host's address from a GUdpSocket. socket : a GUdpSocket Returns : a GInetAddr. <anchor id="gnet-udp-socket-get-ttl" role="function"/>gnet_udp_socket_get_ttl () gnet_udp_socket_get_ttlgint gnet_udp_socket_get_ttl (const GUdpSocket *socket); Gets the time-to-live (TTL) default of a GUdpSocket. All UDP packets have a TTL field. This field is decremented by a router before it forwards the packet. If the TTL reaches zero, the packet is discarded. The default value is sufficient for most applications. socket : a GUdpSocket Returns : the TTL (an integer between 0 and 255), -1 if the kernel default is being used, or an integer less than -1 on error. <anchor id="gnet-udp-socket-set-ttl" role="function"/>gnet_udp_socket_set_ttl () gnet_udp_socket_set_ttlgint gnet_udp_socket_set_ttl (GUdpSocket *socket, gint ttl); Sets the time-to-live (TTL) default of a GUdpSocket. Set the TTL to -1 to use the kernel default. The default value is sufficient for most applications. socket : a GUdpSocket ttl : value to set TTL to Returns : 0 if successful. gnet-2.0.8/doc/xml/gnet.xml0000644000175000017500000000555010751404362012432 00000000000000 GNet 3 GNET Library GNet GNet utility functions and macros Synopsis #include <gnet.h> #define GNET_EXPORT #define GNET_CHECK_VERSION (major,minor,micro) void gnet_init (void); Description The main GNet module provides the function gnet_init(). This function should be called at the beginning of any GNet program. Details <anchor id="GNET-EXPORT:CAPS" role="macro"/>GNET_EXPORT GNET_EXPORT#define GNET_EXPORT Declares a variable exported. Used interally. <anchor id="GNET-CHECK-VERSION:CAPS" role="macro"/>GNET_CHECK_VERSION() GNET_CHECK_VERSION#define GNET_CHECK_VERSION(major,minor,micro) Checks if the version given is compatable with this version of the library. For example, GNET_CHECK_VERSION(1.2.3) would return TRUE if the version is 1.2.5, and FALSE if 1.1.0. This can be used in build tests. major : Major version number minor : Minor version number micro : Micro version number <anchor id="gnet-init" role="function"/>gnet_init () gnet_initvoid gnet_init (void); Initializes the GNet library. This should be called at the beginning of any GNet program and before any call to gtk_init(). gnet-2.0.8/doc/xml/uri.xml0000644000175000017500000007165410751404362012304 00000000000000 URI 3 GNET Library URI Uniform Resource Identifier (URI) Synopsis #include <gnet.h> GURI; GURI* gnet_uri_new (const gchar *uri); GURI* gnet_uri_new_fields (const gchar *scheme, const gchar *hostname, const gint port, const gchar *path); GURI* gnet_uri_new_fields_all (const gchar *scheme, const gchar *userinfo, const gchar *hostname, const gint port, const gchar *path, const gchar *query, const gchar *fragment); GURI* gnet_uri_clone (const GURI *uri); void gnet_uri_delete (GURI *uri); void gnet_uri_escape (GURI *uri); void gnet_uri_unescape (GURI *uri); gchar* gnet_uri_get_string (const GURI *uri); void gnet_uri_set_scheme (GURI *uri, const gchar *scheme); void gnet_uri_set_userinfo (GURI *uri, const gchar *userinfo); void gnet_uri_set_hostname (GURI *uri, const gchar *hostname); void gnet_uri_set_port (GURI *uri, gint port); void gnet_uri_set_path (GURI *uri, const gchar *path); void gnet_uri_set_query (GURI *uri, const gchar *query); void gnet_uri_set_fragment (GURI *uri, const gchar *fragment); guint gnet_uri_hash (gconstpointer p); gboolean gnet_uri_equal (gconstpointer p1, gconstpointer p2); gboolean gnet_uri_parse_inplace (GURI *guri, gchar *uri, gchar *hostname, gsize len); Description A URI is a Uniform Resource Identifier, similar to a URL. This module provides functions for creating and manipulating URIs. A URI is represented by GURI. All fields in the GURI structure are publicly readable. Create a URI from a string by calling gnet_uri_new(). To get the string representation back, call gnet_uri_get_string(). To escape a URI call gnet_uri_escape(), and to unescape it call gnet_uri_unescape(). Network protocols use escaped URIs. People use unescaped URIs. Details <anchor id="GURI:CAPS" role="struct"/>GURI GURItypedef struct { gchar* scheme; gchar* userinfo; gchar* hostname; gint port; gchar* path; gchar* query; gchar* fragment; } GURI; The GURI structure represents a URI. All fields in this structure are publicly readable. gchar *scheme; Scheme (or protocol) gchar *userinfo; User info gchar *hostname; Host name gint port; Port number gchar *path; Path gchar *query; Query gchar *fragment; Fragment <anchor id="gnet-uri-new" role="function"/>gnet_uri_new () gnet_uri_newGURI* gnet_uri_new (const gchar *uri); Creates a GURI from a string. Empty fields are set to NULL. The parser does not validate the URI -- it will accept some malformed URI. URIs are usually in the form scheme://userinfohostname:port/path?queryfragment URIs created from user input are typically unescaped. URIs created from machine input (e.g. received over the internet) are typically escaped. uri : URI string Returns : a new GURI, or NULL if there was a failure. <anchor id="gnet-uri-new-fields" role="function"/>gnet_uri_new_fields () gnet_uri_new_fieldsGURI* gnet_uri_new_fields (const gchar *scheme, const gchar *hostname, const gint port, const gchar *path); Creates a GURI from the fields. This function uses the most common fields. Use gnet_uri_new_fields_all() to specify all fields. scheme : scheme hostname : host name port : port path : path Returns : a new GURI. <anchor id="gnet-uri-new-fields-all" role="function"/>gnet_uri_new_fields_all () gnet_uri_new_fields_allGURI* gnet_uri_new_fields_all (const gchar *scheme, const gchar *userinfo, const gchar *hostname, const gint port, const gchar *path, const gchar *query, const gchar *fragment); Creates a GURI from all fields. scheme : scheme userinfo : user info hostname : host name port : port path : path query : query fragment : fragment Returns : a new GURI. <anchor id="gnet-uri-clone" role="function"/>gnet_uri_clone () gnet_uri_cloneGURI* gnet_uri_clone (const GURI *uri); Copies a GURI. uri : a GURI Returns : a copy of uri. <anchor id="gnet-uri-delete" role="function"/>gnet_uri_delete () gnet_uri_deletevoid gnet_uri_delete (GURI *uri); Deletes a GURI. uri : a GURI <anchor id="gnet-uri-escape" role="function"/>gnet_uri_escape () gnet_uri_escapevoid gnet_uri_escape (GURI *uri); Escapes the fields in a GURI. Network protocols use escaped URIs. People use unescaped URIs. uri : a GURI <anchor id="gnet-uri-unescape" role="function"/>gnet_uri_unescape () gnet_uri_unescapevoid gnet_uri_unescape (GURI *uri); Unescapes the fields in the URI. Network protocols use escaped URIs. People use unescaped URIs. uri : a GURI <anchor id="gnet-uri-get-string" role="function"/>gnet_uri_get_string () gnet_uri_get_stringgchar* gnet_uri_get_string (const GURI *uri); Gets a string representation of a GURI. This function does not escape or unescape the fields first. Call gnet_uri_escape() or gnet_uri_unescape first if necessary. uri : a GURI Returns : a string. <anchor id="gnet-uri-set-scheme" role="function"/>gnet_uri_set_scheme () gnet_uri_set_schemevoid gnet_uri_set_scheme (GURI *uri, const gchar *scheme); Sets a GURI's scheme. uri : a GURI scheme : scheme <anchor id="gnet-uri-set-userinfo" role="function"/>gnet_uri_set_userinfo () gnet_uri_set_userinfovoid gnet_uri_set_userinfo (GURI *uri, const gchar *userinfo); Sets a GURI's user info. uri : a GURI userinfo : user info <anchor id="gnet-uri-set-hostname" role="function"/>gnet_uri_set_hostname () gnet_uri_set_hostnamevoid gnet_uri_set_hostname (GURI *uri, const gchar *hostname); Sets a GURI's host name. uri : a GURI hostname : host name <anchor id="gnet-uri-set-port" role="function"/>gnet_uri_set_port () gnet_uri_set_portvoid gnet_uri_set_port (GURI *uri, gint port); Set a GURI's port. uri : a GURI port : port <anchor id="gnet-uri-set-path" role="function"/>gnet_uri_set_path () gnet_uri_set_pathvoid gnet_uri_set_path (GURI *uri, const gchar *path); Set a GURI's path. uri : a GURI path : path <anchor id="gnet-uri-set-query" role="function"/>gnet_uri_set_query () gnet_uri_set_queryvoid gnet_uri_set_query (GURI *uri, const gchar *query); Set a GURI's query. uri : a GURI query : query <anchor id="gnet-uri-set-fragment" role="function"/>gnet_uri_set_fragment () gnet_uri_set_fragmentvoid gnet_uri_set_fragment (GURI *uri, const gchar *fragment); Set a GURI's fragment. uri : a GURI fragment : fragment <anchor id="gnet-uri-hash" role="function"/>gnet_uri_hash () gnet_uri_hashguint gnet_uri_hash (gconstpointer p); Creates a hash code for p for use with GHashTable. p : a GURI Returns : hash code for p. <anchor id="gnet-uri-equal" role="function"/>gnet_uri_equal () gnet_uri_equalgboolean gnet_uri_equal (gconstpointer p1, gconstpointer p2); Compares two GURI's for equality. p1 : a GURI p2 : another GURI Returns : TRUE if they are equal; FALSE otherwise. <anchor id="gnet-uri-parse-inplace" role="function" condition="since:2.0.8"/>gnet_uri_parse_inplace () gnet_uri_parse_inplacegboolean gnet_uri_parse_inplace (GURI *guri, gchar *uri, gchar *hostname, gsize len); This function parses an URI string very efficiently and without allocating any memory on the heap. It does this by modifying the passed-in string uri and changing field separators into string terminators in place. The result will then be put into the already-allocated and usually uninitialised, GURI structure guri. Because the slash (') which separates the hostname from the path in an URI is needed as the first character of the path, it cannot be turned into a string terminator for the hostname. This makes it necessary for the caller (ie. you) to pass in an array where the hostname can be put. If the URI has been parsed successfully, the fields of the GURI structure will either point into the given string uri (or to hostname in case of the hostname field), or be NULL. No freeing or de-initialising of the GURI structure is required. The only gnet_uri_*() functions you are allowed to call with this URI structure are gnet_uri_clone(), gnet_uri_equal(), gnet_uri_hash(), gnet_uri_get_string() and gnet_uri_unescape() (the latter unescapes the string fragments in place, so is safe to use here). You must not call any other gnet_uri_*() functions with this GURI, especially not any gnet_uri_set() functions. Under normal circumstances, you should never need to use this function. Use gnet_uri_new() instead. guri : pointer to an uninitialised GURI structure (usually on the stack) uri : a writable URI string (which will be modified by this function!) hostname : a preallocated array of size len, into which the hostname will be copied if the URI has a hostname. This array should live as long as guri may be used, since guri might reference it. You may pass NULL here if you know your URIs won't contain a hostname field len : Returns : TRUE if uri was parsed successfully and GURI is usable, or FALSE if there was a failure. Since 2.0.8 gnet-2.0.8/doc/xml/mcast.xml0000644000175000017500000006771710751404362012621 00000000000000 Mcast 3 GNET Library Mcast IP Multicast socket Synopsis #include <gnet.h> GMcastSocket; GMcastSocket* gnet_mcast_socket_new (void); GMcastSocket* gnet_mcast_socket_new_with_port (gint port); GMcastSocket* gnet_mcast_socket_new_full (const GInetAddr *iface, gint port); void gnet_mcast_socket_delete (GMcastSocket *socket); void gnet_mcast_socket_ref (GMcastSocket *socket); void gnet_mcast_socket_unref (GMcastSocket *socket); GIOChannel* gnet_mcast_socket_get_io_channel (GMcastSocket *socket); GInetAddr* gnet_mcast_socket_get_local_inetaddr (const GMcastSocket *socket); gint gnet_mcast_socket_join_group (GMcastSocket *socket, const GInetAddr *inetaddr); gint gnet_mcast_socket_leave_group (GMcastSocket *socket, const GInetAddr *inetaddr); gint gnet_mcast_socket_get_ttl (const GMcastSocket *socket); gint gnet_mcast_socket_set_ttl (GMcastSocket *socket, gint ttl); gint gnet_mcast_socket_send (GMcastSocket *socket, const gchar *buffer, gint length, const GInetAddr *dst); gint gnet_mcast_socket_receive (GMcastSocket *socket, gchar *buffer, gint length, GInetAddr **src); gboolean gnet_mcast_socket_has_packet (const GMcastSocket *socket); gint gnet_mcast_socket_is_loopback (const GMcastSocket *socket); gint gnet_mcast_socket_set_loopback (GMcastSocket *socket, gboolean enable); #define gnet_mcast_socket_to_udp_socket (MS) Description The Mcast module provides support for IP Multicast sockets. IP Multicast allows you to send one packet to many receivers at once. Unfortunately, IP Multicast is not widely available. IP Multicast is built on UDP. An IP Multicast socket is represented by a GMcastSocket stucture. To create a GMcastSocket, call gnet_mcast_socket_new(), gnet_mcast_socket_new_with_port(), or gnet_mcast_socket_new_full(). Then call gnet_mcast_socket_join_group() to join a multicast group. To leave the group, call gnet_mcast_socket_leave_group(). Use gnet_mcast_socket_set_loopback() to set whether packets sent by the host will also be received by the host. Applications typically disable loopback. Details <anchor id="GMcastSocket" role="struct"/>GMcastSocket GMcastSockettypedef struct _GMcastSocket GMcastSocket; A GMcastSocket structure represents a IP Multicast socket. The implementation is hidden. A GMcastSocket is child of GUdpSocket. Use gnet_mcast_socket_to_udp_socket() to safely cast a GMcastSocket to a GUdpSocket. <anchor id="gnet-mcast-socket-new" role="function"/>gnet_mcast_socket_new () gnet_mcast_socket_newGMcastSocket* gnet_mcast_socket_new (void); Creates a GMcastSocket bound to all interfaces and an arbitrary port. Returns : a new GMcastSocket; NULL on error. <anchor id="gnet-mcast-socket-new-with-port" role="function"/>gnet_mcast_socket_new_with_port () gnet_mcast_socket_new_with_portGMcastSocket* gnet_mcast_socket_new_with_port (gint port); Creates a GMcastSocket bound to all interfaces and port port. If port is 0, an arbitrary port will be used. Use this constructor if you know the port of the group you will join. Most applications will use this constructor. port : port to bind to Returns : a new GMcastSocket; NULL on error. <anchor id="gnet-mcast-socket-new-full" role="function"/>gnet_mcast_socket_new_full () gnet_mcast_socket_new_fullGMcastSocket* gnet_mcast_socket_new_full (const GInetAddr *iface, gint port); Creates a GMcastSocket bound to interface iface and port port. If iface is NULL, all interfaces will be used. If port is 0, an arbitrary port will be used. To receive packets from this group, call gnet_mcast_socket_join_group() next. Loopback is disabled by default. iface : interface to bind to (NULL for all interfaces) port : port to bind to (0 for an arbitrary port) Returns : a new GMcastSocket; NULL on error. <anchor id="gnet-mcast-socket-delete" role="function"/>gnet_mcast_socket_delete () gnet_mcast_socket_deletevoid gnet_mcast_socket_delete (GMcastSocket *socket); Deletes a GMcastSocket. Does nothing if socket is NULL. socket : a GMcastSocket, or NULL <anchor id="gnet-mcast-socket-ref" role="function"/>gnet_mcast_socket_ref () gnet_mcast_socket_refvoid gnet_mcast_socket_ref (GMcastSocket *socket); Adds a reference to a GMcastSocket. socket : a GMcastSocket <anchor id="gnet-mcast-socket-unref" role="function"/>gnet_mcast_socket_unref () gnet_mcast_socket_unrefvoid gnet_mcast_socket_unref (GMcastSocket *socket); Removes a reference from a GMcastSocket. A GMcastSocket is deleted when the reference count reaches 0. socket : a GMcastSocket <anchor id="gnet-mcast-socket-get-io-channel" role="function"/>gnet_mcast_socket_get_io_channel () gnet_mcast_socket_get_io_channelGIOChannel* gnet_mcast_socket_get_io_channel (GMcastSocket *socket); Gets the GIOChannel of a GMcastSocket. Use the channel with g_io_add_watch() to check if the socket is readable or writable. If the channel is readable, call gnet_mcast_socket_receive() to receive a packet. If the channel is writable, call gnet_mcast_socket_send() to send a packet. This is not a normal giochannel - do not read from or write to it. Every GMcastSocket has one and only one GIOChannel. If you ref the channel, then you must unref it eventually. Do not close the channel. The channel is closed by GNet when the socket is deleted. socket : a GMcastSocket Returns : a GIOChannel. <anchor id="gnet-mcast-socket-get-local-inetaddr" role="function"/>gnet_mcast_socket_get_local_inetaddr () gnet_mcast_socket_get_local_inetaddrGInetAddr* gnet_mcast_socket_get_local_inetaddr (const GMcastSocket *socket); Gets the local host's address from a GMcastSocket. socket : a GMcastSocket Returns : a GInetAddr. <anchor id="gnet-mcast-socket-join-group" role="function"/>gnet_mcast_socket_join_group () gnet_mcast_socket_join_groupgint gnet_mcast_socket_join_group (GMcastSocket *socket, const GInetAddr *inetaddr); Joins a multicast group. Join only one group per socket. socket : a GMcastSocket inetaddr : address of the group Returns : 0 on success. <anchor id="gnet-mcast-socket-leave-group" role="function"/>gnet_mcast_socket_leave_group () gnet_mcast_socket_leave_groupgint gnet_mcast_socket_leave_group (GMcastSocket *socket, const GInetAddr *inetaddr); Leaves a mulitcast group. socket : a GMcastSocket inetaddr : address of the group Returns : 0 on success. <anchor id="gnet-mcast-socket-get-ttl" role="function"/>gnet_mcast_socket_get_ttl () gnet_mcast_socket_get_ttlgint gnet_mcast_socket_get_ttl (const GMcastSocket *socket); Gets the multicast time-to-live (TTL) of a GMcastSocket. All IP multicast packets have a TTL field. This field is decremented by a router before it forwards the packet. If the TTL reaches zero, the packet is discarded. The default value is sufficient for most applications. The table below shows the scope for a given TTL. The scope is only an estimate. TTL and scope TTL Scope 0 node local 1 link local 2-32 site local 33-64 region local 65-128 continent local 129-255 unrestricted (global)
socket : a GMcastSocket Returns : the TTL (an integer between 0 and 255), -1 if the kernel default is being used, or an integer less than -1 on error.
<anchor id="gnet-mcast-socket-set-ttl" role="function"/>gnet_mcast_socket_set_ttl () gnet_mcast_socket_set_ttlgint gnet_mcast_socket_set_ttl (GMcastSocket *socket, gint ttl); Sets the time-to-live (TTL) default of a GMcastSocket. Set the TTL to -1 to use the kernel default. The default value is sufficient for most applications. socket : a GMcastSocket ttl : value to set TTL to Returns : 0 if successful. <anchor id="gnet-mcast-socket-send" role="function"/>gnet_mcast_socket_send () gnet_mcast_socket_sendgint gnet_mcast_socket_send (GMcastSocket *socket, const gchar *buffer, gint length, const GInetAddr *dst); Sends data to a host using a GMcastSocket. socket : a GMcastSocket buffer : buffer to send length : length of buffer dst : destination address Returns : 0 if successful. <anchor id="gnet-mcast-socket-receive" role="function"/>gnet_mcast_socket_receive () gnet_mcast_socket_receivegint gnet_mcast_socket_receive (GMcastSocket *socket, gchar *buffer, gint length, GInetAddr **src); Receives data using a GMcastSocket. If src is set, the source address is stored in the location src points to. The address is caller owned. socket : a GMcastSocket buffer : buffer to write to length : length of buffer src : pointer to source address (optional) Returns : the number of bytes received, -1 if unsuccessful. <anchor id="gnet-mcast-socket-has-packet" role="function"/>gnet_mcast_socket_has_packet () gnet_mcast_socket_has_packetgboolean gnet_mcast_socket_has_packet (const GMcastSocket *socket); Tests if a GMcastSocket has a packet waiting to be received. socket : a GMcastSocket Returns : TRUE if there is packet waiting, FALSE otherwise. <anchor id="gnet-mcast-socket-is-loopback" role="function"/>gnet_mcast_socket_is_loopback () gnet_mcast_socket_is_loopbackgint gnet_mcast_socket_is_loopback (const GMcastSocket *socket); Checks if a GMcastSocket has loopback enabled. If loopback is enabled, all packets sent by the host will also be received by the host. Loopback is disabled by default. socket : a GMcastSocket Returns : 0 if loopback is disabled, 1 if enabled, and -1 on error. <anchor id="gnet-mcast-socket-set-loopback" role="function"/>gnet_mcast_socket_set_loopback () gnet_mcast_socket_set_loopbackgint gnet_mcast_socket_set_loopback (GMcastSocket *socket, gboolean enable); Enables (or disables) loopback on a GMcastSocket. Loopback is disabled by default. socket : a GMcastSocket enable : should loopback be enabled? Returns : 0 if successful. <anchor id="gnet-mcast-socket-to-udp-socket" role="macro"/>gnet_mcast_socket_to_udp_socket() gnet_mcast_socket_to_udp_socket#define gnet_mcast_socket_to_udp_socket(MS) ((GUdpSocket*) (MS)) Converts a GMcastSocket to a GUdpSocket. A GMcastSocket is a child of GUdpSocket. MS : a GMcastSocket
gnet-2.0.8/doc/xml/socks.xml0000644000175000017500000001627210751404362012622 00000000000000 SOCKS 3 GNET Library SOCKS SOCKS proxy Synopsis #include <gnet.h> #define GNET_SOCKS_PORT #define GNET_SOCKS_VERSION gboolean gnet_socks_get_enabled (void); void gnet_socks_set_enabled (gboolean enabled); GInetAddr* gnet_socks_get_server (void); void gnet_socks_set_server (const GInetAddr *inetaddr); gint gnet_socks_get_version (void); void gnet_socks_set_version (gint version); Description SOCKS is a TCP proxy protocol. Typically, a host behind a firewall uses SOCKS to connect to hosts outside the firewall via a SOCKS proxy server. To open a TCP connection, a SOCKS client connects to a SOCKS server and the SOCKS server connects to the destination. Data is then forwarded between the client and the destination by the SOCKS server. GNet supports SOCKS versions 4 and 5. Version 5 includes support for server sockets. SOCKS is used if the SOCKS_SERVER environment variable is set or gnet_socks_set_server() is called to set the SOCKS server's address. To disable SOCKS support, call gnet_socks_set_enabled() and pass FALSE. The SOCKS_VERSION environment variable controls which SOCKS version is used. The default is version 5. Details <anchor id="GNET-SOCKS-PORT:CAPS" role="macro"/>GNET_SOCKS_PORT GNET_SOCKS_PORT#define GNET_SOCKS_PORT 1080 Default port for the SOCKS protocol. <anchor id="GNET-SOCKS-VERSION:CAPS" role="macro"/>GNET_SOCKS_VERSION GNET_SOCKS_VERSION#define GNET_SOCKS_VERSION 5 Default version of the SOCKS protocol. <anchor id="gnet-socks-get-enabled" role="function"/>gnet_socks_get_enabled () gnet_socks_get_enabledgboolean gnet_socks_get_enabled (void); Determines whether SOCKS support is enabled. Returns : TRUE if SOCKS is enabled, FALSE otherwise. <anchor id="gnet-socks-set-enabled" role="function"/>gnet_socks_set_enabled () gnet_socks_set_enabledvoid gnet_socks_set_enabled (gboolean enabled); Sets whether SOCKS support is enabled. enabled : is SOCKS support enabled? <anchor id="gnet-socks-get-server" role="function"/>gnet_socks_get_server () gnet_socks_get_serverGInetAddr* gnet_socks_get_server (void); Gets the address of the SOCKS server (regardless of whether SOCKS is enabled). This function checks the gnet_socks_set_server() value and, if not set, the SOCKS_SERVER environment variable. The SOCKS_SERVER enviroment variable should be in the form HOSTNAME or HOSTNAME:PORT. Returns : a copy of the address; NULL if there is no server. <anchor id="gnet-socks-set-server" role="function"/>gnet_socks_set_server () gnet_socks_set_servervoid gnet_socks_set_server (const GInetAddr *inetaddr); Sets the address of the SOCKS server. inetaddr : SOCKS server address <anchor id="gnet-socks-get-version" role="function"/>gnet_socks_get_version () gnet_socks_get_versiongint gnet_socks_get_version (void); Gets the SOCKS version GNet uses. This function checks the gnet_socks_set_version() value and, if not set, the SOCKS_VERSION environment variable. Returns : the SOCKS version. <anchor id="gnet-socks-set-version" role="function"/>gnet_socks_set_version () gnet_socks_set_versionvoid gnet_socks_set_version (gint version); Sets the SOCKS version GNet uses. GNet only supports versions 4 and 5. version : SOCKS version gnet-2.0.8/doc/xml/conn.xml0000644000175000017500000013535110751404362012435 00000000000000 Conn 3 GNET Library Conn TCP connection object Synopsis #include <gnet.h> GConn; GConnEvent; enum GConnEventType; void (*GConnFunc) (GConn *conn, GConnEvent *event, gpointer user_data); GConn* gnet_conn_new (const gchar *hostname, gint port, GConnFunc func, gpointer user_data); GConn* gnet_conn_new_inetaddr (const GInetAddr *inetaddr, GConnFunc func, gpointer user_data); GConn* gnet_conn_new_socket (GTcpSocket *socket, GConnFunc func, gpointer user_data); void gnet_conn_delete (GConn *conn); void gnet_conn_ref (GConn *conn); void gnet_conn_unref (GConn *conn); void gnet_conn_set_callback (GConn *conn, GConnFunc func, gpointer user_data); gboolean gnet_conn_set_main_context (GConn *conn, GMainContext *context); void gnet_conn_connect (GConn *conn); void gnet_conn_disconnect (GConn *conn); gboolean gnet_conn_is_connected (const GConn *conn); void gnet_conn_read (GConn *conn); void gnet_conn_readn (GConn *conn, gint length); void gnet_conn_readline (GConn *conn); void gnet_conn_write (GConn *conn, gchar *buffer, gint length); void gnet_conn_write_direct (GConn *conn, gchar *buffer, gint length, GDestroyNotify buffer_destroy_cb); void gnet_conn_set_watch_error (GConn *conn, gboolean enable); void gnet_conn_set_watch_readable (GConn *conn, gboolean enable); void gnet_conn_set_watch_writable (GConn *conn, gboolean enable); void gnet_conn_timeout (GConn *conn, guint timeout); Description A GConn represents a TCP connection. A GConn is usually created directly by the user by calling gnet_conn_new() or gnet_conn_new_inetaddr(). To connect to the remote host, call gnet_conn_connect() and to disconnect call gnet_conn_disconnect(). You may use the same GConn to connect again to the host after you disconnected. Free the GConn with gnet_conn_unref() or gnet_conn_delete() when no longer needed. GConns are also created by a GServer when a client connects. You will need to call gnet_conn_set_callback() to set the GConn callback after it is created by the GServer. A GConn that has been created by a GServer is already connect, you don't have to call gnet_conn_connect() in this case. Call gnet_conn_unref() or gnet_conn_delete() to disconnect the remote client and free the GConn. The iochannel field and GIOChannel functions can be used to read from or write to the socket. GIOChannel functions block. To make an asynchronous read call gnet_conn_read() and to make an asynchronous write call gnet_conn_write(). The callback is called whenever a read or write completes. Special use cases (you usually do not need this): use gnet_conn_set_watch_error() to get an event if an error occurs. Use gnet_conn_set_watch_readable() and gnet_conn_set_watch_writable() to get events when the connection is readable or writable. These can be used to implement custom I/O handling for cases where gnet_conn_read(), gnet_conn_write() and gnet_conn_write_direct() are not suitable. For example, consider writing from a mmap()'ed file. gnet_conn_write() will allocate memory for a buffer and copy part of the file into the buffer. To avoid the copy, use gnet_conn_set_watch_writable() to catch the writable event and then write directly from memory to the socket (note: this is obsolete, you can now use gnet_conn_write_direct() for this). gnet_conn_timeout() sets a timeout on the GConn. The GNET_CONN_TIMEOUT event occurs when the timer expires. For example, the timer may be set before connecting to the host. If the connection is made, the GNET_CONN_CONNECT event occurs. The timer can then be reset by setting the timeout to 0. Otherwise, the GNET_CONN_TIMEOUT event will eventually occur. Details <anchor id="GConn" role="struct"/>GConn GConntypedef struct { /* Public */ gchar* hostname; gint port; GIOChannel* iochannel; GTcpSocket* socket; GInetAddr* inetaddr; /* Private */ guint ref_count; guint ref_count_internal; /* Connect */ GTcpSocketConnectAsyncID connect_id; GTcpSocketNewAsyncID new_id; /* Write */ GList* write_queue; guint bytes_written; /* Read */ gchar* buffer; guint length; guint bytes_read; gboolean read_eof; GList* read_queue; guint process_buffer_timeout; /* Readable/writable */ gboolean watch_readable; gboolean watch_writable; /* IO watch */ guint watch_flags; guint watch; /* Timer */ guint timer; /* User data */ GConnFunc func; gpointer user_data; GMainContext * context; gint priority; } GConn; TCP Connection. Some of the fields are public, but do not set these fields. gchar *hostname; host name gint port; port GIOChannel *iochannel; IO channel GTcpSocket *socket; socket GInetAddr *inetaddr; address guint ref_count; [private] guint ref_count_internal; [private] GTcpSocketConnectAsyncID connect_id; [private] GTcpSocketNewAsyncID new_id; [private] GList *write_queue; [private] guint bytes_written; [private] gchar *buffer; [private] guint length; [private] guint bytes_read; [private] gboolean read_eof; [private] GList *read_queue; [private] guint process_buffer_timeout; [private] gboolean watch_readable; [private] gboolean watch_writable; [private] guint watch_flags; [private] guint watch; [private] guint timer; [private] GConnFunc func; [private] gpointer user_data; [private] GMainContext *context; gint priority; <anchor id="GConnEvent" role="struct"/>GConnEvent GConnEventtypedef struct { GConnEventType type; gchar* buffer; gint length; } GConnEvent; GConn Event. buffer and length are set only on GNET_CONN_READ events. The buffer is caller-owned. GConnEventType type; event type gchar *buffer; buffer gint length; buffer length <anchor id="GConnEventType" role="enum"/>enum GConnEventType GConnEventTypetypedef enum { GNET_CONN_ERROR, GNET_CONN_CONNECT, GNET_CONN_CLOSE, GNET_CONN_TIMEOUT, GNET_CONN_READ, GNET_CONN_WRITE, GNET_CONN_READABLE, GNET_CONN_WRITABLE } GConnEventType; Event type. Used by GConnEvent. GNET_CONN_ERROR Connection error GNET_CONN_CONNECT Connection complete GNET_CONN_CLOSE Connection closed GNET_CONN_TIMEOUT Timeout GNET_CONN_READ Read complete GNET_CONN_WRITE Write complete GNET_CONN_READABLE Connection is readable GNET_CONN_WRITABLE Connection is writable <anchor id="GConnFunc" role="function"/>GConnFunc () GConnFuncvoid (*GConnFunc) (GConn *conn, GConnEvent *event, gpointer user_data); Callback for GConn. Possible events: GNET_CONN_ERROR: GConn error. The event occurs if the connection fails somehow. The connection is closed before this event occurs. GNET_CONN_CONNECT: Completion of gnet_conn_connect(). GNET_CONN_CLOSE: Connection has been closed. The event does not occur as a result of calling gnet_conn_disconnect(), gnet_conn_unref(), or gnet_conn_delete(). GNET_CONN_TIMEOUT: Timer set by gnet_conn_timeout() expires. GNET_CONN_READ: Data has been read. This event occurs as a result of calling gnet_conn_read(), gnet_conn_readn(), or gnet_conn_readline(). buffer and length are set in the event object. The buffer is caller owned. GNET_CONN_WRITE: Data has been written. This event occurs as a result of calling gnet_conn_write() or gnet_conn_write_direct(). GNET_CONN_READABLE: The connection is readable. GNET_CONN_WRITABLE: The connection is writable. conn : GConn event : event (caller owned) user_data : user data specified in gnet_conn_new() <anchor id="gnet-conn-new" role="function"/>gnet_conn_new () gnet_conn_newGConn* gnet_conn_new (const gchar *hostname, gint port, GConnFunc func, gpointer user_data); Creates a GConn. A connection is not made until gnet_conn_connect() is called. The callback func is called when events occur. hostname : name of host to connect to port : port to connect to func : function to call on GConn events user_data : data to pass to func on callbacks Returns : a GConn. <anchor id="gnet-conn-new-inetaddr" role="function"/>gnet_conn_new_inetaddr () gnet_conn_new_inetaddrGConn* gnet_conn_new_inetaddr (const GInetAddr *inetaddr, GConnFunc func, gpointer user_data); Creates a GConn. A connection is not made until gnet_conn_connect() is called. The callback func is called when events occur. inetaddr : address of host to connect to func : function to call on GConn events user_data : data to pass to func on callbacks Returns : a GConn. <anchor id="gnet-conn-new-socket" role="function"/>gnet_conn_new_socket () gnet_conn_new_socketGConn* gnet_conn_new_socket (GTcpSocket *socket, GConnFunc func, gpointer user_data); Creates a GConn. The GConn is created from the socket. The socket is callee owned - do not delete it (meaning: GConn will take ownership of the socket). The callback is called when events occur. socket : TCP Socket (callee owned) func : function to call on GConn events user_data : data to pass to func on callbacks Returns : a GConn. <anchor id="gnet-conn-delete" role="function" condition="deprecated:Use g_conn_unref(), which does the same."/>gnet_conn_delete () gnet_conn_deletevoid gnet_conn_delete (GConn *conn); gnet_conn_delete is deprecated and should not be used in newly-written code. Use g_conn_unref(), which does the same. Deletes a GConn. conn : a GConn <anchor id="gnet-conn-ref" role="function"/>gnet_conn_ref () gnet_conn_refvoid gnet_conn_ref (GConn *conn); Adds a reference to a GConn. conn : a GConn <anchor id="gnet-conn-unref" role="function"/>gnet_conn_unref () gnet_conn_unrefvoid gnet_conn_unref (GConn *conn); Removes a reference from a GConn. A GConn is deleted when the reference count reaches 0. conn : a GConn <anchor id="gnet-conn-set-callback" role="function"/>gnet_conn_set_callback () gnet_conn_set_callbackvoid gnet_conn_set_callback (GConn *conn, GConnFunc func, gpointer user_data); Sets the GConnEvent callback for a GConn. The callback func is called when events occur. conn : a GConn func : function to call on GConn events user_data : data to pass to func on callbacks <anchor id="gnet-conn-set-main-context" role="function" condition="since:2.0.8"/>gnet_conn_set_main_context () gnet_conn_set_main_contextgboolean gnet_conn_set_main_context (GConn *conn, GMainContext *context); Sets the GLib GMainContext to use for asynchronous operations. You should call this function right after you create conn. You must not call this function after the actual connection process has started or watches have been set up (e.g. for reading, writing or errors). You are very unlikely to ever need this function. conn : a GConn context : a GMainContext, or NULL to use the default GLib main context Returns : TRUE on success, FALSE on failure. Since 2.0.8 <anchor id="gnet-conn-connect" role="function"/>gnet_conn_connect () gnet_conn_connectvoid gnet_conn_connect (GConn *conn); Establishes a connection. If the connection is pending or already established, this function does nothing. The callback is called when the connection is established or an error occurs. conn : a GConn <anchor id="gnet-conn-disconnect" role="function"/>gnet_conn_disconnect () gnet_conn_disconnectvoid gnet_conn_disconnect (GConn *conn); Closes the connection. The connection can later be reestablished by calling gnet_conn_connect() again. If the connection was not established, this function does nothing. conn : a GConn <anchor id="gnet-conn-is-connected" role="function"/>gnet_conn_is_connected () gnet_conn_is_connectedgboolean gnet_conn_is_connected (const GConn *conn); Checks if the connection is established. conn : a GConn Returns : TRUE if the connection is established, FALSE otherwise. <anchor id="gnet-conn-read" role="function"/>gnet_conn_read () gnet_conn_readvoid gnet_conn_read (GConn *conn); Begins an asynchronous read. The connection callback is called when any data has been read. This function may be called again before the asynchronous read completes. conn : a GConn <anchor id="gnet-conn-readn" role="function"/>gnet_conn_readn () gnet_conn_readnvoid gnet_conn_readn (GConn *conn, gint length); Begins an asynchronous read of exactly length bytes. The connection callback is called when the data has been read. This function may be called again before the asynchronous read completes. conn : a GConn length : Number of bytes to read <anchor id="gnet-conn-readline" role="function"/>gnet_conn_readline () gnet_conn_readlinevoid gnet_conn_readline (GConn *conn); Begins an asynchronous line read. The connection callback is called when a line has been read. Lines are terminated with \n, \r, \r\n, or \0. The terminator is \0'ed out in the buffer. The terminating \0 is accounted for in the buffer length. This function may be called again before the asynchronous read completes. conn : a GConn <anchor id="gnet-conn-write" role="function"/>gnet_conn_write () gnet_conn_writevoid gnet_conn_write (GConn *conn, gchar *buffer, gint length); Sets up an asynchronous write to conn from buffer. The buffer is copied, so it may be deleted by the caller. This function can be called again before the asynchronous write completes. conn : a GConn buffer : buffer to write from length : length of buffer <anchor id="gnet-conn-write-direct" role="function"/>gnet_conn_write_direct () gnet_conn_write_directvoid gnet_conn_write_direct (GConn *conn, gchar *buffer, gint length, GDestroyNotify buffer_destroy_cb); Sets up an asynchronous write to conn from buffer. The buffer is created by the caller and will not be copied. The caller needs to make sure the buffer stays valid until buffer_destroy_cb is called. This function can be called again before the asynchronous write completes. buffer_destroy_cb may be NULL. conn : a GConn buffer : buffer to write from length : length of buffer buffer_destroy_cb : function to call when buffer is no longer needed <anchor id="gnet-conn-set-watch-error" role="function"/>gnet_conn_set_watch_error () gnet_conn_set_watch_errorvoid gnet_conn_set_watch_error (GConn *conn, gboolean enable); Enables (or disables) the GNET_CONN_ERROR event for a GConn. If enabled, the GNET_CONN_ERROR event occurs when an error occurs. The conn is disconnected before the callback is made. conn : a GConn enable : enable the GNET_CONN_READABLE event? <anchor id="gnet-conn-set-watch-readable" role="function"/>gnet_conn_set_watch_readable () gnet_conn_set_watch_readablevoid gnet_conn_set_watch_readable (GConn *conn, gboolean enable); Enables (or disables) the GNET_CONN_READABLE event for a GConn. If enabled, the GNET_CONN_READABLE event occurs when data can be read from the socket. Read from the iochannel member of the conn. Do not enable this while using gnet_conn_read(), gnet_conn_readn(), or gnet_conn_readline(). conn : a GConn enable : enable the GNET_CONN_READABLE event? <anchor id="gnet-conn-set-watch-writable" role="function"/>gnet_conn_set_watch_writable () gnet_conn_set_watch_writablevoid gnet_conn_set_watch_writable (GConn *conn, gboolean enable); Enables (or disables) the GNET_CONN_WRITABLE event for a GConn. If enabled, the GNET_CONN_WRITABLE event occurs when data can be written to the socket. Write to the iochannel member of the conn. Do not enable this while using gnet_conn_write(). conn : a GConn enable : enable the GNET_CONN_WRITABLE event? <anchor id="gnet-conn-timeout" role="function"/>gnet_conn_timeout () gnet_conn_timeoutvoid gnet_conn_timeout (GConn *conn, guint timeout); Sets a timeout on a GConn. When the timer expires, the GNET_CONN_STATUS_TIMEOUT event occurs. If there already is a timeout set on conn, the old timeout is canceled. Set timeout to 0 to cancel the current timeout. conn : a GConn timeout : Timeout (in milliseconds) See Also See also GServer and the echoclient-gconn example. gnet-2.0.8/doc/xml/unix.xml0000644000175000017500000004006110751404362012454 00000000000000 Unix 3 GNET Library Unix Unix socket Synopsis #include <gnet.h> GUnixSocket; GUnixSocket* gnet_unix_socket_new (const gchar *path); GUnixSocket* gnet_unix_socket_new_abstract (const gchar *path); void gnet_unix_socket_delete (GUnixSocket *socket); void gnet_unix_socket_ref (GUnixSocket *socket); void gnet_unix_socket_unref (GUnixSocket *socket); GIOChannel* gnet_unix_socket_get_io_channel (GUnixSocket *socket); gchar* gnet_unix_socket_get_path (const GUnixSocket *socket); GUnixSocket* gnet_unix_socket_server_new (const gchar *path); GUnixSocket* gnet_unix_socket_server_new_abstract (const gchar *path); GUnixSocket* gnet_unix_socket_server_accept (const GUnixSocket *socket); GUnixSocket* gnet_unix_socket_server_accept_nonblock (const GUnixSocket *socket); Description The Unix module provides support for Unix sockets. Unix sockets are used to communicate between processes. Unix sockets are for Unix operating systems only and are not supported in Windows. GNet's Unix sockets are stream-based (like TCP), not datagram-based (like UDP). Unix socket addresses are file names, like "/tmp/my_unix_socket". To connect to a existing Unix socket, call gnet_unix_socket_new(). To create a new Unix socket other processes will connect to, call gnet_unix_socket_server_new(). The functions in this module are similar to those in the TCP module. See the documentation on TCP sockets for more information. Details <anchor id="GUnixSocket" role="struct"/>GUnixSocket GUnixSockettypedef struct _GUnixSocket GUnixSocket; A GUnixSocket structure represents a Unix socket. The implementation is hidden. <anchor id="gnet-unix-socket-new" role="function"/>gnet_unix_socket_new () gnet_unix_socket_newGUnixSocket* gnet_unix_socket_new (const gchar *path); Creates a GUnixSocket and connects to path. This function will block to connect. Use this constructor to create a GUnixSocket for a client. path : path Returns : a new GUnixSocket; NULL on failure. <anchor id="gnet-unix-socket-new-abstract" role="function" condition="since:2.0.8"/>gnet_unix_socket_new_abstract () gnet_unix_socket_new_abstractGUnixSocket* gnet_unix_socket_new_abstract (const gchar *path); Creates a GUnixSocket and connects to path in the abstract unix socket domain. This function will block to connect. Use this constructor to create a GUnixSocket for a client. If the abstract unix sockets are not available on the platform in use, this function will behave like gnet_unix_socket_new(). path : path Returns : a new GUnixSocket, or NULL on failure. Since 2.0.8 <anchor id="gnet-unix-socket-delete" role="function"/>gnet_unix_socket_delete () gnet_unix_socket_deletevoid gnet_unix_socket_delete (GUnixSocket *socket); Deletes a GUnixSocket. socket : a GUnixSocket <anchor id="gnet-unix-socket-ref" role="function"/>gnet_unix_socket_ref () gnet_unix_socket_refvoid gnet_unix_socket_ref (GUnixSocket *socket); Adds a reference to a GUnixSocket. socket : a GUnixSocket <anchor id="gnet-unix-socket-unref" role="function"/>gnet_unix_socket_unref () gnet_unix_socket_unrefvoid gnet_unix_socket_unref (GUnixSocket *socket); Removes a reference from a GUnixSocket. A GUnixSocket is deleted when the reference count reaches 0. socket : a GUnixSocket <anchor id="gnet-unix-socket-get-io-channel" role="function"/>gnet_unix_socket_get_io_channel () gnet_unix_socket_get_io_channelGIOChannel* gnet_unix_socket_get_io_channel (GUnixSocket *socket); Gets the GIOChannel of a GUnixSocket. For a client socket, the GIOChannel represents the data stream. Use it like you would any other GIOChannel. For a server socket, however, the GIOChannel represents the listening socket. When it's readable, there's a connection waiting to be accepted. Every GUnixSocket has one and only one GIOChannel. If you ref the channel, then you must unref it eventually. Do not close the channel. The channel is closed by GNet when the socket is deleted. socket : a GUnixSocket Returns : a GIOChannel. <anchor id="gnet-unix-socket-get-path" role="function"/>gnet_unix_socket_get_path () gnet_unix_socket_get_pathgchar* gnet_unix_socket_get_path (const GUnixSocket *socket); Gets the path of a GUnixSocket. socket : a GUnixSocket Returns : the path. <anchor id="gnet-unix-socket-server-new" role="function"/>gnet_unix_socket_server_new () gnet_unix_socket_server_newGUnixSocket* gnet_unix_socket_server_new (const gchar *path); Creates a GUnixSocket bound to path. Use this constructor to create a GUnixSocket for a server. path : path Returns : a new GUnixSocket; NULL on error. <anchor id="gnet-unix-socket-server-new-abstract" role="function" condition="since:2.0.8"/>gnet_unix_socket_server_new_abstract () gnet_unix_socket_server_new_abstractGUnixSocket* gnet_unix_socket_server_new_abstract (const gchar *path); Creates a GUnixSocket bound to path in the abstract unix socket domain. Use this constructor to create a GUnixSocket for a server. If the abstract unix sockets are not available on the platform in use, this function will behave the same as gnet_unix_socket_server_new(). path : path Returns : a new GUnixSocket, or NULL on error. Since 2.0.8 <anchor id="gnet-unix-socket-server-accept" role="function"/>gnet_unix_socket_server_accept () gnet_unix_socket_server_acceptGUnixSocket* gnet_unix_socket_server_accept (const GUnixSocket *socket); Accepts a connection from a GUnixSocket. The socket must have been created using gnet_unix_socket_server_new(). This function will block. Even if the socket's GIOChannel is readable, the function may still block. socket : a GUnixSocket Returns : a new GUnixSocket representing a new connection; NULL on error. <anchor id="gnet-unix-socket-server-accept-nonblock" role="function"/>gnet_unix_socket_server_accept_nonblock () gnet_unix_socket_server_accept_nonblockGUnixSocket* gnet_unix_socket_server_accept_nonblock (const GUnixSocket *socket); Accepts a connection from a GUnixSocket without blocking. The socket must have been created using gnet_unix_socket_server_new(). Note that if the socket's GIOChannel is readable, then there is PROBABLY a new connection. It is possible for the connection to close by the time this function is called, so it may return NULL. socket : a GUnixSocket Returns : a new GUnixSocket representing a new connection; NULL otherwise. gnet-2.0.8/doc/xml/inetaddr.xml0000644000175000017500000023454610751404362013300 00000000000000 InetAddr 3 GNET Library InetAddr Internet Address Synopsis #include <gnet.h> GInetAddr; GInetAddr* gnet_inetaddr_new (const gchar *hostname, gint port); typedef GInetAddrNewAsyncID; void (*GInetAddrNewAsyncFunc) (GInetAddr *inetaddr, gpointer data); GInetAddrNewAsyncID gnet_inetaddr_new_async (const gchar *hostname, gint port, GInetAddrNewAsyncFunc func, gpointer data); GInetAddrNewAsyncID gnet_inetaddr_new_async_full (const gchar *hostname, gint port, GInetAddrNewAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext *context, gint priority); void gnet_inetaddr_new_async_cancel (GInetAddrNewAsyncID id); GList* gnet_inetaddr_new_list (const gchar *hostname, gint port); void gnet_inetaddr_delete_list (GList *list); typedef GInetAddrNewListAsyncID; void (*GInetAddrNewListAsyncFunc) (GList *list, gpointer data); GInetAddrNewListAsyncID gnet_inetaddr_new_list_async (const gchar *hostname, gint port, GInetAddrNewListAsyncFunc func, gpointer data); GInetAddrNewListAsyncID gnet_inetaddr_new_list_async_full (const gchar *hostname, gint port, GInetAddrNewListAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext *context, gint priority); void gnet_inetaddr_new_list_async_cancel (GInetAddrNewListAsyncID id); GInetAddr* gnet_inetaddr_new_nonblock (const gchar *hostname, gint port); GInetAddr* gnet_inetaddr_new_bytes (const gchar *bytes, const guint length); GInetAddr* gnet_inetaddr_clone (const GInetAddr *inetaddr); void gnet_inetaddr_delete (GInetAddr *inetaddr); void gnet_inetaddr_ref (GInetAddr *inetaddr); void gnet_inetaddr_unref (GInetAddr *inetaddr); gchar* gnet_inetaddr_get_name (GInetAddr *inetaddr); gchar* gnet_inetaddr_get_name_nonblock (GInetAddr *inetaddr); typedef GInetAddrGetNameAsyncID; void (*GInetAddrGetNameAsyncFunc) (gchar *hostname, gpointer data); GInetAddrGetNameAsyncID gnet_inetaddr_get_name_async (GInetAddr *inetaddr, GInetAddrGetNameAsyncFunc func, gpointer data); GInetAddrGetNameAsyncID gnet_inetaddr_get_name_async_full (GInetAddr *inetaddr, GInetAddrGetNameAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext *context, gint priority); void gnet_inetaddr_get_name_async_cancel (GInetAddrGetNameAsyncID id); #define GNET_INETADDR_MAX_LEN gint gnet_inetaddr_get_length (const GInetAddr *inetaddr); void gnet_inetaddr_get_bytes (const GInetAddr *inetaddr, gchar *buffer); void gnet_inetaddr_set_bytes (GInetAddr *inetaddr, const gchar *bytes, gint length); gchar* gnet_inetaddr_get_canonical_name (const GInetAddr *inetaddr); gint gnet_inetaddr_get_port (const GInetAddr *inetaddr); void gnet_inetaddr_set_port (const GInetAddr *inetaddr, gint port); gboolean gnet_inetaddr_is_canonical (const gchar *hostname); gboolean gnet_inetaddr_is_internet (const GInetAddr *inetaddr); gboolean gnet_inetaddr_is_private (const GInetAddr *inetaddr); gboolean gnet_inetaddr_is_reserved (const GInetAddr *inetaddr); gboolean gnet_inetaddr_is_loopback (const GInetAddr *inetaddr); gboolean gnet_inetaddr_is_multicast (const GInetAddr *inetaddr); gboolean gnet_inetaddr_is_broadcast (const GInetAddr *inetaddr); gboolean gnet_inetaddr_is_ipv4 (const GInetAddr *inetaddr); gboolean gnet_inetaddr_is_ipv6 (const GInetAddr *inetaddr); guint gnet_inetaddr_hash (gconstpointer p); gboolean gnet_inetaddr_equal (gconstpointer p1, gconstpointer p2); gboolean gnet_inetaddr_noport_equal (gconstpointer p1, gconstpointer p2); gchar* gnet_inetaddr_get_host_name (void); GInetAddr* gnet_inetaddr_get_host_addr (void); GInetAddr* gnet_inetaddr_autodetect_internet_interface (void); GInetAddr* gnet_inetaddr_get_interface_to (const GInetAddr *inetaddr); GInetAddr* gnet_inetaddr_get_internet_interface (void); gboolean gnet_inetaddr_is_internet_domainname (const gchar *name); GList* gnet_inetaddr_list_interfaces (void); Description A GInetAddr represents an internet address. This module provides functions for making DNS and reverse DNS lookups (blocking and asynchronously) and for working with GInetAddr's. Create a GInetAddr by calling gnet_inetaddr_new(). This function will perform a DNS lookup and creates a GInetAddr representing the address. This function blocks. The function gnet_inetaddr_new_async() performs the lookup asynchronously and calls a callback with the GInetAddr when the lookup completes. An asynchronous lookup can be canceled by calling gnet_inetaddr_new_async_cancel(). Technically a DNS lookup can map a name to several addresses. Use gnet_inetaddr_new_list() or gnet_inetaddr_new_list_async() to get this list. Use gnet_inetaddr_delete_list() to delete the list. This module can also make reverse DNS lookups (i.e., map an address to a hostname). Call gnet_inetaddr_get_name() to get the hostname from an address. This function blocks. Its asynchronous counterpart is gnet_inetadr_get_name_async(). To get the canonical name, or dotted decimal address, call gnet_inetaddr_get_canonical_name(). To get the host's address, call gnet_inetaddr_gethostaddr(). This creates a GInetAddr by performing a DNS lookup on the host's name. To get the list of all the host's interfaces, call gnet_inetaddr_list_interfaces(). The function gnet_inetaddr_autodetect_internet_interface() uses this function and heuristics to find an interface connected to the internet. This can be used to automatically configure peer-to-peer applications. Details <anchor id="GInetAddr" role="struct"/>GInetAddr GInetAddrtypedef struct _GInetAddr GInetAddr; GInetAddr is an internet address. <anchor id="gnet-inetaddr-new" role="function"/>gnet_inetaddr_new () gnet_inetaddr_newGInetAddr* gnet_inetaddr_new (const gchar *hostname, gint port); Creates a GInetAddr from a host name and port. This function makes a DNS lookup on the host name so it may block. The host name may resolve to multiple addresses. If this occurs, the first address in the list is returned. Use gnet_inetaddr_new_list() to get the complete list. hostname : host name port : port number (0 if the port doesn't matter) Returns : a new GInetAddr; NULL on error. <anchor id="GInetAddrNewAsyncID" role="typedef"/>GInetAddrNewAsyncID GInetAddrNewAsyncIDtypedef struct _GInetAddrNewState * GInetAddrNewAsyncID; ID of an asynchronous GInetAddr creation/lookup started with gnet_inetaddr_new_async(). The creation can be canceled by calling gnet_inetaddr_new_async_cancel() with the ID. <anchor id="GInetAddrNewAsyncFunc" role="function"/>GInetAddrNewAsyncFunc () GInetAddrNewAsyncFuncvoid (*GInetAddrNewAsyncFunc) (GInetAddr *inetaddr, gpointer data); Callback for gnet_inetaddr_new_async(). Callee owns the address. The address will be NULL if the lookup failed. inetaddr : InetAddr that was looked up (callee owned) data : User data <anchor id="gnet-inetaddr-new-async" role="function"/>gnet_inetaddr_new_async () gnet_inetaddr_new_asyncGInetAddrNewAsyncID gnet_inetaddr_new_async (const gchar *hostname, gint port, GInetAddrNewAsyncFunc func, gpointer data); Asynchronously creates a GInetAddr from a host name and port. The callback is called once the GInetAddr is created or an error occurs during lookup. The callback will not be called during the call to this function. See gnet_inetaddr_new_list_async() for implementation notes. hostname : host name port : port number (0 if the port doesn't matter) func : callback function data : data to pass to func on the callback Returns : the ID of the lookup; NULL on failure. The ID can be used with gnet_inetaddr_new_async_cancel() to cancel the lookup. <anchor id="gnet-inetaddr-new-async-full" role="function" condition="since:2.0.8"/>gnet_inetaddr_new_async_full () gnet_inetaddr_new_async_fullGInetAddrNewAsyncID gnet_inetaddr_new_async_full (const gchar *hostname, gint port, GInetAddrNewAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext *context, gint priority); Asynchronously creates a GInetAddr from a host name and port. The callback is called once the GInetAddr is created or an error occurs during lookup. The callback will not be called during the call to this function. See gnet_inetaddr_new_list_async() for implementation notes. hostname : host name port : port number (0 if the port doesn't matter) func : callback function data : data to pass to func on the callback, or NULL notify : function to call to free data, or NULL context : the GMainContext to use for notifications, or NULL for the default GLib main context. If in doubt, pass NULL. priority : the priority with which to schedule notifications in the main context, e.g. G_PRIORITY_DEFAULT or G_PRIORITY_HIGH. Returns : the ID of the lookup; NULL on failure. The ID can be used with gnet_inetaddr_new_async_cancel() to cancel the lookup. Since 2.0.8 <anchor id="gnet-inetaddr-new-async-cancel" role="function"/>gnet_inetaddr_new_async_cancel () gnet_inetaddr_new_async_cancelvoid gnet_inetaddr_new_async_cancel (GInetAddrNewAsyncID id); Cancels an asynchronous GInetAddr creation that was started with gnet_inetaddr_new_async(). id : ID of the lookup <anchor id="gnet-inetaddr-new-list" role="function"/>gnet_inetaddr_new_list () gnet_inetaddr_new_listGList* gnet_inetaddr_new_list (const gchar *hostname, gint port); Creates a GList of GInetAddr's from a host name and port. This function makes a DNS lookup on the host name so it may block. hostname : host name port : port number (0 if the port doesn't matter) Returns : a GList of GInetAddr structures or NULL on error. <anchor id="gnet-inetaddr-delete-list" role="function"/>gnet_inetaddr_delete_list () gnet_inetaddr_delete_listvoid gnet_inetaddr_delete_list (GList *list); Deletes a GList of GInetAddr's. list : GList of GInetAddr's <anchor id="GInetAddrNewListAsyncID" role="typedef"/>GInetAddrNewListAsyncID GInetAddrNewListAsyncIDtypedef struct _GInetAddrNewListState * GInetAddrNewListAsyncID; ID of an asynchronous GInetAddr list creation/lookup started with gnet_inetaddr_new_list_async(). The creation can be canceled by calling gnet_inetaddr_new_list_async_cancel() with the ID. <anchor id="GInetAddrNewListAsyncFunc" role="function"/>GInetAddrNewListAsyncFunc () GInetAddrNewListAsyncFuncvoid (*GInetAddrNewListAsyncFunc) (GList *list, gpointer data); Callback for gnet_inetaddr_new_list_async(). Callee owns the list of GInetAddrs. The list is NULL if the lookup failed. list : List of GInetAddr's (callee owned) data : User data <anchor id="gnet-inetaddr-new-list-async" role="function"/>gnet_inetaddr_new_list_async () gnet_inetaddr_new_list_asyncGInetAddrNewListAsyncID gnet_inetaddr_new_list_async (const gchar *hostname, gint port, GInetAddrNewListAsyncFunc func, gpointer data); Asynchronously creates a GList of GInetAddr's from a host name and port. The callback is called once the list is created or an error occurs during lookup. The callback will not be called during the call to gnet_inetaddr_new_list_async(). The list passed in the callback is callee owned (meaning that it is your responsibility to free the list and each GInetAddr in the list). If you need to lookup hundreds of addresses, we recommend calling g_main_iteration(FALSE) between calls. This will help prevent an explosion of threads. If you need a more robust library for Unix, look at GNU ADNS. GNU ADNS is under the GNU GPL. This library does not use threads or processes. The Windows version is molded after the Unix GThread version. hostname : host name port : port number (0 if the port doesn't matter) func : callback function data : data to pass to func on the callback Returns : the ID of the lookup; NULL on failure. The ID can be used with gnet_inetaddr_new_list_async_cancel() to cancel the lookup. <anchor id="gnet-inetaddr-new-list-async-full" role="function" condition="since:2.0.8"/>gnet_inetaddr_new_list_async_full () gnet_inetaddr_new_list_async_fullGInetAddrNewListAsyncID gnet_inetaddr_new_list_async_full (const gchar *hostname, gint port, GInetAddrNewListAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext *context, gint priority); Asynchronously creates a GList of GInetAddr's from a host name and port. The callback is called once the list is created or an error occurs during lookup. The callback will not be called during the call to gnet_inetaddr_new_list_async(). The list passed in the callback is callee owned (meaning that it is your responsibility to free the list and each GInetAddr in the list). If you need to lookup hundreds of addresses, we recommend calling g_main_iteration(FALSE) between calls. This will help prevent an explosion of threads. If you need a more robust library for Unix, look at GNU ADNS. GNU ADNS is under the GNU GPL. This library does not use threads or processes. The Windows version is molded after the Unix GThread version. hostname : host name port : port number (0 if the port doesn't matter) func : callback function data : data to pass to func on the callback, or NULL notify : function to call to free data, or NULL context : the GMainContext to use for notifications, or NULL for the default GLib main context. If in doubt, pass NULL. priority : the priority with which to schedule notifications in the main context, e.g. G_PRIORITY_DEFAULT or G_PRIORITY_HIGH. Returns : the ID of the lookup; NULL on failure. The ID can be used with gnet_inetaddr_new_list_async_cancel() to cancel the lookup. Since 2.0.8 <anchor id="gnet-inetaddr-new-list-async-cancel" role="function"/>gnet_inetaddr_new_list_async_cancel () gnet_inetaddr_new_list_async_cancelvoid gnet_inetaddr_new_list_async_cancel (GInetAddrNewListAsyncID id); Cancels an asynchronous GInetAddr list creation that was started with gnet_inetaddr_new_list_async(). id : ID of the lookup <anchor id="gnet-inetaddr-new-nonblock" role="function"/>gnet_inetaddr_new_nonblock () gnet_inetaddr_new_nonblockGInetAddr* gnet_inetaddr_new_nonblock (const gchar *hostname, gint port); Creates a GInetAddr from a host name and port without blocking. This function does not make a DNS lookup and will fail if creating the address would require a DNS lookup. hostname : host name port : port number (0 if the port doesn't matter) Returns : a new GInetAddr, or NULL if there was a failure or the function would block. <anchor id="gnet-inetaddr-new-bytes" role="function"/>gnet_inetaddr_new_bytes () gnet_inetaddr_new_bytesGInetAddr* gnet_inetaddr_new_bytes (const gchar *bytes, const guint length); Creates a GInetAddr from raw bytes. The bytes should be in network byte order (big endian). There should be 4 bytes if it's an IPv4 address and 16 bytees if it's an IPv6 address. The port is set to 0. bytes : address in raw bytes length : length of bytes (4 if IPv4, 16 if IPv6) Returns : a new GInetAddr, or NULL if there was a failure. <anchor id="gnet-inetaddr-clone" role="function"/>gnet_inetaddr_clone () gnet_inetaddr_cloneGInetAddr* gnet_inetaddr_clone (const GInetAddr *inetaddr); Copies a GInetAddr. inetaddr : a GInetAddr Returns : a copy of inetaddr. <anchor id="gnet-inetaddr-delete" role="function"/>gnet_inetaddr_delete () gnet_inetaddr_deletevoid gnet_inetaddr_delete (GInetAddr *inetaddr); Deletes a GInetAddr. inetaddr : a GInetAddr <anchor id="gnet-inetaddr-ref" role="function"/>gnet_inetaddr_ref () gnet_inetaddr_refvoid gnet_inetaddr_ref (GInetAddr *inetaddr); Adds a reference to a GInetAddr. inetaddr : a GInetAddr <anchor id="gnet-inetaddr-unref" role="function"/>gnet_inetaddr_unref () gnet_inetaddr_unrefvoid gnet_inetaddr_unref (GInetAddr *inetaddr); Removes a reference from a GInetAddr. A GInetAddr is deleted when the reference count reaches 0. inetaddr : a GInetAddr <anchor id="gnet-inetaddr-get-name" role="function"/>gnet_inetaddr_get_name () gnet_inetaddr_get_namegchar* gnet_inetaddr_get_name (GInetAddr *inetaddr); Gets the host name for a GInetAddr. This functions makes a reverse DNS lookup on the address so it may block. The canonical name is returned if the address has no host name. inetaddr : a GInetAddr Returns : the host name for the inetaddr; NULL on error. <anchor id="gnet-inetaddr-get-name-nonblock" role="function"/>gnet_inetaddr_get_name_nonblock () gnet_inetaddr_get_name_nonblockgchar* gnet_inetaddr_get_name_nonblock (GInetAddr *inetaddr); Gets the host name for a GInetAddr. This function does not make a reverse DNS lookup and will fail if getting the name would require a reverse DNS lookup. inetaddr : a GInetAddr Returns : the host name for the inetaddr, or NULL if there was an error or it would require blocking. <anchor id="GInetAddrGetNameAsyncID" role="typedef"/>GInetAddrGetNameAsyncID GInetAddrGetNameAsyncIDtypedef struct _GInetAddrReverseAsyncState * GInetAddrGetNameAsyncID; ID of an asynchronous InetAddr name lookup started with gnet_inetaddr_get_name_async(). The lookup can be canceled by calling gnet_inetaddr_get_name_async_cancel() with the ID. <anchor id="GInetAddrGetNameAsyncFunc" role="function"/>GInetAddrGetNameAsyncFunc () GInetAddrGetNameAsyncFuncvoid (*GInetAddrGetNameAsyncFunc) (gchar *hostname, gpointer data); Callback for gnet_inetaddr_get_name_async(). Callee (that is: you) owns the name. Free it with g_free() when no longer needed. The name will be NULL if the lookup failed. hostname : Canonical name of the address (callee owned), NULL on failure data : User data <anchor id="gnet-inetaddr-get-name-async" role="function"/>gnet_inetaddr_get_name_async () gnet_inetaddr_get_name_asyncGInetAddrGetNameAsyncID gnet_inetaddr_get_name_async (GInetAddr *inetaddr, GInetAddrGetNameAsyncFunc func, gpointer data); Asynchronously gets the host name for a GInetAddr. The callback is called once the reverse DNS lookup is complete. The call back will not be called during the call to this function. See gnet_inetaddr_new_list_async() for implementation notes. inetaddr : a GInetAddr func : callback function data : data to pass to func on the callback Returns : the ID of the lookup; NULL on failure. The ID can be used with gnet_inetaddr_get_name_async_cancel() to cancel the lookup. <anchor id="gnet-inetaddr-get-name-async-full" role="function" condition="since:2.0.8"/>gnet_inetaddr_get_name_async_full () gnet_inetaddr_get_name_async_fullGInetAddrGetNameAsyncID gnet_inetaddr_get_name_async_full (GInetAddr *inetaddr, GInetAddrGetNameAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext *context, gint priority); Asynchronously gets the host name for a GInetAddr. The callback is called once the reverse DNS lookup is complete. The callback will not be called during the call to this function. See gnet_inetaddr_new_list_async_full() for implementation notes. inetaddr : a GInetAddr func : callback function data : data to pass to func on the callback notify : function to call to free data, or NULL context : the GMainContext to use for notifications, or NULL for the default GLib main context. If in doubt, pass NULL. priority : the priority with which to schedule notifications in the main context, e.g. G_PRIORITY_DEFAULT or G_PRIORITY_HIGH. Returns : the ID of the lookup; NULL on failure. The ID can be used with gnet_inetaddr_get_name_async_cancel() to cancel the lookup. Since 2.0.8 <anchor id="gnet-inetaddr-get-name-async-cancel" role="function"/>gnet_inetaddr_get_name_async_cancel () gnet_inetaddr_get_name_async_cancelvoid gnet_inetaddr_get_name_async_cancel (GInetAddrGetNameAsyncID id); Cancels an asynchronous name lookup that was started with gnet_inetaddr_get_name_async(). This function should only be called from the application's main thread, ie. the thread in which context the callback delivering the result would be called (In a GTK+/GUI application this would be your normal GUI thread). id : ID of the lookup <anchor id="GNET-INETADDR-MAX-LEN:CAPS" role="macro"/>GNET_INETADDR_MAX_LEN GNET_INETADDR_MAX_LEN#define GNET_INETADDR_MAX_LEN 16 Maximum length of a GInetAddr's address in bytes. This can be used to allocate a buffer large enough for gnet_inetaddr_get_bytes(). <anchor id="gnet-inetaddr-get-length" role="function"/>gnet_inetaddr_get_length () gnet_inetaddr_get_lengthgint gnet_inetaddr_get_length (const GInetAddr *inetaddr); Get the length of a GInetAddr's address in bytes. An IPv4 address is 4 bytes long. An IPv6 address is 16 bytes long. inetaddr : a GInetAddr Returns : the length in bytes. <anchor id="gnet-inetaddr-get-bytes" role="function"/>gnet_inetaddr_get_bytes () gnet_inetaddr_get_bytesvoid gnet_inetaddr_get_bytes (const GInetAddr *inetaddr, gchar *buffer); Get a GInetAddr's address as bytes. buffer should be 4 bytes long for an IPv4 address or 16 bytes long for an IPv6 address. Use GNET_INETADDR_MAX_LEN when allocating a static buffer and gnet_inetaddr_get_length() when allocating a dynamic buffer. inetaddr : a GInetAddr buffer : buffer to store address in <anchor id="gnet-inetaddr-set-bytes" role="function"/>gnet_inetaddr_set_bytes () gnet_inetaddr_set_bytesvoid gnet_inetaddr_set_bytes (GInetAddr *inetaddr, const gchar *bytes, gint length); Sets the address of a GInetAddr from bytes. buffer will be 4 bytes long for an IPv4 address and 16 bytes long for an IPv6 address. inetaddr : a GInetAddr bytes : address in raw bytes length : length of bytes <anchor id="gnet-inetaddr-get-canonical-name" role="function"/>gnet_inetaddr_get_canonical_name () gnet_inetaddr_get_canonical_namegchar* gnet_inetaddr_get_canonical_name (const GInetAddr *inetaddr); Gets the canonical name of a GInetAddr. An IPv4 canonical name is a dotted decimal name (e.g., 141.213.8.59). An IPv6 canonical name is a semicoloned hexidecimal name (e.g., 23:de:ad:be:ef). inetaddr : a GInetAddr Returns : the canonical name; NULL on error. <anchor id="gnet-inetaddr-get-port" role="function"/>gnet_inetaddr_get_port () gnet_inetaddr_get_portgint gnet_inetaddr_get_port (const GInetAddr *inetaddr); Gets the port number of a GInetAddr. inetaddr : a GInetAddr Returns : the port number. <anchor id="gnet-inetaddr-set-port" role="function"/>gnet_inetaddr_set_port () gnet_inetaddr_set_portvoid gnet_inetaddr_set_port (const GInetAddr *inetaddr, gint port); Set the port number of a GInetAddr. inetaddr : a GInetAddr port : new port number <anchor id="gnet-inetaddr-is-canonical" role="function"/>gnet_inetaddr_is_canonical () gnet_inetaddr_is_canonicalgboolean gnet_inetaddr_is_canonical (const gchar *hostname); Checks if the host name is in canonical form. hostname : host name Returns : TRUE if name is canonical; FALSE otherwise. <anchor id="gnet-inetaddr-is-internet" role="function"/>gnet_inetaddr_is_internet () gnet_inetaddr_is_internetgboolean gnet_inetaddr_is_internet (const GInetAddr *inetaddr); Checks if a GInetAddr is a sensible internet address. This mean it is not private, reserved, loopback, multicast, or broadcast. Note that private and loopback address are often valid addresses, so this should only be used to check for general internet connectivity. That is, if the address passes, it is reachable on the internet. inetaddr : a GInetAddr Returns : TRUE if the address is an internet address; FALSE otherwise. <anchor id="gnet-inetaddr-is-private" role="function"/>gnet_inetaddr_is_private () gnet_inetaddr_is_privategboolean gnet_inetaddr_is_private (const GInetAddr *inetaddr); Checks if a GInetAddr is an address reserved for private networks. For IPv4, this includes: 10.0.0.0 - 10.255.255.255 (10/8 prefix) 172.16.0.0 - 172.31.255.255 (172.16/12 prefix) 192.168.0.0 - 192.168.255.255 (192.168/16 prefix) (from RFC 1918. See also draft-manning-dsua-02.txt) For IPv6, this includes link local addresses (fe80::/64) and site local addresses (fec0::/64). inetaddr : a GInetAddr Returns : TRUE if inetaddr is private; FALSE otherwise. <anchor id="gnet-inetaddr-is-reserved" role="function"/>gnet_inetaddr_is_reserved () gnet_inetaddr_is_reservedgboolean gnet_inetaddr_is_reserved (const GInetAddr *inetaddr); Checks if a GInetAddr is reserved for some purpose. This excludes addresses reserved for private networks. For IPv4, we check for: 0.0.0.0/16 (top 16 bits are 0's) Class E (top 5 bits are 11110) For IPv6, we check for the 00000000 prefix. inetaddr : a GInetAddr Returns : TRUE if inetaddr is reserved; FALSE otherwise. <anchor id="gnet-inetaddr-is-loopback" role="function"/>gnet_inetaddr_is_loopback () gnet_inetaddr_is_loopbackgboolean gnet_inetaddr_is_loopback (const GInetAddr *inetaddr); Checks if a GInetAddr is a loopback address. The IPv4 loopback addresses have the prefix 127.0.0.1/24. The IPv6 loopback address is ::1. inetaddr : a GInetAddr Returns : TRUE if inetaddr is a loopback address; FALSE otherwise. <anchor id="gnet-inetaddr-is-multicast" role="function"/>gnet_inetaddr_is_multicast () gnet_inetaddr_is_multicastgboolean gnet_inetaddr_is_multicast (const GInetAddr *inetaddr); Checks if a GInetAddr is a multicast address. IPv4 multicast addresses are in the range 224.0.0.0 to 239.255.255.255 (ie, the top four bits are 1110). IPv6 multicast addresses have the prefix FF. inetaddr : a GInetAddr Returns : TRUE if inetaddr is a multicast address; FALSE otherwise. <anchor id="gnet-inetaddr-is-broadcast" role="function"/>gnet_inetaddr_is_broadcast () gnet_inetaddr_is_broadcastgboolean gnet_inetaddr_is_broadcast (const GInetAddr *inetaddr); Checks if a GInetAddr is a broadcast address. The broadcast address is 255.255.255.255. (Network broadcast addresses are network dependent.) inetaddr : a GInetAddr Returns : TRUE if inetaddr is a broadcast address; FALSE otherwise. <anchor id="gnet-inetaddr-is-ipv4" role="function"/>gnet_inetaddr_is_ipv4 () gnet_inetaddr_is_ipv4gboolean gnet_inetaddr_is_ipv4 (const GInetAddr *inetaddr); Checks if a GInetAddr is an IPv4 address. inetaddr : a GInetAddr Returns : TRUE if inetaddr is an IPv4 address; FALSE otherwise. <anchor id="gnet-inetaddr-is-ipv6" role="function"/>gnet_inetaddr_is_ipv6 () gnet_inetaddr_is_ipv6gboolean gnet_inetaddr_is_ipv6 (const GInetAddr *inetaddr); Check if a GInetAddr is an IPv6 address. inetaddr : a GInetAddr Returns : TRUE if inetaddr is an IPv6 address; FALSE otherwise. <anchor id="gnet-inetaddr-hash" role="function"/>gnet_inetaddr_hash () gnet_inetaddr_hashguint gnet_inetaddr_hash (gconstpointer p); Creates a hash code for a GInetAddr for use with GHashTable. p : Pointer to an GInetAddr. Returns : the hash code for p. <anchor id="gnet-inetaddr-equal" role="function"/>gnet_inetaddr_equal () gnet_inetaddr_equalgboolean gnet_inetaddr_equal (gconstpointer p1, gconstpointer p2); Compares two GInetAddr's for equality. IPv4 and IPv6 addresses are always unequal. p1 : a GInetAddr. p2 : another GInetAddr. Returns : TRUE if they are equal; FALSE otherwise. <anchor id="gnet-inetaddr-noport-equal" role="function"/>gnet_inetaddr_noport_equal () gnet_inetaddr_noport_equalgboolean gnet_inetaddr_noport_equal (gconstpointer p1, gconstpointer p2); Compares two GInetAddr's for equality, but does not compare the port numbers. p1 : a GInetAddr p2 : another GInetAddr Returns : TRUE if they are equal; FALSE otherwise. <anchor id="gnet-inetaddr-get-host-name" role="function"/>gnet_inetaddr_get_host_name () gnet_inetaddr_get_host_namegchar* gnet_inetaddr_get_host_name (void); Gets the host's name. Returns : the name of the host; NULL on error. <anchor id="gnet-inetaddr-get-host-addr" role="function"/>gnet_inetaddr_get_host_addr () gnet_inetaddr_get_host_addrGInetAddr* gnet_inetaddr_get_host_addr (void); Get the host's address. Returns : the address of the host; NULL on error. <anchor id="gnet-inetaddr-autodetect-internet-interface" role="function"/>gnet_inetaddr_autodetect_internet_interface () gnet_inetaddr_autodetect_internet_interfaceGInetAddr* gnet_inetaddr_autodetect_internet_interface (void); Finds an interface likely to be connected to the internet. This function can be used to automatically configure peer-to-peer applications. The function relies on heuristics and does not always work correctly, especially if the host is behind a NAT. Returns : an address of an internet interface; NULL if it couldn't find one or on error. <anchor id="gnet-inetaddr-get-interface-to" role="function"/>gnet_inetaddr_get_interface_to () gnet_inetaddr_get_interface_toGInetAddr* gnet_inetaddr_get_interface_to (const GInetAddr *inetaddr); Figures out which local interface would be used to send a packet to inetaddr. This works on some systems, but not others. We recommend using gnet_inetaddr_autodetect_internet_interface() to find an Internet interface since it's more likely to work. inetaddr : a GInetAddr Returns : the address of an interface used to route packets to inetaddr; NULL if there is no such interface or the system does not support this check. <anchor id="gnet-inetaddr-get-internet-interface" role="function"/>gnet_inetaddr_get_internet_interface () gnet_inetaddr_get_internet_interfaceGInetAddr* gnet_inetaddr_get_internet_interface (void); Finds an internet interface. This function finds the first interface that is an internet address. IPv6 policy is followed. This function does not work on some systems. We recommend using gnet_inetaddr_autodetect_internet_interface(), which performs additional checks. Returns : the address of an internet interface; NULL if no internet interfaces or on error. <anchor id="gnet-inetaddr-is-internet-domainname" role="function"/>gnet_inetaddr_is_internet_domainname () gnet_inetaddr_is_internet_domainnamegboolean gnet_inetaddr_is_internet_domainname (const gchar *name); Checks if a name is a sensible internet domain name. This function uses heuristics. It does not use DNS and will not block. For example, "localhost" and "10.10.23.42" are not sensible internet domain names. (10.10.23.42 is a network address, but not accessible to the internet at large.) name : name Returns : TRUE if name is a sensible Internet domain name; FALSE otherwise. <anchor id="gnet-inetaddr-list-interfaces" role="function"/>gnet_inetaddr_list_interfaces () gnet_inetaddr_list_interfacesGList* gnet_inetaddr_list_interfaces (void); Gets a list of GInetAddr interfaces's on this host. This list includes all "up" Internet interfaces and the loopback interface, if it exists. On Windows if you do not have IPv6 installed then this function will return up to 10 interfaces. This function may not work on some systems. Returns : A list of GInetAddr's representing available interfaces. The caller should delete the list and the addresses. gnet-2.0.8/doc/xml/tcp.xml0000644000175000017500000016116510751404362012270 00000000000000 TCP 3 GNET Library TCP TCP socket Synopsis #include <gnet.h> GTcpSocket; typedef GTcpSocketConnectAsyncID; enum GTcpSocketConnectAsyncStatus; void (*GTcpSocketConnectAsyncFunc) (GTcpSocket *socket, GTcpSocketConnectAsyncStatus status, gpointer data); typedef GTcpSocketNewAsyncID; void (*GTcpSocketNewAsyncFunc) (GTcpSocket *socket, gpointer data); GTcpSocket* gnet_tcp_socket_connect (const gchar *hostname, gint port); GTcpSocketConnectAsyncID gnet_tcp_socket_connect_async (const gchar *hostname, gint port, GTcpSocketConnectAsyncFunc func, gpointer data); GTcpSocketConnectAsyncID gnet_tcp_socket_connect_async_full (const gchar *hostname, gint port, GTcpSocketConnectAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext *context, gint priority); void gnet_tcp_socket_connect_async_cancel (GTcpSocketConnectAsyncID id); GTcpSocket* gnet_tcp_socket_new (const GInetAddr *addr); GTcpSocketNewAsyncID gnet_tcp_socket_new_async (const GInetAddr *addr, GTcpSocketNewAsyncFunc func, gpointer data); GTcpSocketNewAsyncID gnet_tcp_socket_new_async_full (const GInetAddr *addr, GTcpSocketNewAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext *context, gint priority); void gnet_tcp_socket_new_async_cancel (GTcpSocketNewAsyncID id); void gnet_tcp_socket_delete (GTcpSocket *socket); void gnet_tcp_socket_ref (GTcpSocket *socket); void gnet_tcp_socket_unref (GTcpSocket *socket); GIOChannel* gnet_tcp_socket_get_io_channel (GTcpSocket *socket); GInetAddr* gnet_tcp_socket_get_remote_inetaddr (const GTcpSocket *socket); GInetAddr* gnet_tcp_socket_get_local_inetaddr (const GTcpSocket *socket); gint gnet_tcp_socket_get_port (const GTcpSocket *socket); enum GNetTOS; void gnet_tcp_socket_set_tos (GTcpSocket *socket, GNetTOS tos); GTcpSocket* gnet_tcp_socket_server_new (void); GTcpSocket* gnet_tcp_socket_server_new_with_port (gint port); GTcpSocket* gnet_tcp_socket_server_new_full (const GInetAddr *iface, gint port); GTcpSocket* gnet_tcp_socket_server_accept (GTcpSocket *socket); GTcpSocket* gnet_tcp_socket_server_accept_nonblock (GTcpSocket *socket); void (*GTcpSocketAcceptFunc) (GTcpSocket *server, GTcpSocket *client, gpointer data); void gnet_tcp_socket_server_accept_async (GTcpSocket *socket, GTcpSocketAcceptFunc accept_func, gpointer user_data); void gnet_tcp_socket_server_accept_async_cancel (GTcpSocket *socket); GTcpSocket* gnet_tcp_socket_new_direct (const GInetAddr *addr); GTcpSocketNewAsyncID gnet_tcp_socket_new_async_direct (const GInetAddr *addr, GTcpSocketNewAsyncFunc func, gpointer data); GTcpSocketNewAsyncID gnet_tcp_socket_new_async_direct_full (const GInetAddr *addr, GTcpSocketNewAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext *context, gint priority); Description TCP is an internet protocol that transfers data reliably and in-order. This module provides support for TCP sockets. To create a GTcpSocket and connect to a host, call gnet_tcp_socket_new(). This function will block. The asynchronous version is gnet_tcp_socket_new_async(). Each TCP socket has a GIOChannel which can be used to read and write from the socket. A watch can be set on the GIOChannel by calling g_io_add_watch() (a GLib function). To create a TCP server, call gnet_tcp_socket_server_new(). The socket will be bound to all interfaces. To bind to a specific interface, call gnet_tcp_socket_server_new_interface(). To accept a new connection, call gnet_tcp_socket_server_accept(). This function returns a GTcpSocket representing the client connection. This function can block. To prevent blocking, call either gnet_tcp_socket_server_accept_nonblock() or gnet_tcp_socket_server_accept_async(). The former returns NULL immediately if there is no new connection. The latter calls a callback whenever there is a new connection. We recommend this function. This module will use SOCKS if enabled. Details <anchor id="GTcpSocket" role="struct"/>GTcpSocket GTcpSockettypedef struct _GTcpSocket GTcpSocket; A GTcpSocket structure represents a TCP socket. The implementation is hidden. <anchor id="GTcpSocketConnectAsyncID" role="typedef"/>GTcpSocketConnectAsyncID GTcpSocketConnectAsyncIDtypedef struct _GTcpSocketConnectState * GTcpSocketConnectAsyncID; ID of an asynchronous connection started with gnet_tcp_socket_connect_async(). The connection can be canceled by calling gnet_tcp_socket_connect_async_cancel() with the ID. <anchor id="GTcpSocketConnectAsyncStatus" role="enum"/>enum GTcpSocketConnectAsyncStatus GTcpSocketConnectAsyncStatustypedef enum { GTCP_SOCKET_CONNECT_ASYNC_STATUS_OK, GTCP_SOCKET_CONNECT_ASYNC_STATUS_INETADDR_ERROR, GTCP_SOCKET_CONNECT_ASYNC_STATUS_TCP_ERROR } GTcpSocketConnectAsyncStatus; Status for connecting via gnet_tcp_socket_connect_async(), passed by GTcpSocketConnectAsyncFunc. More errors may be added in the future, so it's best to compare against GTCP_SOCKET_CONNECT_ASYNC_STATUS_OK. GTCP_SOCKET_CONNECT_ASYNC_STATUS_OK Connection succeeded GTCP_SOCKET_CONNECT_ASYNC_STATUS_INETADDR_ERROR Error, address lookup failed GTCP_SOCKET_CONNECT_ASYNC_STATUS_TCP_ERROR Error, could not connect <anchor id="GTcpSocketConnectAsyncFunc" role="function"/>GTcpSocketConnectAsyncFunc () GTcpSocketConnectAsyncFuncvoid (*GTcpSocketConnectAsyncFunc) (GTcpSocket *socket, GTcpSocketConnectAsyncStatus status, gpointer data); Callback for gnet_tcp_socket_connect_async(). socket : TcpSocket that was connecting (callee owned) status : Status of the connection data : User data <anchor id="GTcpSocketNewAsyncID" role="typedef"/>GTcpSocketNewAsyncID GTcpSocketNewAsyncIDtypedef struct _GTcpSocketAsyncState * GTcpSocketNewAsyncID; ID of an asynchronous tcp socket creation started with gnet_tcp_socket_new_async(). The creation can be canceled by calling gnet_tcp_socket_new_async_cancel() with the ID. <anchor id="GTcpSocketNewAsyncFunc" role="function"/>GTcpSocketNewAsyncFunc () GTcpSocketNewAsyncFuncvoid (*GTcpSocketNewAsyncFunc) (GTcpSocket *socket, gpointer data); Callback for gnet_tcp_socket_new_async(). The socket will be NULL if the connection failed. socket : Socket that was connecting data : User data <anchor id="gnet-tcp-socket-connect" role="function"/>gnet_tcp_socket_connect () gnet_tcp_socket_connectGTcpSocket* gnet_tcp_socket_connect (const gchar *hostname, gint port); Creates a GTcpSocket and connects to hostname:port. This function blocks (while gnet_tcp_socket_connect_async() does not). To get the GInetAddr of the GTcpSocket, call gnet_tcp_socket_get_remote_inetaddr(). hostname : host name port : port Returns : a new GTcpSocket; NULL on error. <anchor id="gnet-tcp-socket-connect-async" role="function"/>gnet_tcp_socket_connect_async () gnet_tcp_socket_connect_asyncGTcpSocketConnectAsyncID gnet_tcp_socket_connect_async (const gchar *hostname, gint port, GTcpSocketConnectAsyncFunc func, gpointer data); Asynchronously creates a GTcpSocket and connects to hostname:port. The callback is called when the connection is made or an error occurs. The callback will not be called during the call to this function. hostname : host name port : port func : callback function data : data to pass to func on callback Returns : the ID of the connection; NULL on failure. The ID can be used with gnet_tcp_socket_connect_async_cancel() to cancel the connection. <anchor id="gnet-tcp-socket-connect-async-full" role="function" condition="since:2.0.8"/>gnet_tcp_socket_connect_async_full () gnet_tcp_socket_connect_async_fullGTcpSocketConnectAsyncID gnet_tcp_socket_connect_async_full (const gchar *hostname, gint port, GTcpSocketConnectAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext *context, gint priority); Asynchronously creates a GTcpSocket and connects to hostname:port. The callback is called when the connection is made or an error occurs. The callback will not be called during the call to this function. hostname : host name port : port func : callback function data : data to pass to func on callback notify : function to call to free data, or NULL context : the GMainContext to use for notifications, or NULL for the default GLib main context. If in doubt, pass NULL. priority : the priority with which to schedule notifications in the main context, e.g. G_PRIORITY_DEFAULT or G_PRIORITY_HIGH. Returns : the ID of the connection; NULL on failure. The ID can be used with gnet_tcp_socket_connect_async_cancel() to cancel the connection. Since 2.0.8 <anchor id="gnet-tcp-socket-connect-async-cancel" role="function"/>gnet_tcp_socket_connect_async_cancel () gnet_tcp_socket_connect_async_cancelvoid gnet_tcp_socket_connect_async_cancel (GTcpSocketConnectAsyncID id); Cancels an asynchronous connection that was started with gnet_tcp_socket_connect_async(). id : ID of the connection <anchor id="gnet-tcp-socket-new" role="function"/>gnet_tcp_socket_new () gnet_tcp_socket_newGTcpSocket* gnet_tcp_socket_new (const GInetAddr *addr); Creates a GTcpSocket and connects to addr. This function blocks. SOCKS is used if SOCKS is enabled. addr : address Returns : a new GTcpSocket; NULL on error. <anchor id="gnet-tcp-socket-new-async" role="function"/>gnet_tcp_socket_new_async () gnet_tcp_socket_new_asyncGTcpSocketNewAsyncID gnet_tcp_socket_new_async (const GInetAddr *addr, GTcpSocketNewAsyncFunc func, gpointer data); Asynchronously creates a GTcpSocket and connects to addr. The callback is called once the connection is made or an error occurs. The callback will not be called during the call to this function. SOCKS is used if SOCKS is enabled. The SOCKS negotiation will block. addr : address func : callback function data : data to pass to func on callback Returns : the ID of the connection; NULL on failure. The ID can be used with gnet_tcp_socket_new_async_cancel() to cancel the connection. <anchor id="gnet-tcp-socket-new-async-full" role="function" condition="since:2.0.8"/>gnet_tcp_socket_new_async_full () gnet_tcp_socket_new_async_fullGTcpSocketNewAsyncID gnet_tcp_socket_new_async_full (const GInetAddr *addr, GTcpSocketNewAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext *context, gint priority); Asynchronously creates a GTcpSocket and connects to addr. The callback is called once the connection is made or an error occurs. The callback will not be called during the call to this function. SOCKS is used if SOCKS is enabled. The SOCKS negotiation will block. addr : address func : callback function data : data to pass to func on callback notify : function to call to free data, or NULL context : the GMainContext to use for notifications, or NULL for the default GLib main context. If in doubt, pass NULL. priority : the priority with which to schedule notifications in the main context, e.g. G_PRIORITY_DEFAULT or G_PRIORITY_HIGH. Returns : the ID of the connection; NULL on failure. The ID can be used with gnet_tcp_socket_new_async_cancel() to cancel the connection. Since 2.0.8 <anchor id="gnet-tcp-socket-new-async-cancel" role="function"/>gnet_tcp_socket_new_async_cancel () gnet_tcp_socket_new_async_cancelvoid gnet_tcp_socket_new_async_cancel (GTcpSocketNewAsyncID id); Cancels an asynchronous GTcpSocket creation that was started with gnet_tcp_socket_new_async(). id : ID of the connection <anchor id="gnet-tcp-socket-delete" role="function"/>gnet_tcp_socket_delete () gnet_tcp_socket_deletevoid gnet_tcp_socket_delete (GTcpSocket *socket); Deletes a GTcpSocket. socket : a GTcpSocket <anchor id="gnet-tcp-socket-ref" role="function"/>gnet_tcp_socket_ref () gnet_tcp_socket_refvoid gnet_tcp_socket_ref (GTcpSocket *socket); Adds a reference to a GTcpSocket. socket : a GTcpSocket <anchor id="gnet-tcp-socket-unref" role="function"/>gnet_tcp_socket_unref () gnet_tcp_socket_unrefvoid gnet_tcp_socket_unref (GTcpSocket *socket); Removes a reference from a GTcpSocket. A GTcpSocket is deleted when the reference count reaches 0. socket : a GTcpSocket to unreference <anchor id="gnet-tcp-socket-get-io-channel" role="function"/>gnet_tcp_socket_get_io_channel () gnet_tcp_socket_get_io_channelGIOChannel* gnet_tcp_socket_get_io_channel (GTcpSocket *socket); Gets the GIOChannel of a GTcpSocket. For a client socket, the GIOChannel represents the data stream. Use it like you would any other GIOChannel. For a server socket however, the GIOChannel represents the listening socket. When it's readable, there's a connection waiting to be accepted. However, using gnet_tcp_socket_server_accept_async() is more elegant than watching the GIOChannel. Every GTcpSocket has one and only one GIOChannel. If you ref the channel, then you must unref it eventually. Do not close the channel. The channel is closed by GNet when the socket is deleted. socket : a GTcpSocket Returns : a GIOChannel. <anchor id="gnet-tcp-socket-get-remote-inetaddr" role="function"/>gnet_tcp_socket_get_remote_inetaddr () gnet_tcp_socket_get_remote_inetaddrGInetAddr* gnet_tcp_socket_get_remote_inetaddr (const GTcpSocket *socket); Gets the address of the remote host from a GTcpSocket. This function does not work on server sockets. socket : a GTcpSocket Returns : a GInetAddr. <anchor id="gnet-tcp-socket-get-local-inetaddr" role="function"/>gnet_tcp_socket_get_local_inetaddr () gnet_tcp_socket_get_local_inetaddrGInetAddr* gnet_tcp_socket_get_local_inetaddr (const GTcpSocket *socket); Gets the local host's address from a GTcpSocket. socket : a GTcpSocket Returns : a GInetAddr, or NULL on error. Unref with gnet_inetaddr_unref() when no longer needed. <anchor id="gnet-tcp-socket-get-port" role="function"/>gnet_tcp_socket_get_port () gnet_tcp_socket_get_portgint gnet_tcp_socket_get_port (const GTcpSocket *socket); Gets the port a server GTcpSocket is bound to. socket : a GTcpSocket Returns : the port number. <anchor id="GNetTOS" role="enum"/>enum GNetTOS GNetTOStypedef enum { GNET_TOS_NONE, GNET_TOS_LOWDELAY, GNET_TOS_THROUGHPUT, GNET_TOS_RELIABILITY, GNET_TOS_LOWCOST } GNetTOS; Type-of-service. GNET_TOS_NONE Unspecified GNET_TOS_LOWDELAY Low delay GNET_TOS_THROUGHPUT High throughput GNET_TOS_RELIABILITY High reliability GNET_TOS_LOWCOST Low cost <anchor id="gnet-tcp-socket-set-tos" role="function"/>gnet_tcp_socket_set_tos () gnet_tcp_socket_set_tosvoid gnet_tcp_socket_set_tos (GTcpSocket *socket, GNetTOS tos); Sets the type-of-service (TOS) of the socket. TOS theoretically controls the connection's quality of service, but most routers ignore it. Some systems don't even support this function. The function does nothing if the operating system does not support it. socket : a GTcpSocket tos : type of service <anchor id="gnet-tcp-socket-server-new" role="function"/>gnet_tcp_socket_server_new () gnet_tcp_socket_server_newGTcpSocket* gnet_tcp_socket_server_new (void); Creates a new GTcpSocket bound to all interfaces and an arbitrary port. SOCKS is used if SOCKS is enabled. Returns : a new GTcpSocket; NULL on error. <anchor id="gnet-tcp-socket-server-new-with-port" role="function"/>gnet_tcp_socket_server_new_with_port () gnet_tcp_socket_server_new_with_portGTcpSocket* gnet_tcp_socket_server_new_with_port (gint port); Creates a new GTcpSocket bound to all interfaces and port port. If port is 0, an arbitrary port will be used. SOCKS is used if SOCKS is enabled. port : port to bind to (0 for an arbitrary port) Returns : a new GTcpSocket; NULL on error. <anchor id="gnet-tcp-socket-server-new-full" role="function"/>gnet_tcp_socket_server_new_full () gnet_tcp_socket_server_new_fullGTcpSocket* gnet_tcp_socket_server_new_full (const GInetAddr *iface, gint port); Creates and new GTcpSocket bound to interface iface and port port. If iface is NULL, the socket is bound to all interfaces. If port is 0, the socket is bound to an arbitrary port. SOCKS is used if SOCKS is enabled and the interface is NULL. iface : Interface to bind to (NULL for all interfaces) port : Port to bind to (0 for an arbitrary port) Returns : a new GTcpSocket; NULL on error. <anchor id="gnet-tcp-socket-server-accept" role="function"/>gnet_tcp_socket_server_accept () gnet_tcp_socket_server_acceptGTcpSocket* gnet_tcp_socket_server_accept (GTcpSocket *socket); Accepts a connection from a GTcpSocket. The socket must have been created using gnet_tcp_socket_server_new() (or equivalent). Even if the socket's GIOChannel is readable, the function may still block. socket : a GTcpSocket Returns : a new GTcpSocket representing a new connection; NULL on error. <anchor id="gnet-tcp-socket-server-accept-nonblock" role="function"/>gnet_tcp_socket_server_accept_nonblock () gnet_tcp_socket_server_accept_nonblockGTcpSocket* gnet_tcp_socket_server_accept_nonblock (GTcpSocket *socket); Accepts a connection from a GTcpSocket without blocking. The socket must have been created using gnet_tcp_socket_server_new() (or equivalent). Note that if the socket's GIOChannel is readable, then there is PROBABLY a new connection. It is possible for the connection to close by the time this function is called, so it may return NULL. socket : a GTcpSocket Returns : a new GTcpSocket representing a new connection; NULL otherwise. <anchor id="GTcpSocketAcceptFunc" role="function"/>GTcpSocketAcceptFunc () GTcpSocketAcceptFuncvoid (*GTcpSocketAcceptFunc) (GTcpSocket *server, GTcpSocket *client, gpointer data); Callback for gnet_tcp_socket_server_accept_async(). The socket had an irrecoverable error if client_socket is NULL. server : Server socket client : Client socket data : User data <anchor id="gnet-tcp-socket-server-accept-async" role="function"/>gnet_tcp_socket_server_accept_async () gnet_tcp_socket_server_accept_asyncvoid gnet_tcp_socket_server_accept_async (GTcpSocket *socket, GTcpSocketAcceptFunc accept_func, gpointer user_data); Asynchronously accepts a connection from a GTcpSocket. The callback is called when a new client has connected or an error occurs. The socket must have been created using gnet_tcp_socket_server_new() (or equivalent). socket : a GTcpSocket accept_func : callback function. user_data : data to pass to func on callback <anchor id="gnet-tcp-socket-server-accept-async-cancel" role="function"/>gnet_tcp_socket_server_accept_async_cancel () gnet_tcp_socket_server_accept_async_cancelvoid gnet_tcp_socket_server_accept_async_cancel (GTcpSocket *socket); Stops asynchronously accepting connections for a GTcpSocket. The socket is not closed. socket : a GTcpSocket <anchor id="gnet-tcp-socket-new-direct" role="function"/>gnet_tcp_socket_new_direct () gnet_tcp_socket_new_directGTcpSocket* gnet_tcp_socket_new_direct (const GInetAddr *addr); Creates a GTcpSocket and connects to addr without using SOCKS. This function blocks. Most users should use gnet_tcp_socket_new(). addr : address Returns : a new GTcpSocket; NULL on error. <anchor id="gnet-tcp-socket-new-async-direct" role="function"/>gnet_tcp_socket_new_async_direct () gnet_tcp_socket_new_async_directGTcpSocketNewAsyncID gnet_tcp_socket_new_async_direct (const GInetAddr *addr, GTcpSocketNewAsyncFunc func, gpointer data); Asynchronously creates a GTcpSocket and connects to addr without using SOCKS. Most users should use gnet_tcp_socket_new_async() instead. The callback is called once the connection is made or an error occurs. The callback will not be called during the call to this function. addr : address func : callback function data : data to pass to func on callback Returns : the ID of the connection; NULL on failure. The ID can be used with gnet_tcp_socket_new_async_cancel() to cancel the connection. <anchor id="gnet-tcp-socket-new-async-direct-full" role="function" condition="since:2.0.8"/>gnet_tcp_socket_new_async_direct_full () gnet_tcp_socket_new_async_direct_fullGTcpSocketNewAsyncID gnet_tcp_socket_new_async_direct_full (const GInetAddr *addr, GTcpSocketNewAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext *context, gint priority); Asynchronously creates a GTcpSocket and connects to addr without using SOCKS. Most users should use gnet_tcp_socket_new_async() instead. The callback is called once the connection is made or an error occurs. The callback will not be called during the call to this function. addr : address func : callback function data : data to pass to func on callback notify : function to call to free data, or NULL context : the GMainContext to use for notifications, or NULL for the default GLib main context. If in doubt, pass NULL. priority : the priority with which to schedule notifications in the main context, e.g. G_PRIORITY_DEFAULT or G_PRIORITY_HIGH. Returns : the ID of the connection; NULL on failure. The ID can be used with gnet_tcp_socket_new_async_cancel() to cancel the connection. Since 2.0.8 gnet-2.0.8/doc/xml/pack.xml0000644000175000017500000004403310751404362012412 00000000000000 Pack 3 GNET Library Pack Byte packing and unpacking functions Synopsis #include <gnet.h> gint gnet_pack (const gchar *format, gchar *buffer, const gint length, ...); gint gnet_pack_strdup (const gchar *format, gchar **bufferp, ...); gint gnet_vpack (const gchar *format, gchar *buffer, const gint length, va_list args); gint gnet_calcsize (const gchar *format, ...); gint gnet_vcalcsize (const gchar *format, va_list args); gint gnet_unpack (const gchar *format, const gchar *buffer, gint length, ...); gint gnet_vunpack (const gchar *format, const gchar *buffer, gint length, va_list args); Description The pack module provides functions for converting data into bytes ("packing") and converting bytes to data ("unpacking"). For example, two integers and a string may be packed into a buffer to be transfered over the network. These functions are similar to the ones in Python and Perl. Details <anchor id="gnet-pack" role="function"/>gnet_pack () gnet_packgint gnet_pack (const gchar *format, gchar *buffer, const gint length, ...); Writes Varargs to buffer. format is a string that describes the Varargs and how they are to be packed. This string is a list of characters, each describing the type of an argument in Varargs. An example: char buf[5]; int myint = 42; int mybyte = 23; &space; gnet_pack("!ib", buf, sizeof(buf), myint, mybyte); &comstart; Now buf is { 42, 0, 0, 0, 23 }; &comend; As a shortcut, most types can be prefixed by an integer to specify how many times the type is repeated. For example, "4i2b" is equivalent to "iiiibb". This repeat argument is refered below to as REPEAT. Native byte order and sizes are used by default. If the first character of format is < then little endian order and standard sizes are used. If the first character is > or !, then big endian (or network) order and standard size are used. Standard sizes are 1 byte for chars, 2 bytes for shorts, and 4 bytes for ints and longs. The types: x is a NULL character. It can be used for padding. It does not correspond to an argument in Varargs. b/B is a signed/unsigned char. h/H is a signed/unsigned short. i/I is a signed/unsigned int. l/L is a signed/unsigned long. f/D is a float/double (always native order/size). v is a void pointer (always native size). s is a zero-terminated string. S is a zero-padded string of maximum length REPEAT. We write up-to a NULL character or REPEAT characters, whichever comes first. We then write NULL characters up to a total of REPEAT characters. Special case: if REPEAT is not specified, we write the string as a non-NULL-terminated string (note that it can't be unpacked easily then). r is a byte array of NEXT bytes. NEXT is the next argument passed to gnet_pack() and is a gint. R is a byte array of REPEAT bytes. REPEAT must be specified. p is a Pascal string. The string passed is a NULL-termiated string of less than 256 character. The string writen is a non-NULL-terminated string with a byte before the string storing the string length. REPEAT is repeat. Mnemonics: (B)yte, s(H)ort, (I)nteger, (F)loat, (D)ouble, (V)oid pointer, (S)tring, (R)aw Pack was inspired by Python's and Perl's pack. It is more like Python's than Perl's. Note that in GNet, a repeat of 0 does not align the data (as in Python). format : pack data format buffer : buffer to pack to length : length of buffer ... : variables to pack from Returns : number of bytes packed; -1 on error. <anchor id="gnet-pack-strdup" role="function"/>gnet_pack_strdup () gnet_pack_strdupgint gnet_pack_strdup (const gchar *format, gchar **bufferp, ...); Writes Varargs into a buffer pointed to by bufferp. The buffer is allocated by the function and is caller owned. See gnet_pack() for more information. format : pack data format bufferp : pointer to a buffer (buffer is caller owned) ... : variables to pack from Returns : bytes packed; -1 on error. <anchor id="gnet-vpack" role="function"/>gnet_vpack () gnet_vpackgint gnet_vpack (const gchar *format, gchar *buffer, const gint length, va_list args); Var arg interface to gnet_pack(). See gnet_pack() for more information. format : pack data format buffer : buffer to pack to length : length of buffer args : var args Returns : bytes packed; -1 on error. <anchor id="gnet-calcsize" role="function"/>gnet_calcsize () gnet_calcsizegint gnet_calcsize (const gchar *format, ...); Calculates the size of the buffer needed to pack Varargs by the given format. See gnet_pack() for more information. format : pack data format ... : variables Returns : number of bytes required to pack; -1 on error. <anchor id="gnet-vcalcsize" role="function"/>gnet_vcalcsize () gnet_vcalcsizegint gnet_vcalcsize (const gchar *format, va_list args); Var arg interface to gnet_calcsize(). See gnet_calcsize() for additional information. format : pack data format args : var args Returns : number of bytes required to pack; -1 on error. <anchor id="gnet-unpack" role="function"/>gnet_unpack () gnet_unpackgint gnet_unpack (const gchar *format, const gchar *buffer, gint length, ...); Reads the data in buffer into Varargs. format is a string that describes the Varargs and how they are to be packed. This string is a list of characters, each describing the type of an argument in Varargs. An example: char buf[5] = { 42, 0, 0, 0, 23 }; int myint; int mybyte; &space; gnet_unpack("!ib", buf, sizeof(buf), &myint, &mybyte); &comstart; Now myint is 42 and mybyte is 23 &comend; In unpack, the arguments must be pointers to the appropriate type. Strings and byte arrays are allocated dynamicly (by g_new()). The caller is responsible for g_free()-ing it. As a shortcut, most types can be prefixed by an integer to specify how many times the type is repeated. For example, "4i2b" is equivalent to "iiiibb". This repeat argument is refered below to as REPEAT. The types: x is a pad byte. The byte is skipped and not stored. We do not check its value. b/B is a signed/unsigned char. h/H is a signed/unsigned short. i/I is a signed/unsigned int. l/L is a signed/unsigned long. f/D is a float/double (always native order/size). v is a void pointer (always native size). s is a zero-terminated string. S is a zero-padded string of length REPEAT. We read REPEAT characters or until a NULL character. Any remaining characters are filled in with 0's. REPEAT must be specified. r is a byte array of NEXT bytes. NEXT is the next argument and is a gint. REPEAT is repeat. R is a byte array of REPEAT bytes. REPEAT must be specified. p is a Pascal string. The first byte read is the length of the string and the string follows. The unpacked string will be a normal, NULL-terminated string. REPEAT is repeat. format : unpack data format buffer : buffer to unpack from length : length of buffer ... : addresses of variables to unpack to Returns : number of bytes unpacked; -1 on error. The bytes are unpacked to the variables pointed to by the Varargs. <anchor id="gnet-vunpack" role="function"/>gnet_vunpack () gnet_vunpackgint gnet_vunpack (const gchar *format, const gchar *buffer, gint length, va_list args); Var arg interface to gnet_unpack(). See gnet_unpack() for more information. format : unpack data format buffer : buffer to unpack from length : length of buffer args : var args Returns : number of bytes packed; -1 on error. gnet-2.0.8/doc/xml/base64.xml0000644000175000017500000001336210751404362012561 00000000000000 Base64 3 GNET Library Base64 Base64 encoding and decoding Synopsis #include <gnet.h> gchar* gnet_base64_encode (const gchar *src, gint srclen, gint *dstlenp, gboolean strict); gchar* gnet_base64_decode (const gchar *src, gint srclen, gint *dstlenp); Description gchar* binary_stream = "Hello World!"; gchar* base64_stream; gint base64_len; gchar* newbin_stream; gint newbin_len; base64_stream = gnet_base64_encode(binary_stream,strlen(binary_stream), &base64_len, FALSE); newbin_stream = gnet_base64_decode(base64_stream, base64_len, &newbin_len); This module provides functions to encode and decode strings into the Base64 encoding specified in "RFC 2045 - MIME (Multipurpose Internet Mail Extensions)". The Base64 encoding is designed to represent arbitrary sequences of octets in a form that need not be humanly readable. A 65-character subset ([A-Za-z0-9+/=]) of US-ASCII is used, enabling 6 bits to be represented per printable character. Details <anchor id="gnet-base64-encode" role="function"/>gnet_base64_encode () gnet_base64_encodegchar* gnet_base64_encode (const gchar *src, gint srclen, gint *dstlenp, gboolean strict); Convert a buffer from binary to base64 representation. Set strict to TRUE to insert a newline every 72th character. This is required by RFC 2045, but some applications don't require this. If srclen is 0, an empty string will be returned (not NULL). src : source buffer srclen : length of the source buffer dstlenp : length of the buffer returned (including the terminating \0) strict : insert new lines as required by RFC 2045 Returns : a newly-allocated and NUL-terminated string containing the input data in base64 coding. Free with g_free() when no longer needed. <anchor id="gnet-base64-decode" role="function"/>gnet_base64_decode () gnet_base64_decodegchar* gnet_base64_decode (const gchar *src, gint srclen, gint *dstlenp); Convert a buffer from base64 to binary representation. This function is liberal in what it will accept. It ignores non-base64 symbols. src : the source buffer srclen : the length of the source buffer, or -1 for strlen(src). dstlenp : where to return the length of the returned output buffer Returns : newly-allocated buffer. Free with g_free() when no longer needed. The integer pointed to by dstlenp is set to the length of that buffer. gnet-2.0.8/doc/xml/sha.xml0000644000175000017500000004200110751404362012240 00000000000000 SHA 3 GNET Library SHA SHA hash Synopsis #include <gnet.h> GSHA; #define GNET_SHA_HASH_LENGTH GSHA* gnet_sha_new (const gchar *buffer, guint length); GSHA* gnet_sha_new_string (const gchar *str); GSHA* gnet_sha_clone (const GSHA *sha); void gnet_sha_delete (GSHA *sha); GSHA* gnet_sha_new_incremental (void); void gnet_sha_update (GSHA *sha, const gchar *buffer, guint length); void gnet_sha_final (GSHA *sha); gboolean gnet_sha_equal (gconstpointer p1, gconstpointer p2); guint gnet_sha_hash (gconstpointer p); gchar* gnet_sha_get_digest (const GSHA *sha); gchar* gnet_sha_get_string (const GSHA *sha); void gnet_sha_copy_string (const GSHA *sha, gchar *buffer); Description The SHA module provide support for computing and manipulating SHA hashes. SHA is a hash function with a very low probability of collision. SHA is considered stronger than MD5. A SHA can be calculated at one time or incrementally. To create a SHA at one time, call gnet_sha_new() with the data. To create a SHA incrementally, call gnet_sha_new_incremental() to create the SHA object, then gnet_sha_update() one or more times with data to hash, and finally call gnet_sha_final(). To get the digest, or hash value, call gnet_sha_get_digest(). This returns the raw digest as an array of GNET_SHA_HASH_LENGTH bytes. To get the digest as a human-readable string, call gnet_sha_get_string() or gnet_sha_copy_string(). gchar buffer[] = "Hello world!"; gchar buffer2[] = "Second line"; GSHA* sha; gchar* sha_str; &comstart; Compute an SHA at one time &comend; sha = gnet_sha_new (buffer, strlen(buffer)); sha_str = gnet_sha_get_string (sha); g_print ("The SHA of %s is %s\n", buffer, sha_str); &comstart; Use SHA... &comend; g_free (sha_str); gnet_sha_delete (sha); &comstart; Compute an SHA incrementally &comend; sha = gnet_sha_new_incremental (); gnet_sha_update (sha, buffer, strlen(buffer)); gnet_sha_update (sha, buffer2, strlen(buffer2)); gnet_sha_final (sha); &comstart; Use SHA... &comend; gnet_sha_delete (sha); Details <anchor id="GSHA:CAPS" role="struct"/>GSHA GSHAtypedef struct _GSHA GSHA; GSHA is a SHA hash. <anchor id="GNET-SHA-HASH-LENGTH:CAPS" role="macro"/>GNET_SHA_HASH_LENGTH GNET_SHA_HASH_LENGTH#define GNET_SHA_HASH_LENGTH 20 Length of the SHA hash in bytes. <anchor id="gnet-sha-new" role="function"/>gnet_sha_new () gnet_sha_newGSHA* gnet_sha_new (const gchar *buffer, guint length); Creates a GSHA from buffer. buffer : buffer to hash length : length of buffer Returns : a new GSHA. <anchor id="gnet-sha-new-string" role="function"/>gnet_sha_new_string () gnet_sha_new_stringGSHA* gnet_sha_new_string (const gchar *str); Createss a GSHA from str. str is a hexidecimal string representing the digest. str : hexidecimal string Returns : a new GSHA. <anchor id="gnet-sha-clone" role="function"/>gnet_sha_clone () gnet_sha_cloneGSHA* gnet_sha_clone (const GSHA *sha); Copies a GSHA. sha : a GSHA Returns : a copy of sha. <anchor id="gnet-sha-delete" role="function"/>gnet_sha_delete () gnet_sha_deletevoid gnet_sha_delete (GSHA *sha); Deletes a GSHA. sha : a GSHA <anchor id="gnet-sha-new-incremental" role="function"/>gnet_sha_new_incremental () gnet_sha_new_incrementalGSHA* gnet_sha_new_incremental (void); Creates a GSHA incrementally. After creating a GSHA, call gnet_sha_update() one or more times to hash data. Finally, call gnet_sha_final() to compute the final hash value. Returns : a new GSHA. <anchor id="gnet-sha-update" role="function"/>gnet_sha_update () gnet_sha_updatevoid gnet_sha_update (GSHA *sha, const gchar *buffer, guint length); Updates the hash with buffer. This may be called several times on a hash created by gnet_sha_new_incremental() before being finalized by calling gnet_sha_final(). sha : a GSHA buffer : buffer to add length : length of buffer <anchor id="gnet-sha-final" role="function"/>gnet_sha_final () gnet_sha_finalvoid gnet_sha_final (GSHA *sha); Calcuates the final hash value of a GSHA. This should only be called on a GSHA created by gnet_sha_new_incremental(). sha : a GSHA <anchor id="gnet-sha-equal" role="function"/>gnet_sha_equal () gnet_sha_equalgboolean gnet_sha_equal (gconstpointer p1, gconstpointer p2); Compares two GSHA's for equality. p1 : a GSHA. p2 : another GSHA. Returns : TRUE if they are equal; FALSE otherwise. <anchor id="gnet-sha-hash" role="function"/>gnet_sha_hash () gnet_sha_hashguint gnet_sha_hash (gconstpointer p); Creates a hash code for a GMD5 for use with GHashTable. This hash value is not the same as the MD5 digest. p : a GSHA Returns : the hash code for p. <anchor id="gnet-sha-get-digest" role="function"/>gnet_sha_get_digest () gnet_sha_get_digestgchar* gnet_sha_get_digest (const GSHA *sha); Gets the raw SHA digest. sha : a GSHA Returns : a callee-owned buffer containing the SHA hash digest. The buffer is GNET_SHA_HASH_LENGTH bytes long. <anchor id="gnet-sha-get-string" role="function"/>gnet_sha_get_string () gnet_sha_get_stringgchar* gnet_sha_get_string (const GSHA *sha); Get the digest represented a human-readable string. sha : a GSHA Returns : a hexadecimal string representing the digest. The string is 2 * GNET_SHA_HASH_LENGTH bytes long and NULL terminated. The string is caller owned. <anchor id="gnet-sha-copy-string" role="function"/>gnet_sha_copy_string () gnet_sha_copy_stringvoid gnet_sha_copy_string (const GSHA *sha, gchar *buffer); Copies the digest, represented as a string, into buffer. The string is not NULL terminated. sha : a GSHA buffer : buffer at least 2 * GNET_SHA_HASH_LENGTH bytes long gnet-2.0.8/doc/xml/md5.xml0000644000175000017500000004202010751404362012153 00000000000000 MD5 3 GNET Library MD5 MD5 hash Synopsis #include <gnet.h> GMD5; #define GNET_MD5_HASH_LENGTH GMD5* gnet_md5_new (const gchar *buffer, guint length); GMD5* gnet_md5_new_string (const gchar *str); GMD5* gnet_md5_clone (const GMD5 *md5); void gnet_md5_delete (GMD5 *md5); GMD5* gnet_md5_new_incremental (void); void gnet_md5_update (GMD5 *md5, const gchar *buffer, guint length); void gnet_md5_final (GMD5 *md5); gboolean gnet_md5_equal (gconstpointer p1, gconstpointer p2); guint gnet_md5_hash (gconstpointer p); gchar* gnet_md5_get_digest (const GMD5 *md5); gchar* gnet_md5_get_string (const GMD5 *md5); void gnet_md5_copy_string (const GMD5 *md5, gchar *buffer); Description The MD5 module provide support for computing and manipulating MD5 hashes. MD5 is a hash function with a very low probability of collision. MD5 is considered weaker than SHA. An MD5 can be calculated at one time or incrementally. To create a MD5 at one time, call gnet_md5_new() with the data. To create a MD5 incrementally, call gnet_md5_new_incremental() to create the MD5 object, then gnet_md5_update() one or more times with data to hash, and finally call gnet_md5_final(). To get the digest, or hash value, call gnet_md5_get_digest(). This returns the raw digest as an array of GNET_MD5_HASH_LENGTH bytes. To get the digest as a human-readable hexidecimal string, call gnet_md5_get_string() or gnet_md5_copy_string(). gchar buffer[] = "Hello world!"; gchar buffer2[] = "Second line"; GMD5* md5; gchar* md5_str; &comstart; Compute an MD5 at one time &comend; md5 = gnet_md5_new (buffer, strlen(buffer)); md5_str = gnet_md5_get_string (md5); g_print ("The MD5 of %s is %s\n", buffer, md5_str); &comstart; Use MD5... &comend; g_free (md5_str); gnet_md5_delete (md5); &comstart; Compute an MD5 incrementally &comend; md5 = gnet_md5_new_incremental (); gnet_md5_update (md5, buffer, strlen(buffer)); gnet_md5_update (md5, buffer2, strlen(buffer2)); gnet_md5_final (md5); &comstart; Use MD5... &comend; gnet_md5_delete (md5); Details <anchor id="GMD5:CAPS" role="struct"/>GMD5 GMD5typedef struct _GMD5 GMD5; GMD5 is a MD5 hash. <anchor id="GNET-MD5-HASH-LENGTH:CAPS" role="macro"/>GNET_MD5_HASH_LENGTH GNET_MD5_HASH_LENGTH#define GNET_MD5_HASH_LENGTH 16 Length of the MD5 hash in bytes. <anchor id="gnet-md5-new" role="function"/>gnet_md5_new () gnet_md5_newGMD5* gnet_md5_new (const gchar *buffer, guint length); Creates a GMD5 from buffer. buffer : buffer to hash length : length of buffer Returns : a new GMD5. <anchor id="gnet-md5-new-string" role="function"/>gnet_md5_new_string () gnet_md5_new_stringGMD5* gnet_md5_new_string (const gchar *str); Creates a GMD5 from str. str is a hexidecimal string representing the digest. str : hexidecimal string Returns : a new GMD5. <anchor id="gnet-md5-clone" role="function"/>gnet_md5_clone () gnet_md5_cloneGMD5* gnet_md5_clone (const GMD5 *md5); Copies a GMD5. md5 : a GMD5 Returns : a copy of md5. <anchor id="gnet-md5-delete" role="function"/>gnet_md5_delete () gnet_md5_deletevoid gnet_md5_delete (GMD5 *md5); Deletes a GMD5. md5 : a GMD5 <anchor id="gnet-md5-new-incremental" role="function"/>gnet_md5_new_incremental () gnet_md5_new_incrementalGMD5* gnet_md5_new_incremental (void); Creates a GMD5 incrementally. After creating a GMD5, call gnet_md5_update() one or more times to hash data. Finally, call gnet_md5_final() to compute the final hash value. Returns : a new GMD5. <anchor id="gnet-md5-update" role="function"/>gnet_md5_update () gnet_md5_updatevoid gnet_md5_update (GMD5 *md5, const gchar *buffer, guint length); Updates the hash with buffer. This may be called several times on a hash created by gnet_md5_new_incremental() before being finalized by calling gnet_md5_final(). md5 : a GMD5 buffer : buffer to add length : length of buffer <anchor id="gnet-md5-final" role="function"/>gnet_md5_final () gnet_md5_finalvoid gnet_md5_final (GMD5 *md5); Calcuates the final hash value of a GMD5. This should only be called on an GMD5 created by gnet_md5_new_incremental(). md5 : a GMD5 <anchor id="gnet-md5-equal" role="function"/>gnet_md5_equal () gnet_md5_equalgboolean gnet_md5_equal (gconstpointer p1, gconstpointer p2); Compares two GMD5's for equality. p1 : first GMD5. p2 : second GMD5. Returns : TRUE if they are equal; FALSE otherwise. <anchor id="gnet-md5-hash" role="function"/>gnet_md5_hash () gnet_md5_hashguint gnet_md5_hash (gconstpointer p); Creates a hash code for a GMD5 for use with GHashTable. This hash value is not the same as the MD5 digest. p : a GMD5 Returns : the hash code for p. <anchor id="gnet-md5-get-digest" role="function"/>gnet_md5_get_digest () gnet_md5_get_digestgchar* gnet_md5_get_digest (const GMD5 *md5); Gets the raw MD5 digest. md5 : a GMD5 Returns : a callee-owned buffer containing the MD5 hash digest. The buffer is GNET_MD5_HASH_LENGTH bytes long. <anchor id="gnet-md5-get-string" role="function"/>gnet_md5_get_string () gnet_md5_get_stringgchar* gnet_md5_get_string (const GMD5 *md5); Gets the digest represented a human-readable string. md5 : a GMD5 Returns : a hexadecimal string representing the digest. The string is 2 * GNET_MD5_HASH_LENGTH bytes long and NULL terminated. The string is caller owned. <anchor id="gnet-md5-copy-string" role="function"/>gnet_md5_copy_string () gnet_md5_copy_stringvoid gnet_md5_copy_string (const GMD5 *md5, gchar *buffer); Copies the digest, represented as a string, into buffer. The string is not NULL terminated. md5 : a GMD5 buffer : buffer at least 2 * GNET_MD5_HASH_LENGTH bytes long gnet-2.0.8/doc/xml/server.xml0000644000175000017500000002435010751404362013002 00000000000000 Server 3 GNET Library Server TCP server object Synopsis #include <gnet.h> GServer; void (*GServerFunc) (GServer *server, GConn *conn, gpointer user_data); GServer* gnet_server_new (const GInetAddr *iface, gint port, GServerFunc func, gpointer user_data); void gnet_server_delete (GServer *server); void gnet_server_ref (GServer *server); void gnet_server_unref (GServer *server); Description A GServer represents a TCP server. GServer is a thin wrapper around a TCP server socket. To create a new GServer, call gnet_server_new(). One of the arguments is a callback function that is called with a new GConn whenever a new client connects. Remember to call gnet_conn_set_callback() on the new GConn to set the GConn callback. To delete a GServer, call gnet_server_delete(). See also GConn and the echoserver-gserver example. Details <anchor id="GServer" role="struct"/>GServer GServertypedef struct { GInetAddr* iface; gint port; GTcpSocket* socket; guint ref_count; GServerFunc func; gpointer user_data; } GServer; GServer is a high-level interface to a TCP server socket. The callback is called with a GConn whenever a new connection is made. GInetAddr *iface; interface address gint port; port number GTcpSocket *socket; TCP server socket guint ref_count; [private] GServerFunc func; callback function gpointer user_data; user data for callback <anchor id="GServerFunc" role="function"/>GServerFunc () GServerFuncvoid (*GServerFunc) (GServer *server, GConn *conn, gpointer user_data); Callback for gnet_server_new(). When a client connects, this callback is called with a new connection. If the server fails, this callback is called with conn set to NULL. The callback is not called again. If conn is non-NULL, the address (IP, port) of the client that established the connection can be found in the inetaddr member of the GConn structure. server : server conn : new connection (or NULL if error) user_data : user data specified in gnet_server_new() <anchor id="gnet-server-new" role="function"/>gnet_server_new () gnet_server_newGServer* gnet_server_new (const GInetAddr *iface, gint port, GServerFunc func, gpointer user_data); Creates a new GServer object representing a server. Usually, iface is set to NULL to bind to all interfaces and port is a specific number. The callback is called whenever a new connection arrives or if there is a server error. The callback is not called again after a server error. iface : interface to bind to (NULL for all interfaces) port : port to bind to (0 for an arbitrary port) func : callback to call when a connection is accepted user_data : data to pass to callback Returns : a new GServer. <anchor id="gnet-server-delete" role="function"/>gnet_server_delete () gnet_server_deletevoid gnet_server_delete (GServer *server); Closes and deletes a GServer. server : GServer to delete. <anchor id="gnet-server-ref" role="function"/>gnet_server_ref () gnet_server_refvoid gnet_server_ref (GServer *server); Adds a reference to a GServer. server : a GServer <anchor id="gnet-server-unref" role="function"/>gnet_server_unref () gnet_server_unrefvoid gnet_server_unref (GServer *server); Removes a reference from a GServer. A GServer is deleted when the reference count reaches 0. server : a GServer gnet-2.0.8/doc/xml/conn-http.xml0000644000175000017500000013752710751404362013421 00000000000000 GConnHttp 3 GNET Library GConnHttp HTTP connection object Synopsis #include <gnet.h> GConnHttp; enum GConnHttpMethod; enum GConnHttpError; enum GConnHttpEventType; GConnHttpEvent; GConnHttpEventResolved; GConnHttpEventResponse; GConnHttpEventRedirect; GConnHttpEventData; GConnHttpEventError; void (*GConnHttpFunc) (GConnHttp *conn, GConnHttpEvent *event, gpointer user_data); enum GConnHttpHeaderFlags; GConnHttp* gnet_conn_http_new (void); gboolean gnet_conn_http_set_uri (GConnHttp *conn, const gchar *uri); gboolean gnet_conn_http_set_escaped_uri (GConnHttp *conn, const gchar *uri); gboolean gnet_conn_http_set_header (GConnHttp *conn, const gchar *field, const gchar *value, GConnHttpHeaderFlags flags); void gnet_conn_http_set_max_redirects (GConnHttp *conn, guint num); void gnet_conn_http_set_timeout (GConnHttp *conn, guint timeout); gboolean gnet_conn_http_set_user_agent (GConnHttp *conn, const gchar *agent); gboolean gnet_conn_http_set_method (GConnHttp *conn, GConnHttpMethod method, const gchar *post_data, gsize post_data_len); gboolean gnet_conn_http_set_main_context (GConnHttp *conn, GMainContext *context); void gnet_conn_http_run_async (GConnHttp *conn, GConnHttpFunc func, gpointer user_data); gboolean gnet_conn_http_run (GConnHttp *conn, GConnHttpFunc func, gpointer user_data); gboolean gnet_conn_http_steal_buffer (GConnHttp *conn, gchar **buffer, gsize *length); void gnet_conn_http_cancel (GConnHttp *conn); void gnet_conn_http_delete (GConnHttp *conn); gboolean gnet_http_get (const gchar *url, gchar **buffer, gsize *length, guint *response); Description A GConnHttp represents a HTTP client connection. A GConnHttp is created directly by calling gnet_conn_http_new(). After that set the URI to retrieve using gnet_conn_http_set_uri(). A connection is made and the HTTP request sent only once either gnet_conn_http_run_async() or gnet_conn_http_run() is called. Use the asynchroneous variant if you want the function to return immediately and prefer to receive data and status information in the background via the callback function. gnet_conn_http_run_async() assumes that there is already a GLib main loop running (e.g. the Gtk main loop). You can decide for yourself how much information you would like to receive during the HTTP operation. All status information is communicated to the caller via the optional callback function. The easiest way to just retrieve some data via HTTP is to use the convenience function gnet_http_get(). Here is a small example how to retrieve a file with the least amount of effort and error checking (this is more or less what gnet_http_get() does internally): Simple <structname>GConnHttp</structname> usage. &hash;define GNET_EXPERIMENTAL &hash;include <gnet.h> void fetch_and_print_url (const gchar *url) { GConnHttp *conn; conn = gnet_conn_http_new(); gnet_conn_http_set_uri(conn, url); if (gnet_conn_http_run(conn, NULL, NULL)) { gchar *buf; gsize buflen; if (gnet_conn_http_steal_buffer(conn, &buf, &buflen)) { g_print ("Received %%u bytes of data:\n%%s\n", buflen, buf); g_free(buf); } } gnet_conn_http_delete(conn); } ... fetch_and_print_url ("http://www.google.com"); ... GConnHttp is still considered less mature than other parts of GNet, even though it should generall work just fine. It just has not received as much testing as other parts of GNet yet. You should not use it in production level code without thoroughly testing it for your purposes. Because of that, you need to define GNET_EXPERIMENTAL in your source code before including the GNet headers (otherwise you will get compiler errors when trying to use it). Details <anchor id="GConnHttp" role="struct"/>GConnHttp GConnHttptypedef struct _GConnHttp GConnHttp; HTTP Connection. The entire GConnHttp struct is opaque and private. <anchor id="GConnHttpMethod" role="enum"/>enum GConnHttpMethod GConnHttpMethodtypedef enum { GNET_CONN_HTTP_METHOD_GET, GNET_CONN_HTTP_METHOD_POST } GConnHttpMethod; HTTP request method. Use with gnet_conn_http_set_method(). GNET_CONN_HTTP_METHOD_GET HTTP GET method GNET_CONN_HTTP_METHOD_POST HTTP POST method <anchor id="GConnHttpError" role="enum"/>enum GConnHttpError GConnHttpErrortypedef enum { GNET_CONN_HTTP_ERROR_UNSPECIFIED, GNET_CONN_HTTP_ERROR_PROTOCOL_UNSUPPORTED, GNET_CONN_HTTP_ERROR_HOSTNAME_RESOLUTION } GConnHttpError; Error codes. Used by GConnHttpEventError. Note that errors by the HTTP server will be communicated to the client via the GConnHttpEventResponse event. GNET_CONN_HTTP_ERROR_UNSPECIFIED connection error GNET_CONN_HTTP_ERROR_PROTOCOL_UNSUPPORTED unsupported protocol (ie. not http) GNET_CONN_HTTP_ERROR_HOSTNAME_RESOLUTION the hostname could not be resolved <anchor id="GConnHttpEventType" role="enum"/>enum GConnHttpEventType GConnHttpEventTypetypedef enum { GNET_CONN_HTTP_RESOLVED, /* resolved host name */ GNET_CONN_HTTP_CONNECTED, /* connected to host */ GNET_CONN_HTTP_RESPONSE, /* got response (incl. headers) */ GNET_CONN_HTTP_REDIRECT, /* got redirect */ GNET_CONN_HTTP_DATA_PARTIAL, /* we got some data */ GNET_CONN_HTTP_DATA_COMPLETE, /* we got all data */ GNET_CONN_HTTP_TIMEOUT, /* the connection timed out */ GNET_CONN_HTTP_ERROR /* GConnHttp problem */ } GConnHttpEventType; GConnHttp event type. GNET_CONN_HTTP_RESOLVED the host name has been resolved or host name resolution failed. The event structure will be a GConnHttpEventResolved structure GNET_CONN_HTTP_CONNECTED the TCP connection to the HTTP server has been established GNET_CONN_HTTP_RESPONSE the HTTP server has sent a response and response headers. The event structure will be a GConnHttpEventResponse structure GNET_CONN_HTTP_REDIRECT the HTTP server has sent a redirect response. The event structure will be a GConnHttpEventRedirect structure GNET_CONN_HTTP_DATA_PARTIAL data has been received. The buffer is caller-owned (ie. owned by GNet), but may be emptied using gnet_conn_http_steal_buffer(). The event structure will be a GConnHttpEventData structure GNET_CONN_HTTP_DATA_COMPLETE data has been received in full. The buffer is caller-owned (ie. owned by GNet), but may be emptied using gnet_conn_http_steal_buffer(). The event structure will be a GConnHttpEventData structure GNET_CONN_HTTP_TIMEOUT the connection timed out GNET_CONN_HTTP_ERROR GConnHttp problem (not a server error response). The event structure will be a GConnHttpEventError structure <anchor id="GConnHttpEvent" role="struct"/>GConnHttpEvent GConnHttpEventtypedef struct { GConnHttpEventType type; /* type of event (see above) */ } GConnHttpEvent; GConnHttp Base Event. Check event->type and then cast the event structure into the corresponding specialised event structure. GConnHttpEventType type; event type <anchor id="GConnHttpEventResolved" role="struct"/>GConnHttpEventResolved GConnHttpEventResolvedtypedef struct { GInetAddr *ia; /* GInetAddr of the host name */ } GConnHttpEventResolved; GConnHttp Host Name Resolved Event. Emitted when the host name has been resolved to an IP address, primarily to give progress feedback to the user. ia will be NULL if the host name could not be resolved. GInetAddr *ia; a GInetAddr of the resolved host name. <anchor id="GConnHttpEventResponse" role="struct"/>GConnHttpEventResponse GConnHttpEventResponsetypedef struct { guint response_code; /* response code, e.g. 200, or 404 */ gchar **header_fields; /* NULL-terminated array of strings */ gchar **header_values; /* NULL-terminated array of strings */ } GConnHttpEventResponse; Emitted when the server has sent a response and response headers. guint response_code; response code from the HTTP server (e.g. 200 or 404) gchar **header_fields; array of header field strings, NULL-terminated gchar **header_values; array of header value strings, NULL-terminated <anchor id="GConnHttpEventRedirect" role="struct"/>GConnHttpEventRedirect GConnHttpEventRedirecttypedef struct { guint num_redirects; /* number of redirects so far */ guint max_redirects; /* max. num. of redirects allowed */ gchar *new_location; /* redirect location if provided */ gboolean auto_redirect; /* FALSE if action is needed */ } GConnHttpEventRedirect; Emitted when the server sends a redirect response. guint num_redirects; number of redirects so far guint max_redirects; maximum number of redirects allowed gchar *new_location; redirect location, or NULL if not provided gboolean auto_redirect; FALSE if action by the client is needed. Set to FALSE to prevent automatic redirection <anchor id="GConnHttpEventData" role="struct"/>GConnHttpEventData GConnHttpEventDatatypedef struct { guint64 content_length; /* set if available, otherwise 0 */ guint64 data_received; /* bytes received so far */ const gchar *buffer; /* buffer */ gsize buffer_length; /* buffer length */ } GConnHttpEventData; Emitted when data has been received. Useful for progress feedback to the user or to process data before all of it has been received. The client is responsible for emptying the buffer regularly when the amount of data received or expected is larger than the amount that should be kept in memory (e.g. in the case of large binary files). guint64 content_length; set if available, otherwise 0 guint64 data_received; total amount of data received so far const gchar *buffer; buffer with data received so far. Use gnet_conn_http_steal_buffer() to empty the buffer. gsize buffer_length; buffer length <anchor id="GConnHttpEventError" role="struct"/>GConnHttpEventError GConnHttpEventErrortypedef struct { GConnHttpError code; /* error code */ gchar *message; /* message (use for debugging only) */ } GConnHttpEventError; Emitted when an error has occured. Note that HTTP server errors are communicated to the client by means of a GConnHttpEventResponse event. GConnHttpError code; one of the GConnHttpError codes gchar *message; clear-text error message (for debugging purposes only) <anchor id="GConnHttpFunc" role="function"/>GConnHttpFunc () GConnHttpFuncvoid (*GConnHttpFunc) (GConnHttp *conn, GConnHttpEvent *event, gpointer user_data); Callback for GConnHttp. Check event->type and then cast the event into the appropriate event structure. event->type will be one of GNET_CONN_HTTP_RESOLVED: this event occurs when the host name has been resolved or host name resolution failed GNET_CONN_HTTP_CONNECTED: the TCP connection to the HTTP server has been established GNET_CONN_HTTP_RESPONSE: the HTTP server has sent a response and response headers GNET_CONN_HTTP_REDIRECT: the HTTP server has sent a redirect response GNET_CONN_HTTP_DATA_PARTIAL: data has been read. The buffer is owned by GNet and you must not modify it or free it. You can take ownership of the buffer with gnet_conn_http_steal_buffer() GNET_CONN_HTTP_DATA_COMPLETE: data has been received in full. The buffer is owned by GNet and you must not modify it or free it. You can acquire ownership of the buffer by calling gnet_conn_http_steal_buffer() GNET_CONN_HTTP_TIMEOUT: the connection timed out GNET_CONN_HTTP_ERROR: GConnHttp problem (not a server error response) conn : GConnHttp event : event (caller-owned, do not free) user_data : user data specified in gnet_conn_http_run() or gnet_conn_http_run_async() <anchor id="GConnHttpHeaderFlags" role="enum"/>enum GConnHttpHeaderFlags GConnHttpHeaderFlagstypedef enum { GNET_CONN_HTTP_FLAG_SKIP_HEADER_CHECK = 1 } GConnHttpHeaderFlags; Flags for gnet_conn_http_set_header(). GNET_CONN_HTTP_FLAG_SKIP_HEADER_CHECK do not check whether the header is a standard header <anchor id="gnet-conn-http-new" role="function"/>gnet_conn_http_new () gnet_conn_http_newGConnHttp* gnet_conn_http_new (void); Creates a GConnHttp. Returns : a GConnHttp. <anchor id="gnet-conn-http-set-uri" role="function"/>gnet_conn_http_set_uri () gnet_conn_http_set_urigboolean gnet_conn_http_set_uri (GConnHttp *conn, const gchar *uri); Sets the URI to GET or POST, e.g. http://www.foo.com/bar.html. uri is assumed to be unescaped, so all special URI characters will be escaped. conn : a GConnHttp uri : URI string Returns : TRUE if the URI has been accepted. <anchor id="gnet-conn-http-set-escaped-uri" role="function"/>gnet_conn_http_set_escaped_uri () gnet_conn_http_set_escaped_urigboolean gnet_conn_http_set_escaped_uri (GConnHttp *conn, const gchar *uri); Sets the URI to GET or POST, e.g. http://www.foo.com/My%20Documents/bar.txt conn : a GConnHttp uri : URI string with special characters already escaped Returns : TRUE if the URI has been accepted. <anchor id="gnet-conn-http-set-header" role="function"/>gnet_conn_http_set_header () gnet_conn_http_set_headergboolean gnet_conn_http_set_header (GConnHttp *conn, const gchar *field, const gchar *value, GConnHttpHeaderFlags flags); Set header field to send with the HTTP request. conn : a GConnHttp field : a header field, e.g. "Accept" value : the header field value, e.g. "text/html" flags : one or more flags of GConnHttpHeaderFlags, or 0 Returns : TRUE if the header field has been set or changed <anchor id="gnet-conn-http-set-max-redirects" role="function"/>gnet_conn_http_set_max_redirects () gnet_conn_http_set_max_redirectsvoid gnet_conn_http_set_max_redirects (GConnHttp *conn, guint num); Sets the maximum allowed number of automatic redirects. Note that the HTTP protocol specification (RFC2616) specifies occasions where the client must not redirect automatically without user intervention. In those cases, no automatic redirect will be performed, even if the limit has not been reached yet. conn : a GConnHttp num : the maximum number of allowed automatic redirects <anchor id="gnet-conn-http-set-timeout" role="function"/>gnet_conn_http_set_timeout () gnet_conn_http_set_timeoutvoid gnet_conn_http_set_timeout (GConnHttp *conn, guint timeout); Sets a timeout on the http connection. conn : a GConnHttp timeout : timeout in milliseconds <anchor id="gnet-conn-http-set-user-agent" role="function"/>gnet_conn_http_set_user_agent () gnet_conn_http_set_user_agentgboolean gnet_conn_http_set_user_agent (GConnHttp *conn, const gchar *agent); Convenience function. Wraps gnet_conn_http_set_header(). conn : a GConnHttp agent : the user agent string to send (will be supplemented by a GNet version number comment) Returns : TRUE if the user agent string has been changed. <anchor id="gnet-conn-http-set-method" role="function"/>gnet_conn_http_set_method () gnet_conn_http_set_methodgboolean gnet_conn_http_set_method (GConnHttp *conn, GConnHttpMethod method, const gchar *post_data, gsize post_data_len); Sets the HTTP request method. Default is the GET method. conn : a GConnHttp method : a GConnHttpMethod post_data : post data to send with POST method, or NULL post_data_len : the length of the post data to send with POST method, or 0 Returns : TRUE if the method has been changed successfully. <anchor id="gnet-conn-http-set-main-context" role="function" condition="since:2.0.8"/>gnet_conn_http_set_main_context () gnet_conn_http_set_main_contextgboolean gnet_conn_http_set_main_context (GConnHttp *conn, GMainContext *context); Sets the GLib GMainContext to use for asynchronous operations. You should call this function right after you create conn. You must not call this function after the actual connection process has started. You are very unlikely to ever need this function. conn : a GConnHttp context : a GMainContext, or NULL to use the default GLib main context Returns : TRUE on success, FALSE on failure. Since 2.0.8 <anchor id="gnet-conn-http-run-async" role="function"/>gnet_conn_http_run_async () gnet_conn_http_run_asyncvoid gnet_conn_http_run_async (GConnHttp *conn, GConnHttpFunc func, gpointer user_data); Starts connecting and sending the specified http request. Will return immediately. Assumes there is an existing and running default Gtk/GLib/Gnome main loop. conn : a GConnHttp func : callback function to communicate progress and errors, or NULL user_data : user data to pass to callback function, or NULL <anchor id="gnet-conn-http-run" role="function"/>gnet_conn_http_run () gnet_conn_http_rungboolean gnet_conn_http_run (GConnHttp *conn, GConnHttpFunc func, gpointer user_data); Starts connecting and sending the specified http request. Will return once the operation has finished and either an error has occured, or the data has been received in full. This function will run its own main loop in the default GLib main context (or the user-specified main context, if one was specified with gnet_conn_http_set_main_context()), which means that if your application is based on Gtk+ or sets up GLib timeouts or idle callbacks, it is possible that those callback functions are invoked while you are waiting for gnet_conn_http_run() to return. This means you shouldn't make assumptions about any state you set up before calling this function, because it might have been changed again from within a callback in the mean time (if this can happen or not depends on your callbacks and what they do of course). conn : a GConnHttp func : callback function to communicate progress and errors, or NULL user_data : user data to pass to callback function, or NULL Returns : TRUE if no error occured before connecting <anchor id="gnet-conn-http-steal-buffer" role="function"/>gnet_conn_http_steal_buffer () gnet_conn_http_steal_buffergboolean gnet_conn_http_steal_buffer (GConnHttp *conn, gchar **buffer, gsize *length); Empties the current buffer and returns the contents. The main purpose of this function is to make it possible to just use gnet_conn_http_run(), check its return value, and then get the buffer data without having to install a callback function. Also needed to empty the buffer regularly while receiving large amounts of data. The caller (you) needs to free the buffer with g_free() when done. conn : a GConnHttp buffer : where to store a pointer to the buffer data length : where to store the length of the buffer data Returns : TRUE if buffer and length have been set <anchor id="gnet-conn-http-cancel" role="function"/>gnet_conn_http_cancel () gnet_conn_http_cancelvoid gnet_conn_http_cancel (GConnHttp *conn); Cancels the current http transfer (if any) and makes gnet_conn_http_run() return immediately. Will do nothing if the transfer was started with gnet_conn_http_run_async(). conn : a GConnHttp <anchor id="gnet-conn-http-delete" role="function"/>gnet_conn_http_delete () gnet_conn_http_deletevoid gnet_conn_http_delete (GConnHttp *conn); Deletes a GConnHttp and frees all associated resources. conn : a GConnHttp <anchor id="gnet-http-get" role="function"/>gnet_http_get () gnet_http_getgboolean gnet_http_get (const gchar *url, gchar **buffer, gsize *length, guint *response); Convenience function that just retrieves the provided URI without the need to set up a full GConnHttp. Uses gnet_conn_http_run() internally. Caller (you) needs to free the buffer with g_free() when no longer needed. This function will run its own main loop in the default GLib main context, which means that if your application is based on Gtk+ or sets up GLib timeouts or idle callbacks, it is possible that those callback functions are invoked while you are waiting for gnet_http_get() to return. This means you shouldn't make assumptions about any state you set up before calling this function, because it might have been changed again from within a callback in the mean time (if this can happen or not depends on your callbacks and what they do of course). url : a URI, e.g. http://www.foo.com buffer : where to store a pointer to the data retrieved length : where to store the length of the data retrieved response : where to store the last HTTP response code received from the HTTP server, or NULL. Returns : TRUE if buffer, length and response are set, otherwise FALSE. gnet-2.0.8/doc/xml/ipv6.xml0000644000175000017500000001537010751404362012362 00000000000000 IPv6 3 GNET Library IPv6 IPv6 policy functions Synopsis #include <gnet.h> enum GIPv6Policy; void gnet_ipv6_set_policy (GIPv6Policy policy); GIPv6Policy gnet_ipv6_get_policy (void); Description The IPv6 module provides functions for setting and getting the "IPv6 policy". The IPv6 policy affects domain name resolution and server binding. The possible policies are: IPv4 only, IPv6 only, IPv4 then IPv6, and IPv6 then IPv4. GNet attempts to set the policy when gnet_init() is called based on two environment variables (if set) or on the host's interfaces. This can be overridden by calling gnet_ipv6_set_policy(). IPv6 policy affects domain name resolution. A domain name can be resolved to several addresses. Most programs will only use the first address in the list. The problem then is what order the addresses should be in. For example, if there are both IPv4 and IPv6 addresses in the list and the system cannot connect to IPv6 hosts then an IPv6 address should not be first in the list. Otherwise, the host will attempt to connect to it and fail. IPv6 policy determines the order of the list. If the policy is "IPv4 only", only IPv4 addresses will be returned. If the policy is "IPv6 then IPv4", IPv6 addresses will come before IPv4 addresses in the list. IPv6 policy also affects server binding. When a server socket is created, GNet binds to the "any" address by default. There are IPv4 and IPv6 "any" addresses. GNet needs to know which one to use. If the IPv6 policy allows IPv6, GNet will use the IPv6 "any" address. If the IPv6 policy allows only IPv4, GNet will use the IPv4 "any" address. GNet sets IPv6 policy in gnet_init(). First it checks two environment variables: GNET_IPV6_POLICY and IPV6_POLICY. If either is set, it uses the value to set IPv6 policy. Set the value to "4" for GIPV6_POLICY_IPV4_ONLY, "6" for GIPV6_POLICY_IPV6_ONLY, "46" for GIPV6_POLICY_IPV4_THEN_IPV6, or "64" for GIPV6_POLICY_IPV6_THEN_IPV4. If neither environment variable is set, GNet sets the policy based on the host's interfaces. If there are only IPv4 interfaces, the policy is set to GIPV6_POLICY_IPV4_ONLY. If there are only IPv6 interfaces, the policy is set to GIPV6_POLICY_IPV6_ONLY. If there are both, the policy is set to GIPV6_POLICY_IPV4_THEN_IPV6. At runtime on Windows, GNet will check to see the computer can support IPv6. If so it will set the policy to GIPV6_POLICY_IPV4_THEN_IPV6. If not it will set the policy to GIPV6_POLICY_IPV4_ONLY. Environment variables are not checked on Windows. Details <anchor id="GIPv6Policy" role="enum"/>enum GIPv6Policy GIPv6Policytypedef enum { GIPV6_POLICY_IPV4_THEN_IPV6, GIPV6_POLICY_IPV6_THEN_IPV4, GIPV6_POLICY_IPV4_ONLY, GIPV6_POLICY_IPV6_ONLY } GIPv6Policy; Policy for IPv6 use in GNet. This affects domain name resolution and server binding. gnet_init() attempts to set a reasonable default based on environment variables or the interfaces available on the host. GIPV6_POLICY_IPV4_THEN_IPV6 Use IPv4, then IPv6 GIPV6_POLICY_IPV6_THEN_IPV4 Use IPv6, then IPv4 GIPV6_POLICY_IPV4_ONLY Use IPv4 only GIPV6_POLICY_IPV6_ONLY Use IPv6 only <anchor id="gnet-ipv6-set-policy" role="function"/>gnet_ipv6_set_policy () gnet_ipv6_set_policyvoid gnet_ipv6_set_policy (GIPv6Policy policy); Sets the IPv6 policy. policy : IPv6 policy <anchor id="gnet-ipv6-get-policy" role="function"/>gnet_ipv6_get_policy () gnet_ipv6_get_policyGIPv6Policy gnet_ipv6_get_policy (void); Gets the IPv6 policy. Returns : IPv6 policy. gnet-2.0.8/doc/xml/iochannel.xml0000644000175000017500000003136110751404362013434 00000000000000 IOChannel 3 GNET Library IOChannel GIOChannel utility functions Synopsis #include <gnet.h> GIOError gnet_io_channel_writen (GIOChannel *channel, gpointer buffer, gsize length, gsize *bytes_writtenp); GIOError gnet_io_channel_readn (GIOChannel *channel, gpointer buffer, gsize length, gsize *bytes_readp); GIOError gnet_io_channel_readline (GIOChannel *channel, gchar *buffer, gsize length, gsize *bytes_readp); GIOError gnet_io_channel_readline_strdup (GIOChannel *channel, gchar **bufferp, gsize *bytes_readp); Description The IOChannel module provides utility functions for reading from and writing to GIOChannels. Details <anchor id="gnet-io-channel-writen" role="function"/>gnet_io_channel_writen () gnet_io_channel_writenGIOError gnet_io_channel_writen (GIOChannel *channel, gpointer buffer, gsize length, gsize *bytes_writtenp); Writes all length bytes in buffer to channel. If bytes_writtenp is set, the number of bytes written is stored in the integer it points to. bytes_writtenp will be less than length if the connection closed or an error occured. This function is essentially a wrapper around g_io_channel_write(). The problem with g_io_channel_write() is that it may not write all the bytes and will return a short count even when there was not an error. This is rare, but possible, and often difficult to detect when it does happen. channel : channel to write to buffer : buffer to read from length : length of buffer bytes_writtenp : pointer to integer in which to store the number of bytes written Returns : G_IO_ERROR_NONE if successful; something else otherwise. The number of bytes written is stored in the integer pointed to by bytes_writtenp. <anchor id="gnet-io-channel-readn" role="function"/>gnet_io_channel_readn () gnet_io_channel_readnGIOError gnet_io_channel_readn (GIOChannel *channel, gpointer buffer, gsize length, gsize *bytes_readp); Read exactly length bytes from channel into buffer. If bytes_readp is set, the number of bytes read is stored in the integer it points to. bytes_readp will be less than length if the end-of-file was reached or an error occured. This function is essentially a wrapper around g_io_channel_read(). The problem with g_io_channel_read() is that it may not read all the bytes requested and will return a short count even when there was not an error (this is rare, but it can happen and is often difficult to detect when it does). channel : channel to read from buffer : buffer to write to length : length of the buffer bytes_readp : pointer to integer for the function to store the number of of bytes read Returns : G_IO_ERROR_NONE if everything is ok; something else otherwise. Also, returns the number of bytes read by modifying the integer pointed to by bytes_readp. <anchor id="gnet-io-channel-readline" role="function"/>gnet_io_channel_readline () gnet_io_channel_readlineGIOError gnet_io_channel_readline (GIOChannel *channel, gchar *buffer, gsize length, gsize *bytes_readp); Read a line from the channel. The line will be NULL-terminated and include the newline character. If there is not enough room for the line, the line is truncated to fit in the buffer. Warnings: 1. If the buffer is full and the last character is not a newline, the line was truncated. Do not assume the buffer ends with a newline. 2. bytes_readp is the number of bytes put in the buffer. It includes the terminating NULL character. 3. NULL characters can appear in the line before the terminating NULL (e.g., "Hello world\0\n"). If this matters, check the string length of the buffer against the bytes read. I hope this isn't too confusing. Usually the function works as you expect it to if you have a big enough buffer. If you have the Stevens book, you should be familiar with the semantics. channel : channel to read from buffer : buffer to write to length : length of the buffer bytes_readp : pointer to integer in which to store the number of of bytes read Returns : G_IO_ERROR_NONE if everything is ok; something else otherwise. The number of bytes read is stored in the integer pointed to by bytes_readp (this number includes the newline). If an error is returned, the contents of buffer and bytes_readp are undefined. <anchor id="gnet-io-channel-readline-strdup" role="function"/>gnet_io_channel_readline_strdup () gnet_io_channel_readline_strdupGIOError gnet_io_channel_readline_strdup (GIOChannel *channel, gchar **bufferp, gsize *bytes_readp); Read a line from the channel. The line will be null-terminated and include the newline character. Similarly to g_strdup_printf, a buffer large enough to hold the string will be allocated. Warnings: 1. If the last character of the buffer is not a newline, the line was truncated by EOF. Do not assume the buffer ends with a newline. 2. bytes_readp is actually the number of bytes put in the buffer. It includes the terminating NULL character. 3. NULL characters can appear in the line before the terminating null (e.g., "Hello world\0\n"). If this matters, check the string length of the buffer against the bytes read. channel : channel to read from bufferp : pointer to gchar* in which to store the new buffer bytes_readp : pointer to integer in which to store the number of of bytes read Returns : G_IO_ERROR_NONE if everything is ok; something else otherwise. The number of bytes read is stored in the integer pointed to by bytes_readp (this number includes the newline). The data pointer is stored in the pointer pointed to by bufferp. This data is caller-owned. If an error is returned, the contents of bufferp and bytes_readp are undefined. gnet-2.0.8/doc/html/0000777000175000017500000000000010751404362011176 500000000000000gnet-2.0.8/doc/html/gnet-sha.html0000644000175000017500000004631710751404362013521 00000000000000 SHA

SHA

SHA — SHA hash

Synopsis


#include <gnet.h>


                    GSHA;
#define             GNET_SHA_HASH_LENGTH
GSHA*               gnet_sha_new                        (const gchar *buffer,
                                                         guint length);
GSHA*               gnet_sha_new_string                 (const gchar *str);
GSHA*               gnet_sha_clone                      (const GSHA *sha);
void                gnet_sha_delete                     (GSHA *sha);
GSHA*               gnet_sha_new_incremental            (void);
void                gnet_sha_update                     (GSHA *sha,
                                                         const gchar *buffer,
                                                         guint length);
void                gnet_sha_final                      (GSHA *sha);
gboolean            gnet_sha_equal                      (gconstpointer p1,
                                                         gconstpointer p2);
guint               gnet_sha_hash                       (gconstpointer p);
gchar*              gnet_sha_get_digest                 (const GSHA *sha);
gchar*              gnet_sha_get_string                 (const GSHA *sha);
void                gnet_sha_copy_string                (const GSHA *sha,
                                                         gchar *buffer);

Description

The SHA module provide support for computing and manipulating SHA hashes. SHA is a hash function with a very low probability of collision. SHA is considered stronger than MD5.

A SHA can be calculated at one time or incrementally. To create a SHA at one time, call gnet_sha_new() with the data. To create a SHA incrementally, call gnet_sha_new_incremental() to create the SHA object, then gnet_sha_update() one or more times with data to hash, and finally call gnet_sha_final().

To get the digest, or hash value, call gnet_sha_get_digest(). This returns the raw digest as an array of GNET_SHA_HASH_LENGTH bytes. To get the digest as a human-readable string, call gnet_sha_get_string() or gnet_sha_copy_string().

gchar buffer[] = "Hello world!";
gchar buffer2[] = "Second line";
GSHA*  sha;
gchar* sha_str;

/* Compute an SHA at one time */
sha = gnet_sha_new (buffer, strlen(buffer));

sha_str = gnet_sha_get_string (sha);
g_print ("The SHA of %s is %s\n", buffer, sha_str);

/* Use SHA... */

g_free (sha_str);
gnet_sha_delete (sha);

/* Compute an SHA incrementally */
sha = gnet_sha_new_incremental ();
gnet_sha_update (sha, buffer, strlen(buffer));
gnet_sha_update (sha, buffer2, strlen(buffer2));
gnet_sha_final (sha);

/* Use SHA... */

gnet_sha_delete (sha);

Details

GSHA

typedef struct _GSHA GSHA;

GSHA is a SHA hash.


GNET_SHA_HASH_LENGTH

#define GNET_SHA_HASH_LENGTH	20

Length of the SHA hash in bytes.


gnet_sha_new ()

GSHA*               gnet_sha_new                        (const gchar *buffer,
                                                         guint length);

Creates a GSHA from buffer.

buffer : buffer to hash
length : length of buffer
Returns : a new GSHA.

gnet_sha_new_string ()

GSHA*               gnet_sha_new_string                 (const gchar *str);

Createss a GSHA from str. str is a hexidecimal string representing the digest.

str : hexidecimal string
Returns : a new GSHA.

gnet_sha_clone ()

GSHA*               gnet_sha_clone                      (const GSHA *sha);

Copies a GSHA.

sha : a GSHA
Returns : a copy of sha.

gnet_sha_delete ()

void                gnet_sha_delete                     (GSHA *sha);

Deletes a GSHA.

sha : a GSHA

gnet_sha_new_incremental ()

GSHA*               gnet_sha_new_incremental            (void);

Creates a GSHA incrementally. After creating a GSHA, call gnet_sha_update() one or more times to hash data. Finally, call gnet_sha_final() to compute the final hash value.

Returns : a new GSHA.

gnet_sha_update ()

void                gnet_sha_update                     (GSHA *sha,
                                                         const gchar *buffer,
                                                         guint length);

Updates the hash with buffer. This may be called several times on a hash created by gnet_sha_new_incremental() before being finalized by calling gnet_sha_final().

sha : a GSHA
buffer : buffer to add
length : length of buffer

gnet_sha_final ()

void                gnet_sha_final                      (GSHA *sha);

Calcuates the final hash value of a GSHA. This should only be called on a GSHA created by gnet_sha_new_incremental().

sha : a GSHA

gnet_sha_equal ()

gboolean            gnet_sha_equal                      (gconstpointer p1,
                                                         gconstpointer p2);

Compares two GSHA's for equality.

p1 : a GSHA.
p2 : another GSHA.
Returns : TRUE if they are equal; FALSE otherwise.

gnet_sha_hash ()

guint               gnet_sha_hash                       (gconstpointer p);

Creates a hash code for a GMD5 for use with GHashTable. This hash value is not the same as the MD5 digest.

p : a GSHA
Returns : the hash code for p.

gnet_sha_get_digest ()

gchar*              gnet_sha_get_digest                 (const GSHA *sha);

Gets the raw SHA digest.

sha : a GSHA
Returns : a callee-owned buffer containing the SHA hash digest. The buffer is GNET_SHA_HASH_LENGTH bytes long.

gnet_sha_get_string ()

gchar*              gnet_sha_get_string                 (const GSHA *sha);

Get the digest represented a human-readable string.

sha : a GSHA
Returns : a hexadecimal string representing the digest. The string is 2 * GNET_SHA_HASH_LENGTH bytes long and NULL terminated. The string is caller owned.

gnet_sha_copy_string ()

void                gnet_sha_copy_string                (const GSHA *sha,
                                                         gchar *buffer);

Copies the digest, represented as a string, into buffer. The string is not NULL terminated.

sha : a GSHA
buffer : buffer at least 2 * GNET_SHA_HASH_LENGTH bytes long
gnet-2.0.8/doc/html/up.png0000644000175000017500000000062610751404362012250 00000000000000PNG  IHDRw=bKGD pHYs  ~tIME2.E#IDATx=J@Fo] !+2[Z<@/9|t$D9nnBjBRIsI:H8UPN1fcsN95M㧖ɵ 束1~pEe$I 7nrDf!;`'ykI䲤sI_]y^^I>O>?YBIENDB`gnet-2.0.8/doc/html/gnet-pack.html0000644000175000017500000004550010751404362013655 00000000000000 Pack

Pack

Pack — Byte packing and unpacking functions

Synopsis


#include <gnet.h>


gint                gnet_pack                           (const gchar *format,
                                                         gchar *buffer,
                                                         const gint length,
                                                         ...);
gint                gnet_pack_strdup                    (const gchar *format,
                                                         gchar **bufferp,
                                                         ...);
gint                gnet_vpack                          (const gchar *format,
                                                         gchar *buffer,
                                                         const gint length,
                                                         va_list args);
gint                gnet_calcsize                       (const gchar *format,
                                                         ...);
gint                gnet_vcalcsize                      (const gchar *format,
                                                         va_list args);
gint                gnet_unpack                         (const gchar *format,
                                                         const gchar *buffer,
                                                         gint length,
                                                         ...);
gint                gnet_vunpack                        (const gchar *format,
                                                         const gchar *buffer,
                                                         gint length,
                                                         va_list args);

Description

The pack module provides functions for converting data into bytes ("packing") and converting bytes to data ("unpacking"). For example, two integers and a string may be packed into a buffer to be transfered over the network. These functions are similar to the ones in Python and Perl.

Details

gnet_pack ()

gint                gnet_pack                           (const gchar *format,
                                                         gchar *buffer,
                                                         const gint length,
                                                         ...);

Writes Varargs to buffer. format is a string that describes the Varargs and how they are to be packed. This string is a list of characters, each describing the type of an argument in Varargs.

An example:

 char buf[5];
 int myint = 42;
 int mybyte = 23;
  
 gnet_pack("!ib", buf, sizeof(buf), myint, mybyte);
 /* Now buf is { 42, 0, 0, 0, 23 }; */
 

As a shortcut, most types can be prefixed by an integer to specify how many times the type is repeated. For example, "4i2b" is equivalent to "iiiibb". This repeat argument is refered below to as REPEAT.

Native byte order and sizes are used by default. If the first character of format is < then little endian order and standard sizes are used. If the first character is > or !, then big endian (or network) order and standard size are used. Standard sizes are 1 byte for chars, 2 bytes for shorts, and 4 bytes for ints and longs.

The types:

x is a NULL character. It can be used for padding. It does not correspond to an argument in Varargs.

b/B is a signed/unsigned char.

h/H is a signed/unsigned short.

i/I is a signed/unsigned int.

l/L is a signed/unsigned long.

f/D is a float/double (always native order/size).

v is a void pointer (always native size).

s is a zero-terminated string.

S is a zero-padded string of maximum length REPEAT. We write up-to a NULL character or REPEAT characters, whichever comes first. We then write NULL characters up to a total of REPEAT characters. Special case: if REPEAT is not specified, we write the string as a non-NULL-terminated string (note that it can't be unpacked easily then).

r is a byte array of NEXT bytes. NEXT is the next argument passed to gnet_pack() and is a gint.

R is a byte array of REPEAT bytes. REPEAT must be specified.

p is a Pascal string. The string passed is a NULL-termiated string of less than 256 character. The string writen is a non-NULL-terminated string with a byte before the string storing the string length. REPEAT is repeat.

Mnemonics: (B)yte, s(H)ort, (I)nteger, (F)loat, (D)ouble, (V)oid pointer, (S)tring, (R)aw

Pack was inspired by Python's and Perl's pack. It is more like Python's than Perl's. Note that in GNet, a repeat of 0 does not align the data (as in Python).

format : pack data format
buffer : buffer to pack to
length : length of buffer
... : variables to pack from
Returns : number of bytes packed; -1 on error.

gnet_pack_strdup ()

gint                gnet_pack_strdup                    (const gchar *format,
                                                         gchar **bufferp,
                                                         ...);

Writes Varargs into a buffer pointed to by bufferp. The buffer is allocated by the function and is caller owned. See gnet_pack() for more information.

format : pack data format
bufferp : pointer to a buffer (buffer is caller owned)
... : variables to pack from
Returns : bytes packed; -1 on error.

gnet_vpack ()

gint                gnet_vpack                          (const gchar *format,
                                                         gchar *buffer,
                                                         const gint length,
                                                         va_list args);

Var arg interface to gnet_pack(). See gnet_pack() for more information.

format : pack data format
buffer : buffer to pack to
length : length of buffer
args : var args
Returns : bytes packed; -1 on error.

gnet_calcsize ()

gint                gnet_calcsize                       (const gchar *format,
                                                         ...);

Calculates the size of the buffer needed to pack Varargs by the given format. See gnet_pack() for more information.

format : pack data format
... : variables
Returns : number of bytes required to pack; -1 on error.

gnet_vcalcsize ()

gint                gnet_vcalcsize                      (const gchar *format,
                                                         va_list args);

Var arg interface to gnet_calcsize(). See gnet_calcsize() for additional information.

format : pack data format
args : var args
Returns : number of bytes required to pack; -1 on error.

gnet_unpack ()

gint                gnet_unpack                         (const gchar *format,
                                                         const gchar *buffer,
                                                         gint length,
                                                         ...);

Reads the data in buffer into Varargs. format is a string that describes the Varargs and how they are to be packed. This string is a list of characters, each describing the type of an argument in Varargs.

An example:

 char buf[5] = { 42, 0, 0, 0, 23 };
 int myint;
 int mybyte;
  
 gnet_unpack("!ib", buf, sizeof(buf), &myint, &mybyte);
 /* Now myint is 42 and mybyte is 23 */
 

In unpack, the arguments must be pointers to the appropriate type. Strings and byte arrays are allocated dynamicly (by g_new()). The caller is responsible for g_free()-ing it.

As a shortcut, most types can be prefixed by an integer to specify how many times the type is repeated. For example, "4i2b" is equivalent to "iiiibb". This repeat argument is refered below to as REPEAT.

The types:

x is a pad byte. The byte is skipped and not stored. We do not check its value.

b/B is a signed/unsigned char.

h/H is a signed/unsigned short.

i/I is a signed/unsigned int.

l/L is a signed/unsigned long.

f/D is a float/double (always native order/size). v is a void pointer (always native size).

s is a zero-terminated string.

S is a zero-padded string of length REPEAT. We read REPEAT characters or until a NULL character. Any remaining characters are filled in with 0's. REPEAT must be specified.

r is a byte array of NEXT bytes. NEXT is the next argument and is a gint. REPEAT is repeat.

R is a byte array of REPEAT bytes. REPEAT must be specified.

p is a Pascal string. The first byte read is the length of the string and the string follows. The unpacked string will be a normal, NULL-terminated string. REPEAT is repeat.

format : unpack data format
buffer : buffer to unpack from
length : length of buffer
... : addresses of variables to unpack to
Returns : number of bytes unpacked; -1 on error. The bytes are unpacked to the variables pointed to by the Varargs.

gnet_vunpack ()

gint                gnet_vunpack                        (const gchar *format,
                                                         const gchar *buffer,
                                                         gint length,
                                                         va_list args);

Var arg interface to gnet_unpack(). See gnet_unpack() for more information.

format : unpack data format
buffer : buffer to unpack from
length : length of buffer
args : var args
Returns : number of bytes packed; -1 on error.
gnet-2.0.8/doc/html/gnet-mcast.html0000644000175000017500000007543310751404362014056 00000000000000 Mcast

Mcast

Mcast — IP Multicast socket

Synopsis


#include <gnet.h>


                    GMcastSocket;
GMcastSocket*       gnet_mcast_socket_new               (void);
GMcastSocket*       gnet_mcast_socket_new_with_port     (gint port);
GMcastSocket*       gnet_mcast_socket_new_full          (const GInetAddr *iface,
                                                         gint port);
void                gnet_mcast_socket_delete            (GMcastSocket *socket);
void                gnet_mcast_socket_ref               (GMcastSocket *socket);
void                gnet_mcast_socket_unref             (GMcastSocket *socket);
GIOChannel*         gnet_mcast_socket_get_io_channel    (GMcastSocket *socket);
GInetAddr*          gnet_mcast_socket_get_local_inetaddr
                                                        (const GMcastSocket *socket);
gint                gnet_mcast_socket_join_group        (GMcastSocket *socket,
                                                         const GInetAddr *inetaddr);
gint                gnet_mcast_socket_leave_group       (GMcastSocket *socket,
                                                         const GInetAddr *inetaddr);
gint                gnet_mcast_socket_get_ttl           (const GMcastSocket *socket);
gint                gnet_mcast_socket_set_ttl           (GMcastSocket *socket,
                                                         gint ttl);
gint                gnet_mcast_socket_send              (GMcastSocket *socket,
                                                         const gchar *buffer,
                                                         gint length,
                                                         const GInetAddr *dst);
gint                gnet_mcast_socket_receive           (GMcastSocket *socket,
                                                         gchar *buffer,
                                                         gint length,
                                                         GInetAddr **src);
gboolean            gnet_mcast_socket_has_packet        (const GMcastSocket *socket);
gint                gnet_mcast_socket_is_loopback       (const GMcastSocket *socket);
gint                gnet_mcast_socket_set_loopback      (GMcastSocket *socket,
                                                         gboolean enable);
#define             gnet_mcast_socket_to_udp_socket     (MS)

Description

The Mcast module provides support for IP Multicast sockets. IP Multicast allows you to send one packet to many receivers at once. Unfortunately, IP Multicast is not widely available. IP Multicast is built on UDP.

An IP Multicast socket is represented by a GMcastSocket stucture. To create a GMcastSocket, call gnet_mcast_socket_new(), gnet_mcast_socket_new_with_port(), or gnet_mcast_socket_new_full(). Then call gnet_mcast_socket_join_group() to join a multicast group. To leave the group, call gnet_mcast_socket_leave_group().

Use gnet_mcast_socket_set_loopback() to set whether packets sent by the host will also be received by the host. Applications typically disable loopback.

Details

GMcastSocket

typedef struct _GMcastSocket GMcastSocket;

A GMcastSocket structure represents a IP Multicast socket. The implementation is hidden. A GMcastSocket is child of GUdpSocket. Use gnet_mcast_socket_to_udp_socket() to safely cast a GMcastSocket to a GUdpSocket.


gnet_mcast_socket_new ()

GMcastSocket*       gnet_mcast_socket_new               (void);

Creates a GMcastSocket bound to all interfaces and an arbitrary port.

Returns : a new GMcastSocket; NULL on error.

gnet_mcast_socket_new_with_port ()

GMcastSocket*       gnet_mcast_socket_new_with_port     (gint port);

Creates a GMcastSocket bound to all interfaces and port port. If port is 0, an arbitrary port will be used. Use this constructor if you know the port of the group you will join. Most applications will use this constructor.

port : port to bind to
Returns : a new GMcastSocket; NULL on error.

gnet_mcast_socket_new_full ()

GMcastSocket*       gnet_mcast_socket_new_full          (const GInetAddr *iface,
                                                         gint port);

Creates a GMcastSocket bound to interface iface and port port. If iface is NULL, all interfaces will be used. If port is 0, an arbitrary port will be used. To receive packets from this group, call gnet_mcast_socket_join_group() next. Loopback is disabled by default.

iface : interface to bind to (NULL for all interfaces)
port : port to bind to (0 for an arbitrary port)
Returns : a new GMcastSocket; NULL on error.

gnet_mcast_socket_delete ()

void                gnet_mcast_socket_delete            (GMcastSocket *socket);

Deletes a GMcastSocket. Does nothing if socket is NULL.

socket : a GMcastSocket, or NULL

gnet_mcast_socket_ref ()

void                gnet_mcast_socket_ref               (GMcastSocket *socket);

Adds a reference to a GMcastSocket.

socket : a GMcastSocket

gnet_mcast_socket_unref ()

void                gnet_mcast_socket_unref             (GMcastSocket *socket);

Removes a reference from a GMcastSocket. A GMcastSocket is deleted when the reference count reaches 0.

socket : a GMcastSocket

gnet_mcast_socket_get_io_channel ()

GIOChannel*         gnet_mcast_socket_get_io_channel    (GMcastSocket *socket);

Gets the GIOChannel of a GMcastSocket.

Use the channel with g_io_add_watch() to check if the socket is readable or writable. If the channel is readable, call gnet_mcast_socket_receive() to receive a packet. If the channel is writable, call gnet_mcast_socket_send() to send a packet. This is not a normal giochannel - do not read from or write to it.

Every GMcastSocket has one and only one GIOChannel. If you ref the channel, then you must unref it eventually. Do not close the channel. The channel is closed by GNet when the socket is deleted.

socket : a GMcastSocket
Returns : a GIOChannel.

gnet_mcast_socket_get_local_inetaddr ()

GInetAddr*          gnet_mcast_socket_get_local_inetaddr
                                                        (const GMcastSocket *socket);

Gets the local host's address from a GMcastSocket.

socket : a GMcastSocket
Returns : a GInetAddr.

gnet_mcast_socket_join_group ()

gint                gnet_mcast_socket_join_group        (GMcastSocket *socket,
                                                         const GInetAddr *inetaddr);

Joins a multicast group. Join only one group per socket.

socket : a GMcastSocket
inetaddr : address of the group
Returns : 0 on success.

gnet_mcast_socket_leave_group ()

gint                gnet_mcast_socket_leave_group       (GMcastSocket *socket,
                                                         const GInetAddr *inetaddr);

Leaves a mulitcast group.

socket : a GMcastSocket
inetaddr : address of the group
Returns : 0 on success.

gnet_mcast_socket_get_ttl ()

gint                gnet_mcast_socket_get_ttl           (const GMcastSocket *socket);

Gets the multicast time-to-live (TTL) of a GMcastSocket. All IP multicast packets have a TTL field. This field is decremented by a router before it forwards the packet. If the TTL reaches zero, the packet is discarded. The default value is sufficient for most applications.

The table below shows the scope for a given TTL. The scope is only an estimate.

Table 1. TTL and scope

TTL Scope
0 node local
1 link local
2-32 site local
33-64 region local
65-128 continent local
129-255 unrestricted (global)


socket : a GMcastSocket
Returns : the TTL (an integer between 0 and 255), -1 if the kernel default is being used, or an integer less than -1 on error.

gnet_mcast_socket_set_ttl ()

gint                gnet_mcast_socket_set_ttl           (GMcastSocket *socket,
                                                         gint ttl);

Sets the time-to-live (TTL) default of a GMcastSocket. Set the TTL to -1 to use the kernel default. The default value is sufficient for most applications.

socket : a GMcastSocket
ttl : value to set TTL to
Returns : 0 if successful.

gnet_mcast_socket_send ()

gint                gnet_mcast_socket_send              (GMcastSocket *socket,
                                                         const gchar *buffer,
                                                         gint length,
                                                         const GInetAddr *dst);

Sends data to a host using a GMcastSocket.

socket : a GMcastSocket
buffer : buffer to send
length : length of buffer
dst : destination address
Returns : 0 if successful.

gnet_mcast_socket_receive ()

gint                gnet_mcast_socket_receive           (GMcastSocket *socket,
                                                         gchar *buffer,
                                                         gint length,
                                                         GInetAddr **src);

Receives data using a GMcastSocket. If src is set, the source address is stored in the location src points to. The address is caller owned.

socket : a GMcastSocket
buffer : buffer to write to
length : length of buffer
src : pointer to source address (optional)
Returns : the number of bytes received, -1 if unsuccessful.

gnet_mcast_socket_has_packet ()

gboolean            gnet_mcast_socket_has_packet        (const GMcastSocket *socket);

Tests if a GMcastSocket has a packet waiting to be received.

socket : a GMcastSocket
Returns : TRUE if there is packet waiting, FALSE otherwise.

gnet_mcast_socket_is_loopback ()

gint                gnet_mcast_socket_is_loopback       (const GMcastSocket *socket);

Checks if a GMcastSocket has loopback enabled. If loopback is enabled, all packets sent by the host will also be received by the host. Loopback is disabled by default.

socket : a GMcastSocket
Returns : 0 if loopback is disabled, 1 if enabled, and -1 on error.

gnet_mcast_socket_set_loopback ()

gint                gnet_mcast_socket_set_loopback      (GMcastSocket *socket,
                                                         gboolean enable);

Enables (or disables) loopback on a GMcastSocket. Loopback is disabled by default.

socket : a GMcastSocket
enable : should loopback be enabled?
Returns : 0 if successful.

gnet_mcast_socket_to_udp_socket()

#define gnet_mcast_socket_to_udp_socket(MS) ((GUdpSocket*) (MS))

Converts a GMcastSocket to a GUdpSocket. A GMcastSocket is a child of GUdpSocket.

MS : a GMcastSocket
gnet-2.0.8/doc/html/gnet.devhelp20000644000175000017500000007411110751404362013506 00000000000000 gnet-2.0.8/doc/html/gnet-server.html0000644000175000017500000003077310751404362014253 00000000000000 Server

Server

Server — TCP server object

Synopsis


#include <gnet.h>


                    GServer;
void                (*GServerFunc)                      (GServer *server,
                                                         GConn *conn,
                                                         gpointer user_data);
GServer*            gnet_server_new                     (const GInetAddr *iface,
                                                         gint port,
                                                         GServerFunc func,
                                                         gpointer user_data);
void                gnet_server_delete                  (GServer *server);
void                gnet_server_ref                     (GServer *server);
void                gnet_server_unref                   (GServer *server);

Description

A GServer represents a TCP server. GServer is a thin wrapper around a TCP server socket. To create a new GServer, call gnet_server_new(). One of the arguments is a callback function that is called with a new GConn whenever a new client connects. Remember to call gnet_conn_set_callback() on the new GConn to set the GConn callback. To delete a GServer, call gnet_server_delete().

See also GConn and the echoserver-gserver example.

Details

GServer

typedef struct {
  GInetAddr* 	iface;
  gint		port;

  GTcpSocket* 	socket;

  guint 	ref_count;

  GServerFunc	func;
  gpointer	user_data;
} GServer;

GServer is a high-level interface to a TCP server socket. The callback is called with a GConn whenever a new connection is made.

GInetAddr *iface; interface address
gint port; port number
GTcpSocket *socket; TCP server socket
guint ref_count; [private]
GServerFunc func; callback function
gpointer user_data; user data for callback

GServerFunc ()

void                (*GServerFunc)                      (GServer *server,
                                                         GConn *conn,
                                                         gpointer user_data);

Callback for gnet_server_new(). When a client connects, this callback is called with a new connection. If the server fails, this callback is called with conn set to NULL. The callback is not called again.

If conn is non-NULL, the address (IP, port) of the client that established the connection can be found in the inetaddr member of the GConn structure.

server : server
conn : new connection (or NULL if error)
user_data : user data specified in gnet_server_new()

gnet_server_new ()

GServer*            gnet_server_new                     (const GInetAddr *iface,
                                                         gint port,
                                                         GServerFunc func,
                                                         gpointer user_data);

Creates a new GServer object representing a server. Usually, iface is set to NULL to bind to all interfaces and port is a specific number. The callback is called whenever a new connection arrives or if there is a server error. The callback is not called again after a server error.

iface : interface to bind to (NULL for all interfaces)
port : port to bind to (0 for an arbitrary port)
func : callback to call when a connection is accepted
user_data : data to pass to callback
Returns : a new GServer.

gnet_server_delete ()

void                gnet_server_delete                  (GServer *server);

Closes and deletes a GServer.

server : GServer to delete.

gnet_server_ref ()

void                gnet_server_ref                     (GServer *server);

Adds a reference to a GServer.

server : a GServer

gnet_server_unref ()

void                gnet_server_unref                   (GServer *server);

Removes a reference from a GServer. A GServer is deleted when the reference count reaches 0.

server : a GServer
gnet-2.0.8/doc/html/gnet-inetaddr.html0000644000175000017500000024103310751404362014530 00000000000000 InetAddr

InetAddr

InetAddr — Internet Address

Synopsis


#include <gnet.h>


                    GInetAddr;
GInetAddr*          gnet_inetaddr_new                   (const gchar *hostname,
                                                         gint port);
typedef             GInetAddrNewAsyncID;
void                (*GInetAddrNewAsyncFunc)            (GInetAddr *inetaddr,
                                                         gpointer data);
GInetAddrNewAsyncID gnet_inetaddr_new_async             (const gchar *hostname,
                                                         gint port,
                                                         GInetAddrNewAsyncFunc func,
                                                         gpointer data);
GInetAddrNewAsyncID gnet_inetaddr_new_async_full        (const gchar *hostname,
                                                         gint port,
                                                         GInetAddrNewAsyncFunc func,
                                                         gpointer data,
                                                         GDestroyNotify notify,
                                                         GMainContext *context,
                                                         gint priority);
void                gnet_inetaddr_new_async_cancel      (GInetAddrNewAsyncID id);
GList*              gnet_inetaddr_new_list              (const gchar *hostname,
                                                         gint port);
void                gnet_inetaddr_delete_list           (GList *list);
typedef             GInetAddrNewListAsyncID;
void                (*GInetAddrNewListAsyncFunc)        (GList *list,
                                                         gpointer data);
GInetAddrNewListAsyncID gnet_inetaddr_new_list_async    (const gchar *hostname,
                                                         gint port,
                                                         GInetAddrNewListAsyncFunc func,
                                                         gpointer data);
GInetAddrNewListAsyncID gnet_inetaddr_new_list_async_full
                                                        (const gchar *hostname,
                                                         gint port,
                                                         GInetAddrNewListAsyncFunc func,
                                                         gpointer data,
                                                         GDestroyNotify notify,
                                                         GMainContext *context,
                                                         gint priority);
void                gnet_inetaddr_new_list_async_cancel (GInetAddrNewListAsyncID id);
GInetAddr*          gnet_inetaddr_new_nonblock          (const gchar *hostname,
                                                         gint port);
GInetAddr*          gnet_inetaddr_new_bytes             (const gchar *bytes,
                                                         const guint length);
GInetAddr*          gnet_inetaddr_clone                 (const GInetAddr *inetaddr);
void                gnet_inetaddr_delete                (GInetAddr *inetaddr);
void                gnet_inetaddr_ref                   (GInetAddr *inetaddr);
void                gnet_inetaddr_unref                 (GInetAddr *inetaddr);
gchar*              gnet_inetaddr_get_name              (GInetAddr *inetaddr);
gchar*              gnet_inetaddr_get_name_nonblock     (GInetAddr *inetaddr);
typedef             GInetAddrGetNameAsyncID;
void                (*GInetAddrGetNameAsyncFunc)        (gchar *hostname,
                                                         gpointer data);
GInetAddrGetNameAsyncID gnet_inetaddr_get_name_async    (GInetAddr *inetaddr,
                                                         GInetAddrGetNameAsyncFunc func,
                                                         gpointer data);
GInetAddrGetNameAsyncID gnet_inetaddr_get_name_async_full
                                                        (GInetAddr *inetaddr,
                                                         GInetAddrGetNameAsyncFunc func,
                                                         gpointer data,
                                                         GDestroyNotify notify,
                                                         GMainContext *context,
                                                         gint priority);
void                gnet_inetaddr_get_name_async_cancel (GInetAddrGetNameAsyncID id);
#define             GNET_INETADDR_MAX_LEN
gint                gnet_inetaddr_get_length            (const GInetAddr *inetaddr);
void                gnet_inetaddr_get_bytes             (const GInetAddr *inetaddr,
                                                         gchar *buffer);
void                gnet_inetaddr_set_bytes             (GInetAddr *inetaddr,
                                                         const gchar *bytes,
                                                         gint length);
gchar*              gnet_inetaddr_get_canonical_name    (const GInetAddr *inetaddr);
gint                gnet_inetaddr_get_port              (const GInetAddr *inetaddr);
void                gnet_inetaddr_set_port              (const GInetAddr *inetaddr,
                                                         gint port);
gboolean            gnet_inetaddr_is_canonical          (const gchar *hostname);
gboolean            gnet_inetaddr_is_internet           (const GInetAddr *inetaddr);
gboolean            gnet_inetaddr_is_private            (const GInetAddr *inetaddr);
gboolean            gnet_inetaddr_is_reserved           (const GInetAddr *inetaddr);
gboolean            gnet_inetaddr_is_loopback           (const GInetAddr *inetaddr);
gboolean            gnet_inetaddr_is_multicast          (const GInetAddr *inetaddr);
gboolean            gnet_inetaddr_is_broadcast          (const GInetAddr *inetaddr);
gboolean            gnet_inetaddr_is_ipv4               (const GInetAddr *inetaddr);
gboolean            gnet_inetaddr_is_ipv6               (const GInetAddr *inetaddr);
guint               gnet_inetaddr_hash                  (gconstpointer p);
gboolean            gnet_inetaddr_equal                 (gconstpointer p1,
                                                         gconstpointer p2);
gboolean            gnet_inetaddr_noport_equal          (gconstpointer p1,
                                                         gconstpointer p2);
gchar*              gnet_inetaddr_get_host_name         (void);
GInetAddr*          gnet_inetaddr_get_host_addr         (void);
GInetAddr*          gnet_inetaddr_autodetect_internet_interface
                                                        (void);
GInetAddr*          gnet_inetaddr_get_interface_to      (const GInetAddr *inetaddr);
GInetAddr*          gnet_inetaddr_get_internet_interface
                                                        (void);
gboolean            gnet_inetaddr_is_internet_domainname
                                                        (const gchar *name);
GList*              gnet_inetaddr_list_interfaces       (void);

Description

A GInetAddr represents an internet address. This module provides functions for making DNS and reverse DNS lookups (blocking and asynchronously) and for working with GInetAddr's.

Create a GInetAddr by calling gnet_inetaddr_new(). This function will perform a DNS lookup and creates a GInetAddr representing the address. This function blocks. The function gnet_inetaddr_new_async() performs the lookup asynchronously and calls a callback with the GInetAddr when the lookup completes. An asynchronous lookup can be canceled by calling gnet_inetaddr_new_async_cancel().

Technically a DNS lookup can map a name to several addresses. Use gnet_inetaddr_new_list() or gnet_inetaddr_new_list_async() to get this list. Use gnet_inetaddr_delete_list() to delete the list.

This module can also make reverse DNS lookups (i.e., map an address to a hostname). Call gnet_inetaddr_get_name() to get the hostname from an address. This function blocks. Its asynchronous counterpart is gnet_inetadr_get_name_async(). To get the canonical name, or dotted decimal address, call gnet_inetaddr_get_canonical_name().

To get the host's address, call gnet_inetaddr_gethostaddr(). This creates a GInetAddr by performing a DNS lookup on the host's name. To get the list of all the host's interfaces, call gnet_inetaddr_list_interfaces(). The function gnet_inetaddr_autodetect_internet_interface() uses this function and heuristics to find an interface connected to the internet. This can be used to automatically configure peer-to-peer applications.

Details

GInetAddr

typedef struct _GInetAddr GInetAddr;

GInetAddr is an internet address.


gnet_inetaddr_new ()

GInetAddr*          gnet_inetaddr_new                   (const gchar *hostname,
                                                         gint port);

Creates a GInetAddr from a host name and port. This function makes a DNS lookup on the host name so it may block. The host name may resolve to multiple addresses. If this occurs, the first address in the list is returned. Use gnet_inetaddr_new_list() to get the complete list.

hostname : host name
port : port number (0 if the port doesn't matter)
Returns : a new GInetAddr; NULL on error.

GInetAddrNewAsyncID

typedef struct _GInetAddrNewState * GInetAddrNewAsyncID;

ID of an asynchronous GInetAddr creation/lookup started with gnet_inetaddr_new_async(). The creation can be canceled by calling gnet_inetaddr_new_async_cancel() with the ID.


GInetAddrNewAsyncFunc ()

void                (*GInetAddrNewAsyncFunc)            (GInetAddr *inetaddr,
                                                         gpointer data);

Callback for gnet_inetaddr_new_async(). Callee owns the address. The address will be NULL if the lookup failed.

inetaddr : InetAddr that was looked up (callee owned)
data : User data

gnet_inetaddr_new_async ()

GInetAddrNewAsyncID gnet_inetaddr_new_async             (const gchar *hostname,
                                                         gint port,
                                                         GInetAddrNewAsyncFunc func,
                                                         gpointer data);

Asynchronously creates a GInetAddr from a host name and port. The callback is called once the GInetAddr is created or an error occurs during lookup. The callback will not be called during the call to this function.

See gnet_inetaddr_new_list_async() for implementation notes.

hostname : host name
port : port number (0 if the port doesn't matter)
func : callback function
data : data to pass to func on the callback
Returns : the ID of the lookup; NULL on failure. The ID can be used with gnet_inetaddr_new_async_cancel() to cancel the lookup.

gnet_inetaddr_new_async_full ()

GInetAddrNewAsyncID gnet_inetaddr_new_async_full        (const gchar *hostname,
                                                         gint port,
                                                         GInetAddrNewAsyncFunc func,
                                                         gpointer data,
                                                         GDestroyNotify notify,
                                                         GMainContext *context,
                                                         gint priority);

Asynchronously creates a GInetAddr from a host name and port. The callback is called once the GInetAddr is created or an error occurs during lookup. The callback will not be called during the call to this function.

See gnet_inetaddr_new_list_async() for implementation notes.

hostname : host name
port : port number (0 if the port doesn't matter)
func : callback function
data : data to pass to func on the callback, or NULL
notify : function to call to free data, or NULL
context : the GMainContext to use for notifications, or NULL for the default GLib main context. If in doubt, pass NULL.
priority : the priority with which to schedule notifications in the main context, e.g. G_PRIORITY_DEFAULT or G_PRIORITY_HIGH.
Returns : the ID of the lookup; NULL on failure. The ID can be used with gnet_inetaddr_new_async_cancel() to cancel the lookup.

Since 2.0.8


gnet_inetaddr_new_async_cancel ()

void                gnet_inetaddr_new_async_cancel      (GInetAddrNewAsyncID id);

Cancels an asynchronous GInetAddr creation that was started with gnet_inetaddr_new_async().

id : ID of the lookup

gnet_inetaddr_new_list ()

GList*              gnet_inetaddr_new_list              (const gchar *hostname,
                                                         gint port);

Creates a GList of GInetAddr's from a host name and port. This function makes a DNS lookup on the host name so it may block.

hostname : host name
port : port number (0 if the port doesn't matter)
Returns : a GList of GInetAddr structures or NULL on error.

gnet_inetaddr_delete_list ()

void                gnet_inetaddr_delete_list           (GList *list);

Deletes a GList of GInetAddr's.

list : GList of GInetAddr's

GInetAddrNewListAsyncID

typedef struct _GInetAddrNewListState * GInetAddrNewListAsyncID;

ID of an asynchronous GInetAddr list creation/lookup started with gnet_inetaddr_new_list_async(). The creation can be canceled by calling gnet_inetaddr_new_list_async_cancel() with the ID.


GInetAddrNewListAsyncFunc ()

void                (*GInetAddrNewListAsyncFunc)        (GList *list,
                                                         gpointer data);

Callback for gnet_inetaddr_new_list_async(). Callee owns the list of GInetAddrs. The list is NULL if the lookup failed.

list : List of GInetAddr's (callee owned)
data : User data

gnet_inetaddr_new_list_async ()

GInetAddrNewListAsyncID gnet_inetaddr_new_list_async    (const gchar *hostname,
                                                         gint port,
                                                         GInetAddrNewListAsyncFunc func,
                                                         gpointer data);

Asynchronously creates a GList of GInetAddr's from a host name and port. The callback is called once the list is created or an error occurs during lookup. The callback will not be called during the call to gnet_inetaddr_new_list_async(). The list passed in the callback is callee owned (meaning that it is your responsibility to free the list and each GInetAddr in the list).

If you need to lookup hundreds of addresses, we recommend calling g_main_iteration(FALSE) between calls. This will help prevent an explosion of threads.

If you need a more robust library for Unix, look at GNU ADNS. GNU ADNS is under the GNU GPL. This library does not use threads or processes.

The Windows version is molded after the Unix GThread version.

hostname : host name
port : port number (0 if the port doesn't matter)
func : callback function
data : data to pass to func on the callback
Returns : the ID of the lookup; NULL on failure. The ID can be used with gnet_inetaddr_new_list_async_cancel() to cancel the lookup.

gnet_inetaddr_new_list_async_full ()

GInetAddrNewListAsyncID gnet_inetaddr_new_list_async_full
                                                        (const gchar *hostname,
                                                         gint port,
                                                         GInetAddrNewListAsyncFunc func,
                                                         gpointer data,
                                                         GDestroyNotify notify,
                                                         GMainContext *context,
                                                         gint priority);

Asynchronously creates a GList of GInetAddr's from a host name and port. The callback is called once the list is created or an error occurs during lookup. The callback will not be called during the call to gnet_inetaddr_new_list_async(). The list passed in the callback is callee owned (meaning that it is your responsibility to free the list and each GInetAddr in the list).

If you need to lookup hundreds of addresses, we recommend calling g_main_iteration(FALSE) between calls. This will help prevent an explosion of threads.

If you need a more robust library for Unix, look at GNU ADNS. GNU ADNS is under the GNU GPL. This library does not use threads or processes.

The Windows version is molded after the Unix GThread version.

hostname : host name
port : port number (0 if the port doesn't matter)
func : callback function
data : data to pass to func on the callback, or NULL
notify : function to call to free data, or NULL
context : the GMainContext to use for notifications, or NULL for the default GLib main context. If in doubt, pass NULL.
priority : the priority with which to schedule notifications in the main context, e.g. G_PRIORITY_DEFAULT or G_PRIORITY_HIGH.
Returns : the ID of the lookup; NULL on failure. The ID can be used with gnet_inetaddr_new_list_async_cancel() to cancel the lookup.

Since 2.0.8


gnet_inetaddr_new_list_async_cancel ()

void                gnet_inetaddr_new_list_async_cancel (GInetAddrNewListAsyncID id);

Cancels an asynchronous GInetAddr list creation that was started with gnet_inetaddr_new_list_async().

id : ID of the lookup

gnet_inetaddr_new_nonblock ()

GInetAddr*          gnet_inetaddr_new_nonblock          (const gchar *hostname,
                                                         gint port);

Creates a GInetAddr from a host name and port without blocking. This function does not make a DNS lookup and will fail if creating the address would require a DNS lookup.

hostname : host name
port : port number (0 if the port doesn't matter)
Returns : a new GInetAddr, or NULL if there was a failure or the function would block.

gnet_inetaddr_new_bytes ()

GInetAddr*          gnet_inetaddr_new_bytes             (const gchar *bytes,
                                                         const guint length);

Creates a GInetAddr from raw bytes. The bytes should be in network byte order (big endian). There should be 4 bytes if it's an IPv4 address and 16 bytees if it's an IPv6 address. The port is set to 0.

bytes : address in raw bytes
length : length of bytes (4 if IPv4, 16 if IPv6)
Returns : a new GInetAddr, or NULL if there was a failure.

gnet_inetaddr_clone ()

GInetAddr*          gnet_inetaddr_clone                 (const GInetAddr *inetaddr);

Copies a GInetAddr.

inetaddr : a GInetAddr
Returns : a copy of inetaddr.

gnet_inetaddr_delete ()

void                gnet_inetaddr_delete                (GInetAddr *inetaddr);

Deletes a GInetAddr.

inetaddr : a GInetAddr

gnet_inetaddr_ref ()

void                gnet_inetaddr_ref                   (GInetAddr *inetaddr);

Adds a reference to a GInetAddr.

inetaddr : a GInetAddr

gnet_inetaddr_unref ()

void                gnet_inetaddr_unref                 (GInetAddr *inetaddr);

Removes a reference from a GInetAddr. A GInetAddr is deleted when the reference count reaches 0.

inetaddr : a GInetAddr

gnet_inetaddr_get_name ()

gchar*              gnet_inetaddr_get_name              (GInetAddr *inetaddr);

Gets the host name for a GInetAddr. This functions makes a reverse DNS lookup on the address so it may block. The canonical name is returned if the address has no host name.

inetaddr : a GInetAddr
Returns : the host name for the inetaddr; NULL on error.

gnet_inetaddr_get_name_nonblock ()

gchar*              gnet_inetaddr_get_name_nonblock     (GInetAddr *inetaddr);

Gets the host name for a GInetAddr. This function does not make a reverse DNS lookup and will fail if getting the name would require a reverse DNS lookup.

inetaddr : a GInetAddr
Returns : the host name for the inetaddr, or NULL if there was an error or it would require blocking.

GInetAddrGetNameAsyncID

typedef struct _GInetAddrReverseAsyncState * GInetAddrGetNameAsyncID;

ID of an asynchronous InetAddr name lookup started with gnet_inetaddr_get_name_async(). The lookup can be canceled by calling gnet_inetaddr_get_name_async_cancel() with the ID.


GInetAddrGetNameAsyncFunc ()

void                (*GInetAddrGetNameAsyncFunc)        (gchar *hostname,
                                                         gpointer data);

Callback for gnet_inetaddr_get_name_async(). Callee (that is: you) owns the name. Free it with g_free() when no longer needed. The name will be NULL if the lookup failed.

hostname : Canonical name of the address (callee owned), NULL on failure
data : User data

gnet_inetaddr_get_name_async ()

GInetAddrGetNameAsyncID gnet_inetaddr_get_name_async    (GInetAddr *inetaddr,
                                                         GInetAddrGetNameAsyncFunc func,
                                                         gpointer data);

Asynchronously gets the host name for a GInetAddr. The callback is called once the reverse DNS lookup is complete. The call back will not be called during the call to this function.

See gnet_inetaddr_new_list_async() for implementation notes.

inetaddr : a GInetAddr
func : callback function
data : data to pass to func on the callback
Returns : the ID of the lookup; NULL on failure. The ID can be used with gnet_inetaddr_get_name_async_cancel() to cancel the lookup.

gnet_inetaddr_get_name_async_full ()

GInetAddrGetNameAsyncID gnet_inetaddr_get_name_async_full
                                                        (GInetAddr *inetaddr,
                                                         GInetAddrGetNameAsyncFunc func,
                                                         gpointer data,
                                                         GDestroyNotify notify,
                                                         GMainContext *context,
                                                         gint priority);

Asynchronously gets the host name for a GInetAddr. The callback is called once the reverse DNS lookup is complete. The callback will not be called during the call to this function.

See gnet_inetaddr_new_list_async_full() for implementation notes.

inetaddr : a GInetAddr
func : callback function
data : data to pass to func on the callback
notify : function to call to free data, or NULL
context : the GMainContext to use for notifications, or NULL for the default GLib main context. If in doubt, pass NULL.
priority : the priority with which to schedule notifications in the main context, e.g. G_PRIORITY_DEFAULT or G_PRIORITY_HIGH.
Returns : the ID of the lookup; NULL on failure. The ID can be used with gnet_inetaddr_get_name_async_cancel() to cancel the lookup.

Since 2.0.8


gnet_inetaddr_get_name_async_cancel ()

void                gnet_inetaddr_get_name_async_cancel (GInetAddrGetNameAsyncID id);

Cancels an asynchronous name lookup that was started with gnet_inetaddr_get_name_async(). This function should only be called from the application's main thread, ie. the thread in which context the callback delivering the result would be called (In a GTK+/GUI application this would be your normal GUI thread).

id : ID of the lookup

GNET_INETADDR_MAX_LEN

#define GNET_INETADDR_MAX_LEN 16

Maximum length of a GInetAddr's address in bytes. This can be used to allocate a buffer large enough for gnet_inetaddr_get_bytes().


gnet_inetaddr_get_length ()

gint                gnet_inetaddr_get_length            (const GInetAddr *inetaddr);

Get the length of a GInetAddr's address in bytes. An IPv4 address is 4 bytes long. An IPv6 address is 16 bytes long.

inetaddr : a GInetAddr
Returns : the length in bytes.

gnet_inetaddr_get_bytes ()

void                gnet_inetaddr_get_bytes             (const GInetAddr *inetaddr,
                                                         gchar *buffer);

Get a GInetAddr's address as bytes. buffer should be 4 bytes long for an IPv4 address or 16 bytes long for an IPv6 address. Use GNET_INETADDR_MAX_LEN when allocating a static buffer and gnet_inetaddr_get_length() when allocating a dynamic buffer.

inetaddr : a GInetAddr
buffer : buffer to store address in

gnet_inetaddr_set_bytes ()

void                gnet_inetaddr_set_bytes             (GInetAddr *inetaddr,
                                                         const gchar *bytes,
                                                         gint length);

Sets the address of a GInetAddr from bytes. buffer will be 4 bytes long for an IPv4 address and 16 bytes long for an IPv6 address.

inetaddr : a GInetAddr
bytes : address in raw bytes
length : length of bytes

gnet_inetaddr_get_canonical_name ()

gchar*              gnet_inetaddr_get_canonical_name    (const GInetAddr *inetaddr);

Gets the canonical name of a GInetAddr. An IPv4 canonical name is a dotted decimal name (e.g., 141.213.8.59). An IPv6 canonical name is a semicoloned hexidecimal name (e.g., 23:de:ad:be:ef).

inetaddr : a GInetAddr
Returns : the canonical name; NULL on error.

gnet_inetaddr_get_port ()

gint                gnet_inetaddr_get_port              (const GInetAddr *inetaddr);

Gets the port number of a GInetAddr.

inetaddr : a GInetAddr
Returns : the port number.

gnet_inetaddr_set_port ()

void                gnet_inetaddr_set_port              (const GInetAddr *inetaddr,
                                                         gint port);

Set the port number of a GInetAddr.

inetaddr : a GInetAddr
port : new port number

gnet_inetaddr_is_canonical ()

gboolean            gnet_inetaddr_is_canonical          (const gchar *hostname);

Checks if the host name is in canonical form.

hostname : host name
Returns : TRUE if name is canonical; FALSE otherwise.

gnet_inetaddr_is_internet ()

gboolean            gnet_inetaddr_is_internet           (const GInetAddr *inetaddr);

Checks if a GInetAddr is a sensible internet address. This mean it is not private, reserved, loopback, multicast, or broadcast.

Note that private and loopback address are often valid addresses, so this should only be used to check for general internet connectivity. That is, if the address passes, it is reachable on the internet.

inetaddr : a GInetAddr
Returns : TRUE if the address is an internet address; FALSE otherwise.

gnet_inetaddr_is_private ()

gboolean            gnet_inetaddr_is_private            (const GInetAddr *inetaddr);

Checks if a GInetAddr is an address reserved for private networks. For IPv4, this includes:

10.0.0.0 - 10.255.255.255 (10/8 prefix) 172.16.0.0 - 172.31.255.255 (172.16/12 prefix) 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)

(from RFC 1918. See also draft-manning-dsua-02.txt)

For IPv6, this includes link local addresses (fe80::/64) and site local addresses (fec0::/64).

inetaddr : a GInetAddr
Returns : TRUE if inetaddr is private; FALSE otherwise.

gnet_inetaddr_is_reserved ()

gboolean            gnet_inetaddr_is_reserved           (const GInetAddr *inetaddr);

Checks if a GInetAddr is reserved for some purpose. This excludes addresses reserved for private networks.

For IPv4, we check for: 0.0.0.0/16 (top 16 bits are 0's) Class E (top 5 bits are 11110)

For IPv6, we check for the 00000000 prefix.

inetaddr : a GInetAddr
Returns : TRUE if inetaddr is reserved; FALSE otherwise.

gnet_inetaddr_is_loopback ()

gboolean            gnet_inetaddr_is_loopback           (const GInetAddr *inetaddr);

Checks if a GInetAddr is a loopback address. The IPv4 loopback addresses have the prefix 127.0.0.1/24. The IPv6 loopback address is ::1.

inetaddr : a GInetAddr
Returns : TRUE if inetaddr is a loopback address; FALSE otherwise.

gnet_inetaddr_is_multicast ()

gboolean            gnet_inetaddr_is_multicast          (const GInetAddr *inetaddr);

Checks if a GInetAddr is a multicast address. IPv4 multicast addresses are in the range 224.0.0.0 to 239.255.255.255 (ie, the top four bits are 1110). IPv6 multicast addresses have the prefix FF.

inetaddr : a GInetAddr
Returns : TRUE if inetaddr is a multicast address; FALSE otherwise.

gnet_inetaddr_is_broadcast ()

gboolean            gnet_inetaddr_is_broadcast          (const GInetAddr *inetaddr);

Checks if a GInetAddr is a broadcast address. The broadcast address is 255.255.255.255. (Network broadcast addresses are network dependent.)

inetaddr : a GInetAddr
Returns : TRUE if inetaddr is a broadcast address; FALSE otherwise.

gnet_inetaddr_is_ipv4 ()

gboolean            gnet_inetaddr_is_ipv4               (const GInetAddr *inetaddr);

Checks if a GInetAddr is an IPv4 address.

inetaddr : a GInetAddr
Returns : TRUE if inetaddr is an IPv4 address; FALSE otherwise.

gnet_inetaddr_is_ipv6 ()

gboolean            gnet_inetaddr_is_ipv6               (const GInetAddr *inetaddr);

Check if a GInetAddr is an IPv6 address.

inetaddr : a GInetAddr
Returns : TRUE if inetaddr is an IPv6 address; FALSE otherwise.

gnet_inetaddr_hash ()

guint               gnet_inetaddr_hash                  (gconstpointer p);

Creates a hash code for a GInetAddr for use with GHashTable.

p : Pointer to an GInetAddr.
Returns : the hash code for p.

gnet_inetaddr_equal ()

gboolean            gnet_inetaddr_equal                 (gconstpointer p1,
                                                         gconstpointer p2);

Compares two GInetAddr's for equality. IPv4 and IPv6 addresses are always unequal.

p1 : a GInetAddr.
p2 : another GInetAddr.
Returns : TRUE if they are equal; FALSE otherwise.

gnet_inetaddr_noport_equal ()

gboolean            gnet_inetaddr_noport_equal          (gconstpointer p1,
                                                         gconstpointer p2);

Compares two GInetAddr's for equality, but does not compare the port numbers.

p1 : a GInetAddr
p2 : another GInetAddr
Returns : TRUE if they are equal; FALSE otherwise.

gnet_inetaddr_get_host_name ()

gchar*              gnet_inetaddr_get_host_name         (void);

Gets the host's name.

Returns : the name of the host; NULL on error.

gnet_inetaddr_get_host_addr ()

GInetAddr*          gnet_inetaddr_get_host_addr         (void);

Get the host's address.

Returns : the address of the host; NULL on error.

gnet_inetaddr_autodetect_internet_interface ()

GInetAddr*          gnet_inetaddr_autodetect_internet_interface
                                                        (void);

Finds an interface likely to be connected to the internet. This function can be used to automatically configure peer-to-peer applications. The function relies on heuristics and does not always work correctly, especially if the host is behind a NAT.

Returns : an address of an internet interface; NULL if it couldn't find one or on error.

gnet_inetaddr_get_interface_to ()

GInetAddr*          gnet_inetaddr_get_interface_to      (const GInetAddr *inetaddr);

Figures out which local interface would be used to send a packet to inetaddr. This works on some systems, but not others. We recommend using gnet_inetaddr_autodetect_internet_interface() to find an Internet interface since it's more likely to work.

inetaddr : a GInetAddr
Returns : the address of an interface used to route packets to inetaddr; NULL if there is no such interface or the system does not support this check.

gnet_inetaddr_get_internet_interface ()

GInetAddr*          gnet_inetaddr_get_internet_interface
                                                        (void);

Finds an internet interface. This function finds the first interface that is an internet address. IPv6 policy is followed.

This function does not work on some systems. We recommend using gnet_inetaddr_autodetect_internet_interface(), which performs additional checks.

Returns : the address of an internet interface; NULL if no internet interfaces or on error.

gnet_inetaddr_is_internet_domainname ()

gboolean            gnet_inetaddr_is_internet_domainname
                                                        (const gchar *name);

Checks if a name is a sensible internet domain name. This function uses heuristics. It does not use DNS and will not block. For example, "localhost" and "10.10.23.42" are not sensible internet domain names. (10.10.23.42 is a network address, but not accessible to the internet at large.)

name : name
Returns : TRUE if name is a sensible Internet domain name; FALSE otherwise.

gnet_inetaddr_list_interfaces ()

GList*              gnet_inetaddr_list_interfaces       (void);

Gets a list of GInetAddr interfaces's on this host. This list includes all "up" Internet interfaces and the loopback interface, if it exists.

On Windows if you do not have IPv6 installed then this function will return up to 10 interfaces.

This function may not work on some systems.

Returns : A list of GInetAddr's representing available interfaces. The caller should delete the list and the addresses.
gnet-2.0.8/doc/html/style.css0000644000175000017500000000311610751404362012765 00000000000000.synopsis, .classsynopsis { background: #eeeeee; border: solid 1px #aaaaaa; padding: 0.5em; } .programlisting { background: #eeeeff; border: solid 1px #aaaaff; padding: 0.5em; } .variablelist { padding: 4px; margin-left: 3em; } .variablelist td:first-child { vertical-align: top; } /* this is needed so that the local anchors are displayed below the naviagtion */ div.refnamediv a[name], div.refsect1 a[name] { position: relative; top: -4.5em; } table.navigation#top { background: #ffeeee; border: solid 1px #ffaaaa; margin-top: 0; margin-bottom: 0; position: fixed; top: 0; left: 0; height: 2em; z-index: 1; } .navigation a { color: #770000; } .navigation a:visited { color: #550000; } .navigation .title { font-size: 200%; } td.shortcuts { color: #770000; font-size: 80%; } div.refentry, div.chapter, div.part, div.book, div.index, div.glossary, div.sect1, div.appendix, div.preface { position: relative; top: 3em; z-index: 0; } div.refnamediv { margin-top: 2em; } div.gallery-float { float: left; padding: 10px; } div.gallery-float img { border-style: none; } div.gallery-spacer { clear: both; } a { text-decoration: none; } a:hover { text-decoration: underline; color: #FF0000; } div.table table { border-collapse: collapse; border-spacing: 0px; border-style: solid; border-color: #777777; border-width: 1px; } div.table table td, div.table table th { border-style: solid; border-color: #777777; border-width: 1px; padding: 3px; vertical-align: top; } div.table table th { background-color: #eeeeee; } gnet-2.0.8/doc/html/gnet-md5.html0000644000175000017500000004633610751404362013434 00000000000000 MD5

MD5

MD5 — MD5 hash

Synopsis


#include <gnet.h>


                    GMD5;
#define             GNET_MD5_HASH_LENGTH
GMD5*               gnet_md5_new                        (const gchar *buffer,
                                                         guint length);
GMD5*               gnet_md5_new_string                 (const gchar *str);
GMD5*               gnet_md5_clone                      (const GMD5 *md5);
void                gnet_md5_delete                     (GMD5 *md5);
GMD5*               gnet_md5_new_incremental            (void);
void                gnet_md5_update                     (GMD5 *md5,
                                                         const gchar *buffer,
                                                         guint length);
void                gnet_md5_final                      (GMD5 *md5);
gboolean            gnet_md5_equal                      (gconstpointer p1,
                                                         gconstpointer p2);
guint               gnet_md5_hash                       (gconstpointer p);
gchar*              gnet_md5_get_digest                 (const GMD5 *md5);
gchar*              gnet_md5_get_string                 (const GMD5 *md5);
void                gnet_md5_copy_string                (const GMD5 *md5,
                                                         gchar *buffer);

Description

The MD5 module provide support for computing and manipulating MD5 hashes. MD5 is a hash function with a very low probability of collision. MD5 is considered weaker than SHA.

An MD5 can be calculated at one time or incrementally. To create a MD5 at one time, call gnet_md5_new() with the data. To create a MD5 incrementally, call gnet_md5_new_incremental() to create the MD5 object, then gnet_md5_update() one or more times with data to hash, and finally call gnet_md5_final().

To get the digest, or hash value, call gnet_md5_get_digest(). This returns the raw digest as an array of GNET_MD5_HASH_LENGTH bytes. To get the digest as a human-readable hexidecimal string, call gnet_md5_get_string() or gnet_md5_copy_string().

gchar buffer[] = "Hello world!";
gchar buffer2[] = "Second line";
GMD5*  md5;
gchar* md5_str;

/* Compute an MD5 at one time */
md5 = gnet_md5_new (buffer, strlen(buffer));

md5_str = gnet_md5_get_string (md5);
g_print ("The MD5 of %s is %s\n", buffer, md5_str);

/* Use MD5... */

g_free (md5_str);
gnet_md5_delete (md5);

/* Compute an MD5 incrementally */
md5 = gnet_md5_new_incremental ();
gnet_md5_update (md5, buffer, strlen(buffer));
gnet_md5_update (md5, buffer2, strlen(buffer2));
gnet_md5_final (md5);

/* Use MD5... */

gnet_md5_delete (md5);

Details

GMD5

typedef struct _GMD5 GMD5;

GMD5 is a MD5 hash.


GNET_MD5_HASH_LENGTH

#define GNET_MD5_HASH_LENGTH	16

Length of the MD5 hash in bytes.


gnet_md5_new ()

GMD5*               gnet_md5_new                        (const gchar *buffer,
                                                         guint length);

Creates a GMD5 from buffer.

buffer : buffer to hash
length : length of buffer
Returns : a new GMD5.

gnet_md5_new_string ()

GMD5*               gnet_md5_new_string                 (const gchar *str);

Creates a GMD5 from str. str is a hexidecimal string representing the digest.

str : hexidecimal string
Returns : a new GMD5.

gnet_md5_clone ()

GMD5*               gnet_md5_clone                      (const GMD5 *md5);

Copies a GMD5.

md5 : a GMD5
Returns : a copy of md5.

gnet_md5_delete ()

void                gnet_md5_delete                     (GMD5 *md5);

Deletes a GMD5.

md5 : a GMD5

gnet_md5_new_incremental ()

GMD5*               gnet_md5_new_incremental            (void);

Creates a GMD5 incrementally. After creating a GMD5, call gnet_md5_update() one or more times to hash data. Finally, call gnet_md5_final() to compute the final hash value.

Returns : a new GMD5.

gnet_md5_update ()

void                gnet_md5_update                     (GMD5 *md5,
                                                         const gchar *buffer,
                                                         guint length);

Updates the hash with buffer. This may be called several times on a hash created by gnet_md5_new_incremental() before being finalized by calling gnet_md5_final().

md5 : a GMD5
buffer : buffer to add
length : length of buffer

gnet_md5_final ()

void                gnet_md5_final                      (GMD5 *md5);

Calcuates the final hash value of a GMD5. This should only be called on an GMD5 created by gnet_md5_new_incremental().

md5 : a GMD5

gnet_md5_equal ()

gboolean            gnet_md5_equal                      (gconstpointer p1,
                                                         gconstpointer p2);

Compares two GMD5's for equality.

p1 : first GMD5.
p2 : second GMD5.
Returns : TRUE if they are equal; FALSE otherwise.

gnet_md5_hash ()

guint               gnet_md5_hash                       (gconstpointer p);

Creates a hash code for a GMD5 for use with GHashTable. This hash value is not the same as the MD5 digest.

p : a GMD5
Returns : the hash code for p.

gnet_md5_get_digest ()

gchar*              gnet_md5_get_digest                 (const GMD5 *md5);

Gets the raw MD5 digest.

md5 : a GMD5
Returns : a callee-owned buffer containing the MD5 hash digest. The buffer is GNET_MD5_HASH_LENGTH bytes long.

gnet_md5_get_string ()

gchar*              gnet_md5_get_string                 (const GMD5 *md5);

Gets the digest represented a human-readable string.

md5 : a GMD5
Returns : a hexadecimal string representing the digest. The string is 2 * GNET_MD5_HASH_LENGTH bytes long and NULL terminated. The string is caller owned.

gnet_md5_copy_string ()

void                gnet_md5_copy_string                (const GMD5 *md5,
                                                         gchar *buffer);

Copies the digest, represented as a string, into buffer. The string is not NULL terminated.

md5 : a GMD5
buffer : buffer at least 2 * GNET_MD5_HASH_LENGTH bytes long
gnet-2.0.8/doc/html/gnet-conn-http.html0000644000175000017500000014361110751404362014653 00000000000000 GConnHttp

GConnHttp

GConnHttp — HTTP connection object

Synopsis


#include <gnet.h>


                    GConnHttp;
enum                GConnHttpMethod;
enum                GConnHttpError;
enum                GConnHttpEventType;
                    GConnHttpEvent;
                    GConnHttpEventResolved;
                    GConnHttpEventResponse;
                    GConnHttpEventRedirect;
                    GConnHttpEventData;
                    GConnHttpEventError;
void                (*GConnHttpFunc)                    (GConnHttp *conn,
                                                         GConnHttpEvent *event,
                                                         gpointer user_data);
enum                GConnHttpHeaderFlags;
GConnHttp*          gnet_conn_http_new                  (void);
gboolean            gnet_conn_http_set_uri              (GConnHttp *conn,
                                                         const gchar *uri);
gboolean            gnet_conn_http_set_escaped_uri      (GConnHttp *conn,
                                                         const gchar *uri);
gboolean            gnet_conn_http_set_header           (GConnHttp *conn,
                                                         const gchar *field,
                                                         const gchar *value,
                                                         GConnHttpHeaderFlags flags);
void                gnet_conn_http_set_max_redirects    (GConnHttp *conn,
                                                         guint num);
void                gnet_conn_http_set_timeout          (GConnHttp *conn,
                                                         guint timeout);
gboolean            gnet_conn_http_set_user_agent       (GConnHttp *conn,
                                                         const gchar *agent);
gboolean            gnet_conn_http_set_method           (GConnHttp *conn,
                                                         GConnHttpMethod method,
                                                         const gchar *post_data,
                                                         gsize post_data_len);
gboolean            gnet_conn_http_set_main_context     (GConnHttp *conn,
                                                         GMainContext *context);
void                gnet_conn_http_run_async            (GConnHttp *conn,
                                                         GConnHttpFunc func,
                                                         gpointer user_data);
gboolean            gnet_conn_http_run                  (GConnHttp *conn,
                                                         GConnHttpFunc func,
                                                         gpointer user_data);
gboolean            gnet_conn_http_steal_buffer         (GConnHttp *conn,
                                                         gchar **buffer,
                                                         gsize *length);
void                gnet_conn_http_cancel               (GConnHttp *conn);
void                gnet_conn_http_delete               (GConnHttp *conn);
gboolean            gnet_http_get                       (const gchar *url,
                                                         gchar **buffer,
                                                         gsize *length,
                                                         guint *response);

Description

A GConnHttp represents a HTTP client connection. A GConnHttp is created directly by calling gnet_conn_http_new(). After that set the URI to retrieve using gnet_conn_http_set_uri(). A connection is made and the HTTP request sent only once either gnet_conn_http_run_async() or gnet_conn_http_run() is called. Use the asynchroneous variant if you want the function to return immediately and prefer to receive data and status information in the background via the callback function. gnet_conn_http_run_async() assumes that there is already a GLib main loop running (e.g. the Gtk main loop).

You can decide for yourself how much information you would like to receive during the HTTP operation. All status information is communicated to the caller via the optional callback function.

The easiest way to just retrieve some data via HTTP is to use the convenience function gnet_http_get().

Here is a small example how to retrieve a file with the least amount of effort and error checking (this is more or less what gnet_http_get() does internally):

Example 1. Simple GConnHttp usage.

#define GNET_EXPERIMENTAL
#include <gnet.h>

void
fetch_and_print_url (const gchar *url)
{
  GConnHttp  *conn;
  
  conn = gnet_conn_http_new();
  
  gnet_conn_http_set_uri(conn, url);
  
  if (gnet_conn_http_run(conn, NULL, NULL))
  {
    gchar *buf;
    gsize  buflen;
    
    if (gnet_conn_http_steal_buffer(conn, &buf, &buflen))
    {
      g_print ("Received %%u bytes of data:\n%%s\n", buflen, buf);
      g_free(buf);
    }
  }
  
  gnet_conn_http_delete(conn);
}

  ...

  fetch_and_print_url ("http://www.google.com");
  
  ...


GConnHttp is still considered less mature than other parts of GNet, even though it should generall work just fine. It just has not received as much testing as other parts of GNet yet. You should not use it in production level code without thoroughly testing it for your purposes. Because of that, you need to define GNET_EXPERIMENTAL in your source code before including the GNet headers (otherwise you will get compiler errors when trying to use it).

Details

GConnHttp

typedef struct _GConnHttp GConnHttp;

HTTP Connection. The entire GConnHttp struct is opaque and private.


enum GConnHttpMethod

typedef enum
{
 GNET_CONN_HTTP_METHOD_GET,
 GNET_CONN_HTTP_METHOD_POST
} GConnHttpMethod;

HTTP request method. Use with gnet_conn_http_set_method().

GNET_CONN_HTTP_METHOD_GET HTTP GET method
GNET_CONN_HTTP_METHOD_POST HTTP POST method

enum GConnHttpError

typedef enum
{
 GNET_CONN_HTTP_ERROR_UNSPECIFIED,
 GNET_CONN_HTTP_ERROR_PROTOCOL_UNSUPPORTED,
 GNET_CONN_HTTP_ERROR_HOSTNAME_RESOLUTION
} GConnHttpError;

Error codes. Used by GConnHttpEventError. Note that errors by the HTTP server will be communicated to the client via the GConnHttpEventResponse event.

GNET_CONN_HTTP_ERROR_UNSPECIFIED connection error
GNET_CONN_HTTP_ERROR_PROTOCOL_UNSUPPORTED unsupported protocol (ie. not http)
GNET_CONN_HTTP_ERROR_HOSTNAME_RESOLUTION the hostname could not be resolved

enum GConnHttpEventType

typedef enum
{
 GNET_CONN_HTTP_RESOLVED,           /* resolved host name           */
 GNET_CONN_HTTP_CONNECTED,          /* connected to host            */
 GNET_CONN_HTTP_RESPONSE,           /* got response (incl. headers) */
 GNET_CONN_HTTP_REDIRECT,           /* got redirect                 */
 GNET_CONN_HTTP_DATA_PARTIAL,       /* we got some data             */
 GNET_CONN_HTTP_DATA_COMPLETE,      /* we got all data              */
 GNET_CONN_HTTP_TIMEOUT,            /* the connection timed out     */
 GNET_CONN_HTTP_ERROR               /* GConnHttp problem            */
} GConnHttpEventType;

GConnHttp event type.

GNET_CONN_HTTP_RESOLVED the host name has been resolved or host name resolution failed. The event structure will be a GConnHttpEventResolved structure
GNET_CONN_HTTP_CONNECTED the TCP connection to the HTTP server has been established
GNET_CONN_HTTP_RESPONSE the HTTP server has sent a response and response headers. The event structure will be a GConnHttpEventResponse structure
GNET_CONN_HTTP_REDIRECT the HTTP server has sent a redirect response. The event structure will be a GConnHttpEventRedirect structure
GNET_CONN_HTTP_DATA_PARTIAL data has been received. The buffer is caller-owned (ie. owned by GNet), but may be emptied using gnet_conn_http_steal_buffer(). The event structure will be a GConnHttpEventData structure
GNET_CONN_HTTP_DATA_COMPLETE data has been received in full. The buffer is caller-owned (ie. owned by GNet), but may be emptied using gnet_conn_http_steal_buffer(). The event structure will be a GConnHttpEventData structure
GNET_CONN_HTTP_TIMEOUT the connection timed out
GNET_CONN_HTTP_ERROR GConnHttp problem (not a server error response). The event structure will be a GConnHttpEventError structure

GConnHttpEvent

typedef struct {
 GConnHttpEventType   type;           /* type of event (see above)         */
} GConnHttpEvent;

GConnHttp Base Event. Check event->type and then cast the event structure into the corresponding specialised event structure.

GConnHttpEventType type; event type

GConnHttpEventResolved

typedef struct {
 GInetAddr           *ia;             /* GInetAddr of the host name        */
} GConnHttpEventResolved;

GConnHttp Host Name Resolved Event. Emitted when the host name has been resolved to an IP address, primarily to give progress feedback to the user. ia will be NULL if the host name could not be resolved.

GInetAddr *ia; a GInetAddr of the resolved host name.

GConnHttpEventResponse

typedef struct {
 guint                response_code;  /* response code, e.g. 200, or 404   */
 gchar              **header_fields;  /* NULL-terminated array of strings  */
 gchar              **header_values;  /* NULL-terminated array of strings  */
} GConnHttpEventResponse;

Emitted when the server has sent a response and response headers.

guint response_code; response code from the HTTP server (e.g. 200 or 404)
gchar **header_fields; array of header field strings, NULL-terminated
gchar **header_values; array of header value strings, NULL-terminated

GConnHttpEventRedirect

typedef struct {
 guint                num_redirects;  /* number of redirects so far        */
 guint                max_redirects;  /* max. num. of redirects allowed    */
 gchar               *new_location;   /* redirect location if provided     */
 gboolean             auto_redirect;  /* FALSE if action is needed         */
} GConnHttpEventRedirect;

Emitted when the server sends a redirect response.

guint num_redirects; number of redirects so far
guint max_redirects; maximum number of redirects allowed
gchar *new_location; redirect location, or NULL if not provided
gboolean auto_redirect; FALSE if action by the client is needed. Set to FALSE to prevent automatic redirection

GConnHttpEventData

typedef struct {
 guint64              content_length; /* set if available, otherwise 0     */
 guint64              data_received;  /* bytes received so far             */
 const gchar         *buffer;         /* buffer                            */
 gsize                buffer_length;  /* buffer length                     */
} GConnHttpEventData;

Emitted when data has been received. Useful for progress feedback to the user or to process data before all of it has been received. The client is responsible for emptying the buffer regularly when the amount of data received or expected is larger than the amount that should be kept in memory (e.g. in the case of large binary files).

guint64 content_length; set if available, otherwise 0
guint64 data_received; total amount of data received so far
const gchar *buffer; buffer with data received so far. Use gnet_conn_http_steal_buffer() to empty the buffer.
gsize buffer_length; buffer length

GConnHttpEventError

typedef struct {
 GConnHttpError       code;           /* error code                        */
 gchar               *message;        /* message (use for debugging only)  */
} GConnHttpEventError;

Emitted when an error has occured. Note that HTTP server errors are communicated to the client by means of a GConnHttpEventResponse event.

GConnHttpError code; one of the GConnHttpError codes
gchar *message; clear-text error message (for debugging purposes only)

GConnHttpFunc ()

void                (*GConnHttpFunc)                    (GConnHttp *conn,
                                                         GConnHttpEvent *event,
                                                         gpointer user_data);

Callback for GConnHttp.

Check event->type and then cast the event into the appropriate event structure. event->type will be one of

GNET_CONN_HTTP_RESOLVED: this event occurs when the host name has been resolved or host name resolution failed

GNET_CONN_HTTP_CONNECTED: the TCP connection to the HTTP server has been established

GNET_CONN_HTTP_RESPONSE: the HTTP server has sent a response and response headers

GNET_CONN_HTTP_REDIRECT: the HTTP server has sent a redirect response

GNET_CONN_HTTP_DATA_PARTIAL: data has been read. The buffer is owned by GNet and you must not modify it or free it. You can take ownership of the buffer with gnet_conn_http_steal_buffer()

GNET_CONN_HTTP_DATA_COMPLETE: data has been received in full. The buffer is owned by GNet and you must not modify it or free it. You can acquire ownership of the buffer by calling gnet_conn_http_steal_buffer()

GNET_CONN_HTTP_TIMEOUT: the connection timed out

GNET_CONN_HTTP_ERROR: GConnHttp problem (not a server error response)

conn : GConnHttp
event : event (caller-owned, do not free)
user_data : user data specified in gnet_conn_http_run() or gnet_conn_http_run_async()

enum GConnHttpHeaderFlags

typedef enum
{
  GNET_CONN_HTTP_FLAG_SKIP_HEADER_CHECK  = 1
} GConnHttpHeaderFlags;

Flags for gnet_conn_http_set_header().

GNET_CONN_HTTP_FLAG_SKIP_HEADER_CHECK do not check whether the header is a standard header

gnet_conn_http_new ()

GConnHttp*          gnet_conn_http_new                  (void);

Creates a GConnHttp.

Returns : a GConnHttp.

gnet_conn_http_set_uri ()

gboolean            gnet_conn_http_set_uri              (GConnHttp *conn,
                                                         const gchar *uri);

Sets the URI to GET or POST, e.g. http://www.foo.com/bar.html. uri is assumed to be unescaped, so all special URI characters will be escaped.

conn : a GConnHttp
uri : URI string
Returns : TRUE if the URI has been accepted.

gnet_conn_http_set_escaped_uri ()

gboolean            gnet_conn_http_set_escaped_uri      (GConnHttp *conn,
                                                         const gchar *uri);

Sets the URI to GET or POST, e.g. http://www.foo.com/My%20Documents/bar.txt

conn : a GConnHttp
uri : URI string with special characters already escaped
Returns : TRUE if the URI has been accepted.

gnet_conn_http_set_header ()

gboolean            gnet_conn_http_set_header           (GConnHttp *conn,
                                                         const gchar *field,
                                                         const gchar *value,
                                                         GConnHttpHeaderFlags flags);

Set header field to send with the HTTP request.

conn : a GConnHttp
field : a header field, e.g. "Accept"
value : the header field value, e.g. "text/html"
flags : one or more flags of GConnHttpHeaderFlags, or 0
Returns : TRUE if the header field has been set or changed

gnet_conn_http_set_max_redirects ()

void                gnet_conn_http_set_max_redirects    (GConnHttp *conn,
                                                         guint num);

Sets the maximum allowed number of automatic redirects. Note that the HTTP protocol specification (RFC2616) specifies occasions where the client must not redirect automatically without user intervention. In those cases, no automatic redirect will be performed, even if the limit has not been reached yet.

conn : a GConnHttp
num : the maximum number of allowed automatic redirects

gnet_conn_http_set_timeout ()

void                gnet_conn_http_set_timeout          (GConnHttp *conn,
                                                         guint timeout);

Sets a timeout on the http connection.

conn : a GConnHttp
timeout : timeout in milliseconds

gnet_conn_http_set_user_agent ()

gboolean            gnet_conn_http_set_user_agent       (GConnHttp *conn,
                                                         const gchar *agent);

Convenience function. Wraps gnet_conn_http_set_header().

conn : a GConnHttp
agent : the user agent string to send (will be supplemented by a GNet version number comment)
Returns : TRUE if the user agent string has been changed.

gnet_conn_http_set_method ()

gboolean            gnet_conn_http_set_method           (GConnHttp *conn,
                                                         GConnHttpMethod method,
                                                         const gchar *post_data,
                                                         gsize post_data_len);

Sets the HTTP request method. Default is the GET method.

conn : a GConnHttp
method : a GConnHttpMethod
post_data : post data to send with POST method, or NULL
post_data_len : the length of the post data to send with POST method, or 0
Returns : TRUE if the method has been changed successfully.

gnet_conn_http_set_main_context ()

gboolean            gnet_conn_http_set_main_context     (GConnHttp *conn,
                                                         GMainContext *context);

Sets the GLib GMainContext to use for asynchronous operations. You should call this function right after you create conn. You must not call this function after the actual connection process has started.

You are very unlikely to ever need this function.

conn : a GConnHttp
context : a GMainContext, or NULL to use the default GLib main context
Returns : TRUE on success, FALSE on failure.

Since 2.0.8


gnet_conn_http_run_async ()

void                gnet_conn_http_run_async            (GConnHttp *conn,
                                                         GConnHttpFunc func,
                                                         gpointer user_data);

Starts connecting and sending the specified http request. Will return immediately. Assumes there is an existing and running default Gtk/GLib/Gnome main loop.

conn : a GConnHttp
func : callback function to communicate progress and errors, or NULL
user_data : user data to pass to callback function, or NULL

gnet_conn_http_run ()

gboolean            gnet_conn_http_run                  (GConnHttp *conn,
                                                         GConnHttpFunc func,
                                                         gpointer user_data);

Starts connecting and sending the specified http request. Will return once the operation has finished and either an error has occured, or the data has been received in full.

This function will run its own main loop in the default GLib main context (or the user-specified main context, if one was specified with gnet_conn_http_set_main_context()), which means that if your application is based on Gtk+ or sets up GLib timeouts or idle callbacks, it is possible that those callback functions are invoked while you are waiting for gnet_conn_http_run() to return. This means you shouldn't make assumptions about any state you set up before calling this function, because it might have been changed again from within a callback in the mean time (if this can happen or not depends on your callbacks and what they do of course).

conn : a GConnHttp
func : callback function to communicate progress and errors, or NULL
user_data : user data to pass to callback function, or NULL
Returns : TRUE if no error occured before connecting

gnet_conn_http_steal_buffer ()

gboolean            gnet_conn_http_steal_buffer         (GConnHttp *conn,
                                                         gchar **buffer,
                                                         gsize *length);

Empties the current buffer and returns the contents. The main purpose of this function is to make it possible to just use gnet_conn_http_run(), check its return value, and then get the buffer data without having to install a callback function. Also needed to empty the buffer regularly while receiving large amounts of data.

The caller (you) needs to free the buffer with g_free() when done.

conn : a GConnHttp
buffer : where to store a pointer to the buffer data
length : where to store the length of the buffer data
Returns : TRUE if buffer and length have been set

gnet_conn_http_cancel ()

void                gnet_conn_http_cancel               (GConnHttp *conn);

Cancels the current http transfer (if any) and makes gnet_conn_http_run() return immediately. Will do nothing if the transfer was started with gnet_conn_http_run_async().

conn : a GConnHttp

gnet_conn_http_delete ()

void                gnet_conn_http_delete               (GConnHttp *conn);

Deletes a GConnHttp and frees all associated resources.

conn : a GConnHttp

gnet_http_get ()

gboolean            gnet_http_get                       (const gchar *url,
                                                         gchar **buffer,
                                                         gsize *length,
                                                         guint *response);

Convenience function that just retrieves the provided URI without the need to set up a full GConnHttp. Uses gnet_conn_http_run() internally.

Caller (you) needs to free the buffer with g_free() when no longer needed.

This function will run its own main loop in the default GLib main context, which means that if your application is based on Gtk+ or sets up GLib timeouts or idle callbacks, it is possible that those callback functions are invoked while you are waiting for gnet_http_get() to return. This means you shouldn't make assumptions about any state you set up before calling this function, because it might have been changed again from within a callback in the mean time (if this can happen or not depends on your callbacks and what they do of course).

url : a URI, e.g. http://www.foo.com
buffer : where to store a pointer to the data retrieved
length : where to store the length of the data retrieved
response : where to store the last HTTP response code received from the HTTP server, or NULL.
Returns : TRUE if buffer, length and response are set, otherwise FALSE.
gnet-2.0.8/doc/html/gnet-gnet.html0000644000175000017500000001133710751404362013675 00000000000000 GNet

GNet

GNet — GNet utility functions and macros

Synopsis


#include <gnet.h>


#define             GNET_EXPORT
#define             GNET_CHECK_VERSION                  (major,minor,micro)
void                gnet_init                           (void);

Description

The main GNet module provides the function gnet_init(). This function should be called at the beginning of any GNet program.

Details

GNET_EXPORT

#define             GNET_EXPORT

Declares a variable exported. Used interally.


GNET_CHECK_VERSION()

#define             GNET_CHECK_VERSION(major,minor,micro)

Checks if the version given is compatable with this version of the library. For example, GNET_CHECK_VERSION(1.2.3) would return TRUE if the version is 1.2.5, and FALSE if 1.1.0. This can be used in build tests.

major : Major version number
minor : Minor version number
micro : Micro version number

gnet_init ()

void                gnet_init                           (void);

Initializes the GNet library. This should be called at the beginning of any GNet program and before any call to gtk_init().

gnet-2.0.8/doc/html/index.html0000644000175000017500000001421710751404362013114 00000000000000 GNet Network Library Reference Manual

David Helder


    
  

for GNet 2.0.8

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.

Abstract

This manual documents GNet, a network library. It gives an overview of GNet, discusses examples that come with GNet, and includes detailed documentation of the GNet API.


GNet Overview
GNet for developers
Compiling programs with GNet
Tips and tricks
Hiding blocking
GNet Examples
echoclient and echoserver
dnslookup, hash, hfetch, hostinfo, and SDR
GNet Library Reference
GNet — GNet utility functions and macros
InetAddr — Internet Address
TCP — TCP socket
UDP — UDP socket
Mcast — IP Multicast socket
GConnHttp — HTTP connection object
Conn — TCP connection object
Server — TCP server object
IOChannel — GIOChannel utility functions
URI — Uniform Resource Identifier (URI)
Base64 — Base64 encoding and decoding
Pack — Byte packing and unpacking functions
MD5 — MD5 hash
SHA — SHA hash
Unix — Unix socket
IPv6 — IPv6 policy functions
SOCKS — SOCKS proxy
gnet-2.0.8/doc/html/gnet-examples-other.html0000644000175000017500000000534410751404362015676 00000000000000 dnslookup, hash, hfetch, hostinfo, and SDR

dnslookup, hash, hfetch, hostinfo, and SDR

dnslookup. dnslookup performs a DNS lookup of a hostname or a reverse DNS lookup of an address. It demonstrates how to use both the blocking and asynchronous methods of DNS lookups.

hash. hash computes the MD5 and SHA hashes of a file.

hfetch. hfetch is a simple HTTP file fetcher.

hostinfo. hostinfo prints information about the host including it's domain name and interfaces.

SDR. SDR prints multimedia session announcements. It demonstrates how to use multicast sockets in GNet. SDR will only work if your network supports IP Multicast. In fact, SDR is a good test for this. If the network supports multicast, SDR will print announcements after a few seconds, otherwise, it will print nothing.

gnet-2.0.8/doc/html/libgnet-reference.html0000644000175000017500000001063610751404362015366 00000000000000 GNet Library Reference

GNet Library Reference

GNet — GNet utility functions and macros
InetAddr — Internet Address
TCP — TCP socket
UDP — UDP socket
Mcast — IP Multicast socket
GConnHttp — HTTP connection object
Conn — TCP connection object
Server — TCP server object
IOChannel — GIOChannel utility functions
URI — Uniform Resource Identifier (URI)
Base64 — Base64 encoding and decoding
Pack — Byte packing and unpacking functions
MD5 — MD5 hash
SHA — SHA hash
Unix — Unix socket
IPv6 — IPv6 policy functions
SOCKS — SOCKS proxy

This section contains the API reference for gnet. All the public interfaces are documented here. This reference guide is built by extracting comments from the code sources.

gnet-2.0.8/doc/html/home.png0000644000175000017500000000121610751404362012550 00000000000000PNG  IHDRw=bKGD pHYs  ~tIME1KvIDATxՕkq?rCp ~CnpCAAJ .B-\'G]:ܠC -(8 Ԁ!fDғklbRoyxwpðIJ<of_-@RHf֟t^ښ$Q|pgv;X^^&s(bwwZF9&3඙ ^IRZUE.0Z]]U PYM8HGIekqqҀ! $۬3n e{-/seeeÌXOͷ$8==USQRR'9-s+B^ Cەs+%<7W :2IENDB`gnet-2.0.8/doc/html/index.sgml0000644000175000017500000006564310751404362013123 00000000000000 gnet-2.0.8/doc/html/gnet-overview.html0000644000175000017500000000535410751404362014610 00000000000000 GNet Overview

GNet Overview

GNet is a network library. It is written in C, object-oriented, and built upon GLib. It is intended to be easy to use and port.

Features:

  • TCP "client" and "server" sockets

  • UDP and IP Multicast sockets

  • High-level TCP connection and server objects

  • Asynchronous socket IO

  • HTTP client object

  • Internet address abstraction

  • Asynchronous DNS lookup

  • IPv4 and IPv6 support

  • Byte packing and unpacking

  • URI parsing

  • SHA and MD5 hashes

  • Base64 encoding and decoding

  • SOCKS support

GNet is licensed under the GNU Lesser General Public License. Read COPYING for information on the license (this file comes with the GNet distribution).

gnet-2.0.8/doc/html/gnet-uri.html0000644000175000017500000007413110751404362013540 00000000000000 URI

URI

URI — Uniform Resource Identifier (URI)

Synopsis


#include <gnet.h>


                    GURI;
GURI*               gnet_uri_new                        (const gchar *uri);
GURI*               gnet_uri_new_fields                 (const gchar *scheme,
                                                         const gchar *hostname,
                                                         const gint port,
                                                         const gchar *path);
GURI*               gnet_uri_new_fields_all             (const gchar *scheme,
                                                         const gchar *userinfo,
                                                         const gchar *hostname,
                                                         const gint port,
                                                         const gchar *path,
                                                         const gchar *query,
                                                         const gchar *fragment);
GURI*               gnet_uri_clone                      (const GURI *uri);
void                gnet_uri_delete                     (GURI *uri);
void                gnet_uri_escape                     (GURI *uri);
void                gnet_uri_unescape                   (GURI *uri);
gchar*              gnet_uri_get_string                 (const GURI *uri);
void                gnet_uri_set_scheme                 (GURI *uri,
                                                         const gchar *scheme);
void                gnet_uri_set_userinfo               (GURI *uri,
                                                         const gchar *userinfo);
void                gnet_uri_set_hostname               (GURI *uri,
                                                         const gchar *hostname);
void                gnet_uri_set_port                   (GURI *uri,
                                                         gint port);
void                gnet_uri_set_path                   (GURI *uri,
                                                         const gchar *path);
void                gnet_uri_set_query                  (GURI *uri,
                                                         const gchar *query);
void                gnet_uri_set_fragment               (GURI *uri,
                                                         const gchar *fragment);
guint               gnet_uri_hash                       (gconstpointer p);
gboolean            gnet_uri_equal                      (gconstpointer p1,
                                                         gconstpointer p2);
gboolean            gnet_uri_parse_inplace              (GURI *guri,
                                                         gchar *uri,
                                                         gchar *hostname,
                                                         gsize len);

Description

A URI is a Uniform Resource Identifier, similar to a URL. This module provides functions for creating and manipulating URIs. A URI is represented by GURI. All fields in the GURI structure are publicly readable.

Create a URI from a string by calling gnet_uri_new(). To get the string representation back, call gnet_uri_get_string(). To escape a URI call gnet_uri_escape(), and to unescape it call gnet_uri_unescape(). Network protocols use escaped URIs. People use unescaped URIs.

Details

GURI

typedef struct {
  gchar* scheme;
  gchar* userinfo;
  gchar* hostname;
  gint   port;
  gchar* path;
  gchar* query;
  gchar* fragment;
} GURI;

The GURI structure represents a URI. All fields in this structure are publicly readable.

gchar *scheme; Scheme (or protocol)
gchar *userinfo; User info
gchar *hostname; Host name
gint port; Port number
gchar *path; Path
gchar *query; Query
gchar *fragment; Fragment

gnet_uri_new ()

GURI*               gnet_uri_new                        (const gchar *uri);

Creates a GURI from a string. Empty fields are set to NULL. The parser does not validate the URI -- it will accept some malformed URI. URIs are usually in the form scheme://userinfohostname:port/path?queryfragment

URIs created from user input are typically unescaped. URIs created from machine input (e.g. received over the internet) are typically escaped.

uri : URI string
Returns : a new GURI, or NULL if there was a failure.

gnet_uri_new_fields ()

GURI*               gnet_uri_new_fields                 (const gchar *scheme,
                                                         const gchar *hostname,
                                                         const gint port,
                                                         const gchar *path);

Creates a GURI from the fields. This function uses the most common fields. Use gnet_uri_new_fields_all() to specify all fields.

scheme : scheme
hostname : host name
port : port
path : path
Returns : a new GURI.

gnet_uri_new_fields_all ()

GURI*               gnet_uri_new_fields_all             (const gchar *scheme,
                                                         const gchar *userinfo,
                                                         const gchar *hostname,
                                                         const gint port,
                                                         const gchar *path,
                                                         const gchar *query,
                                                         const gchar *fragment);

Creates a GURI from all fields.

scheme : scheme
userinfo : user info
hostname : host name
port : port
path : path
query : query
fragment : fragment
Returns : a new GURI.

gnet_uri_clone ()

GURI*               gnet_uri_clone                      (const GURI *uri);

Copies a GURI.

uri : a GURI
Returns : a copy of uri.

gnet_uri_delete ()

void                gnet_uri_delete                     (GURI *uri);

Deletes a GURI.

uri : a GURI

gnet_uri_escape ()

void                gnet_uri_escape                     (GURI *uri);

Escapes the fields in a GURI. Network protocols use escaped URIs. People use unescaped URIs.

uri : a GURI

gnet_uri_unescape ()

void                gnet_uri_unescape                   (GURI *uri);

Unescapes the fields in the URI. Network protocols use escaped URIs. People use unescaped URIs.

uri : a GURI

gnet_uri_get_string ()

gchar*              gnet_uri_get_string                 (const GURI *uri);

Gets a string representation of a GURI. This function does not escape or unescape the fields first. Call gnet_uri_escape() or gnet_uri_unescape first if necessary.

uri : a GURI
Returns : a string.

gnet_uri_set_scheme ()

void                gnet_uri_set_scheme                 (GURI *uri,
                                                         const gchar *scheme);

Sets a GURI's scheme.

uri : a GURI
scheme : scheme

gnet_uri_set_userinfo ()

void                gnet_uri_set_userinfo               (GURI *uri,
                                                         const gchar *userinfo);

Sets a GURI's user info.

uri : a GURI
userinfo : user info

gnet_uri_set_hostname ()

void                gnet_uri_set_hostname               (GURI *uri,
                                                         const gchar *hostname);

Sets a GURI's host name.

uri : a GURI
hostname : host name

gnet_uri_set_port ()

void                gnet_uri_set_port                   (GURI *uri,
                                                         gint port);

Set a GURI's port.

uri : a GURI
port : port

gnet_uri_set_path ()

void                gnet_uri_set_path                   (GURI *uri,
                                                         const gchar *path);

Set a GURI's path.

uri : a GURI
path : path

gnet_uri_set_query ()

void                gnet_uri_set_query                  (GURI *uri,
                                                         const gchar *query);

Set a GURI's query.

uri : a GURI
query : query

gnet_uri_set_fragment ()

void                gnet_uri_set_fragment               (GURI *uri,
                                                         const gchar *fragment);

Set a GURI's fragment.

uri : a GURI
fragment : fragment

gnet_uri_hash ()

guint               gnet_uri_hash                       (gconstpointer p);

Creates a hash code for p for use with GHashTable.

p : a GURI
Returns : hash code for p.

gnet_uri_equal ()

gboolean            gnet_uri_equal                      (gconstpointer p1,
                                                         gconstpointer p2);

Compares two GURI's for equality.

p1 : a GURI
p2 : another GURI
Returns : TRUE if they are equal; FALSE otherwise.

gnet_uri_parse_inplace ()

gboolean            gnet_uri_parse_inplace              (GURI *guri,
                                                         gchar *uri,
                                                         gchar *hostname,
                                                         gsize len);

This function parses an URI string very efficiently and without allocating any memory on the heap. It does this by modifying the passed-in string uri and changing field separators into string terminators in place. The result will then be put into the already-allocated and usually uninitialised, GURI structure guri.

Because the slash (') which separates the hostname from the path in an URI is needed as the first character of the path, it cannot be turned into a string terminator for the hostname. This makes it necessary for the caller (ie. you) to pass in an array where the hostname can be put.

If the URI has been parsed successfully, the fields of the GURI structure will either point into the given string uri (or to hostname in case of the hostname field), or be NULL. No freeing or de-initialising of the GURI structure is required.

The only gnet_uri_*() functions you are allowed to call with this URI structure are gnet_uri_clone(), gnet_uri_equal(), gnet_uri_hash(), gnet_uri_get_string() and gnet_uri_unescape() (the latter unescapes the string fragments in place, so is safe to use here).

You must not call any other gnet_uri_*() functions with this GURI, especially not any gnet_uri_set() functions.

Under normal circumstances, you should never need to use this function. Use gnet_uri_new() instead.

guri : pointer to an uninitialised GURI structure (usually on the stack)
uri : a writable URI string (which will be modified by this function!)
hostname : a preallocated array of size len, into which the hostname will be copied if the URI has a hostname. This array should live as long as guri may be used, since guri might reference it. You may pass NULL here if you know your URIs won't contain a hostname field
len :
Returns : TRUE if uri was parsed successfully and GURI is usable, or FALSE if there was a failure.

Since 2.0.8

gnet-2.0.8/doc/html/right.png0000644000175000017500000000073010751404362012735 00000000000000PNG  IHDRw=bKGD pHYs  ~tIME2 I%=eIDATx!o@.'**M0$$?1~vIeEuLl&4䝠Bݛ|>$ݶoc gnet-2.0.8/doc/html/gnet-base64.html0000644000175000017500000001617510751404362014031 00000000000000 Base64

Base64

Base64 — Base64 encoding and decoding

Synopsis


#include <gnet.h>


gchar*              gnet_base64_encode                  (const gchar *src,
                                                         gint srclen,
                                                         gint *dstlenp,
                                                         gboolean strict);
gchar*              gnet_base64_decode                  (const gchar *src,
                                                         gint srclen,
                                                         gint *dstlenp);

Description

gchar* binary_stream = "Hello World!";
gchar* base64_stream;
gint   base64_len;
gchar* newbin_stream;
gint   newbin_len;

base64_stream = gnet_base64_encode(binary_stream,strlen(binary_stream), &base64_len, FALSE);
newbin_stream = gnet_base64_decode(base64_stream, base64_len, &newbin_len);

This module provides functions to encode and decode strings into the Base64 encoding specified in "RFC 2045 - MIME (Multipurpose Internet Mail Extensions)". The Base64 encoding is designed to represent arbitrary sequences of octets in a form that need not be humanly readable. A 65-character subset ([A-Za-z0-9+/=]) of US-ASCII is used, enabling 6 bits to be represented per printable character.

Details

gnet_base64_encode ()

gchar*              gnet_base64_encode                  (const gchar *src,
                                                         gint srclen,
                                                         gint *dstlenp,
                                                         gboolean strict);

Convert a buffer from binary to base64 representation. Set strict to TRUE to insert a newline every 72th character. This is required by RFC 2045, but some applications don't require this.

If srclen is 0, an empty string will be returned (not NULL).

src : source buffer
srclen : length of the source buffer
dstlenp : length of the buffer returned (including the terminating \0)
strict : insert new lines as required by RFC 2045
Returns : a newly-allocated and NUL-terminated string containing the input data in base64 coding. Free with g_free() when no longer needed.

gnet_base64_decode ()

gchar*              gnet_base64_decode                  (const gchar *src,
                                                         gint srclen,
                                                         gint *dstlenp);

Convert a buffer from base64 to binary representation. This function is liberal in what it will accept. It ignores non-base64 symbols.

src : the source buffer
srclen : the length of the source buffer, or -1 for strlen(src).
dstlenp : where to return the length of the returned output buffer
Returns : newly-allocated buffer. Free with g_free() when no longer needed. The integer pointed to by dstlenp is set to the length of that buffer.
gnet-2.0.8/doc/html/gnet-examples.html0000644000175000017500000001031210751404362014546 00000000000000 GNet Examples

GNet Examples

GNet comes with several example programs. They are intended to be used by developers as examples of how to use GNet. The example programs are in the examples directory that comes with the source code.

The tests in the tests directory also demonstrate to use several modules: MD5/SHA, InetAddr, IPv6, Pack/Unpack, and URI.

echoclient and echoserver

The echoclient connects to the echoserver and sends data it reads in from the user. echoserver then sends it back and echoclient prints it out. These programs demonstrate how to write a basic client and server. There are three versions of the TCP echoclient and echoserver. Each demonstrates a different method of using GNet: blocking, asynchronous, and object GConn/GServer. There is also a blocking UDP example and a Unix sockets example.

echoclient/echoserver. The blocking echoserver accepts a connection and reads and writes to the socket until the socket is closed. No more than one echoclient can be connected at once. A good, robust server wouldn't use this method, but it is suitable for many simple applications.

echoclient-async/echoserver-async. The asynchronous server does not block while reading or writing to a socket or waiting for a connect. Since it's never blocked, it can accept new connections when it isn't reading or writing to another socket. The advantage of the this method is that multiple clients can be served at once.

echoclient-gconn/echoserver-gserver. echoclient-gconn uses GNet's GConn object. echoserver-gserver uses GNet's GServer object. GConn and GServer are high-level wrappers around GTcpSocket. Using GConn and GServer is not as flexible as using GTcpSocket directly, but it is much easier and is flexible enough for most applications.

There is no example using threads. If you would like to contribute one, please send it to us.

gnet-2.0.8/doc/html/gnet-tcp.html0000644000175000017500000016464710751404362013543 00000000000000 TCP

TCP

TCP — TCP socket

Synopsis


#include <gnet.h>


                    GTcpSocket;
typedef             GTcpSocketConnectAsyncID;
enum                GTcpSocketConnectAsyncStatus;
void                (*GTcpSocketConnectAsyncFunc)       (GTcpSocket *socket,
                                                         GTcpSocketConnectAsyncStatus status,
                                                         gpointer data);
typedef             GTcpSocketNewAsyncID;
void                (*GTcpSocketNewAsyncFunc)           (GTcpSocket *socket,
                                                         gpointer data);
GTcpSocket*         gnet_tcp_socket_connect             (const gchar *hostname,
                                                         gint port);
GTcpSocketConnectAsyncID gnet_tcp_socket_connect_async  (const gchar *hostname,
                                                         gint port,
                                                         GTcpSocketConnectAsyncFunc func,
                                                         gpointer data);
GTcpSocketConnectAsyncID gnet_tcp_socket_connect_async_full
                                                        (const gchar *hostname,
                                                         gint port,
                                                         GTcpSocketConnectAsyncFunc func,
                                                         gpointer data,
                                                         GDestroyNotify notify,
                                                         GMainContext *context,
                                                         gint priority);
void                gnet_tcp_socket_connect_async_cancel
                                                        (GTcpSocketConnectAsyncID id);
GTcpSocket*         gnet_tcp_socket_new                 (const GInetAddr *addr);
GTcpSocketNewAsyncID gnet_tcp_socket_new_async          (const GInetAddr *addr,
                                                         GTcpSocketNewAsyncFunc func,
                                                         gpointer data);
GTcpSocketNewAsyncID gnet_tcp_socket_new_async_full     (const GInetAddr *addr,
                                                         GTcpSocketNewAsyncFunc func,
                                                         gpointer data,
                                                         GDestroyNotify notify,
                                                         GMainContext *context,
                                                         gint priority);
void                gnet_tcp_socket_new_async_cancel    (GTcpSocketNewAsyncID id);
void                gnet_tcp_socket_delete              (GTcpSocket *socket);
void                gnet_tcp_socket_ref                 (GTcpSocket *socket);
void                gnet_tcp_socket_unref               (GTcpSocket *socket);
GIOChannel*         gnet_tcp_socket_get_io_channel      (GTcpSocket *socket);
GInetAddr*          gnet_tcp_socket_get_remote_inetaddr (const GTcpSocket *socket);
GInetAddr*          gnet_tcp_socket_get_local_inetaddr  (const GTcpSocket *socket);
gint                gnet_tcp_socket_get_port            (const GTcpSocket *socket);
enum                GNetTOS;
void                gnet_tcp_socket_set_tos             (GTcpSocket *socket,
                                                         GNetTOS tos);
GTcpSocket*         gnet_tcp_socket_server_new          (void);
GTcpSocket*         gnet_tcp_socket_server_new_with_port
                                                        (gint port);
GTcpSocket*         gnet_tcp_socket_server_new_full     (const GInetAddr *iface,
                                                         gint port);
GTcpSocket*         gnet_tcp_socket_server_accept       (GTcpSocket *socket);
GTcpSocket*         gnet_tcp_socket_server_accept_nonblock
                                                        (GTcpSocket *socket);
void                (*GTcpSocketAcceptFunc)             (GTcpSocket *server,
                                                         GTcpSocket *client,
                                                         gpointer data);
void                gnet_tcp_socket_server_accept_async (GTcpSocket *socket,
                                                         GTcpSocketAcceptFunc accept_func,
                                                         gpointer user_data);
void                gnet_tcp_socket_server_accept_async_cancel
                                                        (GTcpSocket *socket);
GTcpSocket*         gnet_tcp_socket_new_direct          (const GInetAddr *addr);
GTcpSocketNewAsyncID gnet_tcp_socket_new_async_direct   (const GInetAddr *addr,
                                                         GTcpSocketNewAsyncFunc func,
                                                         gpointer data);
GTcpSocketNewAsyncID gnet_tcp_socket_new_async_direct_full
                                                        (const GInetAddr *addr,
                                                         GTcpSocketNewAsyncFunc func,
                                                         gpointer data,
                                                         GDestroyNotify notify,
                                                         GMainContext *context,
                                                         gint priority);

Description

TCP is an internet protocol that transfers data reliably and in-order. This module provides support for TCP sockets.

To create a GTcpSocket and connect to a host, call gnet_tcp_socket_new(). This function will block. The asynchronous version is gnet_tcp_socket_new_async().

Each TCP socket has a GIOChannel which can be used to read and write from the socket. A watch can be set on the GIOChannel by calling g_io_add_watch() (a GLib function).

To create a TCP server, call gnet_tcp_socket_server_new(). The socket will be bound to all interfaces. To bind to a specific interface, call gnet_tcp_socket_server_new_interface(). To accept a new connection, call gnet_tcp_socket_server_accept(). This function returns a GTcpSocket representing the client connection. This function can block. To prevent blocking, call either gnet_tcp_socket_server_accept_nonblock() or gnet_tcp_socket_server_accept_async(). The former returns NULL immediately if there is no new connection. The latter calls a callback whenever there is a new connection. We recommend this function.

This module will use SOCKS if enabled.

Details

GTcpSocket

typedef struct _GTcpSocket GTcpSocket;

A GTcpSocket structure represents a TCP socket. The implementation is hidden.


GTcpSocketConnectAsyncID

typedef struct _GTcpSocketConnectState * GTcpSocketConnectAsyncID;

ID of an asynchronous connection started with gnet_tcp_socket_connect_async(). The connection can be canceled by calling gnet_tcp_socket_connect_async_cancel() with the ID.


enum GTcpSocketConnectAsyncStatus

typedef enum {
  GTCP_SOCKET_CONNECT_ASYNC_STATUS_OK,
  GTCP_SOCKET_CONNECT_ASYNC_STATUS_INETADDR_ERROR,
  GTCP_SOCKET_CONNECT_ASYNC_STATUS_TCP_ERROR
} GTcpSocketConnectAsyncStatus;

Status for connecting via gnet_tcp_socket_connect_async(), passed by GTcpSocketConnectAsyncFunc. More errors may be added in the future, so it's best to compare against GTCP_SOCKET_CONNECT_ASYNC_STATUS_OK.

GTCP_SOCKET_CONNECT_ASYNC_STATUS_OK Connection succeeded
GTCP_SOCKET_CONNECT_ASYNC_STATUS_INETADDR_ERROR Error, address lookup failed
GTCP_SOCKET_CONNECT_ASYNC_STATUS_TCP_ERROR Error, could not connect

GTcpSocketConnectAsyncFunc ()

void                (*GTcpSocketConnectAsyncFunc)       (GTcpSocket *socket,
                                                         GTcpSocketConnectAsyncStatus status,
                                                         gpointer data);

Callback for gnet_tcp_socket_connect_async().

socket : TcpSocket that was connecting (callee owned)
status : Status of the connection
data : User data

GTcpSocketNewAsyncID

typedef struct _GTcpSocketAsyncState * GTcpSocketNewAsyncID;

ID of an asynchronous tcp socket creation started with gnet_tcp_socket_new_async(). The creation can be canceled by calling gnet_tcp_socket_new_async_cancel() with the ID.


GTcpSocketNewAsyncFunc ()

void                (*GTcpSocketNewAsyncFunc)           (GTcpSocket *socket,
                                                         gpointer data);

Callback for gnet_tcp_socket_new_async(). The socket will be NULL if the connection failed.

socket : Socket that was connecting
data : User data

gnet_tcp_socket_connect ()

GTcpSocket*         gnet_tcp_socket_connect             (const gchar *hostname,
                                                         gint port);

Creates a GTcpSocket and connects to hostname:port. This function blocks (while gnet_tcp_socket_connect_async() does not). To get the GInetAddr of the GTcpSocket, call gnet_tcp_socket_get_remote_inetaddr().

hostname : host name
port : port
Returns : a new GTcpSocket; NULL on error.

gnet_tcp_socket_connect_async ()

GTcpSocketConnectAsyncID gnet_tcp_socket_connect_async  (const gchar *hostname,
                                                         gint port,
                                                         GTcpSocketConnectAsyncFunc func,
                                                         gpointer data);

Asynchronously creates a GTcpSocket and connects to hostname:port. The callback is called when the connection is made or an error occurs. The callback will not be called during the call to this function.

hostname : host name
port : port
func : callback function
data : data to pass to func on callback
Returns : the ID of the connection; NULL on failure. The ID can be used with gnet_tcp_socket_connect_async_cancel() to cancel the connection.

gnet_tcp_socket_connect_async_full ()

GTcpSocketConnectAsyncID gnet_tcp_socket_connect_async_full
                                                        (const gchar *hostname,
                                                         gint port,
                                                         GTcpSocketConnectAsyncFunc func,
                                                         gpointer data,
                                                         GDestroyNotify notify,
                                                         GMainContext *context,
                                                         gint priority);

Asynchronously creates a GTcpSocket and connects to hostname:port. The callback is called when the connection is made or an error occurs. The callback will not be called during the call to this function.

hostname : host name
port : port
func : callback function
data : data to pass to func on callback
notify : function to call to free data, or NULL
context : the GMainContext to use for notifications, or NULL for the default GLib main context. If in doubt, pass NULL.
priority : the priority with which to schedule notifications in the main context, e.g. G_PRIORITY_DEFAULT or G_PRIORITY_HIGH.
Returns : the ID of the connection; NULL on failure. The ID can be used with gnet_tcp_socket_connect_async_cancel() to cancel the connection.

Since 2.0.8


gnet_tcp_socket_connect_async_cancel ()

void                gnet_tcp_socket_connect_async_cancel
                                                        (GTcpSocketConnectAsyncID id);

Cancels an asynchronous connection that was started with gnet_tcp_socket_connect_async().

id : ID of the connection

gnet_tcp_socket_new ()

GTcpSocket*         gnet_tcp_socket_new                 (const GInetAddr *addr);

Creates a GTcpSocket and connects to addr. This function blocks. SOCKS is used if SOCKS is enabled.

addr : address
Returns : a new GTcpSocket; NULL on error.

gnet_tcp_socket_new_async ()

GTcpSocketNewAsyncID gnet_tcp_socket_new_async          (const GInetAddr *addr,
                                                         GTcpSocketNewAsyncFunc func,
                                                         gpointer data);

Asynchronously creates a GTcpSocket and connects to addr. The callback is called once the connection is made or an error occurs. The callback will not be called during the call to this function.

SOCKS is used if SOCKS is enabled. The SOCKS negotiation will block.

addr : address
func : callback function
data : data to pass to func on callback
Returns : the ID of the connection; NULL on failure. The ID can be used with gnet_tcp_socket_new_async_cancel() to cancel the connection.

gnet_tcp_socket_new_async_full ()

GTcpSocketNewAsyncID gnet_tcp_socket_new_async_full     (const GInetAddr *addr,
                                                         GTcpSocketNewAsyncFunc func,
                                                         gpointer data,
                                                         GDestroyNotify notify,
                                                         GMainContext *context,
                                                         gint priority);

Asynchronously creates a GTcpSocket and connects to addr. The callback is called once the connection is made or an error occurs. The callback will not be called during the call to this function.

SOCKS is used if SOCKS is enabled. The SOCKS negotiation will block.

addr : address
func : callback function
data : data to pass to func on callback
notify : function to call to free data, or NULL
context : the GMainContext to use for notifications, or NULL for the default GLib main context. If in doubt, pass NULL.
priority : the priority with which to schedule notifications in the main context, e.g. G_PRIORITY_DEFAULT or G_PRIORITY_HIGH.
Returns : the ID of the connection; NULL on failure. The ID can be used with gnet_tcp_socket_new_async_cancel() to cancel the connection.

Since 2.0.8


gnet_tcp_socket_new_async_cancel ()

void                gnet_tcp_socket_new_async_cancel    (GTcpSocketNewAsyncID id);

Cancels an asynchronous GTcpSocket creation that was started with gnet_tcp_socket_new_async().

id : ID of the connection

gnet_tcp_socket_delete ()

void                gnet_tcp_socket_delete              (GTcpSocket *socket);

Deletes a GTcpSocket.

socket : a GTcpSocket

gnet_tcp_socket_ref ()

void                gnet_tcp_socket_ref                 (GTcpSocket *socket);

Adds a reference to a GTcpSocket.

socket : a GTcpSocket

gnet_tcp_socket_unref ()

void                gnet_tcp_socket_unref               (GTcpSocket *socket);

Removes a reference from a GTcpSocket. A GTcpSocket is deleted when the reference count reaches 0.

socket : a GTcpSocket to unreference

gnet_tcp_socket_get_io_channel ()

GIOChannel*         gnet_tcp_socket_get_io_channel      (GTcpSocket *socket);

Gets the GIOChannel of a GTcpSocket.

For a client socket, the GIOChannel represents the data stream. Use it like you would any other GIOChannel.

For a server socket however, the GIOChannel represents the listening socket. When it's readable, there's a connection waiting to be accepted. However, using gnet_tcp_socket_server_accept_async() is more elegant than watching the GIOChannel.

Every GTcpSocket has one and only one GIOChannel. If you ref the channel, then you must unref it eventually. Do not close the channel. The channel is closed by GNet when the socket is deleted.

socket : a GTcpSocket
Returns : a GIOChannel.

gnet_tcp_socket_get_remote_inetaddr ()

GInetAddr*          gnet_tcp_socket_get_remote_inetaddr (const GTcpSocket *socket);

Gets the address of the remote host from a GTcpSocket. This function does not work on server sockets.

socket : a GTcpSocket
Returns : a GInetAddr.

gnet_tcp_socket_get_local_inetaddr ()

GInetAddr*          gnet_tcp_socket_get_local_inetaddr  (const GTcpSocket *socket);

Gets the local host's address from a GTcpSocket.

socket : a GTcpSocket
Returns : a GInetAddr, or NULL on error. Unref with gnet_inetaddr_unref() when no longer needed.

gnet_tcp_socket_get_port ()

gint                gnet_tcp_socket_get_port            (const GTcpSocket *socket);

Gets the port a server GTcpSocket is bound to.

socket : a GTcpSocket
Returns : the port number.

enum GNetTOS

typedef enum
{
  GNET_TOS_NONE,
  GNET_TOS_LOWDELAY,
  GNET_TOS_THROUGHPUT,
  GNET_TOS_RELIABILITY,
  GNET_TOS_LOWCOST

} GNetTOS;

Type-of-service.

GNET_TOS_NONE Unspecified
GNET_TOS_LOWDELAY Low delay
GNET_TOS_THROUGHPUT High throughput
GNET_TOS_RELIABILITY High reliability
GNET_TOS_LOWCOST Low cost

gnet_tcp_socket_set_tos ()

void                gnet_tcp_socket_set_tos             (GTcpSocket *socket,
                                                         GNetTOS tos);

Sets the type-of-service (TOS) of the socket. TOS theoretically controls the connection's quality of service, but most routers ignore it. Some systems don't even support this function. The function does nothing if the operating system does not support it.

socket : a GTcpSocket
tos : type of service

gnet_tcp_socket_server_new ()

GTcpSocket*         gnet_tcp_socket_server_new          (void);

Creates a new GTcpSocket bound to all interfaces and an arbitrary port. SOCKS is used if SOCKS is enabled.

Returns : a new GTcpSocket; NULL on error.

gnet_tcp_socket_server_new_with_port ()

GTcpSocket*         gnet_tcp_socket_server_new_with_port
                                                        (gint port);

Creates a new GTcpSocket bound to all interfaces and port port. If port is 0, an arbitrary port will be used. SOCKS is used if SOCKS is enabled.

port : port to bind to (0 for an arbitrary port)
Returns : a new GTcpSocket; NULL on error.

gnet_tcp_socket_server_new_full ()

GTcpSocket*         gnet_tcp_socket_server_new_full     (const GInetAddr *iface,
                                                         gint port);

Creates and new GTcpSocket bound to interface iface and port port. If iface is NULL, the socket is bound to all interfaces. If port is 0, the socket is bound to an arbitrary port. SOCKS is used if SOCKS is enabled and the interface is NULL.

iface : Interface to bind to (NULL for all interfaces)
port : Port to bind to (0 for an arbitrary port)
Returns : a new GTcpSocket; NULL on error.

gnet_tcp_socket_server_accept ()

GTcpSocket*         gnet_tcp_socket_server_accept       (GTcpSocket *socket);

Accepts a connection from a GTcpSocket. The socket must have been created using gnet_tcp_socket_server_new() (or equivalent). Even if the socket's GIOChannel is readable, the function may still block.

socket : a GTcpSocket
Returns : a new GTcpSocket representing a new connection; NULL on error.

gnet_tcp_socket_server_accept_nonblock ()

GTcpSocket*         gnet_tcp_socket_server_accept_nonblock
                                                        (GTcpSocket *socket);

Accepts a connection from a GTcpSocket without blocking. The socket must have been created using gnet_tcp_socket_server_new() (or equivalent).

Note that if the socket's GIOChannel is readable, then there is PROBABLY a new connection. It is possible for the connection to close by the time this function is called, so it may return NULL.

socket : a GTcpSocket
Returns : a new GTcpSocket representing a new connection; NULL otherwise.

GTcpSocketAcceptFunc ()

void                (*GTcpSocketAcceptFunc)             (GTcpSocket *server,
                                                         GTcpSocket *client,
                                                         gpointer data);

Callback for gnet_tcp_socket_server_accept_async(). The socket had an irrecoverable error if client_socket is NULL.

server : Server socket
client : Client socket
data : User data

gnet_tcp_socket_server_accept_async ()

void                gnet_tcp_socket_server_accept_async (GTcpSocket *socket,
                                                         GTcpSocketAcceptFunc accept_func,
                                                         gpointer user_data);

Asynchronously accepts a connection from a GTcpSocket. The callback is called when a new client has connected or an error occurs. The socket must have been created using gnet_tcp_socket_server_new() (or equivalent).

socket : a GTcpSocket
accept_func : callback function.
user_data : data to pass to func on callback

gnet_tcp_socket_server_accept_async_cancel ()

void                gnet_tcp_socket_server_accept_async_cancel
                                                        (GTcpSocket *socket);

Stops asynchronously accepting connections for a GTcpSocket. The socket is not closed.

socket : a GTcpSocket

gnet_tcp_socket_new_direct ()

GTcpSocket*         gnet_tcp_socket_new_direct          (const GInetAddr *addr);

Creates a GTcpSocket and connects to addr without using SOCKS. This function blocks. Most users should use gnet_tcp_socket_new().

addr : address
Returns : a new GTcpSocket; NULL on error.

gnet_tcp_socket_new_async_direct ()

GTcpSocketNewAsyncID gnet_tcp_socket_new_async_direct   (const GInetAddr *addr,
                                                         GTcpSocketNewAsyncFunc func,
                                                         gpointer data);

Asynchronously creates a GTcpSocket and connects to addr without using SOCKS. Most users should use gnet_tcp_socket_new_async() instead. The callback is called once the connection is made or an error occurs. The callback will not be called during the call to this function.

addr : address
func : callback function
data : data to pass to func on callback
Returns : the ID of the connection; NULL on failure. The ID can be used with gnet_tcp_socket_new_async_cancel() to cancel the connection.

gnet_tcp_socket_new_async_direct_full ()

GTcpSocketNewAsyncID gnet_tcp_socket_new_async_direct_full
                                                        (const GInetAddr *addr,
                                                         GTcpSocketNewAsyncFunc func,
                                                         gpointer data,
                                                         GDestroyNotify notify,
                                                         GMainContext *context,
                                                         gint priority);

Asynchronously creates a GTcpSocket and connects to addr without using SOCKS. Most users should use gnet_tcp_socket_new_async() instead. The callback is called once the connection is made or an error occurs. The callback will not be called during the call to this function.

addr : address
func : callback function
data : data to pass to func on callback
notify : function to call to free data, or NULL
context : the GMainContext to use for notifications, or NULL for the default GLib main context. If in doubt, pass NULL.
priority : the priority with which to schedule notifications in the main context, e.g. G_PRIORITY_DEFAULT or G_PRIORITY_HIGH.
Returns : the ID of the connection; NULL on failure. The ID can be used with gnet_tcp_socket_new_async_cancel() to cancel the connection.

Since 2.0.8

gnet-2.0.8/doc/html/gnet-developers-async.html0000644000175000017500000000704310751404362016222 00000000000000 Hiding blocking

Hiding blocking

Many GNet functions block. That is, they do not return immediately. For example gnet_inetaddr_new performs a DNS lookup that may take several seconds. This is acceptable for many programs. But, it is not tolerable in interactive GUI programs or high-performance servers.

There are two ways to hide blocking. The first is to use threads. GLib 2.0 includes thread support (GThread). The second method is to use asynchronous functions. Asynchronous functions return immediately and call a callback when the operation is completed. For example, gnet_inetaddr_new_async begins an asynchronous DNS lookup and returns immediately. When the lookup is complete, a callback is called with the GInetAddr. Most blocking function in GNet have an asynchronous counterpart.

To use GNet's asynchronous functions, you must also use the GLib main event loop. Most GTK and Gnome program already do this.

Another common blocking operation is reading or writing to a GIOChannel (a GLib object). g_io_channel_read blocks until there is data available to read. g_io_channel_write blocks until there is OS buffer space to write to. To determine when a GIOChannel can be read to or written from without blocking, use GLib's g_io_add_watch to set a watch. A callback is called when the GIOChannel becomes readable or writable. See the GLib documentation for more information and GNet's echoclient-async and echoserver-async for an example.

gnet-2.0.8/doc/html/gnet-developers-tips.html0000644000175000017500000000502610751404362016063 00000000000000 Tips and tricks

Tips and tricks

GNet was designed so that most of the implementation is hidden from the programmer. You should not have to include any network header files other than gnet.h.

By convention, integers are usually transfered in big-endian, or network-byte, order. GLib has conversion functions for shorts and ints: g_ntohs (network-to-host short), g_htons (host-to network short), g_ntohl (network-to-host long), and g_htonl (host-to-network long).

gnet-2.0.8/doc/html/gnet-udp.html0000644000175000017500000005652010751404362013533 00000000000000 UDP

UDP

UDP — UDP socket

Synopsis


#include <gnet.h>


                    GUdpSocket;
GUdpSocket*         gnet_udp_socket_new                 (void);
GUdpSocket*         gnet_udp_socket_new_with_port       (gint port);
GUdpSocket*         gnet_udp_socket_new_full            (const GInetAddr *iface,
                                                         gint port);
void                gnet_udp_socket_delete              (GUdpSocket *socket);
void                gnet_udp_socket_ref                 (GUdpSocket *socket);
void                gnet_udp_socket_unref               (GUdpSocket *socket);
gint                gnet_udp_socket_send                (GUdpSocket *socket,
                                                         const gchar *buffer,
                                                         gint length,
                                                         const GInetAddr *dst);
gint                gnet_udp_socket_receive             (GUdpSocket *socket,
                                                         gchar *buffer,
                                                         gint length,
                                                         GInetAddr **src);
gboolean            gnet_udp_socket_has_packet          (const GUdpSocket *socket);
GIOChannel*         gnet_udp_socket_get_io_channel      (GUdpSocket *socket);
GInetAddr*          gnet_udp_socket_get_local_inetaddr  (const GUdpSocket *socket);
gint                gnet_udp_socket_get_ttl             (const GUdpSocket *socket);
gint                gnet_udp_socket_set_ttl             (GUdpSocket *socket,
                                                         gint ttl);

Description

This module provides support for UDP sockets. UDP is an internet protocol that transfers packets by best-effort delivery. Packets may be lost or arrive out-of-order. Use TCP if your protocol requires data transfered reliably and in-order -- most do.

A UDP socket is represented by a GUdpSocket structure. To create a GUdpSocket, call gnet_udp_socket_new(), gnet_udp_socket_new_with_port(), or gnet_udp_socket_new_full().

To send a packet, call gnet_udp_socket_send(). To receive a packet, call gnet_udp_socket_receive(). gnet_udp_socket_send() will block if the OS cannot buffer the packet immediately. gnet_udp_socket_receive() will block until there is a packet available to receive. Call gnet_udp_socket_has_packet() to determine whether a packet is available immediately. A more elegant method is to get the GIOChannel and add a read watch. A callback will be called when a packet is available. Note that a UDP socket's GIOChannel is not a normal GIOChannel -- it should not be written to or read from directly.

Packets have a time-to-live (TTL) field. This field is decremented before a router forwards the packet. If the TTL reaches zero, the packet is dropped. The TTL can be set by calling gnet_udp_socket_get_ttl(). The default value is sufficient for most applications.

Details

GUdpSocket

typedef struct _GUdpSocket GUdpSocket;

A GUdpSocket structure represents a UDP socket. The implementation is hidden.


gnet_udp_socket_new ()

GUdpSocket*         gnet_udp_socket_new                 (void);

Creates a GUdpSocket bound to all interfaces and an arbitrary port.

Returns : a new GUdpSocket; NULL on error.

gnet_udp_socket_new_with_port ()

GUdpSocket*         gnet_udp_socket_new_with_port       (gint port);

Creates a GUdpSocket bound to all interfaces and port port. If port is 0, an arbitrary port will be used.

port : port to bind to (0 for an arbitrary port)
Returns : a new GUdpSocket; NULL on error.

gnet_udp_socket_new_full ()

GUdpSocket*         gnet_udp_socket_new_full            (const GInetAddr *iface,
                                                         gint port);

Creates a GUdpSocket bound to interface iface and port port. If iface is NULL, all interfaces will be used. If port is 0, an arbitrary port will be used.

iface : interface to bind to (NULL for all interfaces)
port : port to bind to (0 for an arbitrary port)
Returns : a new GUdpSocket; NULL on error.

gnet_udp_socket_delete ()

void                gnet_udp_socket_delete              (GUdpSocket *socket);

Deletes a GUdpSocket. Does nothing if socket is NULL.

socket : a GUdpSocket, or NULL

gnet_udp_socket_ref ()

void                gnet_udp_socket_ref                 (GUdpSocket *socket);

Adds a reference to a GUdpSocket.

socket : GUdpSocket to reference

gnet_udp_socket_unref ()

void                gnet_udp_socket_unref               (GUdpSocket *socket);

Removes a reference from a GUdpScoket. A GUdpSocket is deleted when the reference count reaches 0.

socket : a GUdpSocket

gnet_udp_socket_send ()

gint                gnet_udp_socket_send                (GUdpSocket *socket,
                                                         const gchar *buffer,
                                                         gint length,
                                                         const GInetAddr *dst);

Sends data to a host using a GUdpSocket.

socket : a GUdpSocket
buffer : buffer to send
length : length of buffer
dst : destination address
Returns : 0 if successful; something else on error.

gnet_udp_socket_receive ()

gint                gnet_udp_socket_receive             (GUdpSocket *socket,
                                                         gchar *buffer,
                                                         gint length,
                                                         GInetAddr **src);

Receives data using a GUdpSocket. If src is set, the source address is stored in the location src points to. The address is caller owned.

socket : a GUdpSocket
buffer : buffer to write to
length : length of buffer
src : pointer to source address (optional)
Returns : the number of bytes received, -1 on error.

gnet_udp_socket_has_packet ()

gboolean            gnet_udp_socket_has_packet          (const GUdpSocket *socket);

Tests if a GUdpSocket has a packet waiting to be received.

socket : a GUdpSocket
Returns : TRUE if there is packet waiting, FALSE otherwise.

gnet_udp_socket_get_io_channel ()

GIOChannel*         gnet_udp_socket_get_io_channel      (GUdpSocket *socket);

Gets the GIOChannel of a GUdpSocket.

Use the channel with g_io_add_watch() to check if the socket is readable or writable. If the channel is readable, call gnet_udp_socket_receive() to receive a packet. If the channel is writable, call gnet_udp_socket_send() to send a packet. This is not a normal giochannel - do not read from or write to it.

Every GUdpSocket has one and only one GIOChannel. If you ref the channel, then you must unref it eventually. Do not close the channel. The channel is closed by GNet when the socket is deleted.

Before deleting the UDP socket, make sure to remove any watches you have added with g_io_add_watch() again with g_source_remove() using the integer id returned by g_io_add_watch(). You may find your program stuck in a busy loop at 100% CPU utilisation if you forget to do this.

socket : a GUdpSocket
Returns : a GIOChannel.

gnet_udp_socket_get_local_inetaddr ()

GInetAddr*          gnet_udp_socket_get_local_inetaddr  (const GUdpSocket *socket);

Gets the local host's address from a GUdpSocket.

socket : a GUdpSocket
Returns : a GInetAddr.

gnet_udp_socket_get_ttl ()

gint                gnet_udp_socket_get_ttl             (const GUdpSocket *socket);

Gets the time-to-live (TTL) default of a GUdpSocket. All UDP packets have a TTL field. This field is decremented by a router before it forwards the packet. If the TTL reaches zero, the packet is discarded. The default value is sufficient for most applications.

socket : a GUdpSocket
Returns : the TTL (an integer between 0 and 255), -1 if the kernel default is being used, or an integer less than -1 on error.

gnet_udp_socket_set_ttl ()

gint                gnet_udp_socket_set_ttl             (GUdpSocket *socket,
                                                         gint ttl);

Sets the time-to-live (TTL) default of a GUdpSocket. Set the TTL to -1 to use the kernel default. The default value is sufficient for most applications.

socket : a GUdpSocket
ttl : value to set TTL to
Returns : 0 if successful.
gnet-2.0.8/doc/html/gnet-socks.html0000644000175000017500000002157410751404362014066 00000000000000 SOCKS

SOCKS

SOCKS — SOCKS proxy

Synopsis


#include <gnet.h>


#define             GNET_SOCKS_PORT
#define             GNET_SOCKS_VERSION
gboolean            gnet_socks_get_enabled              (void);
void                gnet_socks_set_enabled              (gboolean enabled);
GInetAddr*          gnet_socks_get_server               (void);
void                gnet_socks_set_server               (const GInetAddr *inetaddr);
gint                gnet_socks_get_version              (void);
void                gnet_socks_set_version              (gint version);

Description

SOCKS is a TCP proxy protocol. Typically, a host behind a firewall uses SOCKS to connect to hosts outside the firewall via a SOCKS proxy server. To open a TCP connection, a SOCKS client connects to a SOCKS server and the SOCKS server connects to the destination. Data is then forwarded between the client and the destination by the SOCKS server. GNet supports SOCKS versions 4 and 5. Version 5 includes support for server sockets.

SOCKS is used if the SOCKS_SERVER environment variable is set or gnet_socks_set_server() is called to set the SOCKS server's address. To disable SOCKS support, call gnet_socks_set_enabled() and pass FALSE. The SOCKS_VERSION environment variable controls which SOCKS version is used. The default is version 5.

Details

GNET_SOCKS_PORT

#define GNET_SOCKS_PORT 1080

Default port for the SOCKS protocol.


GNET_SOCKS_VERSION

#define GNET_SOCKS_VERSION 5

Default version of the SOCKS protocol.


gnet_socks_get_enabled ()

gboolean            gnet_socks_get_enabled              (void);

Determines whether SOCKS support is enabled.

Returns : TRUE if SOCKS is enabled, FALSE otherwise.

gnet_socks_set_enabled ()

void                gnet_socks_set_enabled              (gboolean enabled);

Sets whether SOCKS support is enabled.

enabled : is SOCKS support enabled?

gnet_socks_get_server ()

GInetAddr*          gnet_socks_get_server               (void);

Gets the address of the SOCKS server (regardless of whether SOCKS is enabled). This function checks the gnet_socks_set_server() value and, if not set, the SOCKS_SERVER environment variable. The SOCKS_SERVER enviroment variable should be in the form HOSTNAME or HOSTNAME:PORT.

Returns : a copy of the address; NULL if there is no server.

gnet_socks_set_server ()

void                gnet_socks_set_server               (const GInetAddr *inetaddr);

Sets the address of the SOCKS server.

inetaddr : SOCKS server address

gnet_socks_get_version ()

gint                gnet_socks_get_version              (void);

Gets the SOCKS version GNet uses. This function checks the gnet_socks_set_version() value and, if not set, the SOCKS_VERSION environment variable.

Returns : the SOCKS version.

gnet_socks_set_version ()

void                gnet_socks_set_version              (gint version);

Sets the SOCKS version GNet uses. GNet only supports versions 4 and 5.

version : SOCKS version
gnet-2.0.8/doc/html/gnet-unix.html0000644000175000017500000004461410751404362013727 00000000000000 Unix

Unix

Unix — Unix socket

Description

The Unix module provides support for Unix sockets. Unix sockets are used to communicate between processes. Unix sockets are for Unix operating systems only and are not supported in Windows. GNet's Unix sockets are stream-based (like TCP), not datagram-based (like UDP). Unix socket addresses are file names, like "/tmp/my_unix_socket".

To connect to a existing Unix socket, call gnet_unix_socket_new(). To create a new Unix socket other processes will connect to, call gnet_unix_socket_server_new().

The functions in this module are similar to those in the TCP module. See the documentation on TCP sockets for more information.

Details

GUnixSocket

typedef struct _GUnixSocket GUnixSocket;

A GUnixSocket structure represents a Unix socket. The implementation is hidden.


gnet_unix_socket_new ()

GUnixSocket*        gnet_unix_socket_new                (const gchar *path);

Creates a GUnixSocket and connects to path. This function will block to connect. Use this constructor to create a GUnixSocket for a client.

path : path
Returns : a new GUnixSocket; NULL on failure.

gnet_unix_socket_new_abstract ()

GUnixSocket*        gnet_unix_socket_new_abstract       (const gchar *path);

Creates a GUnixSocket and connects to path in the abstract unix socket domain. This function will block to connect. Use this constructor to create a GUnixSocket for a client.

If the abstract unix sockets are not available on the platform in use, this function will behave like gnet_unix_socket_new().

path : path
Returns : a new GUnixSocket, or NULL on failure.

Since 2.0.8


gnet_unix_socket_delete ()

void                gnet_unix_socket_delete             (GUnixSocket *socket);

Deletes a GUnixSocket.

socket : a GUnixSocket

gnet_unix_socket_ref ()

void                gnet_unix_socket_ref                (GUnixSocket *socket);

Adds a reference to a GUnixSocket.

socket : a GUnixSocket

gnet_unix_socket_unref ()

void                gnet_unix_socket_unref              (GUnixSocket *socket);

Removes a reference from a GUnixSocket. A GUnixSocket is deleted when the reference count reaches 0.

socket : a GUnixSocket

gnet_unix_socket_get_io_channel ()

GIOChannel*         gnet_unix_socket_get_io_channel     (GUnixSocket *socket);

Gets the GIOChannel of a GUnixSocket.

For a client socket, the GIOChannel represents the data stream. Use it like you would any other GIOChannel.

For a server socket, however, the GIOChannel represents the listening socket. When it's readable, there's a connection waiting to be accepted.

Every GUnixSocket has one and only one GIOChannel. If you ref the channel, then you must unref it eventually. Do not close the channel. The channel is closed by GNet when the socket is deleted.

socket : a GUnixSocket
Returns : a GIOChannel.

gnet_unix_socket_get_path ()

gchar*              gnet_unix_socket_get_path           (const GUnixSocket *socket);

Gets the path of a GUnixSocket.

socket : a GUnixSocket
Returns : the path.

gnet_unix_socket_server_new ()

GUnixSocket*        gnet_unix_socket_server_new         (const gchar *path);

Creates a GUnixSocket bound to path. Use this constructor to create a GUnixSocket for a server.

path : path
Returns : a new GUnixSocket; NULL on error.

gnet_unix_socket_server_new_abstract ()

GUnixSocket*        gnet_unix_socket_server_new_abstract
                                                        (const gchar *path);

Creates a GUnixSocket bound to path in the abstract unix socket domain. Use this constructor to create a GUnixSocket for a server.

If the abstract unix sockets are not available on the platform in use, this function will behave the same as gnet_unix_socket_server_new().

path : path
Returns : a new GUnixSocket, or NULL on error.

Since 2.0.8


gnet_unix_socket_server_accept ()

GUnixSocket*        gnet_unix_socket_server_accept      (const GUnixSocket *socket);

Accepts a connection from a GUnixSocket. The socket must have been created using gnet_unix_socket_server_new(). This function will block. Even if the socket's GIOChannel is readable, the function may still block.

socket : a GUnixSocket
Returns : a new GUnixSocket representing a new connection; NULL on error.

gnet_unix_socket_server_accept_nonblock ()

GUnixSocket*        gnet_unix_socket_server_accept_nonblock
                                                        (const GUnixSocket *socket);

Accepts a connection from a GUnixSocket without blocking. The socket must have been created using gnet_unix_socket_server_new().

Note that if the socket's GIOChannel is readable, then there is PROBABLY a new connection. It is possible for the connection to close by the time this function is called, so it may return NULL.

socket : a GUnixSocket
Returns : a new GUnixSocket representing a new connection; NULL otherwise.
gnet-2.0.8/doc/html/gnet-iochannel.html0000644000175000017500000003310410751404362014674 00000000000000 IOChannel

IOChannel

IOChannel — GIOChannel utility functions

Synopsis


#include <gnet.h>


GIOError            gnet_io_channel_writen              (GIOChannel *channel,
                                                         gpointer buffer,
                                                         gsize length,
                                                         gsize *bytes_writtenp);
GIOError            gnet_io_channel_readn               (GIOChannel *channel,
                                                         gpointer buffer,
                                                         gsize length,
                                                         gsize *bytes_readp);
GIOError            gnet_io_channel_readline            (GIOChannel *channel,
                                                         gchar *buffer,
                                                         gsize length,
                                                         gsize *bytes_readp);
GIOError            gnet_io_channel_readline_strdup     (GIOChannel *channel,
                                                         gchar **bufferp,
                                                         gsize *bytes_readp);

Description

The IOChannel module provides utility functions for reading from and writing to GIOChannels.

Details

gnet_io_channel_writen ()

GIOError            gnet_io_channel_writen              (GIOChannel *channel,
                                                         gpointer buffer,
                                                         gsize length,
                                                         gsize *bytes_writtenp);

Writes all length bytes in buffer to channel. If bytes_writtenp is set, the number of bytes written is stored in the integer it points to. bytes_writtenp will be less than length if the connection closed or an error occured.

This function is essentially a wrapper around g_io_channel_write(). The problem with g_io_channel_write() is that it may not write all the bytes and will return a short count even when there was not an error. This is rare, but possible, and often difficult to detect when it does happen.

channel : channel to write to
buffer : buffer to read from
length : length of buffer
bytes_writtenp : pointer to integer in which to store the number of bytes written
Returns : G_IO_ERROR_NONE if successful; something else otherwise. The number of bytes written is stored in the integer pointed to by bytes_writtenp.

gnet_io_channel_readn ()

GIOError            gnet_io_channel_readn               (GIOChannel *channel,
                                                         gpointer buffer,
                                                         gsize length,
                                                         gsize *bytes_readp);

Read exactly length bytes from channel into buffer. If bytes_readp is set, the number of bytes read is stored in the integer it points to. bytes_readp will be less than length if the end-of-file was reached or an error occured.

This function is essentially a wrapper around g_io_channel_read(). The problem with g_io_channel_read() is that it may not read all the bytes requested and will return a short count even when there was not an error (this is rare, but it can happen and is often difficult to detect when it does).

channel : channel to read from
buffer : buffer to write to
length : length of the buffer
bytes_readp : pointer to integer for the function to store the number of of bytes read
Returns : G_IO_ERROR_NONE if everything is ok; something else otherwise. Also, returns the number of bytes read by modifying the integer pointed to by bytes_readp.

gnet_io_channel_readline ()

GIOError            gnet_io_channel_readline            (GIOChannel *channel,
                                                         gchar *buffer,
                                                         gsize length,
                                                         gsize *bytes_readp);

Read a line from the channel. The line will be NULL-terminated and include the newline character. If there is not enough room for the line, the line is truncated to fit in the buffer.

Warnings:

1. If the buffer is full and the last character is not a newline, the line was truncated. Do not assume the buffer ends with a newline.

2. bytes_readp is the number of bytes put in the buffer. It includes the terminating NULL character.

3. NULL characters can appear in the line before the terminating NULL (e.g., "Hello world\0\n"). If this matters, check the string length of the buffer against the bytes read.

I hope this isn't too confusing. Usually the function works as you expect it to if you have a big enough buffer. If you have the Stevens book, you should be familiar with the semantics.

channel : channel to read from
buffer : buffer to write to
length : length of the buffer
bytes_readp : pointer to integer in which to store the number of of bytes read
Returns : G_IO_ERROR_NONE if everything is ok; something else otherwise. The number of bytes read is stored in the integer pointed to by bytes_readp (this number includes the newline). If an error is returned, the contents of buffer and bytes_readp are undefined.

gnet_io_channel_readline_strdup ()

GIOError            gnet_io_channel_readline_strdup     (GIOChannel *channel,
                                                         gchar **bufferp,
                                                         gsize *bytes_readp);

Read a line from the channel. The line will be null-terminated and include the newline character. Similarly to g_strdup_printf, a buffer large enough to hold the string will be allocated.

Warnings:

1. If the last character of the buffer is not a newline, the line was truncated by EOF. Do not assume the buffer ends with a newline.

2. bytes_readp is actually the number of bytes put in the buffer. It includes the terminating NULL character.

3. NULL characters can appear in the line before the terminating null (e.g., "Hello world\0\n"). If this matters, check the string length of the buffer against the bytes read.

channel : channel to read from
bufferp : pointer to gchar* in which to store the new buffer
bytes_readp : pointer to integer in which to store the number of of bytes read
Returns : G_IO_ERROR_NONE if everything is ok; something else otherwise. The number of bytes read is stored in the integer pointed to by bytes_readp (this number includes the newline). The data pointer is stored in the pointer pointed to by bufferp. This data is caller-owned. If an error is returned, the contents of bufferp and bytes_readp are undefined.
gnet-2.0.8/doc/html/gnet-ipv6.html0000644000175000017500000002137610751404362013630 00000000000000 IPv6

IPv6

IPv6 — IPv6 policy functions

Synopsis


#include <gnet.h>


enum                GIPv6Policy;
void                gnet_ipv6_set_policy                (GIPv6Policy policy);
GIPv6Policy         gnet_ipv6_get_policy                (void);

Description

The IPv6 module provides functions for setting and getting the "IPv6 policy". The IPv6 policy affects domain name resolution and server binding. The possible policies are: IPv4 only, IPv6 only, IPv4 then IPv6, and IPv6 then IPv4. GNet attempts to set the policy when gnet_init() is called based on two environment variables (if set) or on the host's interfaces. This can be overridden by calling gnet_ipv6_set_policy().

IPv6 policy affects domain name resolution. A domain name can be resolved to several addresses. Most programs will only use the first address in the list. The problem then is what order the addresses should be in. For example, if there are both IPv4 and IPv6 addresses in the list and the system cannot connect to IPv6 hosts then an IPv6 address should not be first in the list. Otherwise, the host will attempt to connect to it and fail. IPv6 policy determines the order of the list. If the policy is "IPv4 only", only IPv4 addresses will be returned. If the policy is "IPv6 then IPv4", IPv6 addresses will come before IPv4 addresses in the list.

IPv6 policy also affects server binding. When a server socket is created, GNet binds to the "any" address by default. There are IPv4 and IPv6 "any" addresses. GNet needs to know which one to use. If the IPv6 policy allows IPv6, GNet will use the IPv6 "any" address. If the IPv6 policy allows only IPv4, GNet will use the IPv4 "any" address.

GNet sets IPv6 policy in gnet_init(). First it checks two environment variables: GNET_IPV6_POLICY and IPV6_POLICY. If either is set, it uses the value to set IPv6 policy. Set the value to "4" for GIPV6_POLICY_IPV4_ONLY, "6" for GIPV6_POLICY_IPV6_ONLY, "46" for GIPV6_POLICY_IPV4_THEN_IPV6, or "64" for GIPV6_POLICY_IPV6_THEN_IPV4.

If neither environment variable is set, GNet sets the policy based on the host's interfaces. If there are only IPv4 interfaces, the policy is set to GIPV6_POLICY_IPV4_ONLY. If there are only IPv6 interfaces, the policy is set to GIPV6_POLICY_IPV6_ONLY. If there are both, the policy is set to GIPV6_POLICY_IPV4_THEN_IPV6.

At runtime on Windows, GNet will check to see the computer can support IPv6. If so it will set the policy to GIPV6_POLICY_IPV4_THEN_IPV6. If not it will set the policy to GIPV6_POLICY_IPV4_ONLY. Environment variables are not checked on Windows.

Details

enum GIPv6Policy

typedef enum {
  GIPV6_POLICY_IPV4_THEN_IPV6,
  GIPV6_POLICY_IPV6_THEN_IPV4,
  GIPV6_POLICY_IPV4_ONLY,
  GIPV6_POLICY_IPV6_ONLY
} GIPv6Policy;

Policy for IPv6 use in GNet. This affects domain name resolution and server binding. gnet_init() attempts to set a reasonable default based on environment variables or the interfaces available on the host.

GIPV6_POLICY_IPV4_THEN_IPV6 Use IPv4, then IPv6
GIPV6_POLICY_IPV6_THEN_IPV4 Use IPv6, then IPv4
GIPV6_POLICY_IPV4_ONLY Use IPv4 only
GIPV6_POLICY_IPV6_ONLY Use IPv6 only

gnet_ipv6_set_policy ()

void                gnet_ipv6_set_policy                (GIPv6Policy policy);

Sets the IPv6 policy.

policy : IPv6 policy

gnet_ipv6_get_policy ()

GIPv6Policy         gnet_ipv6_get_policy                (void);

Gets the IPv6 policy.

Returns : IPv6 policy.
gnet-2.0.8/doc/html/left.png0000644000175000017500000000071310751404362012553 00000000000000PNG  IHDRw=bKGD pHYs  ~tIME1&[(XIDATx!OPE*ID%~ꊯ"p'ŏ`sܖrKf hmiIz}ܯI.p\`x l?l[,Hk<#c%\AUx[S7n6rzEs1j@NL$ݤi0 5/}\EKIo͓$a0jdFbkIAh>WlC'?tk;|/t*INZ^`y4Nr]׮ J<ڐt`X1@p䀸dZ')hK $V?%]+LsgUK"w53OIENDB`gnet-2.0.8/doc/html/gnet-developers.html0000644000175000017500000000615710751404362015114 00000000000000 GNet for developers

GNet for developers

Compiling programs with GNet

If you are a developer and you want to use GNet in your program, you can use the pkg-config script to figure out which flags need to set when compiling. For example, type gcc main.c `pkg-config --cflags --libs gnet-2.0` to compile the program main.c with GNet and link it to GNet. Note that those are backticks, not apostrophes.

If you use autoconf and automake, you can the pkg-config macros to set the appropriate variables. Just add this to your configure.in:

PKG_CHECK_MODULES(GNET, gnet-2.0 > 2.0.0,
  [LIBS="$LIBS $GNET_LIBS" CFLAGS="$CFLAGS $GNET_CFLAGS"],
  AC_MSG_ERROR(Cannot find GNet: do you have the GNet development packages installed?))
	

gnet-2.0.8/doc/html/gnet-conn.html0000644000175000017500000014124110751404362013673 00000000000000 Conn

Conn

Conn — TCP connection object

Synopsis


#include <gnet.h>


                    GConn;
                    GConnEvent;
enum                GConnEventType;
void                (*GConnFunc)                        (GConn *conn,
                                                         GConnEvent *event,
                                                         gpointer user_data);
GConn*              gnet_conn_new                       (const gchar *hostname,
                                                         gint port,
                                                         GConnFunc func,
                                                         gpointer user_data);
GConn*              gnet_conn_new_inetaddr              (const GInetAddr *inetaddr,
                                                         GConnFunc func,
                                                         gpointer user_data);
GConn*              gnet_conn_new_socket                (GTcpSocket *socket,
                                                         GConnFunc func,
                                                         gpointer user_data);
void                gnet_conn_delete                    (GConn *conn);
void                gnet_conn_ref                       (GConn *conn);
void                gnet_conn_unref                     (GConn *conn);
void                gnet_conn_set_callback              (GConn *conn,
                                                         GConnFunc func,
                                                         gpointer user_data);
gboolean            gnet_conn_set_main_context          (GConn *conn,
                                                         GMainContext *context);
void                gnet_conn_connect                   (GConn *conn);
void                gnet_conn_disconnect                (GConn *conn);
gboolean            gnet_conn_is_connected              (const GConn *conn);
void                gnet_conn_read                      (GConn *conn);
void                gnet_conn_readn                     (GConn *conn,
                                                         gint length);
void                gnet_conn_readline                  (GConn *conn);
void                gnet_conn_write                     (GConn *conn,
                                                         gchar *buffer,
                                                         gint length);
void                gnet_conn_write_direct              (GConn *conn,
                                                         gchar *buffer,
                                                         gint length,
                                                         GDestroyNotify buffer_destroy_cb);
void                gnet_conn_set_watch_error           (GConn *conn,
                                                         gboolean enable);
void                gnet_conn_set_watch_readable        (GConn *conn,
                                                         gboolean enable);
void                gnet_conn_set_watch_writable        (GConn *conn,
                                                         gboolean enable);
void                gnet_conn_timeout                   (GConn *conn,
                                                         guint timeout);

Description

A GConn represents a TCP connection. A GConn is usually created directly by the user by calling gnet_conn_new() or gnet_conn_new_inetaddr(). To connect to the remote host, call gnet_conn_connect() and to disconnect call gnet_conn_disconnect(). You may use the same GConn to connect again to the host after you disconnected. Free the GConn with gnet_conn_unref() or gnet_conn_delete() when no longer needed.

GConns are also created by a GServer when a client connects. You will need to call gnet_conn_set_callback() to set the GConn callback after it is created by the GServer. A GConn that has been created by a GServer is already connect, you don't have to call gnet_conn_connect() in this case. Call gnet_conn_unref() or gnet_conn_delete() to disconnect the remote client and free the GConn.

The iochannel field and GIOChannel functions can be used to read from or write to the socket. GIOChannel functions block. To make an asynchronous read call gnet_conn_read() and to make an asynchronous write call gnet_conn_write(). The callback is called whenever a read or write completes.

Special use cases (you usually do not need this): use gnet_conn_set_watch_error() to get an event if an error occurs. Use gnet_conn_set_watch_readable() and gnet_conn_set_watch_writable() to get events when the connection is readable or writable. These can be used to implement custom I/O handling for cases where gnet_conn_read(), gnet_conn_write() and gnet_conn_write_direct() are not suitable. For example, consider writing from a mmap()'ed file. gnet_conn_write() will allocate memory for a buffer and copy part of the file into the buffer. To avoid the copy, use gnet_conn_set_watch_writable() to catch the writable event and then write directly from memory to the socket (note: this is obsolete, you can now use gnet_conn_write_direct() for this).

gnet_conn_timeout() sets a timeout on the GConn. The GNET_CONN_TIMEOUT event occurs when the timer expires. For example, the timer may be set before connecting to the host. If the connection is made, the GNET_CONN_CONNECT event occurs. The timer can then be reset by setting the timeout to 0. Otherwise, the GNET_CONN_TIMEOUT event will eventually occur.

Details

GConn

typedef struct {
  /* Public */
  gchar*			hostname;
  gint				port;

  GIOChannel* 			iochannel;
  GTcpSocket* 			socket;
  GInetAddr*			inetaddr;


  /* Private */
  guint				ref_count;
  guint				ref_count_internal;

  /* Connect */
  GTcpSocketConnectAsyncID 	connect_id;
  GTcpSocketNewAsyncID 		new_id;

  /* Write */
  GList*			write_queue;
  guint				bytes_written;

  /* Read */
  gchar* 			buffer;
  guint 			length;
  guint 			bytes_read;
  gboolean			read_eof;
  GList*			read_queue;
  guint				process_buffer_timeout;

  /* Readable/writable */
  gboolean			watch_readable;
  gboolean			watch_writable;

  /* IO watch */
  guint				watch_flags;
  guint				watch;

  /* Timer */
  guint				timer;

  /* User data */
  GConnFunc			func;
  gpointer			user_data;

  GMainContext                * context;
  gint                          priority;
} GConn;

TCP Connection. Some of the fields are public, but do not set these fields.

gchar *hostname; host name
gint port; port
GIOChannel *iochannel; IO channel
GTcpSocket *socket; socket
GInetAddr *inetaddr; address
guint ref_count; [private]
guint ref_count_internal; [private]
GTcpSocketConnectAsyncID connect_id; [private]
GTcpSocketNewAsyncID new_id; [private]
GList *write_queue; [private]
guint bytes_written; [private]
gchar *buffer; [private]
guint length; [private]
guint bytes_read; [private]
gboolean read_eof; [private]
GList *read_queue; [private]
guint process_buffer_timeout; [private]
gboolean watch_readable; [private]
gboolean watch_writable; [private]
guint watch_flags; [private]
guint watch; [private]
guint timer; [private]
GConnFunc func; [private]
gpointer user_data; [private]
GMainContext *context;
gint priority;

GConnEvent

typedef struct {
  GConnEventType type;
  gchar*	 buffer;
  gint		 length;
} GConnEvent;

GConn Event. buffer and length are set only on GNET_CONN_READ events. The buffer is caller-owned.

GConnEventType type; event type
gchar *buffer; buffer
gint length; buffer length

enum GConnEventType

typedef enum {
  GNET_CONN_ERROR,
  GNET_CONN_CONNECT,
  GNET_CONN_CLOSE,
  GNET_CONN_TIMEOUT,
  GNET_CONN_READ,
  GNET_CONN_WRITE,
  GNET_CONN_READABLE,
  GNET_CONN_WRITABLE
} GConnEventType;

Event type. Used by GConnEvent.

GNET_CONN_ERROR Connection error
GNET_CONN_CONNECT Connection complete
GNET_CONN_CLOSE Connection closed
GNET_CONN_TIMEOUT Timeout
GNET_CONN_READ Read complete
GNET_CONN_WRITE Write complete
GNET_CONN_READABLE Connection is readable
GNET_CONN_WRITABLE Connection is writable

GConnFunc ()

void                (*GConnFunc)                        (GConn *conn,
                                                         GConnEvent *event,
                                                         gpointer user_data);

Callback for GConn.

Possible events:

GNET_CONN_ERROR: GConn error. The event occurs if the connection fails somehow. The connection is closed before this event occurs.

GNET_CONN_CONNECT: Completion of gnet_conn_connect().

GNET_CONN_CLOSE: Connection has been closed. The event does not occur as a result of calling gnet_conn_disconnect(), gnet_conn_unref(), or gnet_conn_delete().

GNET_CONN_TIMEOUT: Timer set by gnet_conn_timeout() expires.

GNET_CONN_READ: Data has been read. This event occurs as a result of calling gnet_conn_read(), gnet_conn_readn(), or gnet_conn_readline(). buffer and length are set in the event object. The buffer is caller owned.

GNET_CONN_WRITE: Data has been written. This event occurs as a result of calling gnet_conn_write() or gnet_conn_write_direct().

GNET_CONN_READABLE: The connection is readable.

GNET_CONN_WRITABLE: The connection is writable.

conn : GConn
event : event (caller owned)
user_data : user data specified in gnet_conn_new()

gnet_conn_new ()

GConn*              gnet_conn_new                       (const gchar *hostname,
                                                         gint port,
                                                         GConnFunc func,
                                                         gpointer user_data);

Creates a GConn. A connection is not made until gnet_conn_connect() is called. The callback func is called when events occur.

hostname : name of host to connect to
port : port to connect to
func : function to call on GConn events
user_data : data to pass to func on callbacks
Returns : a GConn.

gnet_conn_new_inetaddr ()

GConn*              gnet_conn_new_inetaddr              (const GInetAddr *inetaddr,
                                                         GConnFunc func,
                                                         gpointer user_data);

Creates a GConn. A connection is not made until gnet_conn_connect() is called. The callback func is called when events occur.

inetaddr : address of host to connect to
func : function to call on GConn events
user_data : data to pass to func on callbacks
Returns : a GConn.

gnet_conn_new_socket ()

GConn*              gnet_conn_new_socket                (GTcpSocket *socket,
                                                         GConnFunc func,
                                                         gpointer user_data);

Creates a GConn. The GConn is created from the socket. The socket is callee owned - do not delete it (meaning: GConn will take ownership of the socket). The callback is called when events occur.

socket : TCP Socket (callee owned)
func : function to call on GConn events
user_data : data to pass to func on callbacks
Returns : a GConn.

gnet_conn_delete ()

void                gnet_conn_delete                    (GConn *conn);

Warning

gnet_conn_delete is deprecated and should not be used in newly-written code. Use g_conn_unref(), which does the same.

Deletes a GConn.

conn : a GConn

gnet_conn_ref ()

void                gnet_conn_ref                       (GConn *conn);

Adds a reference to a GConn.

conn : a GConn

gnet_conn_unref ()

void                gnet_conn_unref                     (GConn *conn);

Removes a reference from a GConn. A GConn is deleted when the reference count reaches 0.

conn : a GConn

gnet_conn_set_callback ()

void                gnet_conn_set_callback              (GConn *conn,
                                                         GConnFunc func,
                                                         gpointer user_data);

Sets the GConnEvent callback for a GConn. The callback func is called when events occur.

conn : a GConn
func : function to call on GConn events
user_data : data to pass to func on callbacks

gnet_conn_set_main_context ()

gboolean            gnet_conn_set_main_context          (GConn *conn,
                                                         GMainContext *context);

Sets the GLib GMainContext to use for asynchronous operations. You should call this function right after you create conn. You must not call this function after the actual connection process has started or watches have been set up (e.g. for reading, writing or errors).

You are very unlikely to ever need this function.

conn : a GConn
context : a GMainContext, or NULL to use the default GLib main context
Returns : TRUE on success, FALSE on failure.

Since 2.0.8


gnet_conn_connect ()

void                gnet_conn_connect                   (GConn *conn);

Establishes a connection. If the connection is pending or already established, this function does nothing. The callback is called when the connection is established or an error occurs.

conn : a GConn

gnet_conn_disconnect ()

void                gnet_conn_disconnect                (GConn *conn);

Closes the connection. The connection can later be reestablished by calling gnet_conn_connect() again. If the connection was not established, this function does nothing.

conn : a GConn

gnet_conn_is_connected ()

gboolean            gnet_conn_is_connected              (const GConn *conn);

Checks if the connection is established.

conn : a GConn
Returns : TRUE if the connection is established, FALSE otherwise.

gnet_conn_read ()

void                gnet_conn_read                      (GConn *conn);

Begins an asynchronous read. The connection callback is called when any data has been read. This function may be called again before the asynchronous read completes.

conn : a GConn

gnet_conn_readn ()

void                gnet_conn_readn                     (GConn *conn,
                                                         gint length);

Begins an asynchronous read of exactly length bytes. The connection callback is called when the data has been read. This function may be called again before the asynchronous read completes.

conn : a GConn
length : Number of bytes to read

gnet_conn_readline ()

void                gnet_conn_readline                  (GConn *conn);

Begins an asynchronous line read. The connection callback is called when a line has been read. Lines are terminated with \n, \r, \r\n, or \0. The terminator is \0'ed out in the buffer. The terminating \0 is accounted for in the buffer length. This function may be called again before the asynchronous read completes.

conn : a GConn

gnet_conn_write ()

void                gnet_conn_write                     (GConn *conn,
                                                         gchar *buffer,
                                                         gint length);

Sets up an asynchronous write to conn from buffer. The buffer is copied, so it may be deleted by the caller. This function can be called again before the asynchronous write completes.

conn : a GConn
buffer : buffer to write from
length : length of buffer

gnet_conn_write_direct ()

void                gnet_conn_write_direct              (GConn *conn,
                                                         gchar *buffer,
                                                         gint length,
                                                         GDestroyNotify buffer_destroy_cb);

Sets up an asynchronous write to conn from buffer. The buffer is created by the caller and will not be copied. The caller needs to make sure the buffer stays valid until buffer_destroy_cb is called. This function can be called again before the asynchronous write completes. buffer_destroy_cb may be NULL.

conn : a GConn
buffer : buffer to write from
length : length of buffer
buffer_destroy_cb : function to call when buffer is no longer needed

gnet_conn_set_watch_error ()

void                gnet_conn_set_watch_error           (GConn *conn,
                                                         gboolean enable);

Enables (or disables) the GNET_CONN_ERROR event for a GConn. If enabled, the GNET_CONN_ERROR event occurs when an error occurs. The conn is disconnected before the callback is made.

conn : a GConn
enable : enable the GNET_CONN_READABLE event?

gnet_conn_set_watch_readable ()

void                gnet_conn_set_watch_readable        (GConn *conn,
                                                         gboolean enable);

Enables (or disables) the GNET_CONN_READABLE event for a GConn. If enabled, the GNET_CONN_READABLE event occurs when data can be read from the socket. Read from the iochannel member of the conn. Do not enable this while using gnet_conn_read(), gnet_conn_readn(), or gnet_conn_readline().

conn : a GConn
enable : enable the GNET_CONN_READABLE event?

gnet_conn_set_watch_writable ()

void                gnet_conn_set_watch_writable        (GConn *conn,
                                                         gboolean enable);

Enables (or disables) the GNET_CONN_WRITABLE event for a GConn. If enabled, the GNET_CONN_WRITABLE event occurs when data can be written to the socket. Write to the iochannel member of the conn. Do not enable this while using gnet_conn_write().

conn : a GConn
enable : enable the GNET_CONN_WRITABLE event?

gnet_conn_timeout ()

void                gnet_conn_timeout                   (GConn *conn,
                                                         guint timeout);

Sets a timeout on a GConn. When the timer expires, the GNET_CONN_STATUS_TIMEOUT event occurs. If there already is a timeout set on conn, the old timeout is canceled. Set timeout to 0 to cancel the current timeout.

conn : a GConn
timeout : Timeout (in milliseconds)

See Also

See also GServer and the echoclient-gconn example.

gnet-2.0.8/config.h.in0000644000175000017500000001201610751327170011425 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define if building on Apple Darwin */ #undef GNET_APPLE_DARWIN /* GNet binary age */ #undef GNET_BINARY_AGE /* Whether to run tests using the external network */ #undef GNET_ENABLE_NETWORK_TESTS /* GNet interface age */ #undef GNET_INTERFACE_AGE /* GNet major version */ #undef GNET_MAJOR_VERSION /* GNet micro version */ #undef GNET_MICRO_VERSION /* GNet minor version */ #undef GNET_MINOR_VERSION /* Name of sockaddr_storage family field */ #undef GNET_SOCKADDR_FAMILY_FIELD_NAME /* Define when compiling on Windows */ #undef GNET_WIN32 /* Have abstract socket namespace */ #undef HAVE_ABSTRACT_SOCKETS /* Define if the host CPU is an Alpha */ #undef HAVE_CPU_ALPHA /* Define if the host CPU is an ARM */ #undef HAVE_CPU_ARM /* Define if the host CPU is a CRIS */ #undef HAVE_CPU_CRIS /* Define if the host CPU is a CRISv32 */ #undef HAVE_CPU_CRISV32 /* Define if the host CPU is a HPPA */ #undef HAVE_CPU_HPPA /* Define if the host CPU is an x86 */ #undef HAVE_CPU_I386 /* Define if the host CPU is a IA64 */ #undef HAVE_CPU_IA64 /* Define if the host CPU is a M68K */ #undef HAVE_CPU_M68K /* Define if the host CPU is a MIPS */ #undef HAVE_CPU_MIPS /* Define if the host CPU is a PowerPC */ #undef HAVE_CPU_PPC /* Define if the host CPU is a 64 bit PowerPC */ #undef HAVE_CPU_PPC64 /* Define if the host CPU is a S390 */ #undef HAVE_CPU_S390 /* Define if the host CPU is a SPARC */ #undef HAVE_CPU_SPARC /* Define if the host CPU is a x86_64 */ #undef HAVE_CPU_X86_64 /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define if getaddrinfo() is available */ #undef HAVE_GETADDRINFO /* Define if getaddrinfo requires a mutex for thread-safety */ #undef HAVE_GETADDRINFO_GLIB_MUTEX /* Define if getaddrinfo is threadsafe */ #undef HAVE_GETADDRINFO_THREADSAFE /* Define if glibc variant of gethostbyname() is available */ #undef HAVE_GETHOSTBYNAME_R_GLIBC /* Define if gethostbyname requires a mutex for thread-safety */ #undef HAVE_GETHOSTBYNAME_R_GLIB_MUTEX /* Define if HPUX variant of gethostbyname() is available */ #undef HAVE_GETHOSTBYNAME_R_HPUX /* Define if Solaris variant of gethostbyname() is available */ #undef HAVE_GETHOSTBYNAME_R_SOLARIS /* Define if gethostbyname is threadsafe */ #undef HAVE_GETHOSTBYNAME_THREADSAFE /* Define if getifaddrs() is available */ #undef HAVE_GETIFADDRS /* Define to 1 if you have the header file. */ #undef HAVE_IFADDRS_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define if IPv6 is potentially available */ #undef HAVE_IPV6 /* Define to 1 if you have the `nsl' library (-lnsl). */ #undef HAVE_LIBNSL /* Define to 1 if you have the `resolv' library (-lresolv). */ #undef HAVE_LIBRESOLV /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET /* Define if linux/netlink.h header exists */ #undef HAVE_LINUX_NETLINK_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define if RDTSC is available */ #undef HAVE_RDTSC /* Define if struct sockaddr has sa_len field */ #undef HAVE_SOCKADDR_SA_LEN /* Whether you have struct sockaddr_storage */ #undef HAVE_SOCKADDR_STORAGE /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKIO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Whether valgrind headers are available */ #undef HAVE_VALGRIND /* the host CPU */ #undef HOST_CPU /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of `void*', as computed by sizeof. */ #undef SIZEOF_VOIDP /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Defined if system has no socklen_t type */ #undef socklen_t gnet-2.0.8/COPYING0000644000175000017500000004725210751326732010452 00000000000000 GNet COPYING ------------ GNet is licensed under the GNU LGPL. A copy is provided below. ---------------------------------------------------------------------- GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA. Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! gnet-2.0.8/install-sh0000755000175000017500000002202110535563747011417 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: gnet-2.0.8/examples/0000777000175000017500000000000010751404362011303 500000000000000gnet-2.0.8/examples/hash.c0000644000175000017500000000570710751326732012323 00000000000000/* Computes SHA and MD5 of given file * Copyright (C) 2000 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include #include int main (int argc, char* argv[]) { gchar* filename; FILE* file; gchar* buffer; gint length; struct stat filestat; gchar* str; GMD5* md5; GMD5* md5b; GSHA* sha; GSHA* shab; gnet_init (); /* ******************** */ if (argc != 2) { fprintf (stderr, "Usage: hash \n"); exit (EXIT_FAILURE); } filename = argv[1]; /* Open file */ file = fopen (filename, "rb"); g_assert (file); length = fstat(fileno(file), &filestat); g_assert (length == 0); length = filestat.st_size; g_assert (length >= 0); if (length) { buffer = g_malloc (length); g_assert (fread (buffer, length, 1, file) == 1); } else buffer = NULL; fclose (file); /* Reminder that on windows, text files have extra "\r" in them where as on *NIX they do not. This will throw off SHA & MD5 if you don't filter the extra characters out before calling those functions. */ /* **************************************** */ /* Create MD5 */ md5 = gnet_md5_new (buffer, length); g_assert (md5); /* Get string */ str = gnet_md5_get_string (md5); g_assert (str); g_print ("%s MD5: %s\n", filename, str); /* Create MD5 from string */ md5b = gnet_md5_new_string (str); g_assert (md5b); g_free (str); /* Check if equal */ g_assert (gnet_md5_equal (md5, md5b)); gnet_md5_delete (md5); gnet_md5_delete (md5b); /* **************************************** */ /* Create SHA */ sha = gnet_sha_new (buffer, length); g_assert (sha); /* Get string */ str = gnet_sha_get_string (sha); g_assert (str); g_print ("%s SHA: %s\n", filename, str); /* Create SHA from string */ shab = gnet_sha_new_string (str); g_assert (shab); g_free (str); /* Check if equal */ g_assert (gnet_sha_equal (sha, shab)); gnet_sha_delete (sha); gnet_sha_delete (shab); /* **************************************** */ if (buffer) g_free (buffer); /* **************************************** */ exit (EXIT_SUCCESS); return 0; } gnet-2.0.8/examples/echoclient-udp.c0000644000175000017500000000442610751326732014300 00000000000000/* Echo client (UDP) * Copyright (C) 2000 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include static void usage (int status); int main(int argc, char** argv) { gchar* hostname; gint port; GInetAddr* addr = NULL; GUdpSocket* socket = NULL; gint ttl; gint rv; gchar buffer[1024]; guint n; gnet_init (); if (argc != 3) usage (EXIT_FAILURE); hostname = argv[argc-2]; port = atoi(argv[argc-1]); /* Create the address */ addr = gnet_inetaddr_new (hostname, port); g_assert (addr != NULL); /* Create the socket */ socket = gnet_udp_socket_new (); g_assert (socket != NULL); /* Get the TTL */ ttl = gnet_udp_socket_get_ttl (socket); g_assert (ttl >= -1); /* Set the TTL to 64 (the default on many systems) */ rv = gnet_udp_socket_set_ttl (socket, 64); g_assert (rv == 0); /* Make sure that worked */ ttl = gnet_udp_socket_get_ttl (socket); g_assert (ttl == 64); while (fgets(buffer, sizeof(buffer), stdin) != 0) { gint rv; /* Send packet */ n = strlen(buffer); rv = gnet_udp_socket_send (socket, buffer, n, addr); g_assert (rv == 0); /* Receive packet */ n = gnet_udp_socket_receive (socket, buffer, sizeof(buffer), NULL); if (n == -1) break; /* Write out */ fwrite (buffer, n, 1, stdout); } gnet_inetaddr_delete (addr); gnet_udp_socket_delete (socket); return 0; } static void usage (int status) { g_print ("usage: echoclient-udp \n"); exit(status); } gnet-2.0.8/examples/echoclient-async.c0000644000175000017500000001256010751326732014623 00000000000000/* Echo client (async TCP) * Copyright (C) 2000-2003 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include static void async_client_connfunc (GTcpSocket* socket, GTcpSocketConnectAsyncStatus status, gpointer data); static gboolean async_client_sin_iofunc (GIOChannel* iochannel, GIOCondition condition, gpointer data); static gboolean async_client_in_iofunc (GIOChannel* iochannel, GIOCondition condition, gpointer data); static GIOChannel* async_in; static GIOChannel* async_sin; static GTcpSocket* async_socket; static int lines_pending = 0; static gboolean read_eof = FALSE; int main(int argc, char** argv) { gchar* hostname; gint port; GMainLoop* main_loop; gnet_init (); /* Parse args */ if (argc != 3) { g_print ("usage: %s \n", argv[0]); exit(EXIT_FAILURE); } hostname = argv[1]; port = atoi(argv[2]); /* Create the main loop */ main_loop = g_main_new (FALSE); /* Connect asynchronously */ gnet_tcp_socket_connect_async (hostname, port, async_client_connfunc, NULL); /* Start the main loop */ g_main_run (main_loop); exit (EXIT_SUCCESS); return 0; } static void async_client_connfunc (GTcpSocket* socket, GTcpSocketConnectAsyncStatus status, gpointer data) { if (status != GTCP_SOCKET_CONNECT_ASYNC_STATUS_OK) { fprintf (stderr, "Error: Could not connect (status = %d)\n", status); exit (EXIT_FAILURE); } async_socket = socket; /* Read from socket */ async_sin = gnet_tcp_socket_get_io_channel (socket); g_io_add_watch (async_sin, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL, async_client_sin_iofunc, NULL); /* Read from stdin */ async_in = g_io_channel_unix_new (fileno(stdin)); g_io_add_watch (async_in, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL, async_client_in_iofunc, async_sin); } #include /* FIX */ static gboolean async_client_sin_iofunc (GIOChannel* iochannel, GIOCondition condition, gpointer data) { /* fprintf (stderr, "async_client_sin_iofunc %d\n", condition); */ /* IN/HUP/ERR */ /* Check for socket error */ if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) { fprintf (stderr, "Error: Socket error (%d, %d)\n", condition, errno); goto error; } /* Check for data to be read */ if (condition & G_IO_IN) { GIOError error; gchar buffer[1024]; gsize bytes_read; /* Read the data into our buffer */ error = g_io_channel_read (iochannel, buffer, sizeof(buffer), &bytes_read); /* Check for stdin error */ if (error != G_IO_ERROR_NONE) { fprintf (stderr, "Error: Read error (%d)\n", error); goto error; } /* Check for EOF */ else if (bytes_read == 0) { gnet_tcp_socket_delete (async_socket); exit (EXIT_SUCCESS); return FALSE; } /* Otherwise, print */ else { gint i; fwrite (buffer, 1, bytes_read, stdout); for (i = 0; i < bytes_read; ++i) if (buffer[i] == '\n') lines_pending--; if (lines_pending == 0 && read_eof) exit (EXIT_SUCCESS); } } return TRUE; error: exit (EXIT_FAILURE); return FALSE; } static gboolean async_client_in_iofunc (GIOChannel* iochannel, GIOCondition condition, gpointer data) { /* fprintf (stderr, "async_client_in_iofunc %d\n", condition); */ /* Check for input error (we check HUP last) */ if (condition & (G_IO_ERR | G_IO_NVAL)) { fprintf (stderr, "Error: Input error\n"); goto error; } /* Check for data to be read (or if the stdin was closed (?)) */ if (condition & G_IO_IN) { GIOError error; gchar buffer[1024]; gsize bytes_read; /* Read the data into our buffer */ error = gnet_io_channel_readline (iochannel, buffer, sizeof(buffer), &bytes_read); /* Check for stdin error */ if (error != G_IO_ERROR_NONE) { fprintf (stderr, "Error: Read error (%d)\n", error); goto error; } /* Check for EOF */ else if (bytes_read == 0) { if (lines_pending == 0) exit (EXIT_SUCCESS); else read_eof = TRUE; return FALSE; } /* Otherwise, write to the socket */ else { GIOChannel* sin; GIOError error; gsize bytes_written; sin = (GIOChannel*) data; error = gnet_io_channel_writen (sin, buffer, bytes_read, &bytes_written); /* g_print ("# write %d\n", bytes_written); */ g_assert (error == G_IO_ERROR_NONE); g_assert (bytes_written == bytes_read); lines_pending++; } } if (condition & G_IO_HUP) goto error; return TRUE; error: exit (EXIT_FAILURE); return FALSE; } gnet-2.0.8/examples/echoclient-gconn.c0000644000175000017500000001030310751326732014603 00000000000000/* Echo client (GConn TCP) * Copyright (C) 2000-2003 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include static gboolean ob_in_iofunc (GIOChannel* iochannel, GIOCondition condition, gpointer data); static void ob_conn_func (GConn* conn, GConnEvent* event, gpointer user_data); static int lines_pending = 0; static gboolean read_eof = FALSE; int main(int argc, char** argv) { gchar* hostname; gint port; GMainLoop* main_loop; GConn* conn; GIOChannel* in; gnet_init (); /* Parse args */ if (argc != 3) { g_print ("usage: %s \n", argv[0]); exit(EXIT_FAILURE); } hostname = argv[1]; port = atoi(argv[2]); /* Create the main loop */ main_loop = g_main_new(FALSE); /* Create connection object */ conn = gnet_conn_new (hostname, port, ob_conn_func, NULL); g_assert (conn); /* Connect */ gnet_conn_connect (conn); gnet_conn_set_watch_error (conn, TRUE); gnet_conn_timeout (conn, 30000); /* 30 second timeout */ /* Read from stdin */ in = g_io_channel_unix_new (fileno(stdin)); g_io_add_watch(in, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL, ob_in_iofunc, conn); /* Start the main loop */ g_main_run (main_loop); exit (EXIT_SUCCESS); return 0; } /* Read line from stdin asynchronously */ static gboolean ob_in_iofunc (GIOChannel* iochannel, GIOCondition condition, gpointer data) { GConn* conn = (GConn*) data; /* Check for socket error */ if (condition & G_IO_ERR) { fprintf (stderr, "Error: Socket error\n"); goto error; } /* Check for data to be read (or if the stdin was closed (?)) */ if (condition & G_IO_IN) { GIOError error; gchar buffer[1024]; gsize bytes_read; /* Read the data into our buffer */ error = gnet_io_channel_readline (iochannel, buffer, sizeof(buffer), &bytes_read); /* Check for stdin error */ if (error != G_IO_ERROR_NONE) { fprintf (stderr, "Read error (%d)\n", error); goto error; } /* Check for EOF */ else if (bytes_read == 0) { if (lines_pending == 0) exit (EXIT_SUCCESS); else read_eof = TRUE; return FALSE; } /* Otherwise, we read something */ else { gnet_conn_write (conn, buffer, bytes_read); lines_pending++; } } return TRUE; error: exit (EXIT_FAILURE); return FALSE; } /* Handle GConn events */ static void ob_conn_func (GConn* conn, GConnEvent* event, gpointer user_data) { switch (event->type) { case GNET_CONN_CONNECT: { gnet_conn_timeout (conn, 0); /* reset timeout */ gnet_conn_readline (conn); break; } case GNET_CONN_READ: { /* Write line out */ event->buffer[event->length - 1] = '\n'; fwrite (event->buffer, event->length, 1, stdout); /* Check if done */ lines_pending--; if (lines_pending == 0 && read_eof) exit (EXIT_SUCCESS); /* Read another line */ gnet_conn_readline (conn); break; } case GNET_CONN_WRITE: { ; /* do nothing */ break; } case GNET_CONN_CLOSE: { gnet_conn_delete (conn); exit (EXIT_SUCCESS); break; } case GNET_CONN_TIMEOUT: { gnet_conn_delete (conn); fprintf (stderr, "Connection timeout\n"); exit (EXIT_FAILURE); break; } case GNET_CONN_ERROR: { gnet_conn_delete (conn); fprintf (stderr, "Connection failure\n"); exit (EXIT_FAILURE); break; } default: g_assert_not_reached (); } } gnet-2.0.8/examples/echoclient-unix.c0000644000175000017500000000607710751326732014477 00000000000000/* Unix Socket Echo client * Copyright (C) 2001 Mark Ferlatte * Adapted from echoclient.c, Copyright (C) 2000 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include typedef enum { NORMAL, ASYNC} ClientType; static void usage (int status); static void normal_echoclient (gchar* path, gboolean abstract); static void async_echoclient (gchar* path, gboolean abstract); int main(int argc, char** argv) { ClientType client_type = NORMAL; gboolean abstract = FALSE; gnet_init (); if (argc < 2) usage(EXIT_FAILURE); if (argc > 2) { if (strcmp(argv[1], "--async") == 0 || strcmp(argv[2], "--async") == 0) client_type = ASYNC; if (strcmp(argv[1], "--abstract") == 0 || strcmp(argv[2], "--abstract") == 0) abstract = TRUE; } switch (client_type) { case NORMAL: /* output would confuse our testing scripts */ /* g_print ("Normal echo client running\n"); */ normal_echoclient(argv[argc - 1], abstract); break; case ASYNC: g_print ("Asynchronous echo client running (UNFINISHED)\n"); async_echoclient(argv[argc - 1], abstract); break; default: g_assert_not_reached(); } return 0; } static void usage (int status) { g_print ("usage: echoclient [(nothing)|--async| --abstract] \n"); exit(status); } static void normal_echoclient(gchar* path, gboolean abstract) { GUnixSocket *socket = NULL; GIOChannel* iochannel = NULL; gchar buffer[1024]; gsize n; GIOError e = G_IO_ERROR_NONE; g_assert(path != NULL); /* Create the socket */ if (abstract) socket = gnet_unix_socket_new_abstract(path); else socket = gnet_unix_socket_new(path); g_assert (socket != NULL); /* Get the IOChannel */ iochannel = gnet_unix_socket_get_io_channel(socket); g_assert (iochannel != NULL); while (fgets(buffer, sizeof(buffer), stdin) != 0) { n = strlen(buffer); e = gnet_io_channel_writen(iochannel, buffer, n, &n); if (e != G_IO_ERROR_NONE) break; e = gnet_io_channel_readn(iochannel, buffer, n, &n); if (e != G_IO_ERROR_NONE) break; fwrite(buffer, n, 1, stdout); } if (e != G_IO_ERROR_NONE) g_print ("IO error (%d)\n", e); return; } static void async_echoclient(gchar *path, gboolean abstract) { g_print("Sorry, there is no async echoclient yet.\n"); return; } gnet-2.0.8/examples/Makefile.in0000644000175000017500000007075010751327171013277 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ @OS_WIN32_FALSE@noinst_PROGRAMS = echoclient$(EXEEXT) \ @OS_WIN32_FALSE@ echoserver$(EXEEXT) echoclient-async$(EXEEXT) \ @OS_WIN32_FALSE@ echoserver-async$(EXEEXT) \ @OS_WIN32_FALSE@ echoclient-gconn$(EXEEXT) \ @OS_WIN32_FALSE@ echoserver-gserver$(EXEEXT) \ @OS_WIN32_FALSE@ echoclient-udp$(EXEEXT) \ @OS_WIN32_FALSE@ echoserver-udp$(EXEEXT) \ @OS_WIN32_FALSE@ echoclient-unix$(EXEEXT) \ @OS_WIN32_FALSE@ echoserver-unix$(EXEEXT) dnslookup$(EXEEXT) \ @OS_WIN32_FALSE@ hash$(EXEEXT) hfetch$(EXEEXT) \ @OS_WIN32_FALSE@ hostinfo$(EXEEXT) sdr$(EXEEXT) @OS_WIN32_TRUE@noinst_PROGRAMS = echoclient$(EXEEXT) \ @OS_WIN32_TRUE@ echoserver$(EXEEXT) echoclient-async$(EXEEXT) \ @OS_WIN32_TRUE@ echoserver-async$(EXEEXT) \ @OS_WIN32_TRUE@ echoclient-gconn$(EXEEXT) \ @OS_WIN32_TRUE@ echoserver-gserver$(EXEEXT) \ @OS_WIN32_TRUE@ echoclient-udp$(EXEEXT) echoserver-udp$(EXEEXT) \ @OS_WIN32_TRUE@ dnslookup$(EXEEXT) hash$(EXEEXT) \ @OS_WIN32_TRUE@ hfetch$(EXEEXT) hostinfo$(EXEEXT) sdr$(EXEEXT) subdir = examples DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/gnet-arch.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = PROGRAMS = $(noinst_PROGRAMS) am_dnslookup_OBJECTS = dnslookup.$(OBJEXT) dnslookup_OBJECTS = $(am_dnslookup_OBJECTS) dnslookup_LDADD = $(LDADD) dnslookup_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_echoclient_OBJECTS = echoclient.$(OBJEXT) echoclient_OBJECTS = $(am_echoclient_OBJECTS) echoclient_LDADD = $(LDADD) echoclient_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_echoclient_async_OBJECTS = echoclient-async.$(OBJEXT) echoclient_async_OBJECTS = $(am_echoclient_async_OBJECTS) echoclient_async_LDADD = $(LDADD) echoclient_async_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_echoclient_gconn_OBJECTS = echoclient-gconn.$(OBJEXT) echoclient_gconn_OBJECTS = $(am_echoclient_gconn_OBJECTS) echoclient_gconn_LDADD = $(LDADD) echoclient_gconn_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_echoclient_udp_OBJECTS = echoclient-udp.$(OBJEXT) echoclient_udp_OBJECTS = $(am_echoclient_udp_OBJECTS) echoclient_udp_LDADD = $(LDADD) echoclient_udp_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_echoclient_unix_OBJECTS = echoclient-unix.$(OBJEXT) echoclient_unix_OBJECTS = $(am_echoclient_unix_OBJECTS) echoclient_unix_LDADD = $(LDADD) echoclient_unix_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_echoserver_OBJECTS = echoserver.$(OBJEXT) echoserver_OBJECTS = $(am_echoserver_OBJECTS) echoserver_LDADD = $(LDADD) echoserver_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_echoserver_async_OBJECTS = echoserver-async.$(OBJEXT) echoserver_async_OBJECTS = $(am_echoserver_async_OBJECTS) echoserver_async_LDADD = $(LDADD) echoserver_async_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_echoserver_gserver_OBJECTS = echoserver-gserver.$(OBJEXT) echoserver_gserver_OBJECTS = $(am_echoserver_gserver_OBJECTS) echoserver_gserver_LDADD = $(LDADD) echoserver_gserver_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_echoserver_udp_OBJECTS = echoserver-udp.$(OBJEXT) echoserver_udp_OBJECTS = $(am_echoserver_udp_OBJECTS) echoserver_udp_LDADD = $(LDADD) echoserver_udp_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_echoserver_unix_OBJECTS = echoserver-unix.$(OBJEXT) echoserver_unix_OBJECTS = $(am_echoserver_unix_OBJECTS) echoserver_unix_LDADD = $(LDADD) echoserver_unix_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_hash_OBJECTS = hash.$(OBJEXT) hash_OBJECTS = $(am_hash_OBJECTS) hash_LDADD = $(LDADD) hash_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_hfetch_OBJECTS = hfetch.$(OBJEXT) hfetch_OBJECTS = $(am_hfetch_OBJECTS) hfetch_LDADD = $(LDADD) hfetch_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la hostinfo_SOURCES = hostinfo.c hostinfo_OBJECTS = hostinfo.$(OBJEXT) hostinfo_LDADD = $(LDADD) hostinfo_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_sdr_OBJECTS = sdr.$(OBJEXT) sdr_OBJECTS = $(am_sdr_OBJECTS) sdr_LDADD = $(LDADD) sdr_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(dnslookup_SOURCES) $(echoclient_SOURCES) \ $(echoclient_async_SOURCES) $(echoclient_gconn_SOURCES) \ $(echoclient_udp_SOURCES) $(echoclient_unix_SOURCES) \ $(echoserver_SOURCES) $(echoserver_async_SOURCES) \ $(echoserver_gserver_SOURCES) $(echoserver_udp_SOURCES) \ $(echoserver_unix_SOURCES) $(hash_SOURCES) $(hfetch_SOURCES) \ hostinfo.c $(sdr_SOURCES) DIST_SOURCES = $(dnslookup_SOURCES) $(echoclient_SOURCES) \ $(echoclient_async_SOURCES) $(echoclient_gconn_SOURCES) \ $(echoclient_udp_SOURCES) $(echoclient_unix_SOURCES) \ $(echoserver_SOURCES) $(echoserver_async_SOURCES) \ $(echoserver_gserver_SOURCES) $(echoserver_udp_SOURCES) \ $(echoserver_unix_SOURCES) $(hash_SOURCES) $(hfetch_SOURCES) \ hostinfo.c $(sdr_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHECK_CFLAGS = @CHECK_CFLAGS@ CHECK_LIBS = @CHECK_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_GTK_DOC_FALSE = @ENABLE_GTK_DOC_FALSE@ ENABLE_GTK_DOC_TRUE = @ENABLE_GTK_DOC_TRUE@ ENABLE_NETWORK_TESTS_FALSE = @ENABLE_NETWORK_TESTS_FALSE@ ENABLE_NETWORK_TESTS_TRUE = @ENABLE_NETWORK_TESTS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GNET_BINARY_AGE = @GNET_BINARY_AGE@ GNET_DEBUG_FLAGS = @GNET_DEBUG_FLAGS@ GNET_GCOV_ENABLED_FALSE = @GNET_GCOV_ENABLED_FALSE@ GNET_GCOV_ENABLED_TRUE = @GNET_GCOV_ENABLED_TRUE@ GNET_INTERFACE_AGE = @GNET_INTERFACE_AGE@ GNET_MAJOR_VERSION = @GNET_MAJOR_VERSION@ GNET_MICRO_VERSION = @GNET_MICRO_VERSION@ GNET_MINOR_VERSION = @GNET_MINOR_VERSION@ GNET_VERSION = @GNET_VERSION@ GREP = @GREP@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ HAVE_CPU_ALPHA_FALSE = @HAVE_CPU_ALPHA_FALSE@ HAVE_CPU_ALPHA_TRUE = @HAVE_CPU_ALPHA_TRUE@ HAVE_CPU_ARM_FALSE = @HAVE_CPU_ARM_FALSE@ HAVE_CPU_ARM_TRUE = @HAVE_CPU_ARM_TRUE@ HAVE_CPU_CRISV32_FALSE = @HAVE_CPU_CRISV32_FALSE@ HAVE_CPU_CRISV32_TRUE = @HAVE_CPU_CRISV32_TRUE@ HAVE_CPU_CRIS_FALSE = @HAVE_CPU_CRIS_FALSE@ HAVE_CPU_CRIS_TRUE = @HAVE_CPU_CRIS_TRUE@ HAVE_CPU_HPPA_FALSE = @HAVE_CPU_HPPA_FALSE@ HAVE_CPU_HPPA_TRUE = @HAVE_CPU_HPPA_TRUE@ HAVE_CPU_I386_FALSE = @HAVE_CPU_I386_FALSE@ HAVE_CPU_I386_TRUE = @HAVE_CPU_I386_TRUE@ HAVE_CPU_IA64_FALSE = @HAVE_CPU_IA64_FALSE@ HAVE_CPU_IA64_TRUE = @HAVE_CPU_IA64_TRUE@ HAVE_CPU_M68K_FALSE = @HAVE_CPU_M68K_FALSE@ HAVE_CPU_M68K_TRUE = @HAVE_CPU_M68K_TRUE@ HAVE_CPU_MIPS_FALSE = @HAVE_CPU_MIPS_FALSE@ HAVE_CPU_MIPS_TRUE = @HAVE_CPU_MIPS_TRUE@ HAVE_CPU_PPC64_FALSE = @HAVE_CPU_PPC64_FALSE@ HAVE_CPU_PPC64_TRUE = @HAVE_CPU_PPC64_TRUE@ HAVE_CPU_PPC_FALSE = @HAVE_CPU_PPC_FALSE@ HAVE_CPU_PPC_TRUE = @HAVE_CPU_PPC_TRUE@ HAVE_CPU_S390_FALSE = @HAVE_CPU_S390_FALSE@ HAVE_CPU_S390_TRUE = @HAVE_CPU_S390_TRUE@ HAVE_CPU_SPARC_FALSE = @HAVE_CPU_SPARC_FALSE@ HAVE_CPU_SPARC_TRUE = @HAVE_CPU_SPARC_TRUE@ HAVE_CPU_X86_64_FALSE = @HAVE_CPU_X86_64_FALSE@ HAVE_CPU_X86_64_TRUE = @HAVE_CPU_X86_64_TRUE@ HAVE_VALGRIND_FALSE = @HAVE_VALGRIND_FALSE@ HAVE_VALGRIND_TRUE = @HAVE_VALGRIND_TRUE@ HTML_DIR = @HTML_DIR@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_WIN32_FALSE = @OS_WIN32_FALSE@ OS_WIN32_TRUE = @OS_WIN32_TRUE@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ VALGRIND_LIBS = @VALGRIND_LIBS@ VALGRIND_PATH = @VALGRIND_PATH@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ SUBDIRS = xmlrpc CLEANFILES = $(EXTRA_PROGRAMS) AM_CFLAGS = $(GLIB_CFLAGS) $(GTHREAD_CFLAGS) INCLUDES = -I$(top_srcdir)/src LDADD = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la ########## echoclient_SOURCES = echoclient.c echoserver_SOURCES = echoserver.c echoclient_async_SOURCES = echoclient-async.c echoserver_async_SOURCES = echoserver-async.c echoclient_gconn_SOURCES = echoclient-gconn.c echoserver_gserver_SOURCES = echoserver-gserver.c echoclient_udp_SOURCES = echoclient-udp.c echoserver_udp_SOURCES = echoserver-udp.c echoclient_unix_SOURCES = echoclient-unix.c echoserver_unix_SOURCES = echoserver-unix.c dnslookup_SOURCES = dnslookup.c hash_SOURCES = hash.c hfetch_SOURCES = hfetch.c sdr_SOURCES = sdr.c all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu examples/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done dnslookup$(EXEEXT): $(dnslookup_OBJECTS) $(dnslookup_DEPENDENCIES) @rm -f dnslookup$(EXEEXT) $(LINK) $(dnslookup_LDFLAGS) $(dnslookup_OBJECTS) $(dnslookup_LDADD) $(LIBS) echoclient$(EXEEXT): $(echoclient_OBJECTS) $(echoclient_DEPENDENCIES) @rm -f echoclient$(EXEEXT) $(LINK) $(echoclient_LDFLAGS) $(echoclient_OBJECTS) $(echoclient_LDADD) $(LIBS) echoclient-async$(EXEEXT): $(echoclient_async_OBJECTS) $(echoclient_async_DEPENDENCIES) @rm -f echoclient-async$(EXEEXT) $(LINK) $(echoclient_async_LDFLAGS) $(echoclient_async_OBJECTS) $(echoclient_async_LDADD) $(LIBS) echoclient-gconn$(EXEEXT): $(echoclient_gconn_OBJECTS) $(echoclient_gconn_DEPENDENCIES) @rm -f echoclient-gconn$(EXEEXT) $(LINK) $(echoclient_gconn_LDFLAGS) $(echoclient_gconn_OBJECTS) $(echoclient_gconn_LDADD) $(LIBS) echoclient-udp$(EXEEXT): $(echoclient_udp_OBJECTS) $(echoclient_udp_DEPENDENCIES) @rm -f echoclient-udp$(EXEEXT) $(LINK) $(echoclient_udp_LDFLAGS) $(echoclient_udp_OBJECTS) $(echoclient_udp_LDADD) $(LIBS) echoclient-unix$(EXEEXT): $(echoclient_unix_OBJECTS) $(echoclient_unix_DEPENDENCIES) @rm -f echoclient-unix$(EXEEXT) $(LINK) $(echoclient_unix_LDFLAGS) $(echoclient_unix_OBJECTS) $(echoclient_unix_LDADD) $(LIBS) echoserver$(EXEEXT): $(echoserver_OBJECTS) $(echoserver_DEPENDENCIES) @rm -f echoserver$(EXEEXT) $(LINK) $(echoserver_LDFLAGS) $(echoserver_OBJECTS) $(echoserver_LDADD) $(LIBS) echoserver-async$(EXEEXT): $(echoserver_async_OBJECTS) $(echoserver_async_DEPENDENCIES) @rm -f echoserver-async$(EXEEXT) $(LINK) $(echoserver_async_LDFLAGS) $(echoserver_async_OBJECTS) $(echoserver_async_LDADD) $(LIBS) echoserver-gserver$(EXEEXT): $(echoserver_gserver_OBJECTS) $(echoserver_gserver_DEPENDENCIES) @rm -f echoserver-gserver$(EXEEXT) $(LINK) $(echoserver_gserver_LDFLAGS) $(echoserver_gserver_OBJECTS) $(echoserver_gserver_LDADD) $(LIBS) echoserver-udp$(EXEEXT): $(echoserver_udp_OBJECTS) $(echoserver_udp_DEPENDENCIES) @rm -f echoserver-udp$(EXEEXT) $(LINK) $(echoserver_udp_LDFLAGS) $(echoserver_udp_OBJECTS) $(echoserver_udp_LDADD) $(LIBS) echoserver-unix$(EXEEXT): $(echoserver_unix_OBJECTS) $(echoserver_unix_DEPENDENCIES) @rm -f echoserver-unix$(EXEEXT) $(LINK) $(echoserver_unix_LDFLAGS) $(echoserver_unix_OBJECTS) $(echoserver_unix_LDADD) $(LIBS) hash$(EXEEXT): $(hash_OBJECTS) $(hash_DEPENDENCIES) @rm -f hash$(EXEEXT) $(LINK) $(hash_LDFLAGS) $(hash_OBJECTS) $(hash_LDADD) $(LIBS) hfetch$(EXEEXT): $(hfetch_OBJECTS) $(hfetch_DEPENDENCIES) @rm -f hfetch$(EXEEXT) $(LINK) $(hfetch_LDFLAGS) $(hfetch_OBJECTS) $(hfetch_LDADD) $(LIBS) hostinfo$(EXEEXT): $(hostinfo_OBJECTS) $(hostinfo_DEPENDENCIES) @rm -f hostinfo$(EXEEXT) $(LINK) $(hostinfo_LDFLAGS) $(hostinfo_OBJECTS) $(hostinfo_LDADD) $(LIBS) sdr$(EXEEXT): $(sdr_OBJECTS) $(sdr_DEPENDENCIES) @rm -f sdr$(EXEEXT) $(LINK) $(sdr_LDFLAGS) $(sdr_OBJECTS) $(sdr_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dnslookup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/echoclient-async.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/echoclient-gconn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/echoclient-udp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/echoclient-unix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/echoclient.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/echoserver-async.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/echoserver-gserver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/echoserver-udp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/echoserver-unix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/echoserver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hfetch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostinfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdr.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(PROGRAMS) installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ clean clean-generic clean-libtool clean-noinstPROGRAMS \ clean-recursive ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-recursive distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am uninstall-info-am @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gnet-2.0.8/examples/Makefile.am0000644000175000017500000000257410751326732013267 00000000000000## Process this file with automake to produce Makefile.in @SET_MAKE@ SUBDIRS = xmlrpc if OS_WIN32 noinst_PROGRAMS = echoclient echoserver \ echoclient-async echoserver-async \ echoclient-gconn echoserver-gserver \ echoclient-udp echoserver-udp \ dnslookup hash hfetch hostinfo sdr else noinst_PROGRAMS = echoclient echoserver \ echoclient-async echoserver-async \ echoclient-gconn echoserver-gserver \ echoclient-udp echoserver-udp \ echoclient-unix echoserver-unix \ dnslookup hash hfetch hostinfo sdr endif CLEANFILES = $(EXTRA_PROGRAMS) AM_CFLAGS = $(GLIB_CFLAGS) $(GTHREAD_CFLAGS) INCLUDES = -I$(top_srcdir)/src LDADD = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la ########## echoclient_SOURCES = echoclient.c echoserver_SOURCES = echoserver.c echoclient_async_SOURCES = echoclient-async.c echoserver_async_SOURCES = echoserver-async.c echoclient_gconn_SOURCES = echoclient-gconn.c echoserver_gserver_SOURCES = echoserver-gserver.c echoclient_udp_SOURCES = echoclient-udp.c echoserver_udp_SOURCES = echoserver-udp.c echoclient_unix_SOURCES = echoclient-unix.c echoserver_unix_SOURCES = echoserver-unix.c dnslookup_SOURCES = dnslookup.c hash_SOURCES = hash.c hfetch_SOURCES = hfetch.c sdr_SOURCES = sdr.c gnet-2.0.8/examples/hfetch.c0000644000175000017500000000657710751326732012647 00000000000000/* Hfetch - Download a file from a web server. * Copyright (C) 2000 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include #define DELIM ":/" void usage(void); void hfetch(gchar* server, gint port, gchar* filename); int main(int argc, char** argv) { gchar* server = NULL; gchar* port_str = NULL; gint port = 80; gchar* filename = NULL; gchar* p = NULL; gnet_init (); if (argc != 2) { usage(); exit(EXIT_FAILURE); } p = argv[1]; /* Strip off the prefix */ if (strncmp("http://", p, sizeof("http://") - 1) == 0) { p = &p[sizeof("http://") - 1]; } /* Read in the server */ server = p; while (*p != 0 && *p != ':' && *p != '/') ++p; if ((p - server) == 0) { usage(); exit(EXIT_FAILURE); } server = g_strndup(server, p - server); /* Read in the port */ if (*p == ':') { port_str = ++p; while (*p != 0 && *p != '/') ++p; if ((p - port_str) == 0) { usage(); exit(EXIT_FAILURE); } port_str = g_strndup(port_str, p - port_str); port = atoi(port_str); } /* Read in the file */ if (*p == 0) { filename = g_strdup("/"); } else { filename = g_strdup(p); } /* g_print ("url = %s\n", argv[1]); */ /* g_print ("server = %s\n", server); */ /* g_print ("port = %d\n", port); */ /* g_print ("file = %s\n", filename); */ hfetch(server, port, filename); g_free(server); g_free(port_str); g_free(filename); return 0; } void usage(void) { g_print ("usage: hfetch \n"); } void hfetch(gchar* server, gint port, gchar* filename) { GInetAddr* addr; GTcpSocket* socket; GIOChannel* iochannel; gchar* command; gchar buffer[1024]; GIOError error; gsize n; /* Create the address */ addr = gnet_inetaddr_new(server, port); g_assert (addr != NULL); /* Create the socket */ socket = gnet_tcp_socket_new(addr); gnet_inetaddr_delete (addr); g_assert (socket != NULL); /* Get the IOChannel */ iochannel = gnet_tcp_socket_get_io_channel(socket); g_assert (iochannel != NULL); /* Send the command */ command = g_strconcat("GET ", filename, "\n", NULL); error = gnet_io_channel_writen(iochannel, command, strlen(command), &n); g_free(command); if (error != G_IO_ERROR_NONE) { g_warning("Write error: %d\n", error); } /* Read the output */ while (1) { error = g_io_channel_read(iochannel, buffer, sizeof(buffer), &n); if (error != G_IO_ERROR_NONE) { g_warning("Read error: %d\n", error); break; } if (n == 0) break; fwrite(buffer, n, 1, stdout); } gnet_tcp_socket_delete(socket); } gnet-2.0.8/examples/echoserver-unix.c0000644000175000017500000001644310751326732014525 00000000000000/* Unix socket Echo server * Copyright (C) 2001 Mark Ferlatte * Adapted from echoserver.c, Copyright (C) 2000 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include #include typedef enum { NORMAL, ASYNC} ServerType; void cleanup_on_sig(int signum); static void usage(int status); static void normal_echoserver(gchar *path, gboolean abstract); static void async_echoserver(gchar *path, gboolean abstract); GUnixSocket *server; int main(int argc, char** argv) { gchar *path = NULL; ServerType server_type = NORMAL; gboolean abstract = FALSE; gnet_init (); if (argc < 2) { usage(EXIT_FAILURE); } if (argc > 2) { if (strcmp(argv[1], "--async") == 0 || strcmp(argv[2], "--async") == 0) server_type = ASYNC; if (strcmp(argv[1], "--abstract") == 0 || strcmp(argv[2], "--abstract") == 0) abstract = TRUE; } path = g_strdup (argv[argc - 1]); signal(SIGINT, cleanup_on_sig); signal(SIGTERM, cleanup_on_sig); switch (server_type) { case NORMAL: g_print("Normal echo server running\n"); normal_echoserver(path, abstract); break; case ASYNC: g_print("Async echo server running\n"); async_echoserver(path, abstract); break; default: g_assert_not_reached(); } return 0; } static void usage(int status) { g_print("usage: echoserver-unix [(nothing)|--async| --abstract] \n"); exit(status); } void cleanup_on_sig(int signum) { gnet_unix_socket_delete(server); exit(EXIT_SUCCESS); } static void normal_echoserver(gchar *path, gboolean abstract) { GUnixSocket *client = NULL; gchar buffer[1024]; gsize n; GIOChannel *ioclient = NULL; GIOError e; g_assert(path != NULL); /* Create the server */ if (abstract) server = gnet_unix_socket_server_new_abstract(path); else server = gnet_unix_socket_server_new(path); g_assert(server != NULL); while ((client = gnet_unix_socket_server_accept(server)) != NULL) { ioclient = gnet_unix_socket_get_io_channel(client); g_assert(ioclient != NULL); while ((e = gnet_io_channel_readline(ioclient, buffer, sizeof(buffer), &n)) == G_IO_ERROR_NONE && (n > 0)) { e = gnet_io_channel_writen(ioclient, buffer, n, &n); if (e != G_IO_ERROR_NONE) break; fwrite(buffer, n, 1, stdout); } if (e != G_IO_ERROR_NONE) fprintf(stderr, "\nRecieved error %d (closing socket).\n", e); gnet_unix_socket_delete (client); } } typedef struct { GUnixSocket *socket; guint out_watch; gchar buffer[1024]; guint n; } client_state; static void clientstate_delete(client_state *state); static gboolean async_server_iofunc(GIOChannel *server, GIOCondition c, gpointer data); static gboolean async_client_iofunc(GIOChannel *client, GIOCondition c, gpointer data); static void clientstate_delete(client_state *state) { if (state->out_watch) g_source_remove(state->out_watch); gnet_unix_socket_delete(state->socket); g_free(state); } static void async_echoserver(gchar *path, gboolean abstract) { GIOChannel *iochannel = NULL; GMainLoop *main_loop = NULL; g_assert(path != NULL); if (abstract) server = gnet_unix_socket_server_new_abstract(path); else server = gnet_unix_socket_server_new(path); g_assert(server != NULL); main_loop = g_main_new(FALSE); /* Add a watch for incoming clients */ iochannel = gnet_unix_socket_get_io_channel(server); g_io_add_watch(iochannel, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL, async_server_iofunc, server); /* Start the main loop */ g_main_run(main_loop); } static gboolean async_server_iofunc(GIOChannel *iochannel, GIOCondition c, gpointer data) { GUnixSocket *server = (GUnixSocket *) data; g_assert(server != NULL); if (c & G_IO_IN) { GUnixSocket *client = NULL; GIOChannel *client_iochannel = NULL; client_state *cs = NULL; client = gnet_unix_socket_server_accept(server); g_assert(client != NULL); client_iochannel = gnet_unix_socket_get_io_channel(client); g_assert(client_iochannel != NULL); cs = g_new0(client_state, 1); cs->socket = client; g_io_add_watch(client_iochannel, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL, async_client_iofunc, cs); } else { fprintf(stderr, "Server error %d\n", c); return FALSE; } return TRUE; } /* This callback is called for (IN|ERR) or OUT. We add the watch for (IN|ERR) when the client connects in async_server_iofunc(). We remove it if the connection is closed (i.e. we read 0 bytes) or if there's an error. We add the watch for OUT when we have something to write and remove it when we're done writing or when the connection is closed. */ static gboolean async_client_iofunc(GIOChannel *iochannel, GIOCondition c, gpointer data) { client_state *cs = (client_state *) data; g_assert(cs != NULL); /* Check for socket error */ if (c & G_IO_ERR) { fprintf(stderr, "Client socket error!\n"); goto error; } /* Check for data to be read (or if the socket was closed) */ if (c & G_IO_IN) { GIOError e; gsize bytes_read; /* Read the data into our buffer */ e = g_io_channel_read(iochannel, &cs->buffer[cs->n], sizeof(cs->buffer) - cs->n, &bytes_read); /* Check for socket error */ if (e != G_IO_ERROR_NONE) { fprintf(stderr, "Client read error: %d\n", e); goto error; } else if (bytes_read == 0) { /* Check if we read 0 bytes, which means the connection is closed */ goto error; } else { g_assert(bytes_read > 0); /* If there isn't an out_watch, add one */ if (cs->out_watch == 0) { cs->out_watch = g_io_add_watch(iochannel, G_IO_OUT, async_client_iofunc, cs); } fwrite(&cs->buffer[cs->n], bytes_read, 1, stdout); cs->n += bytes_read; } } if (c & G_IO_OUT) { GIOError e; gsize bytes_written; /* Write the data out */ e = g_io_channel_write(iochannel, cs->buffer, cs->n, &bytes_written); if (e != G_IO_ERROR_NONE) { fprintf(stderr, "Client write error: %d\n", e); clientstate_delete(cs); return FALSE; } else if (bytes_written > 0) { /* Move the memory down some (you wouldn't do this in a performance server because it's slow) */ g_memmove(cs->buffer, &cs->buffer[bytes_written], bytes_written); cs->n -= bytes_written; } /* Check if done */ if (cs->n == 0) { cs->out_watch = 0; return FALSE; } } return TRUE; error: clientstate_delete(cs); return FALSE; } gnet-2.0.8/examples/echoserver-udp.c0000644000175000017500000000434210751326732014325 00000000000000/* Echo server (UDP) * Copyright (C) 2000 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include int main(int argc, char** argv) { int port = 0; GUdpSocket* server; gchar buffer[1024]; gint ttl; gint rv; GInetAddr* addr; gchar* name; gnet_init (); if (argc != 2) { g_print ("usage: echoserver-udp \n"); exit(EXIT_FAILURE); } port = atoi(argv[argc - 1]); /* Create the server */ server = gnet_udp_socket_new_with_port (port); g_assert (server); /* Get the TTL (for fun) */ ttl = gnet_udp_socket_get_ttl (server); g_assert (ttl >= -1); /* Set the TTL to 64 (the default on many systems) */ rv = gnet_udp_socket_set_ttl (server, 64); g_assert (rv == 0); ttl = gnet_udp_socket_get_ttl (server); g_assert (ttl == 64); /* Print the address */ addr = gnet_udp_socket_get_local_inetaddr(server); g_assert (addr); name = gnet_inetaddr_get_canonical_name (addr); g_assert (name); port = gnet_inetaddr_get_port (addr); g_print ("UDP echoserver running on %s:%d\n", name, port); gnet_inetaddr_delete (addr); g_free (name); while (1) { gint bytes_received; gint rv; bytes_received = gnet_udp_socket_receive (server, buffer, sizeof(buffer), &addr); if (bytes_received == -1) continue; rv = gnet_udp_socket_send (server, buffer, bytes_received, addr); g_assert (rv == 0); gnet_inetaddr_delete (addr); } return 0; } gnet-2.0.8/examples/sdr.c0000644000175000017500000000476710751326732012175 00000000000000/* SDR Example * Copyright (C) 2000 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #define MAXLINE 4096 int main(int argc, char** argv) { gchar buf[MAXLINE + 1]; gint n; struct sap_packet { guint32 sap_header; guint32 sap_src; char sap_data[1]; } * sapptr; GMcastSocket* ms; GInetAddr* ia; gint rv; gnet_init (); /* Create a multicast socket */ ms = gnet_mcast_socket_new_with_port (9875); g_assert(ms != NULL); /* Make sure it derives properly from GUdpSocket */ gnet_udp_socket_ref ((GUdpSocket *) ms); gnet_udp_socket_unref ((GUdpSocket *) ms); /* Let's check this as well then, just for fun */ gnet_mcast_socket_ref (ms); gnet_mcast_socket_unref (ms); /* Get address of our group */ ia = gnet_inetaddr_new ("sap.mcast.net", 9875); g_assert(ia != NULL); /* Join the group */ rv = gnet_mcast_socket_join_group (ms, ia); g_assert(rv == 0); printf("Joined %s:%d...\n", gnet_inetaddr_get_name(ia), gnet_inetaddr_get_port(ia)); /* Print some information about our multicast socket */ g_print ("My addresss: %s\n", gnet_inetaddr_get_host_name()); g_print ("Loopback: %d\n", gnet_mcast_socket_is_loopback (ms)); g_print ("Mcast TTL: %d\n", gnet_mcast_socket_get_ttl(ms)); /* Turn off loopback */ rv = gnet_mcast_socket_set_loopback (ms, 0); g_assert (rv == 0); for(;;) { g_print ("Waiting for packet...\n"); /* Receive packet */ n = gnet_mcast_socket_receive (ms, buf, MAXLINE, NULL); buf[n] = 0; sapptr = (struct sap_packet*) buf; n -= 2 * sizeof(guint32); if (n <= 0) { g_warning ("SAP packet too small"); continue; } g_print ("%s\n", sapptr->sap_data); } } gnet-2.0.8/examples/makefile.mingw0000644000175000017500000000165710751326732014054 00000000000000CC = gcc FLAGS = -g -Wall -mno-cygwin -mcpu=pentium -DGNET_EXPERIMENTAL=1 LINK = -lgnet-2.0 -lglib-2.0-0 -lws2_32 INC = -I../glib -I. -I../gnet -L../glib -L../gnet all: $(CC) $(FLAGS) $(INC) dnslookup.c -o dnslookup $(LINK) $(CC) $(FLAGS) $(INC) echoclient.c -o echoclient $(LINK) $(CC) $(FLAGS) $(INC) echoclient-async.c -o echoclient-async $(LINK) $(CC) $(FLAGS) $(INC) echoclient-gconn.c -o echoclient-gconn $(LINK) $(CC) $(FLAGS) $(INC) echoclient-udp.c -o udp-client $(LINK) $(CC) $(FLAGS) $(INC) echoserver.c -o echoserver $(LINK) $(CC) $(FLAGS) $(INC) echoserver-async.c -o echoserver-async $(LINK) $(CC) $(FLAGS) $(INC) echoserver-gserver.c -o echoserver-gserver $(LINK) $(CC) $(FLAGS) $(INC) echoserver-udp.c -o udp-server $(LINK) $(CC) $(FLAGS) $(INC) hash.c -o hash $(LINK) $(CC) $(FLAGS) $(INC) hfetch.c -o hfetch $(LINK) $(CC) $(FLAGS) $(INC) hostinfo.c -o hostinfo $(LINK) $(CC) $(FLAGS) $(INC) sdr.c -o sdr $(LINK)gnet-2.0.8/examples/echoserver-gserver.c0000644000175000017500000000550210751326732015211 00000000000000/* Echo server (TCP blocking) * Copyright (C) 2000-2003 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include #include static void ob_server_func (GServer* server, GConn* conn, gpointer user_data); static void ob_client_func (GConn* conn, GConnEvent* event, gpointer user_data); static void ob_sig_int (int signum); static GServer* ob_server = NULL; int main(int argc, char** argv) { int port; GServer* server; GMainLoop* main_loop; gnet_init (); if (argc != 2) { fprintf (stderr, "usage: echoserver \n"); exit(EXIT_FAILURE); } port = atoi(argv[argc - 1]); /* Create the main loop */ main_loop = g_main_new (FALSE); /* Create the server */ server = gnet_server_new (NULL, port, ob_server_func, NULL); if (!server) { fprintf (stderr, "Error: Could not start server\n"); exit (EXIT_FAILURE); } ob_server = server; signal (SIGINT, ob_sig_int); /* Start the main loop */ g_main_run(main_loop); exit (EXIT_SUCCESS); return 0; } static void ob_server_func (GServer* server, GConn* conn, gpointer user_data) { if (conn) { gnet_conn_set_callback (conn, ob_client_func, NULL); gnet_conn_set_watch_error (conn, TRUE); gnet_conn_readline (conn); } else /* Error */ { gnet_server_delete (server); exit (EXIT_FAILURE); } } static void ob_client_func (GConn* conn, GConnEvent* event, gpointer user_data) { switch (event->type) { case GNET_CONN_READ: { event->buffer[event->length-1] = '\n'; gnet_conn_write (conn, event->buffer, event->length); /* fwrite (event->buffer, event->length, 1, stdout); */ gnet_conn_readline (conn); break; } case GNET_CONN_WRITE: { ; /* Do nothing */ break; } case GNET_CONN_CLOSE: case GNET_CONN_TIMEOUT: case GNET_CONN_ERROR: { gnet_conn_delete (conn); break; } default: g_assert_not_reached (); } } static void ob_sig_int (int signum) { gnet_server_delete (ob_server); exit (EXIT_FAILURE); } gnet-2.0.8/examples/xmlrpc/0000777000175000017500000000000010751404362012610 500000000000000gnet-2.0.8/examples/xmlrpc/xmlrpc-client.c0000644000175000017500000001750610751326732015466 00000000000000/* An XMLRPC client and server library for GNet * * Copyright (c) 2006 Dov Grobgeld * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * */ #include #include #include #include "xmlrpc.h" typedef struct { GNetXmlRpcClient client; GTcpSocket* socket; GString *xmlrpc_string; gboolean in_header; gint header_lineno; gint message_size; gint error; } GNetXmlRpcClientPrivate; static gchar *build_xmlrpc_message(const gchar *method, const gchar *param); GNetXmlRpcClient *gnet_xmlrpc_client_new(const gchar *hostname, int port) { GNetXmlRpcClientPrivate *client = g_new0(GNetXmlRpcClientPrivate, 1); GInetAddr* addr; addr = gnet_inetaddr_new (hostname, port); if (!addr) { fprintf (stderr, "Error: Name lookup for %s failed\n", hostname); return NULL; } /* Create the socket */ client->socket = gnet_tcp_socket_new (addr); gnet_inetaddr_delete (addr); if (!client->socket) { fprintf (stderr, "Error: Could not connect to %s:%d\n", hostname, port); return NULL; } client->client.gnet_channel = gnet_tcp_socket_get_io_channel (client->socket); g_assert (client->client.gnet_channel != NULL); client->xmlrpc_string = g_string_new(""); client->in_header = TRUE; client->header_lineno = 0; client->message_size = 0; client->error = 0; return (GNetXmlRpcClient*)client; } void gnet_xmlrpc_client_delete(GNetXmlRpcClient *_client) { GNetXmlRpcClientPrivate *client = (GNetXmlRpcClientPrivate*)_client; g_string_free(client->xmlrpc_string, TRUE); gnet_tcp_socket_delete (client->socket); g_free(client); } int gnet_xmlrpc_client_call(GNetXmlRpcClient *_client, const gchar *method, const gchar *param, // output gchar **reply) { GNetXmlRpcClientPrivate *client = (GNetXmlRpcClientPrivate*)_client; gchar *xmlrpc_message = build_xmlrpc_message(method, param); gchar *msg_start, *msg_end; gchar *p; GString *xmlrpc_string = g_string_new(""); GString *reply_string = g_string_new(""); gsize n; gchar buffer[1024]; gint error; n = strlen(xmlrpc_message); // printf("Writing...\n"); fflush(stdout); error = gnet_io_channel_writen (client->client.gnet_channel, xmlrpc_message, n, &n); // printf("error = %d\n", error); fflush(stdout); if (error != G_IO_ERROR_NONE) return -1; // fprintf(stderr, "entering while loop\n"); while (gnet_io_channel_readline (client->client.gnet_channel, buffer, sizeof(buffer), &n) == G_IO_ERROR_NONE) { if (client->in_header) { // Check for a valid response if (client->header_lineno == 0) { // If we don't have HTTP we've got a problem if (g_strstr_len(buffer, 5, "HTTP") == NULL) { return -1; } } else if (n==1) { client->in_header = FALSE; } else { // Look for the content-length string case independant. char *p; // Lower case buf p = buffer; while(*p) { *p = g_ascii_tolower(*p); p++; } // Search for string if ((p = g_strstr_len(buffer, n-1, "content-length:")) != NULL) { p += strlen("Content-length:"); client->message_size = atoi(p); } } client->header_lineno++; } // If we are not in the header then append the line to the xmlrpc string. else { g_string_append_len(xmlrpc_string, buffer, n-1); g_string_append_c(xmlrpc_string, '\n'); } // Check if we are finished if (xmlrpc_string->len && xmlrpc_string->len >= client->message_size) { // Quit and reset parsing for next message client->in_header = 1; client->header_lineno = 0; break; } } // Extract the response. Should be exchanged to some more robust // XML parsing. msg_start = g_strstr_len(xmlrpc_string->str, xmlrpc_string->len, ""); if (msg_start == NULL) return -1; msg_start += strlen(""); msg_end = g_strrstr(msg_start, ""); // Decode the response p = msg_start; while(*p != '<') { gchar c = *p++; if (c == '&') { if (g_strstr_len(p, 4, "amp;") == p) { g_string_append_c(reply_string, '&'); p+= 4; } else if (g_strstr_len(p, 3, "lt;") == p) { g_string_append_c(reply_string, '<'); p+= 3; } else if (g_strstr_len(p, 3, "gt;") == p) { g_string_append_c(reply_string, '>'); p+= 3; } else { // Don't know what to do. Just add the ampersand.. g_string_append_c(reply_string, '&'); } } else g_string_append_c(reply_string, c); } *reply = reply_string->str; g_string_free(reply_string, FALSE); g_string_free(xmlrpc_string, TRUE); return 0; } static gchar *build_xmlrpc_message(const gchar *method, const gchar *param) { GString *xmlrpc_msg = g_string_new(""); GString *req_string = g_string_new(""); const gchar *p; gchar *ret; g_string_append_printf(xmlrpc_msg, "\n" "\n" "%s\n" "\n" "", method); // Encode the param string p = param; while(*p) { gchar c = *p++; switch (c) { case '&' : g_string_append(xmlrpc_msg, "&"); break; case '<': g_string_append(xmlrpc_msg, "<"); break; case '>': g_string_append(xmlrpc_msg, ">"); break; default: g_string_append_c(xmlrpc_msg, c); } } g_string_append(xmlrpc_msg, "\n" "\n" "\n"); g_string_append_printf(req_string, "POST /RPC2 HTTP/1.0\n" "User-Agent: Frontier/5.1.2 (WinNT)\n" "Host: localhost\n" "Content-Type: text/xml\n" "Content-length: %u\n\n", (guint) xmlrpc_msg->len); g_string_append_len(req_string, xmlrpc_msg->str, xmlrpc_msg->len); g_string_free(xmlrpc_msg, TRUE); ret = req_string->str; g_string_free(req_string, FALSE); return ret; } gnet-2.0.8/examples/xmlrpc/Makefile.in0000644000175000017500000004373210751327171014604 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ noinst_PROGRAMS = test-xmlrpc-client$(EXEEXT) \ test-xmlrpc-server$(EXEEXT) subdir = examples/xmlrpc DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/gnet-arch.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru libgnetxmlrpc_a_AR = $(AR) $(ARFLAGS) libgnetxmlrpc_a_DEPENDENCIES = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_libgnetxmlrpc_a_OBJECTS = xmlrpc-client.$(OBJEXT) \ xmlrpc-server.$(OBJEXT) libgnetxmlrpc_a_OBJECTS = $(am_libgnetxmlrpc_a_OBJECTS) PROGRAMS = $(noinst_PROGRAMS) am_test_xmlrpc_client_OBJECTS = test-xmlrpc-client.$(OBJEXT) test_xmlrpc_client_OBJECTS = $(am_test_xmlrpc_client_OBJECTS) test_xmlrpc_client_DEPENDENCIES = libgnetxmlrpc.a \ $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la am_test_xmlrpc_server_OBJECTS = test-xmlrpc-server.$(OBJEXT) test_xmlrpc_server_OBJECTS = $(am_test_xmlrpc_server_OBJECTS) test_xmlrpc_server_DEPENDENCIES = libgnetxmlrpc.a \ $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libgnetxmlrpc_a_SOURCES) $(test_xmlrpc_client_SOURCES) \ $(test_xmlrpc_server_SOURCES) DIST_SOURCES = $(libgnetxmlrpc_a_SOURCES) \ $(test_xmlrpc_client_SOURCES) $(test_xmlrpc_server_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHECK_CFLAGS = @CHECK_CFLAGS@ CHECK_LIBS = @CHECK_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_GTK_DOC_FALSE = @ENABLE_GTK_DOC_FALSE@ ENABLE_GTK_DOC_TRUE = @ENABLE_GTK_DOC_TRUE@ ENABLE_NETWORK_TESTS_FALSE = @ENABLE_NETWORK_TESTS_FALSE@ ENABLE_NETWORK_TESTS_TRUE = @ENABLE_NETWORK_TESTS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GNET_BINARY_AGE = @GNET_BINARY_AGE@ GNET_DEBUG_FLAGS = @GNET_DEBUG_FLAGS@ GNET_GCOV_ENABLED_FALSE = @GNET_GCOV_ENABLED_FALSE@ GNET_GCOV_ENABLED_TRUE = @GNET_GCOV_ENABLED_TRUE@ GNET_INTERFACE_AGE = @GNET_INTERFACE_AGE@ GNET_MAJOR_VERSION = @GNET_MAJOR_VERSION@ GNET_MICRO_VERSION = @GNET_MICRO_VERSION@ GNET_MINOR_VERSION = @GNET_MINOR_VERSION@ GNET_VERSION = @GNET_VERSION@ GREP = @GREP@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ HAVE_CPU_ALPHA_FALSE = @HAVE_CPU_ALPHA_FALSE@ HAVE_CPU_ALPHA_TRUE = @HAVE_CPU_ALPHA_TRUE@ HAVE_CPU_ARM_FALSE = @HAVE_CPU_ARM_FALSE@ HAVE_CPU_ARM_TRUE = @HAVE_CPU_ARM_TRUE@ HAVE_CPU_CRISV32_FALSE = @HAVE_CPU_CRISV32_FALSE@ HAVE_CPU_CRISV32_TRUE = @HAVE_CPU_CRISV32_TRUE@ HAVE_CPU_CRIS_FALSE = @HAVE_CPU_CRIS_FALSE@ HAVE_CPU_CRIS_TRUE = @HAVE_CPU_CRIS_TRUE@ HAVE_CPU_HPPA_FALSE = @HAVE_CPU_HPPA_FALSE@ HAVE_CPU_HPPA_TRUE = @HAVE_CPU_HPPA_TRUE@ HAVE_CPU_I386_FALSE = @HAVE_CPU_I386_FALSE@ HAVE_CPU_I386_TRUE = @HAVE_CPU_I386_TRUE@ HAVE_CPU_IA64_FALSE = @HAVE_CPU_IA64_FALSE@ HAVE_CPU_IA64_TRUE = @HAVE_CPU_IA64_TRUE@ HAVE_CPU_M68K_FALSE = @HAVE_CPU_M68K_FALSE@ HAVE_CPU_M68K_TRUE = @HAVE_CPU_M68K_TRUE@ HAVE_CPU_MIPS_FALSE = @HAVE_CPU_MIPS_FALSE@ HAVE_CPU_MIPS_TRUE = @HAVE_CPU_MIPS_TRUE@ HAVE_CPU_PPC64_FALSE = @HAVE_CPU_PPC64_FALSE@ HAVE_CPU_PPC64_TRUE = @HAVE_CPU_PPC64_TRUE@ HAVE_CPU_PPC_FALSE = @HAVE_CPU_PPC_FALSE@ HAVE_CPU_PPC_TRUE = @HAVE_CPU_PPC_TRUE@ HAVE_CPU_S390_FALSE = @HAVE_CPU_S390_FALSE@ HAVE_CPU_S390_TRUE = @HAVE_CPU_S390_TRUE@ HAVE_CPU_SPARC_FALSE = @HAVE_CPU_SPARC_FALSE@ HAVE_CPU_SPARC_TRUE = @HAVE_CPU_SPARC_TRUE@ HAVE_CPU_X86_64_FALSE = @HAVE_CPU_X86_64_FALSE@ HAVE_CPU_X86_64_TRUE = @HAVE_CPU_X86_64_TRUE@ HAVE_VALGRIND_FALSE = @HAVE_VALGRIND_FALSE@ HAVE_VALGRIND_TRUE = @HAVE_VALGRIND_TRUE@ HTML_DIR = @HTML_DIR@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_WIN32_FALSE = @OS_WIN32_FALSE@ OS_WIN32_TRUE = @OS_WIN32_TRUE@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ VALGRIND_LIBS = @VALGRIND_LIBS@ VALGRIND_PATH = @VALGRIND_PATH@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ noinst_LIBRARIES = libgnetxmlrpc.a AM_CFLAGS = $(GLIB_CFLAGS) $(GTHREAD_CFLAGS) INCLUDES = -I$(top_srcdir)/src LDADD = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la libgnetxmlrpc_a_SOURCES = xmlrpc-client.c xmlrpc-server.c xmlrpc.h libgnetxmlrpc_a_LIBADD = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la test_xmlrpc_client_SOURCES = test-xmlrpc-client.c xmlrpc.h test_xmlrpc_client_LDADD = \ libgnetxmlrpc.a \ $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la test_xmlrpc_server_SOURCES = test-xmlrpc-server.c xmlrpc.h test_xmlrpc_server_LDADD = \ libgnetxmlrpc.a \ $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/xmlrpc/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu examples/xmlrpc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libgnetxmlrpc.a: $(libgnetxmlrpc_a_OBJECTS) $(libgnetxmlrpc_a_DEPENDENCIES) -rm -f libgnetxmlrpc.a $(libgnetxmlrpc_a_AR) libgnetxmlrpc.a $(libgnetxmlrpc_a_OBJECTS) $(libgnetxmlrpc_a_LIBADD) $(RANLIB) libgnetxmlrpc.a clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done test-xmlrpc-client$(EXEEXT): $(test_xmlrpc_client_OBJECTS) $(test_xmlrpc_client_DEPENDENCIES) @rm -f test-xmlrpc-client$(EXEEXT) $(LINK) $(test_xmlrpc_client_LDFLAGS) $(test_xmlrpc_client_OBJECTS) $(test_xmlrpc_client_LDADD) $(LIBS) test-xmlrpc-server$(EXEEXT): $(test_xmlrpc_server_OBJECTS) $(test_xmlrpc_server_DEPENDENCIES) @rm -f test-xmlrpc-server$(EXEEXT) $(LINK) $(test_xmlrpc_server_LDFLAGS) $(test_xmlrpc_server_OBJECTS) $(test_xmlrpc_server_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-xmlrpc-client.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-xmlrpc-server.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlrpc-client.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlrpc-server.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLIBRARIES clean-noinstPROGRAMS ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-info-am @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gnet-2.0.8/examples/xmlrpc/Makefile.am0000644000175000017500000000154210751326732014566 00000000000000## Process this file with automake to produce Makefile.in @SET_MAKE@ noinst_LIBRARIES = libgnetxmlrpc.a noinst_PROGRAMS = \ test-xmlrpc-client \ test-xmlrpc-server AM_CFLAGS = $(GLIB_CFLAGS) $(GTHREAD_CFLAGS) INCLUDES = -I$(top_srcdir)/src LDADD = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la libgnetxmlrpc_a_SOURCES = xmlrpc-client.c xmlrpc-server.c xmlrpc.h libgnetxmlrpc_a_LIBADD = $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la test_xmlrpc_client_SOURCES = test-xmlrpc-client.c xmlrpc.h test_xmlrpc_client_LDADD = \ libgnetxmlrpc.a \ $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la test_xmlrpc_server_SOURCES = test-xmlrpc-server.c xmlrpc.h test_xmlrpc_server_LDADD = \ libgnetxmlrpc.a \ $(top_builddir)/src/libgnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION).la gnet-2.0.8/examples/xmlrpc/test-xmlrpc-client.c0000644000175000017500000000332010751326732016430 00000000000000/* Example program for a client using the gnet_xmlrpc library. * * Copyright (c) 2006 Dov Grobgeld * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * */ #include #include #include "xmlrpc.h" int main(int argc, char *argv[]) { GNetXmlRpcClient *client; gchar *reply; gint port = 8123; if (argc > 1) port = atoi(argv[1]); gnet_init (); client = gnet_xmlrpc_client_new("localhost", port); if (!client) { printf("Failed connecting to localhost!\n"); exit(-1); } if (gnet_xmlrpc_client_call(client, "echo", "Hello world", /* output */ &reply) == 0) { printf("echo reply = %s\n", reply); g_free(reply); } else printf("Failed executing echo!\n"); if (gnet_xmlrpc_client_call(client, "async", "", // output &reply) == 0) { printf("async reply = %s\n", reply); g_free(reply); } else printf("Failed executing echo!\n"); return 0; } gnet-2.0.8/examples/xmlrpc/xmlrpc-server.c0000644000175000017500000003220710751326732015511 00000000000000/* An XMLRPC client and server library for GNet * * Copyright (c) 2006 Dov Grobgeld * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * */ #include #include #include #include #include #include "xmlrpc.h" typedef struct { GNetXmlRpcServer server; GHashTable *command_hash; } GNetXmlRpcServerPrivate; typedef struct { GNetXmlRpcCommandCallback *callback; GNetXmlRpcCommandAsyncCallback *async_callback; gpointer user_data; } command_hash_value_t; typedef struct { GNetXmlRpcServerPrivate *xmlrpc_server; GString *connection_string; } connection_state_t; static void ob_server_func (GServer* server, GConn* conn, gpointer user_data); static void ob_client_func (GConn* conn, GConnEvent* event, gpointer user_data); gchar *create_response_string(const gchar *reply); static GServer* ob_server = NULL; int extract_xmlrpc_request(const gchar *str, /* output */ gchar **command_name, gchar **parameter ); GNetXmlRpcServer *gnet_xmlrpc_server_new(int port) { GNetXmlRpcServerPrivate *xmlrpc_server = g_new0(GNetXmlRpcServerPrivate, 1); /* Create the server */ GServer *gnet_server = gnet_server_new (NULL, port, ob_server_func, xmlrpc_server); if (!gnet_server) { fprintf (stderr, "Error: Could not start server\n"); return NULL; } xmlrpc_server->server.gnet_server = gnet_server; xmlrpc_server->command_hash = g_hash_table_new(g_str_hash, g_str_equal); return (GNetXmlRpcServer*)xmlrpc_server; } void gnet_xmlrpc_server_delete(GNetXmlRpcServer *server) { gnet_server_delete (ob_server); } static void ob_server_func (GServer* server, GConn* conn, gpointer user_data) { if (conn) { connection_state_t *conn_state = g_new0(connection_state_t, 1); conn_state->xmlrpc_server = (GNetXmlRpcServerPrivate*)user_data; conn_state->connection_string = g_string_new(""); gnet_conn_set_callback (conn, ob_client_func, conn_state); gnet_conn_set_watch_error (conn, TRUE); gnet_conn_readline (conn); } else /* Error */ { gnet_server_delete (server); exit (EXIT_FAILURE); } } static void ob_client_func (GConn* conn, GConnEvent* event, gpointer user_data) { connection_state_t *conn_state = (connection_state_t*)user_data; GNetXmlRpcServerPrivate *xmlrpc_server = conn_state->xmlrpc_server; GString *req_string = conn_state->connection_string; switch (event->type) { case GNET_CONN_READ: { event->buffer[event->length-1] = '\n'; g_string_append_len(req_string, event->buffer, event->length); /* Check if we have the whole request */ if (g_strstr_len(req_string->str, req_string->len, "") != NULL) { /* Extract command name */ gchar *command_name=NULL, *parameter=NULL; gchar *response=NULL; command_hash_value_t *command_val; extract_xmlrpc_request(req_string->str, /* output */ &command_name, ¶meter ); /* Call the callback */ command_val = g_hash_table_lookup(xmlrpc_server->command_hash, command_name); if (!command_val) response = create_response_string("No such method!"); else if (command_val->async_callback) { (*command_val->async_callback)((GNetXmlRpcServer*)xmlrpc_server, conn, command_name, parameter, command_val->user_data); } else { gchar *reply; (*command_val->callback)((GNetXmlRpcServer*)xmlrpc_server, command_name, parameter, command_val->user_data, /* output */ &reply); response = create_response_string(reply); g_free(reply); } if (response) { /* Send reply */ gnet_conn_write (conn, response, strlen(response)); g_free(response); } /* printf("rs = ((%s)) len=%d\n", req_string->str, event->length); */ g_string_assign(conn_state->connection_string, ""); g_free(command_name); if (parameter) g_free(parameter); } gnet_conn_readline (conn); break; } case GNET_CONN_WRITE: { ; /* Do nothing */ break; } case GNET_CONN_CLOSE: case GNET_CONN_TIMEOUT: case GNET_CONN_ERROR: { g_string_free(conn_state->connection_string, TRUE); g_free(conn_state); gnet_conn_delete (conn); break; } default: g_assert_not_reached (); } } static int gnet_xmlrpc_server_register_command_full(GNetXmlRpcServer *_xmlrpc_server, const gchar *command, GNetXmlRpcCommandCallback *callback, GNetXmlRpcCommandAsyncCallback *async_callback, gpointer user_data) { GNetXmlRpcServerPrivate *xmlrpc_server = (GNetXmlRpcServerPrivate*)_xmlrpc_server; /* TBD - Check if command exist and override it */ command_hash_value_t *val = g_new0(command_hash_value_t, 1); val->callback = callback; val->async_callback = async_callback; val->user_data = user_data; g_hash_table_insert(xmlrpc_server->command_hash, g_strdup(command), val); return 0; } int gnet_xmlrpc_server_register_command(GNetXmlRpcServer *_xmlrpc_server, const gchar *command, GNetXmlRpcCommandCallback *callback, gpointer user_data) { gnet_xmlrpc_server_register_command_full(_xmlrpc_server, command, callback, NULL, /* async */ user_data); return 0; } int gnet_xmlrpc_server_register_async_command(GNetXmlRpcServer *_xmlrpc_server, const gchar *command, GNetXmlRpcCommandAsyncCallback *async_callback, gpointer user_data) { gnet_xmlrpc_server_register_command_full(_xmlrpc_server, command, NULL, async_callback, /* async */ user_data); return 0; } /** * Reply to an async request * * @param gnet_client * @param reply_string * * @return */ int gnet_xmlrpc_async_client_response(GConn *conn, const gchar *reply) { gchar *response = create_response_string(reply); /* Send reply */ gnet_conn_write (conn, response, strlen(response)); g_free(response); return 0; } /** * Extract the xmlrpc request. This is done by simple reg exp matching. * This should be changed to xml decoding */ int extract_xmlrpc_request(const gchar *str, /* output */ gchar **command_name, gchar **parameter ) { int len = strlen(str); gchar *method_name_start, *method_name_end; gchar *param_name_start, *param_name_end; GString *param_string = g_string_new(""); const gchar *p; method_name_start = g_strstr_len(str, len, ""); if (method_name_start == NULL) return -1; method_name_start += strlen(""); method_name_end = g_strstr_len(method_name_start, strlen(method_name_start), ""); if (method_name_end == NULL) return -1; *command_name = g_strndup(method_name_start, method_name_end - method_name_start); param_name_start = g_strstr_len(str, len, ""); if (param_name_start == NULL) { param_name_start = g_strstr_len(str, len, ""); if (param_name_start == NULL) { } else { param_name_start += strlen(""); param_name_end = g_strstr_len(param_name_start, strlen(param_name_start), ""); } } else { param_name_start += strlen(""); param_name_end = g_strstr_len(param_name_start, strlen(param_name_start), ""); } if (method_name_end == NULL) return -1; /* Decode and build parameter */ if (param_name_start) { p = param_name_start; while (*p) { gchar c = *p++; if (p > param_name_end) break; if (c == '&') { if (g_strstr_len(p, 4, "amp;") == p) { g_string_append_c(param_string, '&'); p+= 4; } if (g_strstr_len(p, 5, "quot;") == p) { g_string_append_c(param_string, '"'); p+= 5; } else if (g_strstr_len(p, 3, "lt;") == p) { g_string_append_c(param_string, '<'); p+= 3; } else if (g_strstr_len(p, 3, "gt;") == p) { g_string_append_c(param_string, '>'); p+= 3; } else { /* Don't know what to do. Just add the ampersand.. */ g_string_append_c(param_string, '&'); } } else g_string_append_c(param_string, c); } *parameter = param_string->str; g_string_free(param_string, FALSE); } else *parameter = NULL; return 0; } gchar *create_response_string(const gchar *reply) { GString *response_string = g_string_new(""); GString *content_string = g_string_new(""); gchar *res; const gchar *p; g_string_append(content_string, " "); /* Encode and add the reply */ p=reply; while(*p) { gchar c = *p++; switch (c) { case '&' : g_string_append(content_string, "&"); break; case '<': g_string_append(content_string, "<"); break; case '>': g_string_append(content_string, ">"); break; default: g_string_append_c(content_string, c); } } g_string_append(content_string, " \n"); g_string_append_printf(response_string, "HTTP/1.1 200 OK\n" "Connection: close\n" "Content-Length: %" G_GSIZE_FORMAT "\n" "Content-Type: text/xml\n" "Date: Fri, 1 Jan 2000 00:00:00 GMT\n" "Server: GNetXMLRpc server\n" "\n" "%s", content_string->len, content_string->str ); g_string_free(content_string, TRUE); res = response_string->str; g_string_free(response_string, FALSE); return res; } gnet-2.0.8/examples/xmlrpc/README0000644000175000017500000000447110751326732013416 00000000000000 =========================================================================== GNetXmlRpc server and client XMLRPC functionality using GLib/GNet Written by Dov Grobgeld Version 0.0.3 =========================================================================== BACKGROUND I built this library for a scientific gtk display application in which I am generating date in one process, and would like to display it in another process. Through this library, whenever the data is ready for display, I can easily send it to the display program. For this application it was enough to support one string in and one string out subset of the full XMLRPC application. If someone is interested it would be easy to add a parallell callback functionality for the full XML data. I doubt that I will get around to doing it though. See the two example programs test-xml-server and test-xml-client for examples how to use this library. =========================================================================== TODO - Ideally, GnetXmlRpcClient would be built on top of GConnHttp and GnetXMLRcpServer would be built on top of a still-to-write GServerHttp (= provide asynchronous client functionality, HTTP authentication would then be handled by GServerHttp) - XML escaping/unescaping should be done using GLib's g_markup_* family of functions. - XML parsing should be done using GMarkupParser (any non-UTF8 input would need to be converted to UTF8 first). - Support other types than just strings / add full xml parameter support - By default block connections from servers other than localhost (IP filter) - Add option to accept connections from a wild card of servers. - When registering commands, check if they already exist and free the corresponding resources. - When destroying a server, destroy the command table hash. - Better error handling. - Make it part of GNet? (needs all of the above fixed + a decent API) =========================================================================== FURTHER INFORMATION http://www.xmlrpc.com/ http://www.gnetlibrary.org/ =========================================================================== gnet-2.0.8/examples/xmlrpc/xmlrpc.h0000644000175000017500000000665610751326732014223 00000000000000/* An XMLRPC client and server library for GNet * * Copyright (c) 2006 Dov Grobgeld * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * */ #ifndef GNET_XMLRPC_H #define GNET_XMLRPC_H #include G_BEGIN_DECLS /* GNetXmlRpcServer API */ typedef struct { /*< private >*/ GServer *gnet_server; } GNetXmlRpcServer; typedef gint (GNetXmlRpcCommandCallback) (GNetXmlRpcServer * server, const gchar * command, const gchar * param, gpointer user_data, gchar ** reply_string); typedef int (GNetXmlRpcCommandAsyncCallback)(GNetXmlRpcServer *server, GConn *gnet_client, const gchar *command, const gchar *param, gpointer user_data); GNetXmlRpcServer * gnet_xmlrpc_server_new (gint port); void gnet_xmlrpc_server_delete (GNetXmlRpcServer * server); gint gnet_xmlrpc_server_register_command (GNetXmlRpcServer * server, const gchar * command, GNetXmlRpcCommandCallback * callback, gpointer user_data); gint gnet_xmlrpc_server_register_async_command (GNetXmlRpcServer * server, const gchar * command, GNetXmlRpcCommandAsyncCallback * async_callback, gpointer user_data); /* GNetXmlRpcClient API */ typedef struct { /*< private >*/ GIOChannel *gnet_channel; } GNetXmlRpcClient; GNetXmlRpcClient * gnet_xmlrpc_client_new (const gchar * hostname, gint port); void gnet_xmlrpc_client_delete (GNetXmlRpcClient * client); gint gnet_xmlrpc_client_call (GNetXmlRpcClient * client, const gchar * method, const gchar * param, gchar ** reply); /* output */ int gnet_xmlrpc_async_client_response(GConn *gnet_client, const gchar *reply); G_END_DECLS #endif /* GNET_XMLRPC */ gnet-2.0.8/examples/xmlrpc/test-xmlrpc-server.c0000644000175000017500000000610710751326732016466 00000000000000/* Example program for the gnet_xmlrpc server functionality. * * Copyright (c) 2006 Dov Grobgeld * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include "xmlrpc.h" int do_foo(GNetXmlRpcServer *server, const gchar *command, const gchar *param, gpointer user_data, /* output */ gchar **reply_string); int do_echo(GNetXmlRpcServer *server, const gchar *command, const gchar *param, gpointer user_data, /* output */ gchar **reply_string); int do_async(GNetXmlRpcServer *server, GConn *conn, const gchar *command, const gchar *param, gpointer user_data); gboolean say_hello(gpointer user_data); int main(int argc, char** argv) { int port = 8123; GNetXmlRpcServer *server; GMainLoop* main_loop; gnet_init (); if (argc > 1) port = atoi(argv[1]); /* Create the main loop */ main_loop = g_main_loop_new (NULL, FALSE); server = gnet_xmlrpc_server_new(port); if (!server) { fprintf (stderr, "Error: Could not start server\n"); exit (EXIT_FAILURE); } gnet_xmlrpc_server_register_command(server, "foo", do_foo, NULL); gnet_xmlrpc_server_register_command(server, "echo", do_echo, NULL); gnet_xmlrpc_server_register_async_command(server, "async", do_async, NULL); /* Start the main loop */ g_main_loop_run(main_loop); exit (EXIT_SUCCESS); return 0; } int do_foo(GNetXmlRpcServer *server, const gchar *command, const gchar *param, gpointer user_data, // output gchar **reply_string) { *reply_string = g_strdup("BAR!"); return 0; } int do_echo(GNetXmlRpcServer *server, const gchar *command, const gchar *param, gpointer user_data, // output gchar **reply_string) { *reply_string = g_strdup_printf("You said: \"%s\"", param); return 0; } int do_async(GNetXmlRpcServer *server, GConn *conn, const gchar *command, const gchar *param, gpointer user_data) { g_timeout_add(2000, say_hello, conn); return 0; } gboolean say_hello(gpointer user_data) { GConn *conn = (GConn*)user_data; gnet_xmlrpc_async_client_response(conn, "hi!!"); return FALSE; } gnet-2.0.8/examples/echoserver-async.c0000644000175000017500000001660310751326732014655 00000000000000/* Echo server (TCP blocking) * Copyright (C) 2000-2003 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include #include typedef struct { GTcpSocket* socket; gchar* name; guint watch_flags; gint port; guint watch; gchar buffer[1024]; guint n; } ClientState; static void clientstate_delete (ClientState* state); static void async_accept (GTcpSocket* server_socket, GTcpSocket* client_socket, gpointer data); static gboolean async_client_iofunc (GIOChannel* client, GIOCondition condition, gpointer data); static void async_sig_int (int signum); static GTcpSocket* async_server = NULL; int main(int argc, char** argv) { GTcpSocket* server; GInetAddr* addr; gchar* name; gint port; GMainLoop* main_loop; gnet_init (); if (argc != 2) { fprintf (stderr, "usage: echoserver \n"); exit(EXIT_FAILURE); } port = atoi(argv[argc - 1]); /* Create the server */ server = gnet_tcp_socket_server_new_with_port (port); if (server == NULL) { fprintf (stderr, "Could not create server on port %d\n", port); exit (EXIT_FAILURE); } async_server = server; signal (SIGINT, async_sig_int); /* Print the address */ addr = gnet_tcp_socket_get_local_inetaddr(server); g_assert (addr); name = gnet_inetaddr_get_canonical_name (addr); g_assert (name); port = gnet_inetaddr_get_port (addr); g_print ("Async echoserver running on %s:%d\n", name, port); gnet_inetaddr_delete (addr); g_free (name); /* Create the main loop */ main_loop = g_main_new (FALSE); /* Wait asyncy for incoming clients */ gnet_tcp_socket_server_accept_async (server, async_accept, NULL); /* Start the main loop */ g_main_run (main_loop); exit (EXIT_SUCCESS); return 0; } static void clientstate_delete (ClientState* state) { g_source_remove (state->watch); gnet_tcp_socket_delete (state->socket); g_free (state->name); g_free (state); } static void async_accept (GTcpSocket* server, GTcpSocket* client, gpointer data) { if (client) { GInetAddr* addr; gchar* name; gint port; GIOChannel* client_iochannel; ClientState* client_state; /* Print the address */ addr = gnet_tcp_socket_get_local_inetaddr(client); g_assert (addr); name = gnet_inetaddr_get_canonical_name (addr); g_assert (name); port = gnet_inetaddr_get_port (addr); gnet_inetaddr_delete (addr); client_iochannel = gnet_tcp_socket_get_io_channel (client); g_assert (client_iochannel != NULL); client_state = g_new0(ClientState, 1); client_state->socket = client; client_state->name = name; client_state->port = port; client_state->watch_flags = G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL; client_state->watch = g_io_add_watch (client_iochannel, client_state->watch_flags, async_client_iofunc, client_state); g_print ("Accepted connection from %s:%d\n", name, port); } else { fprintf (stderr, "Server error\n"); exit (EXIT_FAILURE); } } /* Client IO callback. Called for errors, input, or output. When there is input, we reset the watch with the output flag (if we haven't already). When there is no more data, the watch is reset without the output flag. */ gboolean async_client_iofunc (GIOChannel* iochannel, GIOCondition condition, gpointer data) { ClientState* client_state = (ClientState*) data; gboolean rv = TRUE; g_assert (client_state != NULL); /* Check for socket error */ if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) { fprintf (stderr, "Client socket error (%s:%d)\n", client_state->name, client_state->port); goto error; } if (condition & G_IO_OUT) { GIOError error; gsize bytes_written; /* Write the data out */ error = g_io_channel_write(iochannel, client_state->buffer, client_state->n, &bytes_written); if (error != G_IO_ERROR_NONE) { fprintf (stderr, "Client write error (%s:%d): %d\n", client_state->name, client_state->port, error); goto error; } else if (bytes_written > 0) { guint old_watch_flags; /* Move the memory down some (you wouldn't want to do this in a performance server because it's slow!) */ client_state->n -= bytes_written; g_memmove(client_state->buffer, &client_state->buffer[bytes_written], client_state->n); old_watch_flags = client_state->watch_flags; /* Remove OUT watch if done */ if (client_state->n == 0) client_state->watch_flags &= ~G_IO_OUT; /* Add IN watch */ client_state->watch_flags |= G_IO_IN; /* Update watch flags if they changed */ if (old_watch_flags != client_state->watch_flags) { g_source_remove (client_state->watch); client_state->watch = g_io_add_watch(iochannel, client_state->watch_flags, async_client_iofunc, client_state); rv = FALSE; } } } /* Check for data to be read (or if the socket was closed) */ if (condition & G_IO_IN) { GIOError error; gsize bytes_read; /* Read the data into our buffer */ error = g_io_channel_read (iochannel, &client_state->buffer[client_state->n], sizeof(client_state->buffer) - client_state->n, &bytes_read); /* Check for socket error */ if (error != G_IO_ERROR_NONE) { fprintf (stderr, "Client read error (%s:%d): %d\n", client_state->name, client_state->port, error); goto error; } /* Check if we read 0 bytes, which means the connection is closed */ else if (bytes_read == 0) { g_print ("Connection from %s:%d closed\n", client_state->name, client_state->port); goto error; } /* Otherwise, we read something */ else { guint old_watch_flags; g_assert (bytes_read > 0); old_watch_flags = client_state->watch_flags; client_state->n += bytes_read; /* Add an add watch */ client_state->watch_flags |= G_IO_OUT; /* Remove the IN watch if the buffer is full */ if (client_state->n == sizeof(client_state->buffer)) client_state->watch_flags &= ~G_IO_IN; /* Update watch flags if they changed */ if (old_watch_flags != client_state->watch_flags) { g_source_remove (client_state->watch); client_state->watch = g_io_add_watch(iochannel, client_state->watch_flags, async_client_iofunc, client_state); rv = FALSE; } } } return rv; error: clientstate_delete (client_state); return FALSE; } static void async_sig_int (int signum) { gnet_tcp_socket_delete (async_server); exit (EXIT_FAILURE); } gnet-2.0.8/examples/echoserver.c0000644000175000017500000000610010751326732013531 00000000000000/* Echo server (TCP blocking) * Copyright (C) 2000-2003 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include #include static void normal_sig_int (int signum); static GTcpSocket* normal_server = NULL; int main(int argc, char** argv) { gint port; GTcpSocket* server; GInetAddr* addr; gchar* name; GTcpSocket* client = NULL; gchar buffer[1024]; gsize n; GIOChannel* ioclient = NULL; GIOError error; gnet_init (); if (argc != 2) { fprintf (stderr, "usage: echoserver \n"); exit(EXIT_FAILURE); } port = atoi(argv[argc - 1]); /* Create the server */ server = gnet_tcp_socket_server_new_with_port (port); if (server == NULL) { fprintf (stderr, "Could not create server on port %d\n", port); exit (EXIT_FAILURE); } normal_server = server; signal (SIGINT, normal_sig_int); /* Print the address */ addr = gnet_tcp_socket_get_local_inetaddr(server); g_assert (addr); name = gnet_inetaddr_get_canonical_name (addr); g_assert (name); port = gnet_inetaddr_get_port (addr); g_print ("Normal echoserver running on %s:%d\n", name, port); gnet_inetaddr_delete (addr); g_free (name); while ((client = gnet_tcp_socket_server_accept (server)) != NULL) { /* Get IOChannel */ ioclient = gnet_tcp_socket_get_io_channel(client); g_assert (ioclient); /* Print the address */ addr = gnet_tcp_socket_get_remote_inetaddr(client); g_assert (addr); name = gnet_inetaddr_get_canonical_name (addr); g_assert (name); port = gnet_inetaddr_get_port (addr); g_print ("Accepted connection from %s:%d\n", name, port); while ((error = gnet_io_channel_readline(ioclient, buffer, sizeof(buffer), &n)) == G_IO_ERROR_NONE && (n > 0)) { error = gnet_io_channel_writen(ioclient, buffer, n, &n); if (error != G_IO_ERROR_NONE) break; fwrite(buffer, n, 1, stdout); } if (error != G_IO_ERROR_NONE) gnet_tcp_socket_delete (client); g_print ("Connection from %s:%d closed\n", name, port); gnet_inetaddr_delete (addr); g_free (name); } exit (EXIT_SUCCESS); return 0; } static void normal_sig_int (int signum) { gnet_tcp_socket_delete (normal_server); exit (EXIT_FAILURE); } gnet-2.0.8/examples/hostinfo.c0000644000175000017500000000520210751326732013217 00000000000000/* Print information about the host * Copyright (C) 2000 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include int main(int argc, char** argv) { GInetAddr* ia; GInetAddr* autoia; GList* interfaces; GList* i; gnet_init (); /* Print info about me */ ia = gnet_inetaddr_get_host_addr(); if (ia != NULL) { gchar* cname; gchar* name; name = gnet_inetaddr_get_name(ia); if (!name) name = g_strdup (""); cname = gnet_inetaddr_get_canonical_name(ia); g_assert (cname != NULL); g_print ("Host name is %s (%s)\n", name, cname); gnet_inetaddr_delete (ia); g_free(name); g_free(cname); } else g_print ("Host name is ()\n"); /* Print interfaces */ g_print ("Interfaces:\n"); interfaces = gnet_inetaddr_list_interfaces(); for (i = interfaces; i != NULL; i = g_list_next(i)) { gchar* name; gchar* cname; ia = (GInetAddr*) i->data; g_assert (ia != NULL); name = gnet_inetaddr_get_name(ia); g_assert (name != NULL); cname = gnet_inetaddr_get_canonical_name(ia); g_assert (cname != NULL); g_print ("%s (%s)\n", name, cname); gnet_inetaddr_delete (ia); g_free(name); } g_list_free(interfaces); autoia = gnet_inetaddr_get_internet_interface(); g_print ("Internet inteface: "); if (autoia) { gchar* cname; cname = gnet_inetaddr_get_canonical_name (autoia); g_print ("%s\n", cname); g_free (cname); } else g_print ("\n"); autoia = gnet_inetaddr_autodetect_internet_interface(); g_print ("Auto-detected internet inteface: "); if (autoia) { gchar* cname; cname = gnet_inetaddr_get_canonical_name (autoia); g_print ("%s\n", cname); g_free (cname); } else g_print ("\n"); exit(EXIT_SUCCESS); } gnet-2.0.8/examples/echoclient.c0000644000175000017500000000566410751326732013517 00000000000000/* Echo client * Copyright (C) 2000-2001 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include int main(int argc, char** argv) { gchar* hostname; gint port; GInetAddr* addr; GTcpSocket* socket; GIOChannel* iochannel; GIOError error = G_IO_ERROR_NONE; gchar buffer[1024]; gsize n; gnet_init (); /* Parse args */ if (argc != 3) { g_print ("usage: %s \n", argv[0]); exit(EXIT_FAILURE); } hostname = argv[1]; port = atoi(argv[2]); /* Create the address */ addr = gnet_inetaddr_new (hostname, port); if (!addr) { fprintf (stderr, "Error: Name lookup for %s failed\n", hostname); exit (EXIT_FAILURE); } /* Create the socket */ socket = gnet_tcp_socket_new (addr); gnet_inetaddr_delete (addr); if (!socket) { fprintf (stderr, "Error: Could not connect to %s:%d\n", hostname, port); exit (EXIT_FAILURE); } #if 0 { gchar* cname; /* Print local address */ addr = gnet_tcp_socket_get_local_inetaddr (socket); g_assert (addr); cname = gnet_inetaddr_get_canonical_name (addr); g_assert (cname); g_print ("Local address: %s:%d\n", cname, gnet_inetaddr_get_port(addr)); g_free (cname); gnet_inetaddr_delete (addr); /* Print remote address */ addr = gnet_tcp_socket_get_remote_inetaddr (socket); g_assert (addr); cname = gnet_inetaddr_get_canonical_name (addr); g_assert (cname); g_print ("Remote address: %s:%d\n", cname, gnet_inetaddr_get_port(addr)); g_free (cname); gnet_inetaddr_delete (addr); } #endif /* Get the IOChannel */ iochannel = gnet_tcp_socket_get_io_channel (socket); g_assert (iochannel != NULL); while (fgets(buffer, sizeof(buffer), stdin) != 0) { n = strlen(buffer); error = gnet_io_channel_writen (iochannel, buffer, n, &n); if (error != G_IO_ERROR_NONE) break; error = gnet_io_channel_readn (iochannel, buffer, n, &n); if (error != G_IO_ERROR_NONE) break; fwrite(buffer, n, 1, stdout); } if (error != G_IO_ERROR_NONE) fprintf (stderr, "Error: IO error (%d)\n", error); gnet_tcp_socket_delete (socket); return 0; } gnet-2.0.8/examples/dnslookup.c0000644000175000017500000001470610751326732013415 00000000000000/* DNSTest - Tests InetAddr non-blocking functions * Copyright (C) 2000-2002 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #define PORT 0x1234 gchar* host; gboolean do_reverse = FALSE; gboolean do_async = FALSE; gboolean do_single = FALSE; gint num_runs = 1; gint runs_done = 0; void lookup_block_single (int run); void lookup_block_list (int run); void lookup_async_forward(int run); void inetaddr_cb(GInetAddr* inetaddr, gpointer data); void lookup_async_forward_list (int run); void list_cb(GList* ialist, gpointer data); void lookup_async_reverse(int run); void reverse_inetaddr_cb(gchar* name, gpointer data); void usage(void); struct ReverseState { GInetAddr* ia; gint num; }; int main(int argc, char** argv) { extern char* optarg; extern int optind; int c; gnet_init (); /* Parse arguments */ while ((c = getopt(argc, argv, "arsn:")) != -1) { switch (c) { case 'a': do_async = TRUE; break; case 'r': do_reverse = TRUE; break; case 's': do_single = TRUE; break; case 'n': num_runs = atoi(optarg); break; case 'h': case '?': usage(); break; } } if (argc == optind) usage(); host = argv[optind]; if (!do_async) { int i; for (i = 0; i < num_runs; ++i) { if (do_single) lookup_block_single(i); else lookup_block_list(i); } } else { int i; GMainLoop* main_loop = NULL; main_loop = g_main_new(FALSE); for (i = 0; i < num_runs; ++i) { if (!do_reverse) { if (do_single) lookup_async_forward(i); else lookup_async_forward_list(i); } else lookup_async_reverse(i); } g_main_run(main_loop); } exit(EXIT_SUCCESS); } void lookup_block_single (int run) { GInetAddr* ia; gchar* name; ia = gnet_inetaddr_new (host, PORT); if (ia == NULL) { fprintf (stderr, "DNS lookup for %s failed\n", host); exit (EXIT_FAILURE); } g_assert (gnet_inetaddr_get_port(ia) == PORT); if (do_reverse) name = gnet_inetaddr_get_name(ia); else name = gnet_inetaddr_get_canonical_name(ia); g_assert (name != NULL); g_print ("%d: %s -> %s\n", run, host, name); g_free (name); gnet_inetaddr_delete (ia); } void lookup_block_list (int run) { GList* ialist; GList* i; gchar* name; ialist = gnet_inetaddr_new_list(host, PORT); if (ialist == NULL) { g_print ("DNS lookup for %s failed\n", host); exit (EXIT_FAILURE); } for (i = ialist; i != NULL; i = i->next) { GInetAddr* ia; ia = (GInetAddr*) i->data; g_assert (gnet_inetaddr_get_port(ia) == PORT); if (do_reverse) name = gnet_inetaddr_get_name(ia); else name = gnet_inetaddr_get_canonical_name(ia); g_assert (name != NULL); g_print ("%d: %s -> %s\n", run, host, name); g_free (name); gnet_inetaddr_delete (ia); } g_list_free (ialist); } /* **************************************** */ void lookup_async_forward (int run) { gnet_inetaddr_new_async(host, PORT, inetaddr_cb, GINT_TO_POINTER(run)); } void inetaddr_cb(GInetAddr* ia, gpointer data) { int i = GPOINTER_TO_INT(data); if (ia) { gchar* cname; g_assert (gnet_inetaddr_get_port(ia) == PORT); cname = gnet_inetaddr_get_canonical_name(ia); if (cname == NULL) { g_print ("Reverse DNS lookup failed\n"); exit (EXIT_FAILURE); } g_print ("%d: %s -> %s\n", i, host, cname); g_free (cname); } else g_print ("%d: DNS lookup failed\n", i); runs_done++; if (runs_done == num_runs) exit(EXIT_SUCCESS); } /* ******************** */ void lookup_async_forward_list (int run) { gnet_inetaddr_new_list_async(host, PORT, list_cb, GINT_TO_POINTER(run)); } void list_cb(GList* ialist, gpointer data) { int run = GPOINTER_TO_INT(data); if (ialist) { GList* i; for (i = ialist; i != NULL; i = i->next) { GInetAddr* ia; gchar* cname; ia = (GInetAddr*) i->data; g_assert (gnet_inetaddr_get_port(ia) == PORT); cname = gnet_inetaddr_get_canonical_name(ia); g_assert (cname); g_print ("%d: %s -> %s\n", run, host, cname); g_free (cname); gnet_inetaddr_delete (ia); } g_list_free (ialist); } else g_print ("%d: DNS lookup failed\n", run); runs_done++; if (runs_done == num_runs) exit(EXIT_SUCCESS); } /* ******************** */ void lookup_async_reverse (int run) { GInetAddr* ia; struct ReverseState* rs; ia = gnet_inetaddr_new(host, 0); if (ia == NULL) { g_print ("DNS lookup for %s failed\n", host); exit (EXIT_FAILURE); } rs = g_new0(struct ReverseState, 1); rs->ia = ia; rs->num = run; gnet_inetaddr_get_name_async(ia, reverse_inetaddr_cb, rs); } void reverse_inetaddr_cb (gchar* name, gpointer data) { struct ReverseState* rs = (struct ReverseState*) data; if (name) { gchar* cname; cname = gnet_inetaddr_get_canonical_name(rs->ia); if (cname == NULL) { g_print ("Reverse DNS lookup for %s failed\n", name); exit (EXIT_FAILURE); } g_print ("%d: %s -> %s (reverse)\n", rs->num, cname, name); g_free(cname); } else g_print ("%d: error\n", rs->num); gnet_inetaddr_delete (rs->ia); g_free (rs); runs_done++; if (runs_done == num_runs) exit(EXIT_SUCCESS); } /* **************************************** */ void usage(void) { g_print ("dnslookup -a -r -s -n \n"); g_print (" -a asynchronous\n"); g_print (" -r reverse lookup\n"); g_print (" -s single forward lookup\n"); g_print (" -n number of lookups\n"); exit (EXIT_FAILURE); } gnet-2.0.8/ChangeLog0000644000175000017500000041634410751404213011162 000000000000002008-02-03 Tim-Philipp Müller * NEWS: * RELEASE: * debian/changelog: Update for upcoming 2.0.8 release. 2008-01-07 Tim-Philipp Müller * tests/check/Makefile.am: * tests/check/gnet/gnetabi.c: * tests/check/gnet/struct_ppc64.h: * tests/check/gnet/struct_ppc32.h: Include header based on userland ABI, not on kernel/CPU. 2008-01-06 Tim-Philipp Müller * doc/tmpl/conn.sgml: Clarify docs a bit. 2008-01-05 Tim-Philipp Müller * tests/check/gnet/gnetconnhttp.c: (test_conn_http_post_local): Disable SOCKS use for test that connects to server on localhost. 2008-01-05 Tim-Philipp Müller * configure.ac: Require check 0.9.4 or later. * tests/check/gnetcheck.h: (__gnet_tcase_add_test), (_tcase_add_test): Fix up things so that in case of failure the test that failed is shown properly (before the variable name 'tf' would get stringified instead of the test function name). 2008-01-05 Tim-Philipp Müller * tests/check/gnetcheck.c: (gnet_check_init): Call gnet_socks_set_enabled() if the SOCKS_SERVER environment variable is set, so we can run the unit tests through the SOCKS implementation too (e.g. in connection with ssh -D). 2007-12-18 Tim-Philipp Müller * src/uri.c: (gnet_uri_parse), (parse_inplace_munge_string_part), (gnet_uri_parse_inplace): * src/uri.h: API: add gnet_uri_parse_inplace() * tests/check/gnet/gneturi.c: * doc/gnet-sections.txt: * doc/tmpl/uri.sgml: Add unit test and docs for the above. 2007-12-18 Tim-Philipp Müller * src/tcp.c: (gnet_tcp_socket_get_remote_inetaddr): * src/udp.c: (gnet_udp_socket_unref): Two small doc additions. * doc/tmpl/conn-http.sgml: * doc/tmpl/conn.sgml: * doc/tmpl/inetaddr.sgml: * doc/tmpl/tcp.sgml: Update templates to trunk. 2007-12-14 Tim-Philipp Müller Patch by: Jeff Garzik . * src/uri.c: (field_unescape): Micro-optimisation: avoid unnecessary read/writes. 2007-12-09 Tim-Philipp Müller * src/uri.c: (neednt_escape_table), (StringPart), (DUP_STRING_PART), (ISSPACE), (gnet_uri_parse), (gnet_uri_new): Split out URI parsing code. 2007-11-07 Tim-Philipp Müller * NEWS: * src/conn-http.h: GConnHttp is no longer marked as experimental API (which doesn't mean that it's bug-free, of course). 2007-11-05 Tim-Philipp Müller * src/conn.c: (gnet_conn_new_socket): Improvie docs a bit. * src/gnet-private.h: Change refcount field from guint to gint to avoid compiler warnings when using GLib's g_atomic_* macros. 2007-11-05 Tim-Philipp Müller * doc/gnet-sections.txt: * src/conn-http.c: (gnet_conn_http_ia_cb), (gnet_conn_http_run_async), (gnet_conn_http_run), (gnet_conn_http_delete_internal), (gnet_http_get), (gnet_conn_http_set_main_context): * src/conn-http.h: (GConnHttpFunc): API: add gnet_conn_http_set_main_context(). Make GConnHttp work with a custom main context. * tests/check/gnet/gnetconnhttp.c: (icy_async_cb), (test_shoutcast): Use our own main context in the shoutcast unit test, to make sure GConnHttp works fine with a custom main context. 2007-11-05 Tim-Philipp Müller * src/conn-http.c: (gnet_conn_http_conn_recv_response): Check the server response for a supported protocol and emit an error event if a non-supported protocol is encountered; also emit an error if the response is malformed. * src/conn-http.h: Fix typo in docs. * tests/check/gnet/gnetconnhttp.c: (icy_async_cb), (test_shoutcast), (gnetconnhttp_suite): Add unit test to make sure we accept shoutcast (ICY) server responses in addition to HTTP server responses. 2007-11-05 Tim-Philipp Müller * src/socks-private.c: (_gnet_socks_tcp_socket_server_accept): * src/tcp.c: (gnet_tcp_socket_ref), (gnet_tcp_socket_unref_internal), (gnet_tcp_socket_unref), (tcp_socket_server_accept_async_cb): Do atomic refcounting for GTcpSocket (however much sense that makes). 2007-11-05 Tim-Philipp Müller * tests/check/Makefile.am: * tests/check/gnet/gnetmisc.c: (test_versions), (gnetmisc_suite), (gnetmisc): Unit tests for compile-time version macros and run-time version reporting. 2007-11-05 Tim-Philipp Müller * src/conn.c: (gnet_conn_set_main_context): Also allow setting a context when we already have a socket as long as no watches have been set up yet. * tests/check/gnet/gnetconn.c: (conn_fail_cb), (conn_cb), (test_conn_new), (test_conn_new_inetaddr), (test_conn_new_socket), (gnetconn_suite): Some more unit tests. 2007-11-04 Tim-Philipp Müller * tests/check/Makefile.am: * tests/check/gnet/gnetconn.c: (conn_cb), (test_conn), (gnetconn_suite), (gnetconn): Add very simple test for gnet_conn_new() and running things in a user-specified GMainContext. 2007-11-04 Tim-Philipp Müller * src/conn-http.c: * src/conn-http.h: UTF-8-ise. 2007-11-04 Tim-Philipp Müller * src/conn.c: (ADD_WATCH), (REMOVE_WATCH), (gnet_conn_disconnect), (conn_check_read_queue), (gnet_conn_timeout): Use the configured main context (if any) to hook up or remove watches and timeouts. 2007-11-04 Tim-Philipp Müller * src/inetaddr.c: (gnet_inetaddr_new_list_async_cancel), (gnet_inetaddr_get_name_async_cancel): * src/tcp.c: (gnet_tcp_socket_new_async_cancel): Remove sources from correct main context. 2007-11-04 Tim-Philipp Müller * src/gnet-private.c: (_gnet_idle_add_full), (_gnet_timeout_add_full), (_gnet_io_watch_add_full), (_gnet_source_remove): * src/gnet-private.h: Add private _gnet_source_remove() to remove a source by id from a certain main context. Also accept NULL as context for the other functions in place of the default main context. 2007-11-04 Tim-Philipp Müller * doc/gnet-sections.txt: * src/conn.c: (gnet_conn_new_socket), (gnet_conn_set_main_context), (gnet_conn_connect): * src/conn.h: API: add gnet_conn_set_main_context() 2007-11-04 Tim-Philipp Müller * src/tcp.c: (gnet_tcp_socket_connect), (gnet_tcp_socket_connect_async_full), (gnet_tcp_socket_connect_async), (gnet_tcp_socket_connect_inetaddr_cb), (gnet_tcp_socket_connect_tcp_cb), (gnet_tcp_socket_connect_async_cancel): * src/tcp.h: (GTcpSocketConnectAsyncFunc): API: add gnet_tcp_socket_connect_async_full(). 2007-11-04 Tim-Philipp Müller * src/socks-private.h: * src/socks-private.c: (_gnet_socks_tcp_socket_new), (SocksAsyncData), (socks_async_cb), (_gnet_socks_tcp_socket_new_async_full), (_gnet_socks_tcp_socket_new_async): Add _gnet_socks_tcp_socket_new_async_full() variant that takes a caller-specified GMainContext. * doc/gnet-sections.txt: * src/tcp.h: (GTcpSocketNewAsyncFunc): * src/tcp.c: (gnet_tcp_socket_new_direct), (gnet_tcp_socket_new_async_full), (gnet_tcp_socket_new_async), (gnet_tcp_socket_new_async_direct_full), (gnet_tcp_socket_new_async_direct), (gnet_tcp_socket_new_async_cb), (gnet_tcp_socket_new_async_cancel): API: add gnet_tcp_socket_new_async_direct_full() API: add gnet_tcp_socket_new_direct_full() Add _full() variants that take a caller-specified GMainContext. 2007-11-03 Tim-Philipp Müller * src/gnet-private.c: (_gnet_create_ipv4_listen_socket), (_gnet_create_ipv6_listen_socket), (_gnet_create_listen_socket), (_gnet_io_channel_new), (_gnet_idle_add_full), (_gnet_timeout_add_full), (_gnet_io_watch_add_full): * src/gnet-private.h: * src/inetaddr.c: (gnet_inetaddr_new_list_async_full), (inetaddr_new_list_async_gthread), (inetaddr_get_name_async_gthread): * src/mcast.c: (gnet_mcast_socket_new_full): * src/socks-private.c: (_gnet_socks_tcp_socket_new), (_gnet_socks_tcp_socket_new_async), (_gnet_socks_tcp_socket_server_new), (_gnet_socks_tcp_socket_server_accept), (_gnet_socks_tcp_socket_server_accept_async), (socks_tcp_socket_server_accept_async_cb): * src/socks-private.h: * src/tcp.c: (gnet_tcp_socket_new), (gnet_tcp_socket_new_async), (gnet_tcp_socket_get_io_channel), (gnet_tcp_socket_server_new_full), (gnet_tcp_socket_server_accept), (gnet_tcp_socket_server_accept_nonblock), (gnet_tcp_socket_server_accept), (gnet_tcp_socket_server_accept_nonblock), (gnet_tcp_socket_server_accept_async): * src/udp.c: (gnet_udp_socket_new_full), (gnet_udp_socket_get_io_channel): * src/unix.c: (gnet_unix_socket_get_io_channel): Rename private function from gnet_private_foo() to _gnet_foo(), which is a bit shorter and makes it easier to make sure those symbols aren't exported later. Also rename __gnet_foo_add_full() to _gnet_foo_add_full() for consistency. 2007-10-28 Tim-Philipp Müller * src/tcp.h: (GTcpSocketNewAsyncID): Typedef GTcpSocketNewAsyncID to real structure instead of gpointer so the compiler can help us catch nonsense. * src/socks-private.c: (gnet_private_socks_tcp_socket_new_async): Like this. 2007-10-28 Tim-Philipp Müller * src/gnet-private.c: (__gnet_io_watch_add_full): * src/gnet-private.h: Implement (private) __gnet_io_watch_add_full(), which we'll need shortly. 2007-10-27 Tim-Philipp Müller * tests/check/gnet/gnetinetaddr.c: Add unit tests for the various _async() and _async_full() functions. 2007-10-27 Tim-Philipp Müller * doc/gnet-sections.txt: * src/gnet-private.c: (gnet_uninitialize_windows_sockets), (__gnet_idle_add_full), (__gnet_timeout_add_full): * src/gnet-private.h: * src/inetaddr.c: (gnet_inetaddr_delete_list), (gnet_inetaddr_new_async_full), (gnet_inetaddr_new_async), (gnet_inetaddr_new_async_cancel), (inetaddr_new_async_cb), (gnet_inetaddr_new_list_async_full), (gnet_inetaddr_new_list_async), (inetaddr_new_list_async_nonblock_dispatch), (inetaddr_new_list_async_gthread), (inetaddr_new_list_async_gthread_dispatch), (gnet_inetaddr_new_list_async_cancel), (gnet_inetaddr_get_name_nonblock), (gnet_inetaddr_get_name_async_full), (gnet_inetaddr_get_name_async), (gnet_inetaddr_get_name_async_cancel), (inetaddr_get_name_async_gthread_dispatch), (inetaddr_get_name_async_gthread): * src/inetaddr.h: API: add gnet_inetaddr_new_async_full() API: add gnet_inetaddr_new_list_async_full() API: add gnet_inetaddr_get_name_async_full() Add _full variants for async lookup functions with destroy notify function, main context and priority parameters. 2007-10-24 Tim-Philipp Müller * src/inetaddr.c (inetaddr_new_list_async_gthread): If we've been cancelled, free the correct inetaddr list and not a yet-unassigned NULL list. * tests/check/gnetcheck.h: Some more comments. 2007-10-24 Tim-Philipp Müller * src/inetaddr.c (gnet_inetaddr_get_name_async), (gnet_inetaddr_get_name_async_cancel), (inetaddr_get_name_async_gthread_dispatch), (inetaddr_get_name_async_gthread): Don't take lock in reverse lookup thread while it's doing the blocking reverse lookup, otherwise a _cancel() from the main thread will block until the blocking operation in the thread has finished, which isn't what we want; fix a small leak when cancelling a lookup; no need to take the lock before starting the lookup thread, just set up the structure before starting the thread (no point optimising for an unlikely failure case). * tests/check/gnet/gnetinetaddr.c: (gnetinetaddr_suite): Add dumb unit test for reverse lookup cancellation. 2007-10-24 Tim-Philipp Müller * configure.ac: Check if valgrind.h is available, so we can use it in unit tests to check if we're running under valgrind (and wait for threads to finish etc.). 2007-10-24 Tim-Philipp Müller * tests/check/gnetcheck.c: Don't leak function string array when using GNET_CHECKS. 2007-10-23 Tim-Philipp Müller * configure.ac: * tests/check/Makefile.am: * tests/check/gnet/gnetconnhttp.c: * tests/check/gnet/gnettcpsocket.c: Fix --disable-network-tests configure option. 2007-10-23 Tim-Philipp Müller * src/inetaddr.c: Remove some now-unused structure members (of privat structure). 2007-10-19 Tim-Philipp Müller * NEWS: * src/gnet.c: * src/inetaddr.c: * configure.ac: Remove fork()-and-pipe-based fallback for asynchronous DNS lookups, which was used when GLib has been compiled without support for threading, ie. G_THREADS_ENABLED was not defined. This code is unused in practice, pointless and I simply don't want to maintain it. Also, it's 2007. Besides, getting rid of this cruft might make it a bit easier for someone to implement a non-thread async dns variant. Lastly, fixes some cases where we didn't lock or free mutexes because we checked against a non-existant G_THREADS_ENABLES define. 2007-10-17 Tim-Philipp Müller * src/gnet-private.h: * src/inetaddr.c: Do refcounting of GInetAddr structures atomically. Not that that is particularly useful given how the API isn't thread-safe, but it can't hurt either. 2007-10-16 Tim-Philipp Müller * tests/check/gnetcheck.c: * tests/check/gnetcheck.h: Support running only specific checks of a unit test via the GNET_CHECKS environment variable (specify test case function names, comma-separated). 2007-10-16 Tim-Philipp Müller * NEWS: * src/conn-http.c: Fix parsing of POST method response if the server returns optional headers after the initial 100-Continue response. Should fix #459895. * tests/check/gnet/gnetconnhttp.c: Add unit test for the above. 2007-08-12 Tim-Philipp Müller * MAINTAINERS: Obscure e-mail addresses with spaces only, as suggested on desktop-devel. 2007-08-09 Tim-Philipp Müller * MAINTAINERS: Format maintainers file as requested by the sysadmins on the gnome devel-announce mailing list. 2007-08-08 Tim-Philipp Müller * examples/xmlrpc/Makefile.am: Don't use absolute path from top_builddir for local target, make isn't smart enough to recognise it's a local target which makes the build fail when using make -j2 or similar. 2007-08-04 Tim-Philipp Müller * src/conn-http.c: Add more info to docs about the implications of gnet_http_get() and gnet_conn_http_run() running a main loop iterating the default GLib main context. 2007-07-29 Tim-Philipp Müller * configure.ac: * tests/Makefile.am: * tests/check/Makefile.am: * tests/check/gnet/gnetconnhttp.c: * tests/check/gnet/gnetinetaddr.c: * tests/check/gnet/gnetipv6.c: * tests/check/gnet/gnettcpsocket.c: * tests/conn_http_test.c: * tests/inetaddr_test.c: * tests/ipv6_test.c: * tests/tcp_test.c: Move some more tests over to the check unit testing framework. 2007-07-28 Tim-Philipp Müller * tests/Makefile.am: * tests/base64_test.c: * tests/check/Makefile.am: * tests/check/gnet/gnetbase64.c: * tests/check/gnet/gnethash.c: * tests/check/gnet/gnetpack.c: * tests/check/gnet/gnetunpack.c: * tests/check/gnet/gneturi.c: * tests/hash_test.c: * tests/pack_test.c: * tests/unpack_test.c: * tests/uri_test.c: Migrate some of the existing unit tests over to the check unit testing framework (will currently only be run if you do 'make check' in tests/check/). While we're at it, fix up packing and unpacking checks for 64-bit platforms. 2007-07-28 Tim-Philipp Müller * tests/check/gnetcheck.c: * tests/check/gnetcheck.h: Call the internal gnet_check_init() when setting up a unit test, so we intercept criticals and ASSERT_WARNING() in the tests works. 2007-07-27 Tim-Philipp Müller * src/pack.c: * src/pack.h: Const-ify input buffer arguments to gnet_unpack*(). 2007-07-27 Tim-Philipp Müller * src/pack.c: (flipmemcpy): Fix broken flipmemcpy() function - it never actually reversed the order! Which noone ever noticed, because it is only used if more than four bytes need reversing, and the only types with a possible size of more than four bytes are void* and double and at least for the latter the endianness modifiers are ignored. Not sure what to do about pointers yet, we should probably just ignore those modifiers for pointers too. Also fix gtk-doc blurb. 2007-07-27 Tim-Philipp Müller * src/base64.c: (gnet_base64_encode), (gnet_base64_decode): * src/base64.h: Make arguments for input buffers constant; add more guards against invalid arguments. 2007-07-26 Tim-Philipp Müller * Makefile.am: * configure.ac: * macros/Makefile.am: * macros/gnet-arch.m4: * tests/Makefile.am: * tests/check/Makefile.am: * tests/check/gnet-valgrind.supp: * tests/check/gnet/gnetabi.c: * tests/check/gnet/struct_i386.h: * tests/check/gnet/struct_ppc64.h: * tests/check/gnet/struct_x86_64.h: * tests/check/gnetcheck.c: * tests/check/gnetcheck.h: Add build infrastructure for unit tests based on libcheck. 2007-07-22 Tim-Philipp Müller * autogen.sh: Use '=' instead of '==' to test for equality, dash in gutsy (which seems to be the default shell now) doesn't seem to like '=='. * tests/conn_http_test.c: Add cast to fix compiler warnings due to printf format. 2007-06-11 Tim-Philipp Müller Patch by: Samuel Cormier-Iijima * examples/xmlrpc/xmlrpc-server.c: (create_response_string): Printf format fix for 64-bit systems. 2007-04-30 Tim-Philipp Müller * TODO: Minor update. * src/server.h: Document where to find details of the connecting client in the GServer callback. 2007-03-26 Tim-Philipp Müller * doc/gnet-docs.sgml: The pkg-config module name is gnet-2.0, not gnet. Fix docs. 2007-02-23 Dov Grobgeld * examples/xmlrpc: Added option to split the call and the reply for xmlrpc commands through the addition of command gnet_xmlrpc_server_register_async_command(), which passes the connection variable but does not return a reply. This is useful when the reply may not be given immediately (in terms of mainloop interaction). 2007-02-14 Tim-Philipp Müller * src/conn-http.c: (gnet_conn_http_reset), (gnet_conn_http_free_event): Fix two small memory leaks. 2007-02-07 Tim-Philipp Müller * src/unix.c: (gnet_unix_socket_unlink): Make this function static, it's an internal utility function. Also shuffle a few macros around. 2007-02-07 Tim-Philipp Müller Patch by: Zeeshan Ali * AUTHORS: * NEWS: * configure.ac: * doc/gnet-sections.txt: * doc/tmpl/unix.sgml: * examples/echoclient-unix.c: * examples/echoserver-unix.c: * src/unix.c: (gnet_sun_len), (gnet_unix_socket_new_internal), (gnet_unix_socket_new), (gnet_unix_socket_new_abstract), (gnet_unix_socket_unref), (gnet_unix_socket_server_new_internal), (gnet_unix_socket_server_new), (gnet_unix_socket_server_new_abstract): * src/unix.h: * tests/client_server_test.pl: API: gnet_unix_socket_new_abstract() API: gnet_unix_socket_server_new_abstract() Add support for abstract unix sockets. If not supported on the platform used, the new functions will try to create normal unix sockets. (#404583) 2007-02-01 Tim-Philipp Müller * doc/tmpl/base64.sgml: * doc/tmpl/conn-http.sgml: * doc/tmpl/conn.sgml: * doc/tmpl/gnet.sgml: * doc/tmpl/inetaddr.sgml: * doc/tmpl/iochannel.sgml: * doc/tmpl/ipv6.sgml: * doc/tmpl/mcast.sgml: * doc/tmpl/md5.sgml: * doc/tmpl/pack.sgml: * doc/tmpl/server.sgml: * doc/tmpl/sha.sgml: * doc/tmpl/socks.sgml: * doc/tmpl/tcp.sgml: * doc/tmpl/udp.sgml: * doc/tmpl/unix.sgml: * doc/tmpl/uri.sgml: Update. 2007-02-01 Tim-Philipp Müller Based on patch by: Zeeshan Ali * NEWS: * src/unix.c: (gnet_unix_socket_new), (gnet_unix_socket_server_new): Pass SUN_LEN (struct sockaddr_un) as size parameter to bind() and connect() rather than just sizeof (struct sockaddr_un); apparently this matters in some environments (yay for great APIs; also yay for wrong man pages). Fixes #403197. Also do a bunch of small clean-ups, and don't leak memory/sockets in some failure cases. 2007-02-01 Tim-Philipp Müller * examples/echoclient-unix.c: (main): Don't print a welcome message to stdout, it confuses the automatic testing script. * tests/client_server_test.pl: Test unix socket server/client as well. 2007-01-04 Tim-Philipp Müller Patch by: Jeff Garzik * src/conn.c: (gnet_conn_unref): * src/inetaddr.c: (gnet_inetaddr_unref): (gnet_inetaddr_get_name_async_cb): * src/md5.c: (gnet_md5_delete): * src/sha.c: (gnet_sha_delete): * src/tcp.c: (gnet_tcp_socket_connect_async_cancel): * src/uri.c: (gnet_uri_set_scheme): (gnet_uri_set_userinfo): (gnet_uri_set_hostname): (gnet_uri_set_path): (gnet_uri_set_query): (gnet_uri_set_fragment): Eliminate unnecessary non-NULL checks in front of g_free(). g_free() handles NULL just fine and will do nothing in that case. * tests/conn_http_test.c: (test_simple_get): Fix typo. 2006-12-10 Tim-Philipp Müller * examples/xmlrpc/xmlrpc-client.c: (gnet_xmlrpc_client_call), (build_xmlrpc_message): Use gsize where appropriate; add cast from gsize to correct printf format. Patch by Jeff Garzik . 2006-10-30 Tim-Philipp Müller * src/conn-http.c: (gnet_conn_http_conn_connected), (gnet_conn_http_conn_recv_response), (gnet_conn_http_conn_recv_headers), (gnet_conn_http_conn_recv_chunk_body), (gnet_conn_http_conn_recv_nonchunked_data), (gnet_conn_http_conn_cb): Fix behaviour when the server closes the connection (this is not automatically an error). Fix retrieval of non-text data in non-chunked mode (we would use _readline() for non-chunked mode, but this might cause data at the end of the file to be lost if the file is random binary data). 2006-10-30 Tim-Philipp Müller * src/conn-http.c: (gnet_conn_http_conn_recv_chunk_body), (gnet_conn_http_conn_recv_nonchunked_data): Don't forget to set the buffer_length member in our GConnHttpEventData structure when emitting a PARTIAL_DATA event. * tests/conn_http_test.c: (http_async_callback): Check that GConnHttpEventData members are set for PARTIAL_DATA events. 2006-10-30 Tim-Philipp Müller * src/conn-http.c: (gnet_conn_http_append_to_buf), (gnet_conn_http_new), (gnet_conn_http_set_user_agent): Append comment with GNet version to any custom user agent strings; minor indentation fix in _append_to_buf(). 2006-10-30 Tim-Philipp Müller Based on patch by: Samuel Cormier-Iijima * NEWS: * doc/gnet-sections.txt: * src/conn-http.c: (gnet_conn_http_set_uri_internal), (gnet_conn_http_set_uri), (gnet_conn_http_set_escaped_uri): * src/conn-http.h: API: added gnet_conn_http_set_escaped_uri(). 2006-10-07 Tim-Philipp Müller * src/base64.c: (gnet_base64_encode), (gnet_base64_decode): Add guards for NULL input. A 0-length input to gnet_base64_encode() should return an empty string and not NULL. In the case of gnet_base64_decode(), use strlen(src) for all non-positive values of srclen and not just 0, since glib usually uses -1 for this (0-sized input should really just have returned a 0-sized output buffer, but we can't change that now for backwards compatibility reasons). 2006-09-27 Tim-Philipp Müller * README: Update (no more glib-1.2). 2006-09-13 Tim-Philipp Müller * tests/.cvsignore: * tests/Makefile.am: * tests/tcp_test.c: Add unit test for bug #305854. * examples/sdr.c: (main): Add some refs/unrefs to test the derived nature of GMcastSocket and the run-time 'type checks'. 2006-09-13 Tim-Philipp Müller * src/gnet-private.h: * src/inetaddr.c: (gnet_inetaddr_new_async): * src/tcp.c: (gnet_tcp_socket_connect_async), (gnet_tcp_socket_connect_inetaddr_cb): Move more private and only locally used structs into the appropriate .c files; make some internal functions static; use proper AsyncID types for such IDs; don't leak mutex. 2006-09-13 Tim-Philipp Müller * AUTHORS: * MAINTAINERS: * Makefile.am: Add maintainers file, update/utf8-ise/reformat authors file. 2006-09-13 Tim-Philipp Müller * src/tcp.c: (gnet_tcp_socket_connect_async_cancel): We used gnet_inetaddr_new_list_async(), so we also need to call gnet_inetaddr_new_list_async_cancel() to cancel it, and not gnet_inetaddr_new_async_cancel(). Would cause invalid memory access, double frees and other weird things when cancelling an asynchronous TCP connect before the dns lookup has finished. Fixes #305854. * src/gnet-private.h: * src/inetaddr.h: * src/tcp.h: The compiler can help us with stuff like this. Let's let it. 2006-09-12 Tim-Philipp Müller * src/gnet-private.h: * src/mcast.c: (gnet_mcast_socket_new_full), (gnet_mcast_socket_delete), (gnet_mcast_socket_ref), (gnet_mcast_socket_unref), (gnet_mcast_socket_get_io_channel), (gnet_mcast_socket_get_local_inetaddr), (gnet_mcast_socket_join_group), (gnet_mcast_socket_leave_group), (gnet_mcast_socket_get_ttl), (gnet_mcast_socket_set_ttl), (gnet_mcast_socket_is_loopback), (gnet_mcast_socket_set_loopback): * src/mcast.h: * src/udp.c: Move GUdpSocket structure back into gnet-private.h and make GMcastSocket derive from it explicitly and properly. More and better guards for input to public gnet_mcast_*() functions. 2006-09-12 Tim-Philipp Müller * src/gnet-private.h: * src/unix.c: Move another private structure that is only used locally to where it belongs. 2006-09-11 Tim-Philipp Müller * configure.ac: Require at least GLib-2.6. Give more extensive error message if GLib development files are not found. * src/gnet-private.h: * src/udp.c: (gnet_udp_socket_new_full), (gnet_udp_socket_delete), (gnet_udp_socket_ref), (gnet_udp_socket_unref), (gnet_udp_socket_get_io_channel), (gnet_udp_socket_get_local_inetaddr), (gnet_udp_socket_send), (gnet_udp_socket_receive), (gnet_udp_socket_has_packet), (gnet_udp_socket_get_ttl), (gnet_udp_socket_set_ttl): Move private struct over to where it belongs (udp.c); guard all public functions properly against bad input; try harder to guard against bad input by adding a type cookie to the beginning of our struct; do refcounting atomically for GUdpSocket. 2006-09-11 Tim-Philipp Müller * src/gnet-private.c: (gnet_private_io_channel_new): No need to special-case for GLib-2.0 any more, since we don't support 1.2 any longer. 2006-09-11 Tim-Philipp Müller * src/uri.c: (gnet_uri_new), (gnet_uri_get_string): * tests/uri_test.c: (main): Add support for absolute file:// URIs and add two simple test cases. Not entirely convinced about the required fix to _get_string(), but it doesn't seem to break any of the tests, so it can't be too bad even if it's not entirely correct. Fixes bug #317456. Based on patch by Milosz Derezynski 2006-09-10 Tim-Philipp Müller Patch by: Dov Grobgeld * configure.ac: * examples/Makefile.am: * examples/xmlrpc/.cvsignore: * examples/xmlrpc/Makefile.am: * examples/xmlrpc/README: * examples/xmlrpc/test-xmlrpc-client.c: * examples/xmlrpc/test-xmlrpc-server.c: * examples/xmlrpc/xmlrpc-client.c: * examples/xmlrpc/xmlrpc-server.c: * examples/xmlrpc/xmlrpc.h: Add Dov Grobgeld's XMLRPC code to the examples for posteriority. 2006-09-03 Tim-Philipp Müller Patch by: Thadeu Lima de Souza Cascardo * src/inetaddr.c: (gnet_gethostbyname), (gnet_inetaddr_new), (gnet_inetaddr_new_list), (gnet_inetaddr_new_list_async), (inetaddr_new_list_async_nonblock_dispatch), (inetaddr_new_list_async_gthread): Check whether the given hostname can be resolved without blocking before creating a thread or forking to do the lookup. Avoids unnecessary overhead in some cases (#353727). * tests/unpack_test.c: (main): Add cast for unsigned integers to avoid compiler warnings here. 2006-08-12 Tim-Philipp Müller * RELEASE: Add note to check for ss_family usage before release. * src/inetaddr.c: (hostent2ialist), (gnet_inetaddr_new_list_async_cb): Don't access the ss_family field directly, use the GNET_SOCKADDR_FAMILY() accessor macro instead in order to keep tings compiling on older systems. Patch by: Mark Drago 2006-06-23 Tim-Philipp Müller * autogen.sh: Find newer automake/autoconf versions and use those if available. 2006-05-24 Benjamin Otte * src/gnet-private.h: add lost stuff for !win32 from previous patch * tests/conn_http_test.c: (main): remove windows-specific debugging stuff * tests/unpack_test.c: (main): fix "comparison always true due to limited range of data type" warning 2006-05-24 Benjamin Otte * src/gnet-private.c: (DllMain): * src/gnet-private.h: * src/gnet.c: (gnet_init): * src/inetaddr.c: (inet_pton), (inet_ntop), (gnet_gethostbyname), (gnet_gethostbyaddr), (inetaddr_new_list_async_gthread), (gnet_inetaddr_get_canonical_name), (gnet_inetaddr_get_host_name): * src/inetaddr.h: * src/mcast.c: (gnet_mcast_socket_is_loopback), (gnet_mcast_socket_set_loopback): * src/tcp.c: (gnet_tcp_socket_new_async_direct), (gnet_tcp_socket_new_async_cb), (gnet_tcp_socket_new_async_cancel): * tests/conn_http_test.c: (main): apply patch from bug #147392 - it removes a lot of not-needed special cases for the Windows backend * src/gnet-private.c: (gnet_private_create_ipv4_listen_socket), (gnet_private_create_ipv6_listen_socket), (gnet_private_create_listen_socket) * src/gnet-private.h: handle IP version policy correctly when creating listening sockets 2006-05-20 Tim-Philipp Müller * doc/gnet-sections.txt: Make #include show at top of each docs section (fixes #341816). 2006-05-05 Benjamin Otte various fixes for Windows compilation: * src/gnet-private.h: define socklen_t only if it's not defined in config.h * src/gnet.c: do not compile ipv6_detect_envvar and ipv6_detect_iface on Windows * src/inetaddr.c: inet_ntop is unused on windows * src/mcast.c: (gnet_mcast_socket_is_loopback), (gnet_mcast_socket_set_loopback): cast [gs]etsockopt pointers to avoid warnings 2006-05-05 Benjamin Otte * src/conn-http.c: (gnet_conn_http_set_uri), (gnet_conn_http_delete_internal): * src/conn.c: Deperecated gnet_conn_delete in favour of gnet_conn_unref. 2006-05-05 Benjamin Otte Reviewed by: Tim-Philipp Müller * src/conn.c: (async_cb): Don't send an error on HUP (fixes bug #340747) 2006-03-17 Tim-Philipp Müller * examples/echoserver-unix.c: (main): No need to re-invent g_strdup(), but if someone does he better allocate enough space for the terminating NUL. 2005-12-10 Tim-Philipp Müller * doc/tmpl/conn-http.sgml: Mention the need to define GNET_EXPERIMENTAL before including gnet headers in the docs. 2005-11-30 Benjamin Lee Reviewed by: Tim-Philipp Müller * examples/echoserver-async.c: (async_client_iofunc): Check for G_IO_OUT before checking for G_IO_IN, so that we don't forget to send out the last chunk of bytes if we get notified of a disconnect via G_IO_IN. 2005-11-16 Tim-Philipp Müller * src/base64.c: * src/md5.c: * src/sha.c: const-ify some more arrays; fix potential signedness issue in the md5/sha digest stringification code. 2005-11-16 Tim-Philipp Müller * NEWS: Update * src/base64.c: Make table constant 2005-11-16 Tim-Philipp Müller * src/gnet-private.h: * src/inetaddr.c: (gnet_inetaddr_new_async), (inetaddr_new_async_cb): Fix race condition in async DNS resolution code: inetaddr_new_async_cb() might be called before gnet_inetaddr_new_async() gets around to setting state->func and state->data (based on patch by steve_morris@arcadyan.com). 2005-11-16 Tim-Philipp Müller * src/uri.c: (field_escape): Fix URI escaping for characters from 0x80-0xff. 2005-11-15 Tim-Philipp Müller * NEWS: * configure.ac: * doc/gnet-sections.txt: * gnet.def: Update for API addition. 2005-11-15 Jeff Garzik * src/conn.c: (conn_write_free), (gnet_conn_disconnect), (gnet_conn_write_direct), (gnet_conn_write), (conn_write_async_cb): * src/conn.h: Add gnet_conn_write_direct(), to allow the caller to control the write buffer. 2005-10-27 Tim-Philipp Müller * src/pack.h: * src/scheduler.h: Add extern "C" bits for c++ compiler. 2005-09-19 Tim-Philipp Müller * configure.ac: * src/gnet-private.h: Check if system provides socklen_t; if not define it to be size_t or int as required. * gnetconfig.h.win32: Bump version numbers to 2.0.8 2005-09-19 Tim-Philipp Müller * examples/echoclient-unix.c: * examples/echoserver-unix.c: Relicense these to LGPL as well (I missed Marks approval, see below, same message). * NEWS: update 2005-09-19 Tim-Philipp Müller * examples/dnslookup.c: * examples/echoclient-async.c: * examples/echoclient-gconn.c: * examples/echoclient-udp.c: * examples/echoclient.c: * examples/echoserver-async.c: * examples/echoserver-gserver.c: * examples/echoserver-partyline.c: (ob_sig_int): * examples/echoserver-udp.c: * examples/echoserver.c: * examples/hash.c: * examples/hfetch.c: * examples/hostinfo.c: * examples/sdr.c: Relicense these examples from GPL to LGPL (as approved by the copyright holder, David Helder, on the gnet mailing list, Message ID: ). 2005-09-19 Steve Morris Reviewed by: Tim-Philipp Müller * src/conn-http.c: (gnet_conn_http_done): Disable timeout when we have received all data. 2005-09-18 Daniel Gryniewicz Reviewed by: Tim-Philipp Müller * examples/echoclient-async.c: (async_client_sin_iofunc), (async_client_in_iofunc): * examples/echoclient-gconn.c: (ob_in_iofunc): * examples/echoclient-unix.c: (normal_echoclient): * examples/echoclient.c: (main): * examples/echoserver-async.c: (async_client_iofunc): * examples/echoserver-unix.c: (normal_echoserver), (async_client_iofunc): * examples/echoserver.c: (main): * examples/hfetch.c: (hfetch): * src/conn-http.c: (gnet_conn_http_conn_connected): Fix compilation with -Werror on amd64 (mostly a simple s/guint/gsize/ for the GIOChannel API that was changed the same way in the GLib 1.2 => 2.0 transition). 2005-08-31 Tim-Philipp Müller * src/conn-http.c: (gnet_conn_http_conn_connected), (gnet_conn_http_conn_got_data): Renew timeout when connected and whenever data is received (makes transfers that take longer than 30 seconds work). 2005-08-31 Tim-Philipp Müller * src/md5.c: (gnet_md5_new), (gnet_md5_update): * src/sha.c: (gnet_sha_new), (gnet_sha_update): * src/tcp.c: (gnet_tcp_socket_new_async_cb): * src/udp.c: (gnet_udp_socket_receive): Fix compilation with gcc4 (signedness issues). 2005-07-25 Tim-Philipp Müller * src/conn-http.c: (gnet_conn_http_reset), (gnet_conn_http_conn_parse_response_headers), (gnet_conn_http_conn_recv_headers): Fix redirection to new location in connection with a Content-Length of 0, ie. no body to receive (would just timeout after waiting for the body data before). * tests/conn_http_test.c: (test_post): Fix POST test by supplying a developer ID (please do not use this for your own code, get your own ID). 2005-05-31 Tim-Philipp Müller * doc/gnet-docs.sgml: The pkg-config module is gnet-2.0 these days, fix docs. 2005-05-03 Tim-Philipp Müller * src/usagi_ifaddrs.c: (free_nlmsglist): Fix memory leaks 2005-04-25 Tim-Philipp Müller * configure.ac: Update version to 2.0.8 as well * RELEASE: * configure.ac: * debian/.cvsignore: * debian/README.Debian: * debian/changelog: * debian/control.in: * debian/dirs: * debian/docs: * debian/libgnet-dev.preinst: * debian/libgnet1.0.README.Debian: * debian/libgnet1.0.docs: * debian/libgnet1.0.postinst: * debian/libgnet1.1.README.Debian: * debian/libgnet1.1.docs: * debian/libgnet1.1.postinst: * debian/libgnet2.0-0.files: * debian/rules: * debian/rules.in: Update debian build stuff (most taken directly from Takuo Kitame's .diff for the real debian packages) 2005-04-25 Andreas Rottmann Reviewed by: Tim-Philipp Müller * NEWS: * configure.ac: * doc/gnet-docs.sgml: * src/gnet-private.h: * src/inetaddr.c: (gnet_inetaddr_new_list_async), (inetaddr_new_list_async_gthread), (inetaddr_new_list_async_gthread_dispatch), (gnet_inetaddr_new_list_async_cancel), (gnet_inetaddr_get_name_async), (gnet_inetaddr_get_name_async_cancel), (inetaddr_get_name_async_gthread_dispatch), (inetaddr_get_name_async_gthread): Eliminate direct usage of pthreads on unix systems and use GLib GThreads instead. 2005-04-25 Tim-Philipp Müller * tests/base64_test.c: (main): * tests/conn_http_test.c: (main): * tests/inetaddr_test.c: (main): Tests need to call gnet_init() before using any gnet functions as well. 2005-04-25 Tim-Philipp Müller * NEWS: * src/conn-http.c: (gnet_conn_http_new), (gnet_conn_http_emit_event), (gnet_conn_http_done), (gnet_conn_http_conn_parse_response_headers), (gnet_conn_http_conn_recv_chunk_body), (gnet_conn_http_conn_recv_nonchunked_data), (gnet_conn_http_conn_cb), (gnet_conn_http_ia_cb), (gnet_conn_http_delete_internal), (gnet_conn_http_delete): Make sure the http connection can be deleted from within the user callback. Do not emit _DATA_PARTIAL or _DATA_COMPLETE if we are going to be redirected to a different target anyway. * tests/conn_http_test.c: (http_async_callback), (test_get_async), (main): Add some test cases for GConnHttp in async mode. 2005-04-25 Tim-Philipp Müller * doc/tmpl/conn-http.sgml: Add GNET_CONN_HTTP_ERROR_HOSTNAME_RESOLUTION * src/conn-http.c: (gnet_conn_http_new), (gnet_conn_http_set_header), (gnet_conn_http_set_user_agent), (gnet_conn_http_set_uri), (gnet_conn_http_set_method), (gnet_conn_http_conn_cb), (gnet_conn_http_ia_cb), (gnet_conn_http_run_async), (gnet_conn_http_run), (gnet_conn_http_steal_buffer), (gnet_conn_http_delete), (gnet_conn_http_cancel), (gnet_conn_http_set_timeout): * src/conn-http.h: Actually do emit an error when we couldn't resolve the hostname; add some pseudo-typesafety by adding a magic cookie to the beginning of the structure and checking that cookie in all public gnet_conn_http_*() functions; add GNET_CONN_HTTP_ERROR_HOSTNAME_RESOLUTION; make sure there are no trailing commas after the last enum value in enumerations (gcc-2.9x does not seem to like that). 2005-04-13 Tim-Philipp Müller * acinclude.m4: Added pkg.m4 * configure.ac: Drop support for GLib-1.2 * configure.ac: * src/gnet-private.h: * src/udp.c: (gnet_udp_socket_send): Check for struct sockaddr_storage family member; fixes build on systems that use __ss_family instead of ss_family. Based on patch by Jeremy Denise. * NEWS: Update 2005-04-13 Tim-Philipp Müller * NEWS: Update * src/conn-http.h: Get rid of outdated references to GString in inline documentation. gnet_conn_http_steal_buffer() is the way to take ownership of a HTTP connection's data. 2005-04-13 Tim-Philipp Müller * src/conn-http.c: (gnet_conn_http_append_to_buf), (gnet_conn_http_reset), (gnet_conn_http_new), (gnet_conn_http_steal_buffer): Fix major memory leak in _steal_buffer(); avoid making an unnecessary copy in _steal_buffer(): always allocate one more byte than required, so we always have space for a terminating NUL. * tests/conn_http_test.c: (test_simple_get): Add missing g_free(buf) so we can use the test to check for memory leaks. 2005-03-10 Tim-Philipp Müller * configure.ac Set to 2.0.8 * NEWS: * src/gnet.c: (gnet_init): Return if gnet_init() has been called before, making sure that gnet_init() can safely be called multiple times. This is useful for example for libraries depending on GNet that want to call gnet_init() from their own init function instead of depending on it being called from the application. 2005-02-23 Tim-Philipp Müller * NEWS: Update for 2.0.7 2005-02-20 Tim-Philipp Müller * RELEASE: Before release, check whether the created tarball really contains the HTML docs. * doc/Makefile.am: Fix 'make distcheck' which the previous commit broke (version.xml needs to be copied to built dir apparently) * gnet.def: Make DllMain a stdcall (use DllMain@12) to keep GNU ld and gcc from complaining on win32 (patch by Gisle Vanem). 2005-02-19 Tim-Philipp Müller * configure.ac: * doc/.cvsignore: * doc/Makefile.am: * doc/README: * doc/gnet-docs.sgml: * doc/version.xml.in: Put the version number into the API reference manual banner; update doc README and remove outdated docs build instructions. 2005-02-19 Tim-Philipp Müller * RELEASE: Added some notes on which win32 files need to be changed when new source files and/or new symbols are added. * NEWS: * configure.ac: Set to 2.0.7 * gnet.def: Make sure the new gnet_conn_http_* and gnet_http_get symbols are exported in the win32 DLLs (patch by Gisle Vanem) === release 2.0.6 === 2005-02-17 Tim-Philipp Müller * Makefile.am: Add --enable-gtk-doc to DISTCHECK_CONFIGURE_FLAGS, fixing 'make distcheck'. * NEWS: * README: Update for 2.0.6 2005-02-17 Tim-Philipp Müller * GNET.DSP: * src/makefile.mingw: Add conn-http.[ch] * NEWS: update 2005-02-17 Tim-Philipp Müller * examples/dnslookup.c: (main): getopt returns an int, not a char; fixes compilation under strict conditions. (fixes #167706, patch by Joseph Sacco) 2005-02-07 Tim-Philipp Müller * configure.ac: When building on win32 using configure/autotools, always define HAVE_IPV6, so that GNET_ADDRLEN is the right size for ipv6 structs and calls to getnameinfo() don't crash on IPV6-enabled systems (gnetconfig.h.win32 where HAVE_IPV6 is already defined is not used when building on win32 using the autotools). Fixes #142644 2005-02-04 Tim-Philipp Müller * AUTHORS: Fix my e-mail address * acinclude.m4: * autogen.sh: * configure.ac: Use GTK_DOC_CHECK macro * doc/Makefile.am: Update gtk-doc build magic * doc/gnet-docs.sgml: Fix build issue with some jade versions: add xml header, change to OASIS/DTD DocBook XML V4.1.2 and fix entities and comments accordingly; update copyright to include 2005. * src/mcast.c: Properly quote arguments to HTML tags in inline docs to fix build issues. 2005-02-01 Tim-Philipp Müller * src/base64.c: (gnet_base64_encode): * tests/.cvsignore: * tests/base64_test.c: (main): Fix base64 encoding bug reported on mailing list (24 Oct 2004) and add test case for it. Also fix gnet_base64_encode() documentation (the length of the buffer returned DOES include the terminating 0). * NEWS: Update * tests/.cvsignore: Add conn_http_test binary to list of non-CVS files to ignore 2005-02-01 Tim-Philipp Müller * tests/conn_http_test.c: (test_post): Make ConnHttp test compile on GLib versions < 2.4 which don't have g_markup_printf_escaped() Thu Oct 7 21:25:18 2004 David Helder * src/conn-http.h: Require GNET_EXPERIMENTAL to be defined. * tests/conn_http_test.c (GNET_EXPERIMENTAL): Define GNET_EXPERIMENTAL * configure.ac: Redo pthread checking logic so we actually run a program with pthreads when checking for -pthread. Just checking for linking doesn't work, since gcc will fail *but* exit 0 on -pdoesnotexist. Bug 138692. * NEWS: Updates for Snapshot Mon Sep 27 20:26:51 2004 David Helder * examples/echoclient-async.c (async_client_sin_iofunc): Don't unref iochannel. gnet_tcp_socket_delete() will do this. Bug 118149. Sun Sep 26 22:13:02 2004 David Helder * src/gnet.c (gnet_init): Respect HAVE_IPV6 #define in Windows code too. Patch from David Ergo (david.ergo@alterface.com). Sun Sep 26 22:02:00 2004 David Helder Apply patch from Stephane Rouleau (srouleau@innobec.com). Win32: Don't rely on DllMain() to be called on for init and uninit. Instead init in gnet_init() and uninit on exit. * src/gnet-private.h: Add gnet_{un}initialize_windows_sockets() * src/gnet-private.c (gnet_initialize_windows_sockets): Move init code here. * src/gnet-private.c (gnet_uninitialize_windows_sockets): Move uninit code here. * src/gnet.c (gnet_init): Call gnet_initialize_windows_sockets() * src/gnet.c (gnet_win32_at_exit): Call gnet_uninitialize_windows_sockets() Wed May 19 22:20:54 2004 David Helder * src/conn-http.c: Apply Tim's second patch. Wed May 19 21:58:46 2004 David Helder * *http*: Apply Tim Müller's first HTTP Conn patch. Wed May 19 21:38:38 2004 David Helder * src/gnet-private.h: Add Win32 and Unix macros for GNET_IS_SOCKET_VALID. 0 is an invalid socket in Windows. -1 is invalid in Unix (I check for < 0 to be safe). Suggested by K. Haley. * src/*.c: Use GNET_IS_SOCKET_VALID Wed May 19 21:20:37 2004 David Helder * {tests,examples}/Makefile.am (noinst_PROGRAMS): Add Windows-only rules. From K. Haley Sun Mar 21 18:04:50 2004 Andrew Lanoix *src/gnet-private.c(DllMain): If RegisterClassEx() fails, check to see if class was already registered. Uncomment DestroyWindow(). Found by: Tommy Chang Mon Mar 1 19:07:26 2004 David Helder * *: Prepare 2.0.5 Sun Feb 15 2004 Tomasz K³oczko * gnet-2.0.m4: added missing [] quotation first parameter of AC_DEFUN(). This fix is for aclocal from automake 1.8.x and is backward compatible with older auto tools. Sat Jan 17 2004 Andrew Lanoix *src/tcp.c(gnet_tcp_socket_new_async_direct(): Watch on GNET_ANY_IO_CONDITION like UNIX. Reported to us by Tim Müller. *src/conn.c: Do not do and a g_io_add_watch() if watch_flags is NULL in REMOVE_WATCH macro. Found by Andreas Rottmann Sun Jan 4 2004 Andrew Lanoix * README.win32: Update for GNet 2.0 Sun Dec 28 2003 Andrew Lanoix *src/tcp.c: typecasting cleanup *src/conn.c: " + include string.h for g_memmove/memmove *src/gnet-private.c: Make sockfd of type SOCKET *src/gnet-private.h: " + delete _SocketWatchAsyncState struct *src/upd.c" " Sat Dec 27 2003 Andrew Lanoix *src/tcp.c(gnet_tcp_socket_server_new_full): Set socket as reusable and non-blocking on Windows as well. *src/gnet-private.h: Have gnet_private_create_listen_socket return SOCKET not int to make VC happy. *src/gnet-private.c(gnet_private_create_listen_socket): On Windows use getaddrinfo() in IPv6 case for a simple memset does not work for bind() fails. Tue Dec 9 21:10:46 2003 David Helder * src/inetaddr.c: Check return value of inet_pton with > 0 for success. Negative values can indicate error. FreeBSD and OpenBSD return 1 on success, but Linux return a "postive number" (so don't do == 1). * src/gnet-private.h: Fix comment typos. (Thanks Michael Alger) * TODO: Update note on readv(). (Thanks Stephane LOEUILLET) * src/gnet-private.c: Apply Tim Müller's patch to use gsize. Fixes warnings. Mon Dec 8 2003 Andrew Lanoix * src/gnet-private.c(gnet_private_create_listen_socket): Declare sockfd as type SOCKET to make compiler happy. On Unix, SOCKET is defined as an int. * src/inetaddr.c(gnet_inetaddr_get_interface_to): " * src/*: Get rid of hostent mutex since one hostent per thread on Windows according to MSDN. * src/gnet-private.h: Delete hostent mutex releated code and add new changes for IPv6 for the below functions. * src/inetaddr.c: Include process.h, Add support for IPv6 on Windows for the following functions and update related docs about them. gnet_inetaddr_new_list_async() gnet_inetaddr_new_list_async_cancel() gnet_inetaddr_get_name_async() gnet_inetaddr_get_name_async_cancel() * src/inetaddr.c(gnet_inetaddr_list_interfaces): Update note so that 10 interface limit only applies to IPv4 only systems on Windows, not IPv6 systems. * doc/tmpl/ipv6.sgml: Document how IPv6 policy is set on Windows. Tue Oct 28 19:02:40 2003 David Helder * src/inetaddr.c (inetaddr_get_name_async_pthread): On failure, call gnet_inetaddr_get_canonical_name(). Before we did a g_snprintf(), which only worked for IPv6. * src/conn.c (gnet_conn_set_watch_error): Fix doc. Sun Oct 5 20:53:09 2003 David Helder * README (Features): Added Workrave Sun Oct 5 14:29:03 2003 David Helder * README (Features): Added Mail Notify, Sussen. Remove Gabber, Ximian Red Carpet Sat Oct 4 2003 Andrew Lanoix * src/gnet-private.h: Define SOCKET as guint for non-windows platforms, Add Name-mangled versions of needed IPv6 structs for Mingw & VC, Add typedefs of necessary IPv6 func pointers, Define IN6_ARE_ADDR_EQUAL for Windows. * src/gnet.c (gnet_win32_at_exit): Add * src/gnet.c (gnet_init): Query OS for IPv6 support on Windows and set necessary func pointers at runtime. * gnetconfig.h: Define HAVE_IPV6 for Win32 version, check at runtime on Windows. * src/inetaddr.c (gnet_gethostbyname): Updated for IPv6 on Windows * src/inetaddr.c (gnet_gethostbyaddr): " * src/inetaddr.c (gnet_inetaddr_get_canonical_name): " * src/inetaddr.c (gnet_inetaddr_list_interfaces): " TODO: Fix up gnet_inetaddr_new_list_async() and gnet_inetaddr_get_name_async() so they work like their pthread equivalents. The current Windows implementation using a hidden window can not be upgraded to IPv6 since the underlying functions it relies upon are not IPv6 compliant -- that is: WSAAsyncGetHostByName() and WSAAsyncGetHostByAddr(). Sun Aug 24 20:52:52 2003 Andrew Lanoix * examples/echoserver-partyline.c: Added 2003-08-22 Tor Lillqvist * acinclude.m4: New file. Dummy definition of AM_PATH_GLIB to fool aclocal on systems without GLib 1.2. * configure.ac: Check for Win32, set automake variable OS_WIN32. Call AC_LIBTOOL_WIN32. Define AM_PATH_GLIB if undefined (calling AC_MSG_ERROR). Disable static library build on Windows. * src/Makefile.am: On Win32, use -no-undefined and link with -lws2_32. * src/gnet-private.c: Mark variables used only here as static. Add prototypes, because of the -Wmissing-prototypes and -Werror. * src/gnet-private.h: Remove variables marked as static to gnet-private.c above. * src/unix.c: Bypass on Win32. * src/tcp.c (gnet_tcp_socket_new_async_direct): [Win32 version] Must watch for G_IO_OUT to catch connect() connecting. Sun Aug 10 21:14:20 2003 David Helder * src/uri.c (field_escape): Mask top 4 bytes before shifting. Fixes escaping high Latin-1 bug reported by Emmanuel Saracco. * tests/uri_test.c (escape_tests): Added test case for this. * tests/Makefile.am (CLEANFILES): Delete diff files. * src/tcp.c (gnet_tcp_socket_new_async_direct): Add GNET_CLOSE_SOCKET()'s before returns if there's an error. Warn if fcntl() fails. Thanks Hans Petter Jansson! * src/*.c: Call g_warning() when syscalls that ought not fail, fail: socket(), fcntl(), getsockopt(). (There are probably many that I missed.) Wed Jul 30 20:24:54 2003 Andrew Lanoix * src/gnet-private.c (gnet_MainCallBack): Make PeekMessage() condition of while loop. Found by Hans Petter Jansson . Mon Jul 28 20:19:34 2003 David Helder * NEWS: Update for 2.0.4 Wed Jul 23 21:32:30 2003 David Helder * gnet-2.0.pc.in: Back out the -R${libdir} fix for Solaris. This breaks other systems. * configure.ac: Check sizeof(long), sizeof(void*) * tests/unpack_test.c (main): Compile 64 bit tests if long is 64 bit. Use SIZEOF_VOIDP too. * src/tcp.c (gnet_tcp_socket_server_accept_nonblock): s/INVALID_SOCKET/-1/. This #define isn't on Unix. * examples/echoclient-async.c (async_client_sin_iofunc): Don't unref async_sin. (New GNet 2 get_io_channel() semantics). Fixes bug #118149. Thanks charles. Mon Jul 21 21:04:25 2003 David Helder * src/inetaddr.c (gnet_gethostbyname): Solaris gethostbyname_r() returns a struct hostent*, not an int. Patch from charles. Fixes bug #118023. Wed Jun 11 20:29:44 2003 Andrew Lanoix *src/tcp.c (gnet_tcp_socket_server_accept): Pass size of sockaddr_storage to accept() to get address of incoming conections on win32. Found by Hans Petter Jansson *src/tcp.c (gnet_tcp_socket_server_accept_nonblock): " *src/tcp.c: Fix typecasting to satisfy Visual Studio Sat Jun 6 17:07:19 2003 Andrew Lanoix * src/inetaddr.c (gnet_inetaddr_new_list_async_cb): &state->ias->data should be state->ias->data. * src/tcp.c (gnet_tcp_socket_new_async_direct) Do not call back on a failure in GNet 2.0. Both issues found by Hans Petter Jansson . Tue Jun 3 12:11:44 2003 David Helder * AUTHORS: Change my email address * tests/unpack_test.c (main): Add 64 bit tests. * tests/unpack_test.c (main): Use sizeof's for size. * tests/unpack_test.c (main): Use lg*int where we were using ig*int. * tests/pack_test.c (test_bytes): Skip the first half of 64-bit answers. (We store the correct value as 32 bits.) * src/pack.c (gnet_vpack): Longs should get long off of stack, not int. * src/pack.c (gnet_vcalcsize): " (not that it matters for this func.) * tests/pack_test.c (main): long tests need buffer sizeof(long). (and use sizeof(unsigned int) for unsigned int tests. Sat May 31 12:47:45.57 2003 Andrew Lanoix * src/makefile.mingw: Update for 2.0 * examples/makefile.mingw: " * tests/makefile.mingw: " * gnet.def: " Tue May 20 21:03:15 2003 David Helder * configure.ac: Don't check for -lpthread or -lc_r if -pthread or -pthreads worked. * src/inetaddr.c (inet_ntop): Make buf const. Wed May 14 00:48:22 2003 David Helder * configure.ac: Update version (unreleased) * src/tcp.c (gnet_tcp_socket_server_accept): cast to struct sockaddr (Win32) * src/tcp.c (gnet_tcp_socket_server_accept_nonblock): " Tue May 13 23:54:59 2003 David Helder * src/gnet-private.h (in_addr_t): define for win32. (guint32) * src/inetaddr.c (gnet_inetaddr_unref): ref_count--, not ++ (thanks Pierre-Emmanuel Gros). :-\ Tue May 13 22:31:19 2003 David Helder * NEWS: 2.0.3 * configure.ac (GNET_BINARY_AGE): " Tue May 13 14:58:28 2003 David Helder * README: Added Gnome Jabber. * src/inetaddr.c (inet_ntop): Copy from src, not dst. * src/inetaddr.c (gnet_inetaddr_get_canonical_name): Remove Win32 version (we wrote a inet_ntop for it.) Tue May 13 01:25:12 2003 David Helder * src/inetaddr.c (inet_ntop): Add Win32 inet_pton and inet_aton. * src/gnet-private.c (DllMain): Comment out DestroyWindow. This causes problems. Andy will take a look at it. * src/gnet-private.h: Define IN_LOOPBACKNET if not defined (like in Windows?) * src/inetaddr.c (gnet_inetaddr_new_list_async_cb): Add a & (was bad cast). * src/inetaddr.c (gnet_inetaddr_new_list_async): s/name/hostname, Fix list code. Delete list. * src/gnet-private.c (gnet_MainCallBack): Use GInetAddrNewListState (a rename) Sun May 11 22:31:59 2003 David Helder * src/inetaddr.c: Use ias, not ia (Win32). Clean-up list code. * src/gnet-private.h (struct _GUnixSocket): ifdef out for Win32 compile. Tue May 6 12:27:07 2003 David Helder * src/inetaddr.c (gnet_gethostbyname): Fix memory leak? Call freeaddrinfo on res if res it set, regardless of there being an error. I'm not sure if this fixes anything. Tue May 6 11:44:33 2003 David Helder * src/tcp.c (gnet_tcp_socket_connect_inetaddr_cb): Don't delete the addresses in state. The get deleted when we call cancel. Tue Apr 29 13:57:43 2003 David Helder * README (Features): Remove GnomeICU Tue Apr 29 12:23:34 2003 David Helder * configure.ac: Fix AC_INIT version. Mon Apr 28 12:32:55 2003 David Helder * configure.ac (GNET_BINARY_AGE): version++ * gnet.pc.in, src/?: Sun compiler patch from Ives Aerts * gnet.spec.in: Fixes from Bas Mevissen Mon Apr 21 18:22:07 2003 David Helder * configure.ac: Update version for 2.0.1 Thu Apr 17 17:52:20 2003 David Helder * tests/inetaddr_test.c (main): More IPv6 fixes. * configure.ac: Check for -pthreads (alternative to -pthread) Wed Apr 16 15:21:21 2003 David Helder * src/inetaddr.c (gnet_gethostbyname): Remover sa_inp - not used. * src/inetaddr.c (gnet_gethostbyname): " * src/gnet-private.h: Fix sockaddr_storage def. Wed Apr 16 11:52:22 2003 David Helder * src/{inetaddr,mcast,udp, gnet-private, gnet}.c: Use HAVE_IPV6 * examples/inetaddr_test.c: " * configure.ac (HAVE_IPV6): Added check for. Tue Apr 15 13:37:38 2003 David Helder * src/gnet-private.h: define sockaddr_storage if not defined. * configure.ac: Check for sockaddr_storage Tue Apr 15 11:07:52 2003 David Helder * src/gnet.c (ipv6_detect_envvar): s/index/strchr/ Sun Apr 13 17:50:23 2003 David Helder * doc/Makefile.am (maintainer-clean-local): Fix clean rule. Sun Apr 13 14:09:14 2003 David Helder * doc/gnet-docs.sgml: Update version. Sat Apr 12 15:24:21 2003 David Helder * *: Various 2.0 renames. * tests/client_server_test.pl (test): Add a pause - too fast for BSD. Wed Mar 19 09:46:12 2003 David Helder * gnet.m4/gnet-1.3.m4: Rename -> gnet-1.3.m4 * configure.ac: Use AC_CANONICAL_SYSTEM instead of BUILD (BSD fix). Wed Mar 5 18:58:44 2003 David Helder * BUGS,README: Updates Wed Mar 5 18:47:04 2003 David Helder * gnet.spec.in: Fixes from Jeff Boonggren (closes #107499) Tue Feb 25 15:19:17 2003 David Helder * src/makefile.mingw: Commited Martyn Russell's patch to use pkg-config. * src/conn.c (async_cb): Guard conn->func's with g_return_val_if_fail(). * src/conn.c (gnet_conn_new_socket): Don't watch error. Fri Feb 21 17:52:18 2003 David Helder * *: Release 1.3.2 * src/gnet-private.h: Add macros for setting ss_len based on ss_family. On linux this is a no-op. * src/inetaddr.c (gnet_inetaddr_list_interfaces: GNET_INETADDR_SET_SS_LEN * src/inetaddr.c (gnet_inetaddr_set_bytes): * src/inetaddr.c (gnet_inetaddr_new_nonblock): * src/inetaddr.c (gnet_inetaddr_new_list_async_cb): * src/inetaddr.c (gnet_gethostbyname): * src/inetaddr.c (hostent2ialist): * src/inetaddr.c (gnet_inetaddr_list_interfaces): * src/inetaddr.c (gnet_inetaddr_list_interfaces): * src/udp.c (gnet_udp_socket_send): * src/gnet-private.c (gnet_private_create_listen_socket): * src/inetaddr.c (gnet_inetaddr_get_interface_to): Assign sa, don't memcpy. * src/inetaddr.c (gnet_inetaddr_list_interfaces): " * src/inetaddr.c (gnet_gethostbyname): Set sin_addr, don't memcpy. * src/inetaddr.c (gnet_gethostbyname): " sin6_addr * src/inetaddr.c (gnet_inetaddr_new_nonblock): " * src/udp.c (gnet_udp_socket_receive): * src/gnet-private.c (gnet_private_create_listen_socket): no memcpy * src/tcp.c (gnet_tcp_socket_server_accept_nonblock): * src/tcp.c (gnet_tcp_socket_server_accept): * src/tcp.c (gnet_tcp_socket_server_accept_nonblock): * src/tcp.c (gnet_tcp_socket_server_accept): " * src/tcp.c (gnet_tcp_socket_get_local_inetaddr): " * src/tcp.c (gnet_tcp_socket_server_new_full): " * src/tcp.c (gnet_tcp_socket_get_remote_inetaddr): * src/tcp.c (gnet_tcp_socket_new_async_direct): no memcpy * src/tcp.c (gnet_tcp_socket_new_direct): no memcpy * src/tcp.c (gnet_tcp_socket_new_async_direct): " * src/udp.c (gnet_udp_socket_send): " * src/udp.c (gnet_udp_socket_get_local_inetaddr): " * src/udp.c (gnet_udp_socket_new_full): " * src/mcast.c (gnet_mcast_socket_new_full): no memcopy * examples/echoserver-udp.c: Print address of server. * src/udp.c (gnet_udp_socket_send): Map IPv4 dst to IPv6 is socket is IPv6 and vice versa. FreeBSD is less tolerant than Linux about this. RFC 2553 says to do this anyway. * src/udp.c (gnet_udp_socket_get_local_inetaddr): Added * src/mcast.c (gnet_mcast_socket_get_local_inetaddr): Added Wed Feb 19 16:55:21 2003 David Helder * Makefile.am (EXTRA_DIST): Distribute tests/testfile * gnet.m4: Updated based on GLib 2.2.1's glib-2.0.m4 * Makefile.am: Install gnet-1.3.pc instead of gnet.pc. Install gnet.m4 to gnet-1.3.m4. * gnet.spec.in: Don't build with --enable-debug=yes. This enables -Werror and messes up SRPM builds. * configure.ac: Check for GLib in this order: 2.2, 2.0, 1.2. Use --enable-glib12 to force GLib 1.2 * configure.ac: Check for -pthread * src/udp.c (gnet_udp_socket_get_ttl): Initialize rv. * src/mcast.c (gnet_mcast_socket_leave_group): s/IPV6_REMOVE_MEMBERSHIP/IPV6_LEAVE_GROUP/, s/IPV6_ADD_MEMBERSHIP/IPV6_JOIN_GROUP/, * configure.ac: Look for ifaddrs.h * src/inetaddr.c: Include ifaddrs.h * src/inetaddr.c: Convert s6_addr32 to s6_addr's. FreeBSD says s6_addr32 is "nonstandard". * src/gnet-private.h (GNET_SOCKADDR_ADDR32): Added. Tue Feb 18 16:53:33 2003 David Helder * src/pack.c: Use gsize for internal functions. buffer length is a gint, not a guint. We return the number of bytes packed/unpacked, which can be -1. So the buffer can't be more then a gint. * src/udp.c (gnet_udp_socket_receive/send): " * src/mcast.c (gnet_mcast_socket_receive/send): " * src/iochannel.[ch]: Use gsize instead of guint Fri Feb 14 16:49:10 2003 David Helder * gnet.pc.in: Link against gnet-MAJOR.MINOR, not plain gnet * src/Makefile.am: Build libgnet-1.3 * configure.ac (LT_CURRENT): Use GLib's macros. Yoink! * src/Makefile.am (libgnet_1_3_la_LDFLAGS): Remove revision from LDFLAGS. Thu Feb 13 16:24:22 2003 David Helder * src/inetaddr.c (gnet_inetaddr_new_list_async_cb): Delete using new_list_async_cancel, not new_async_cancel. Bug! * src/inetaddr.c (gnet_inetaddr_new_list_async_cb): Don't delete the ias after callback. They are callee owned. This fixes a bug. * src/inetaddr.c (gnet_inetaddr_new_list_async): Move ialist_free up. (shouldn't matter) * src/inetaddr.c (gnet_inetaddr_get_name_async_cancel): Remove watch only if set (we can remove it above). * src/inetaddr.c (gnet_inetaddr_get_name_async_cb): Set watch to 0 afer it is removed. This avoids gettting a warning maybe. * src/inetaddr.c (gnet_inetaddr_get_name_async): IPv6-ize fork() version. * src/socks.c (gnet_socks_get_version): Make env const. Wed Feb 12 15:53:44 2003 David Helder * tests/dns_test.pl: Add. * configure.ac: Add dns_test.pl to NETWORK_TESTS * Makefile.am (EXTRA_DIST): " * src/inetaddr.c (inetaddr_new_async_cb): ialist condition backwards. * src/gnet-private.h (_GInetAddrNewListState ): Add in_callback flag to GInetAddrNewListState-pthread. * src/inetaddr.c (gnet_inetaddr_new_list_async_cancel): Add in_callback to guard against calling in callback. * src/inetaddr.c (inetaddr_new_list_async_pthread_dispatch): Set in_callback. * examples/dnslookup.c (list_cb): Free the ialist. * src/inetaddr.c (gnet_inetaddr_get_name): s/assert/return_if_fail/. * src/inetaddr.c (gnet_inetaddr_new_async_cancel): s/assert/return_if_fail. * src/inetaddr.c (inetaddr_new_async_cb): Add return_if_fail. * src/inetaddr.c (gnet_inetaddr_new_async): Include state. Fixes bug. Tue Feb 11 16:14:31 2003 David Helder * *: Release 1.3.1 Fri Feb 7 14:00:18 2003 David Helder * README: Added PAN to "Applications that use GNet" Wed Feb 5 18:29:40 2003 David Helder * examples/echoserver-gserver.c (ob_server_func): Watch for error. * examples/echoclient-gconn.c (main): " * src/conn.c (conn_connect_cb): Add watch if flags set * src/conn.c (conn_new_cb): " * src/conn.c (gnet_conn_set_watch_writable): Don't do source add if not connected yet. * src/conn.c (gnet_conn_set_watch_error): Added. * src/conn.c (gnet_conn_timeout): return_if_fail(conn->func) only if a timer is being set. Wed Feb 5 12:26:29 2003 David Helder * src/base64.c: Patch from fredo * tests/base64_test.c: Test from fredo. Tue Feb 4 20:05:23 2003 David Helder * tests/Makefile.am (ipv6_test_SOURCES): Fix ipv6_test_SOURCES rule. Tue Feb 4 19:48:35 2003 David Helder * doc/Makefile.am (dist-hook): Don't require gtk-doc to make dist. Otherwise we need to write our own custom dist rule in the main Makefile. * tests/Makefile.am: Add $(NETWORK_TESTS) * configure.ac: Add --enable-network-tests flag * autogen.sh: network tests enabled by default via autogen.sh * src/conn.c: Add asserts for conn->func on functions that use callbacks. * examples/hostinfo.c (main): Autodetect interface check. * src/inetaddr.c (gnet_inetaddr_get_internet_interface): Use policy. Do not return a non-internet inteface, when there no internet interface. (We did this before, but this did not match the docs). * src/inetaddr.c (gnet_inetaddr_autodetect_internet_interface): IPv6-ize. * src/gnet-private.h (struct _GUnixSocket): Use sockaddr_un. * src/unix.c (gnet_unix_socket_server_new): Add some casts. Tue Feb 4 15:20:46 2003 David Helder * src/inetaddr.c (gnet_inetaddr_new_list_async_cb): Use INETADDR macros. * src/gnet-private.h (GNET_INETADDR_ADDRLEN): Added. * src/inetaddr.c (gnet_inetaddr_get_length): " * src/inetaddr.c (gnet_inetaddr_get_bytes): * src/inetaddr.c (gnet_inetaddr_set_bytes): Tue Feb 4 14:37:05 2003 David Helder * src/tcp.[ch] (gnet_tcp_socket_get_remote_inetaddr): Was gnet_tcp_socket_get_inetaddr(). Note if this is called on a server, the local address is created, which is not unreasonable. This is an undocumented feature. Mon Feb 3 23:06:59 2003 David Helder * src/tcp.c (gnet_tcp_socket_get_local_inetaddr): Added. * src/*: param name clean-ups. * src/unix.c (gnet_unix_socket_unref): Restore old unref code. (Where did it go?!) * src/uri.c (gnet_uri_equal): Return gboolean. * src/inetaddr.c (gnet_inetaddr_equal): " * src/inetaddr.c (gnet_inetaddr_noport_equal): " * src/sha.c (gnet_sha_equal): " * src/sha.c (gnet_md5_equal): " * src/inetaddr.c (gnet_inetaddr_new_bytes): s/guint8*/gchar*/ for bytes arg. * src/inetaddr.c: s/ia/inetaddr in args. * src/inetaddr.c (gnet_inetaddr_set_port): port is a gint, not a guint. * src/inetaddr.c: gnet_inetaddr_gethostname -> gnet_inetaddr_get_host_name. gnet_inetaddr_gethostaddr -> gnet_inetaddr_get_host_addr. Mon Feb 3 20:21:02 2003 David Helder * src/server.c (gnet_server_{ref,unref}): Added * src/socks.c (gnet_socks_get_server): Clean-up. * src/socks-private.c: s/socks_get_version/gnet_socks_get_version/. * src/socks.c (gnet_socks_{get/set}_version): Added * src/tcp.c: gnet_tcp_socket_server_new becomes gnet_tcp_socket_server_new_with_port, gnet_tcp_socket_server_new_interface becomes gnet_tcp_socket_server_new_full. gnet_tcp_socket_server_new now takes 0 args. Mon Feb 3 17:56:55 2003 David Helder * *: More doc work. * src/mcast.c (gnet_mcast_socket_new_full): Disable loopback by default. * src/unix.c (gnet_unix_socket_connect): Removed. Same as gnet_unix_socket_new. * src/inetaddr.c: Remove gnet_inetaddr_new_any(). Not needed with new API for server sockets. Mon Feb 3 12:55:49 2003 David Helder * configure.ac: Bump version to 1.3.1 (unreleased) * examples/*: Remove "Or include " comment. This is no longer true. * src/iochannel.c: bytes_{read,written} is no longer optional (reverses change from a few days ago). Added some g_return_val_if_fail's * *: More doc work. Wed Jan 29 21:23:57 2003 David Helder * src/md5.[hc]: s/guchar and gint8/gchar/ * src/sha.[hc]: s/guchar and gint8/gchar/ * src/socks.c (gnet_socks_get_server): Return the socks server even if socks in disabled. * tests, examples: Renames. Moved dnstest and hostinfo to examples. * *: Doc updates. Tue Jan 28 23:17:30 2003 David Helder * *: Doc updates. Still rough. Mon Jan 27 15:07:38 2003 David Helder * src/base64.[hc]: Updates from Fredo. Fri Jan 24 15:33:13 2003 David Helder * src/base64.[hc]: Added. Contributed by Alfred Reibenschuh * src/iochannel.c (gnet_io_channel_writen): bytes_written is optional. * *: More doc work Tue Jan 21 16:51:45 2003 David Helder * src/unix.[hc]: No longer experimental * *: Clean-ups for release and docs. * *: Release 1.3.0 Tue Jan 21 15:03:49 2003 David Helder * src/uri.c (gnet_uri_get_string): Renamed from gnet_uri_get_nice_string(). The string should be escaped manually if necessary. Tue Jan 21 14:02:43 2003 David Helder * src/uri.c (gnet_uri_new): Fix reading IPv6 name. Convert isspace to locale-independent macro. (Thanks Eric!) * src/server.[hc]: The server func no longer has a status argument. If the conn is NULL, it's an error. Otherwise, it's good. * src/server.c (server_accept_cb): Call gnet_conn_new_socket() to create conn. * src/iochannel.[hc]: Remove experimental functions. These were complex and bug-prone. Most the functionality is now in conn. * src/conn.[hc]: Reworked entire API. * src/uri.[hc]: Added escape/unescape code. Contributed by Eric Williams (ericjw@umich.edu). Thu Jan 9 18:15:16 2003 David Helder * tests/client_server_test.pl: Remove IPC::Open2. We don't use it anymore. Perl in /usr/bin. Thu Jan 9 16:35:36 2003 David Helder * src/tcp.c (gnet_tcp_socket_get_iochannel): Removed. I broke so many interfaces already, why *try* to keep a crappy one? * src/udp.c (gnet_udp_socket_get_iochannel): " * src/udp.c (gnet_unix_socket_get_iochannel): " * src/gnet.c (ipv6_detect_envvar): Make envvar const. Thu Jan 9 16:24:36 2003 David Helder * tests/pack.c: Fixed output in 2 big-ending pointer packing tests * src/tcp.{ch}: Remove status from GTcpSocketNewAsyncFunc. NULL now signifies error (as it did before). * src/inetaddr.{ch}: Reomve status from GInetAddrNewAsyncFunc, GInetAddrGetNameAsyncFunc. NULL now signifies error (as it did before) * src/{conn.c,socks.c}: Update. * src/gnet.c (ipv6_detect_iface): Use interface list again. Thu Jan 9 15:09:16 2003 David Helder * tests/client_server_test.pl, testfile: New echoclient/echoserver tester. * examples/echoserver-async.c: Fix bug where we tried to read into a zero length buffer, read 0, and thought it was an EOF. * examples/echoclient-{async,gconn}.c: If we get an EOF before we've gotten the lines back, then keep waiting. This makes automated testing easier - otherwise we quit too soon. * examples/echoclient,echoserver.c: Break up into more files. * src/conn.c: Implement connect timeout. * src/tcp.h: Remove inetaddr from GTcpSocketConnectAsyncFunc. The user can get this from the socket. * src/tcp.c (gnet_tcp_socket_connect, etc...): Use gnet_inetaddr_new_list(). * src/gnet-private.h (_GTcpSocketConnectState ): Add in_callback flag to guard deletion. * src/inetaddr.c (gnet_gethostbyname): Handle ipv6 policy. * src/mcast.c (gnet_mcast_socket_get_io_channel): Added. * src/mcast.c (gnet_mcast_socket_{get/set}_ttl): Move from udp.c to here. * src/udp.c (gnet_udp_socket_{set/get}_*_ttl): IPv6-ify. * src/udp.c (gnet_udp_socket_get_ttl): Interface change: -1 means "kernel default". < -1 means error. * src/udp.c (gnet_udp_socket_get_mcast_ttl): " * src/udp.c (gnet_udp_socket_get_ttl): Make ttl an int. * src/udp.c (gnet_udp_socket_set_ttl): Make ttl an gint. * src/gnet.c (gnet_init): Use IPv4 before IPv6. Check GNET_IPV6_POLICY and IPV6_POLICY environment variable. Create sockets to get policy - don't list interfaces. * src/gnet-private.c (gnet_private_create_listen_socket): New helper function. Used in tcp and udp. * src/udp.c (gnet_udp_socket_send): Change prototype. Send to dst, not to socket!. * src/udp.c (gnet_udp_socket_receive): " * src/udp.c: Get rid of GUdpPacket. * src/mcast.c: Updates. * examples/echoserver-udp.c (normal_echoserver): Update Wed Jan 1 17:14:54 2003 David Helder * configure.ac: Output clean-ups. * configure.ac: Check for Apple Darwin * src/gnet-private.h (socklen_t): Define to be 'int' on Apple Darwin. Tue Dec 24 14:28:14 2002 David Helder * src/usagi_ifaddrs.c (usagi_getifaddrs): Compile fix. Add ";"'s to default case. Some compiler complains about this. Thanks Murray! Sat Dec 21 14:35:14 2002 David Helder * tests/unpack.c (main): Fix test 40021. Was accessing free'd memory. * src/pack.c (gnet_vunpack): Cosmetic touches. Tue Dec 17 20:25:23 2002 David Helder * src/udp.c (gnet_udp_socket_new_full): Rename. Was gnet_udp_socket_new_interface() * src/udp.c (gnet_udp_socket_new_with_port): Rename. Was gnet_udp_socket_port_new() * src/udp.c (gnet_udp_packet_new): Rename. Was gnet_udp_packet_receive_new(). * src/udp.c (gnet_udp_packet_new_with_address): Rename Was gnet_udp_packet_send_new(). * examples/echo*-udp.c: Updated. Need to fix packet API. * src/tcp.c (gnet_tcp_socket_server_new_interface): Add port argument back. A NULL iface now means INADDR_ANY or IN6ADDR_ANY_INIT. Rather than adding two inetaddr constructors for these, we use IPv6 policy to determine which (or whether both) should be tried. * src/server.c (gnet_server_new): " * examples/echoserver.c (object_echoserver): " * src/tcp.c (gnet_tcp_socket_server_new_interface): Use IPv6 policy. * src/inetaddr.c (gnet_inetaddr_new_bytes): Added * src/inetaddr.c (gnet_inetaddr_get_interface_to): Use family when creating socket. * src/tcp.c (gnet_tcp_socket_new_direct): " * src/tcp.c (gnet_tcp_socket_new_async_direct): " * src/tcp.c (gnet_tcp_socket_new_async_direct): " * src/tcp.c (gnet_tcp_socket_server_new_interface): ". But, use IPv4 by default. TODO: Fix this and use policy. * tests/inetaddr_test.c: Added * tests/Makefile.am: " * src/inetaddr.c (gnet_inetaddr_is_loopback): Add IPv6 implementation. * src/inetaddr.c (gnet_inetaddr_is_multicast): Use in.h IN_MULTICAST macro. * src/inetaddr.c (gnet_inetaddr_equal): Use IN6_ARE_ADDR_EQUAL macro. * src/inetaddr.c (gnet_inetaddr_is_broadcast): Compare with INADDR_BROADCAST. There is no broadcast in IPv6 - only multicast. * src/inetaddr.c (gnet_inetaddr_new_nonblock): Bug: Set family. Thu Dec 12 14:03:05 2002 David Helder * src/inetaddr.c: Fix compile warnings. * src/{tcp, udp,unix}.h (gnet_*_socket_get_iochannel): Add compatibility functions. These are depricated. Note they ref the iochannel before they return it, which is non-intuitive. Sun Dec 8 21:34:16 2002 David Helder * src/inetaddr.c: New inetaddr_new_list{_async} functions. I patched up the Windows code the best I could, but it probably doesn't compile. * tests/dnstest.c: Updated to test list functions. Fri Dec 6 15:57:39 2002 David Helder * *: More IPv6 hacking. DNS and IPv6 should work. Todo: connect()/bind(), auto-detection, inetaddr helper funcs Connections have not been tested yet. IPv6 auto-detection is not done yet. Inetaddr * src/inetaddr.c (gnet_gethostbyname): Add getifaddr() version. Use USAGI's getifaddr() on systems with linux/netlink.h. We do this because Glibc's getifaddr() does not handle IPv6. * configure.ac: Check for linux/netlink.h * src/inetaddr.c (gnet_inetaddr_new_async_cb): read() (ideally) will always return positive. If it's zero, then there's something wrong. We detect when the read is done and close the socket, so we should not get the other side closing the socket. * src/uri.c (gnet_uri_new): Strip whitespace before scheme (before we included it). Strings of whitespace produce errors. Strip hostname brackets (this is used for IPv6 canonical names. * src/uri.c (gnet_uri_get_nice_string): Add brackets if hostname has :'s in it (it's IPv6 then). * src/inetaddr.c (gnet_gethostbyname): Remove "nicename" (FQDN) functionality. It doesn't work consistently. E.g., www.microsoft.com's h_name is www.microsoft.akadns.com, h_alias[0] is www.microsoft.com. Really we need to do a reverse DNS lookup for this to work reliably. * src/inetaddr.c (gnet_inetaddr_gethostname): Do reverse DNS to get name. * src/inetaddr.c (gnet_gethostbyaddr): Add getnameinfo implementation. Changed prototype to take a sockaddr*. * tests/dnstest.c: Clean-up. Add args so you don't have to recompile. * src/inetaddr.c (gnet_gethostbyname): Don't init gthreads - this is done in gnet_init(). * configure.ac: Add --enable-threadsafe-gethostbyname * src/tcp.c (gnet_tcp_socket_get_port): IPv6ize. Use GNET_SOCKADDR_PORT macro. * src/tcp.c (gnet_tcp_socket_new_async): Update docs - callback is *not* called if an error occurs immediately. * src/tcp.c (gnet_tcp_socket_new_async_direct): Don't call callback. * src/tcp.c (gnet_tcp_socket_new_async_direct): IPv6ize. * src/tcp.c (gnet_tcp_socket_new_async_direct[win32]): " Thu Nov 7 14:25:08 2002 Jonathan Blandford * src/inetaddr.c (gnet_inetaddr_hash): initialize addr to keep -Werror compiling. Mon Nov 4 12:24:20 2002 David Helder * *: More IPv6 hacking. Added USAGI project's getifaddr() implementation for Linux. Wed Oct 23 13:52:18 2002 David Helder * configure.ac: Add --disable-pthreads flag. Patch from Ian Peters Tue Oct 22 14:23:13 2002 David Helder * *: First pass at IPv6-ization. Some builds may fail. The main change is to use (struct sockaddr_storage) everywhere. Some macros have been added to aid the conversion. Network addresses should work, DNS addresses are next. TODO: - how should binding work? - fix mcast join - set sa_len? - fix gnet_inetaddr_is_*() - check storage format for in6_addr - fix everything marked FIX :-) Mon Oct 21 23:24:30 2002 David Helder * *: HEAD is now GNet 1.3, to become GNet 1.4. GNet 1.1 is in the "GNET_1_1" CVS branch. * src/inetaddr.c: get_name_async cleanups. Fixed a bug in cancelling async reverse DNS lookups in Win32. * configure.ac: Update version to 1.3.0. GNet 1.1 is in the GNET_1_1 branch. * Makefile.am (configincludedir): " * gnet-config.in (cflags): " * gnet.spec.in: " * gnet.pc.in (Cflags): " * src/tcp.c (gnet_tcp_socket_get_io_channel), udp.c, unix.c: Don't ref the io_channel. * src/conn.c (gnet_conn_disconnect): Don't unref iochannel. * src/socks-private.c (gnet_private_socks_tcp_socket_server_accept_async): " * src/socks-private.c (socks_negotiate_connect): " * src/socks-private.c (socks5_negotiate_bind): " * src/socks-private.c (gnet_private_socks_tcp_socket_server_accept): " * src/tcp.c (gnet_tcp_socket_server_accept_async): " * examples/echoclient.c (normal_echoclient): " * examples/echoserver-unix.c: " * examples/echoserver.c: " * examples/hfetch.c (hfetch): " * src/url.[ch]: s/url/uri/. Re-ordered fields. * src/url.c (gnet_uri_new_fields_all): Fix bug - fields weren't copied right. * glib-config.in, Makefile.am, doc/glib-config.1.in, doc/Makefile.am: Remove glib-config. * src/Makefile.am (gnetincludedir): Put headers into gnet-1.3. * src/inetaddr.h: Changed prototypes of GInetAddrNewAsyncFunc and GInetAddrGetNameAsyncFunc * src/iochannel.h: " GNetIOChannelReadAsyncFunc * src/inetaddr.c (inetaddr_new_async_pthread_dispatch): Address is callee owned. i * src/tcp.c (gnet_tcp_socket_connect_inetaddr_cb): Delete the address. * src/*: s/get_iochannel/get_io_channel/, s/iochannel_new/io_channel_new/ * src/inetaddr.c (gnet_inetaddr_new_nonblock): Remove check for "localhost". * configure.ac: Turn on warnings after tests are done. Simplified test logic. Passing -ansi, etc to gcc more than once doesn't seem to hurt. Mon Oct 21 17:28:57 2002 David Helder * tests/Makefile.am (EXTRA_PROGRAMS): Make tests EXTRA, not noinst. They should only be build when 'make check' is run. * configure.ac: Touch. Wed Oct 16 17:24:00 2002 David Helder * configure.ac: Enable -Werror only when in "yes" debug mode. gcc-3.2 issues warnings on the G_something_BE_LE ASM macro. This allows gcc-3.2 users to compile GNet. Fri Oct 11 15:37:41 2002 David Helder * tests/{unpack,pack}.c: Include stdlib.h. Include string.h in unpack. Thanks Richard and Erland! Mon Oct 7 11:51:22 2002 David Helder * 1.1.7 "re-release" * configure.ac (GNET_BINARY_AGE): Set binary age to 7. Oops. * README: Added eDonkey2000 GTK frontend Mon Sep 30 16:41:55 2002 David Helder * configure.ac: Include "-Werror" in CFLAGS. Mon Sep 30 13:18:47 2002 David Helder * src/gnet-private.c (gnet_private_iochannel_new): Return iochannel. Mon Sep 30 13:18:11 2002 David Helder * NEWS, *: Release 1.1.6 Thu Sep 26 20:10:23 2002 David Helder * configure.ac: Add --enable-threadsafe-gethostbyname option. * src/inetaddr.c (gnet_gethostbyaddr): Add threadsafe gethostbyaddr() variant. (gnet_gethostbyname): " * configure.ac: Define GTHREAD_CFLAGS if gthread module is available. This is used to determine if a gthreads implementation of gethostbyname_r is possible. Thu Sep 26 18:33:16 2002 David Helder * NEWS, TODO: Updates Mon Sep 23 18:59:39 2002 David Helder * examples/Makefile.am (noinst_PROGRAMS): Make examples noinst, not extra. * examples/*: Update include to handle this. * examples/echoclient.c (async_client_sin_iofunc): Return FALSE on EOF. Otherwise we get an error. * src/gnet-private.c (gnet_private_iochannel_new): Added. Creates iochannel from descriptor in usual way. If we're using GLib 2, then it turns off buffering and encoding. * src/tcp.c (gnet_tcp_socket_get_iochannel): Use gnet_private_iochannel_new() * src/tcp.c (gnet_tcp_socket_new_async_direct): " * src/tcp.c (gnet_tcp_socket_new_async_direct): " * src/udp.c (gnet_udp_socket_get_iochannel): * src/unix.c (gnet_unix_socket_get_iochannel): Mon Sep 23 15:31:52 2002 David Helder * Makefile.am (EXTRA_DIST): Move more extra dist here. depcomp is no longer needed evidently. Mon Sep 23 14:43:21 2002 David Helder * autogen.sh: Don't include macros dir if there isn't one. * aclocal.h: Remove this. No longer required. Sat Sep 21 21:11:41 2002 David Helder * configure.ac: Fixes for autoconf 1.6. * acconfig.h.in: Removed this. Not needed in newer autoconf. * autogen.sh: Include the macros directory in aclocal. We do not distribute the macros directory. This is for developer convience. * examples/Makefile.am, src/Makefile.am/, Makefile.am: Move EXTRA_DIST to root makefile. autoconf 1.6 doesn't like EXTRA_DIST in subdirectories for some reason. Thu Sep 12 16:13:37 2002 David Helder * tests/Makefile.am (LDADD): Add glib_libs and gthread_libs * src/inetaddr.c (gnet_inetaddr_list_interfaces): Increment pointer in header. We were missing the first interface. Check return value of ioctl for flags. * configure.ac (pthread_libs): Explicitly define HAVE_SOCKADDR_SA_LEN since autoconf no longer does it, it seems. * Makefile.am (EXTRA_DIST): Include depcomp Tue Sep 10 20:35:27:39 2002 Andrew Lanoix * README.win32: Update * GNET.DSP: Link to Glib 2.0 * gnet.def: Add new funcs * examples\makefile.mingw: Update * tests\makefile.mingw: Update * src\makefile.mingw: Update Wed Sep 04 21:54:47:06 2002 Andrew Lanoix * src/gnet.c (gnet_init): Don't do anything on win32 * src/gnet-private.h (_GInetAddrAsyncState) Needs in_callback * src/inetaddr.c (gnet_gethostbyname) #define out unix code Wed Aug 14 12:37:23 2002 David Helder * *: Release 1.1.5 * src/iochannel.c (gnet_io_channel_write_async): Don't succeed immediately if the buffer is length 0. Also allow a write from a non-NULL buffer of length 0. Sat Aug 10 19:18:33 2002 David Helder * examples/hash.c: Move hash example to examples. * tests/pack.c: Made this a proper automake automated test. * tests/unpack.c: " * tests/hash.c: " * examples/Makefile.am: Updated * tests/hash.c: Don't dump core on './hash' * tests/urlparse.c: Removed. url_test covers this. * src/gnet.c (gnet_init): Added. Call this at the beginning of any Gnet program. (This is really only required for asynchronous DNS support when pthreads are available and GNet is compiled with GLib 2.0.) * examples/*.c (main): Add call to gnet_init (). * tests/*.c (main): " * src/Makefile.am (libgnet_la_LDFLAGS): Link with GTHREAD_LIBS. * src/socks.c (gnet_socks_get_server): Add const * src/socks-private.c (socks_get_version): " Mon Aug 5 16:54:55 2002 David Helder * src/conn.h: Fix typo. * src/inetaddr.c (gnet_inetaddr_new_async_cancel): " * src/iochannel.c (_GNetIOChannelWriteAsyncState): Add in_upcall flag so that state doesn't get deleted during the upcall. * src/iochannel.c (gnet_io_channel_write_async_cancel): Don't delete state if in an upcall. Only delete the buffer (if requested). * src/iochannel.c (write_async_cancel): Added this static function to make all this a bit more clear. Users call gnet_io_channel_write_async_cancel(), but internally we call this. * src/iochannel.c (write_async_cb): Set in_upcall during upcall. Call write_async_cancel(). * src/iochannel.c (write_async_timeout_cb): " * src/iochannel.c (_GNetIOChannelReadAsyncState): Basically did the same thing as above for the read_async functions. * src/iochannel.c (gnet_io_channel_read_async_cancel): Ignore cancel if in an upcall. * src/mcast.c (gnet_mcast_socket_port_new): Add g_htonl around INADDR_ANY (style bug - it should not make a difference). (thanks Eduardo Pérez Ureta) * src/udp.c (gnet_udp_socket_new_interface): Fix memory leak on errors (thanks Jakub Jagielka). * src/tcp.c (gnet_tcp_socket_new_direct): Use GNET_CLOSE_SOCKET macro, not close(). (style bug, maybe affects Windows) Wed May 15 11:43:44 2002 David Helder * configure.ac: Up version to 1.1.5 Wed May 15 11:37:10 2002 David Helder * Release GNet 1.1.4 Mon May 13 22:44:44 2002 David Helder * tests/dnstest.c: Minor improvements. * src/inetaddr.c (inetaddr_new_async_pthread): Rewrite pthread implementation. Problem was writing to closed pipe raised SIGPIPE for threads. Now we don't use pipes with threads. Stupid UNIX. It's not like you get SIGACCES when you attempt to open a file that doesn't exist. * src/inetaddr.c (gnet_inetaddr_get_name_async): " * src/inetaddr.c (gnet_inetaddr_new_async): Move process code here. * src/inetaddr.c (gnet_inetaddr_get_name_async): " * src/inetaddr.c (gnet_inetaddr_new_async): Close unused pipes. * src/inetaddr.c (gnet_inetaddr_get_name_async): " * src/inetaddr.c (gnet_inetaddr_get_name_async): Initialize state. * src/inetaddr.c (gnet_inetaddr_new_async): " Sat May 11 14:36:50 2002 David Helder * src/*.h: Added instructions on using experimental modules. * Makefile.am (copyweb): Updated copyweb. Fri May 3 11:18:51 2002 David Helder * src/{inetaddr,tcp}.h: s/id/async_id/. id is a reserved word in Objective C. Thu Apr 25 10:14:07 2002 David Helder * Release GNet 1.1.3 * src/iochannel.h: Doc fixes. * examples/echoserver.c: Remove debug output. Sat Apr 20 17:04:04 2002 David Helder * src/inetaddr.c (gnet_inetaddr_list_interfaces): Delete buffer. (gethostbyaddr_async_child): * tests/hostinfo.c: Delete addresses. Thu Apr 18 14:13:30 2002 David Helder * src/socks-private.c (gnet_private_socks_tcp_socket_new): Delete socks server address. * src/socks-private.c (gnet_private_socks_tcp_socket_new_async): " * src/gnet-private.c (gnet_private_inetaddr_sockaddr_new): Set ref_count to 1. These weren't getting deleted before. * src/inetaddr.c (gnet_inetaddr_new_any): " * src/pack.c (gnet_vunpack): Fix bad mem deref when zeroing out extra mem. * src/inetaddr.c (gnet_inetaddr_get_name_async_cancel): Don't delete ia - caller owns!. * src/url.c (gnet_url_new): isdigit((int)) cast * src/url.c (gnet_url_new): " * src/inetaddr.c (gnet_inetaddr_get_name_async_cb): Delete old name first. * src/gnet-private.h (_GInetAddrAsyncState ): Add IOChannel field. * src/inetaddr.c (gnet_inetaddr_new_async): Save the IOChannel * src/inetaddr.c (gnet_inetaddr_new_async_cancel): Unref the IOChannel. * src/inetaddr.c (*_get_name_async_*): As above for these funcs. * src/tcp.c (*_new_async_*): As above for these funcs. * src/inetaddr.c (gnet_inetaddr_new_async_cb): Don't clear the watch. This isn't necessary now that we have the in_callback flag. * tests/dnstest.c (reverse_inetaddr_cb): Don't free name - inetaddr owns it, just cname. * tests/dnstest.c (reverse_inetaddr_cb): Delete inetaddr. * examples/echoserver.c (async_client_iofunc): Fix number of bytes moved. Use g_memmove(). * examples/echoserver.c (ob_client_func): Don't add a '\n'. It wasn't needed and wrote past the end of the array. * examples/echoclient.c: Merged echoclient-socks here * tests/echoclient-socks.c: Removed * tests/pack,unpack,dnstest: Memory leak fixes Mon Apr 15 14:05:21 2002 David Helder * src/inetaddr.c (gnet_inetaddr_get_name_async): Handle EAGAIN error from pthread_create(). * src/inetaddr.c (gnet_inetaddr_new_async): " * configure.ac: Upped version to 1.1.3 (unreleased) * NEWS: " * src/tcp.c (gnet_tcp_socket_server_accept_async): Don't return something in void function. * src/tcp.h: Noted data passed to GTcpSocketConnectAsyncFunc is callee owned. * src/tcp.c (gnet_tcp_socket_connect_inetaddr_cb): Copy the inetaddr passed - it's caller owned, not callee owned (RTFM)! * src/tcp.c (gnet_tcp_socket_connect_inetaddr_cb): Do not put tcp_id in state immediately. If it failed, state will be deleted just before we dereference it, which could cause a seg fault. * src/tcp.c (gnet_tcp_socket_connect_tcp_cb): Delete inetaddr on failure. * src/tcp.c (gnet_tcp_socket_connect_async): Update docs: The callback will never be called before the function returns. Also, simplified logic since the same semantics are now true for gnet_inetaddr_new_async(). 2002-02-27 Bastien Nocera * gnet.pc.in: add $(libdir)/gnet/include to the .pc file, it actually works now :) Sat Feb 16 18:25:15 2002 David Helder * Release GNet 1.1.2 * Makefile.am: Remove debian stuff. * src/inetaddr.c (gnet_inetaddr_get_name): Implement pthread version. * src/gnet-private.h (_GInetAddrReverseAsyncState ): Add pthread field. * src/inetaddr.c (gnet_inetaddr_new_async): Duplicate the hostname before passing to thread. * src/inetaddr.c (gethostbyname_async_child): Delete hostname. Thu Feb 14 12:39:59 2002 David Helder * Release GNet 1.1.1 Wed Feb 13 20:47:51 2002 David Helder * src,doc: Doc improvements. * src/inetaddr.c: NOTE: The no-immediate-callbacks for async functions is finally implemented (in inetaddr). * src/inetaddr.c (gnet_inetaddr_get_name_nonblock): Added. Like gnet_inetaddr_new_nonblock. * src/inetaddr.c (gnet_inetaddr_get_name_async): Don't callback on error. Don't callback on immediate success. * src/inetaddr.c (gnet_gethostbyname): Do a non-blocking lookup. * src/inetaddr.c (gnet_inetaddr_new_async): Don't call callback on error. * src/iochannel.c (gnet_io_channel_read_async_cancel): Remove timer only if set * src/socks-private.h: Move SOCKS_PORT here. * src/conn.[hc]: Removed add/remove watch functions. For binary compatibility, the members are still in the struct. * src/conn.c (conn_timeout_cb): Zero out the timeout before call * src/conn.c: Added docs Sun Feb 10 15:27:36 2002 David Helder * examples/echoserver.c: Print more. * examples/echoserver.c (async_accept): Don't unref iochannel since we're saving it. * examples/echoserver.c: Clean up watch logic for async server so that there's only a single watch on a socket. (This works around the GLib poll bug.) * src/socks-private.h: Fix dport size. * src/socks-private.c (gnet_private_socks_tcp_socket_server_accept): Recreate server socket with same port. If the programmer specified 0 initially (for an ephemeral port) and cannot get the same port, this fails. Mon Feb 4 16:52:58 2002 David Helder * src/tcp.c: Doc updates * doc/*: " Mon Feb 4 14:33:37 2002 David Helder * src/tcp.c (gnet_tcp_socket_server_accept_async): Fix warning. * src/socks-private.c (gnet_private_socks_tcp_socket_server_accept_async): " * src/server.c (server_accept_cb): " * configure.ac: Cleaned up debug flag handling. 'minimum' debug flags is set by default * autogen.sh (conf_flags): debug=yes for developers Fri Feb 1 19:37:25 2002 David Helder * src/iochannel.c (gnet_io_channel_read_async_cancel): Don't call g_assert(func()) cause assertions are disabled and func() won't get called. Duh! * src/conn.c (gnet_conn_watch_remove_read): " * src/conn.c (gnet_conn_watch_remove_write): " * src/conn.c (gnet_conn_watch_remove_error): " * src/scheduler.c: " * examples/sdr.c (main): " * examples/echoclient-udp.c (normal_echoclient): " * src/iochannel.c (write_async_cb): Merged write and error cb's into this cb. * src/iochannel.c (read_async_cb): Likewise. * src/conn.c (conn_check_queued_writes): Delete removed link. This was leaking memory. * src/tcp.c (gnet_tcp_socket_server_accept_async): Fix typo (user data not set right). * src/socks-private.c (gnet_private_socks_tcp_socket_server_accept_async): Fix typo. * examples/echoclient.c: Added better debug output. * gnet-config.in: Cleaned up somemore. * src/tcp.c (gnet_tcp_socket_unref): Remove accept watch on destroy. * examples/ljoust.c: Removed. Out-of-date. * doc/gnet.sgml: " * examples/echoserver.c: Update to use new async accept func. * src/server.c: " Wed Jan 30 20:22:33 2002 David Helder * src/sha.c (gnet_sha_new_string): Fixed warning * src/md5.c (gnet_md5_new_string): " * src/tcp.c (gnet_tcp_socket_server_accept_async): Added. We need this to simplify SOCKS code. Setting a read watch on a socket is now DEPRICATED. Use this instead. * src/tcp.c (gnet_tcp_socket_server_accept): No longer const. * src/tcp.c, socks.c: Move most SOCKS logic to socks.c. Add _direct versions in tcp and _socks in socks-private for SOCKSified functions. * src/pack.c (gnet_calcsize): Not _ALL_ arguments should be passed, not just the dynamic arguments. (Otherwise, pack_strdup wouldn't work.) Sun Dec 22 20:36:57 2001 Ross Golder * gnet-config.in (lib_gnet): Fixed breakage if GLIB_LIBS contains spaces Sun Dec 15 23:12:30 2001 Ross Golder * configure.ac: Added gnet-config.1 to AC_OUTPUT Thu Dec 13 09:50:26 2001 David Helder * configure.ac: Added --enable-glib2 (From Mark Ferlatte). I also changed it so GNet will build against 1.3/2.0 if the build against 1.2 fails. * INSTALL: New INSTALL file. * README: Updated installation info. Tue Dec 11 21:23:06 2001 David Helder * gnet.pc.in (Libs): Fixed typos. Tue Dec 11 21:20:43 2001 David Helder * configure.ac: From Mark Ferlatte's patch Fri Nov 30 17:51:02 2001 Ross Golder * configure.in: Removed gmodule stuff, and exported GTHREAD_* even if empty. * src/Makefile.am: Made use of GTHREAD_* Sat Nov 10 18:37:01 2001 Ross Golder * configure.in: Switched to using PKG_CHECK_MODULES to pick up glib flags (now glib2 friendly). * Makefile.am: Added glib flags. Reinstated distribution of gnet.spec file for 'rpm -t[ab] gnet-x.y.z.tar.gz'. * src/Makefile.am: Added glib flags. * src/gnet.h: Replaced depracated GUTILS_C_VAR definition * src/inetaddr.h: Commented out argument to #endif. * gnet-config.in: Removed unnecessary conditional. Ensured glib flags were being presented in output. * tests/url_test.c: Added headers to get rid of compiler warnings. Fri Nov 9 14:44:09 2001 David Helder * configure.in: Check for lib socket (Needed in SunOS 5.8?) Fri Nov 9 14:27:45 2001 David Helder * configure.in: Check for the gthread module and set CFLAGS, LIBS, glib_cflags, and glib_libs as appropriate. * src/inetaddr.c (gnet_gethostbyname, gnet_gethostbyaddr): Initialize gthreads if not initialized in Glib-Mutex case. This caused seg faults in some FreeBSDs. * gnet.m4 (AM_PATH_GNET): Remove modules. gthread is not a gnet module. Mon Oct 29 16:27:55 2001 David Helder * src/unix.c: Unlink socket on delete, doc fixes * examples/echoserver-unix.c: Delete socket on SIGINT, SIGTERM * src/tcp.c (gnet_tcp_socket_server_accept_nonblock): Doc fix. Thu Oct 25 10:48:51 2001 David Helder * configure.in, Makefile.am: Include deb/rpm stuff Wed Oct 24 17:35:51 2001 David Helder * configure.in: Check if debian or RPM files are there before AC_OUTPUT. This causes an autoconf warning, but not a configure warning. * Makefile.am: Removed .spec and debian from dist. If you really need it, I can put it back. Wed Oct 24 10:02:43 2001 Ross Golder * src/pack.h: Commented out argument to #endif. * src/sha.h: Removed extraneous character (typo?). * Makefile.am: Updated handling of rpms and spec files. * Makefile.am: Added debian directory to make dist. Wed Oct 24 15:58:14 2001 David Helder * tests/unpack.c (main): Fix bugs Tue Oct 23 15:00:55 2001 David Helder * doc/tmpl/socks.sgml: Added * doc/gnet.sgml: Added socks Tue Oct 23 13:03:09 2001 David Helder * configure.in: Check for pthreads in c_r (for BSD) Tue Oct 23 10:50:10 2001 David Helder * doc/gnet-sections.txt: Updated * *: Doc fixes * src/ftp.[ch]: Removed Tue Oct 23 10:26:17 2001 David Helder * *: Integrate Mark Ferlatte's Unix patch. Wed Oct 17 22:26:42 2001 David Helder * src/tcp.c: Integrated SOCKS into gnet_tcp_socket_new_async. * src/gnet-private.h (_GTcpSocketAsyncState ): Added field for socks server (so it can be changed while the connect is in effect). * BUGS: Added note about blocking in tcp_socket_new_async during socks negotiation. * examples/echoclient.c: Finished async example. * test/echoclient-socks.c: Renamed from socksclient. Now does async too (but set manually) * src/socks.c (gnet_socks_get_server): Free hostname if port parse fails. Wed Oct 17 16:48:03 2001 David Helder * src/socks-private.c: Use g_getenv. Fix missing io channel deref. * src/socks.c: Cleaned up interface (get/set server and get/set enable). SOCKS is off by default for now. Simplified parsing code. * tests/socksclient.c: Added Sun Oct 7 23:04:29 2001 David Helder * NEWS: Added SOCKS Sun Oct 7 18:42:05 2001 David Helder * src/socks.[hc]: Added. Not integrated with TCP yet. * src/socks-private.c: Added * AUTHORS: Added Marius * src/server.c: Include gnet-private before server. Fixes MAX/MIN warning with param.h * src/iochannel.c (gnet_io_channel_writen): buf is now a gpointer. * src/iochannel.c (gnet_io_channel_readn): Sun Oct 7 17:53:03 2001 David Helder * src/url.[hc]: Integrated David's URL improvements (fragments, query, username, and password handling). Made many parsing changes to make more sane/RFC-compliant. Added some docs. * tests/url_test.c: Added. Uses "make check". * tests/urlparse.c: Added * AUTHORS: Added David Bolcsfoldi Mon Sep 24 14:07:56 2001 David Helder * src/inetaddr.c: s/Interface/iface Fri Sep 21 17:37:50 2001 David Helder * src/inetaddr.c (gnet_inetaddr_new_async): In pthread version, malloc space for pointers passed to pthread_create. Otherwise, if we return before the new thread runs, it crashes. Duh. And I taught this stuff? * src/inetaddr.c (gethostbyname_async_child): Delete args. Thu Sep 20 12:40:43 2001 David Helder * configure.in (glib_libs): Set -lpthread in gnet-config --libs when pthreads are used. * acconfig.h: Added HAVE_LIBPTHREAD manually * gnet-config.in: " * Makefile.am (EXTRA_DIST): Include gnet.m4. It was in m4data, not sure what's going on with autoconf. * configure.in (glib_libs): Use proper glib-config when getting flags for gnet-config Mon Aug 27 13:49:46 2001 Andrew Lanoix * README.win32: Fix typo Fri Aug 24 10:47:34 2001 Andrew Lanoix * README.win32: Update Sun Aug 12 11:59:22 2001 Andrew Lanoix * gnet.def: Add missing gnet_inetaddr_new_nonblock & gnet_inetaddr_new_nonblock Mon Aug 6 13:31:37 2001 David Helder * tests/dnstest.c (main): Clean-up. Now blocks by default. * src/inetaddr.c (inet_aton): Fix our inet_aton to understand 255.255.255.255. This function was in gnet-private.h. Fri Aug 3 10:59:15 2001 David Helder * src/inetaddr.c (gnet_inetaddr_new_async): Same as below for Windows version. Fri Aug 3 10:32:45 2001 David Helder * src/inetaddr.c (gnet_inetaddr_new_async): Don't do inet_aton and call callback immediately. This is confusing for the programmer and can lead to bugs. Now, either NULL will be returned or the callback will be called later. PROGRAMMERS: For the old semantics, call gnet_inetaddr_new_nonblock and if it fails, call gnet_inetaddr_new_async. Wed Jul 25 14:23:16 2001 David Helder * src/inetaddr.c: Added pthread implementation of gnet_inetaddr_new_async. * src/gnet-private.h (_GInetAddrAsyncState ): " * configure.in: Check for pthreads Wed Jun 13 11:29:25 2001 Andrew Lanoix * gnet.def: update * README.win32: update * tests/Makefile.mingw: Build hash.c * tests/hash.c: Add a note that extra \r's on win32 text files will throw off SHA and MD5 if you don't remove them Sat Jun 9 15:35:19 2001 David Helder * tests/hash.c: Actually removed mmap as advertised. Fri Jun 8 16:49:16 2001 David Helder * tests/hash.c: Don't use mmap. Don't make main loop. Fri Jun 8 15:26:41 2001 David Helder * examples/echoserver.c (async_server_iofunc): Should be accept_nonblock in async_server_iofunc, not accept. * BUGS: Typo Thu May 31 10:46:30 2001 David Helder * Makefile.am (EXTRA_DIST): Add README.win32 GNET.DSP config.h.win32 gnet.def * */Makefile.am: Add makefile.mingw * configure.in: Version is now 1.1.1 [unreleased] * configure.in: Remove poll check * src/udp.c (gnet_udp_socket_has_packet): Use select, not poll. * src/gnet-private.h: Remove poll * README.macosx: Added * Makefile.am: Added README.macosx to EXTRA_DIST * AUTHORS: Added Eric Cronin for above * src/sha.c (gnet_sha_clone): Added. * src/md5.c (gnet_md5_clone): Added. * debian/control.in: Sync with README Thu May 24 21:20:09 2001 David Helder * gnet.spec.in: Change name back to 'gnet'. I don't know how to fix this... * *: Get ready for release... Thu May 24 12:12:04 2001 Andrew Lanoix * NEWS updated to say full windows port Thu May 24 10:14:02 2001 David Helder * examples/echoserver.c (object_echoserver): Fixed call to gnet_server_new. * examples/Makefile.am: Make examples noinst, not extra. Wed May 23 9:33:45 2001 Andrew Lanoix * Add makefiles for mingw (gcc for windows) * examples/echoserver.c: In object_echoserver(), too may args to gnet_server_new() * update Gnet.dsp * update gnet.def * update gnetconfig.h.win32 Version to 1.1.0 Wed May 23 10:08:09 2001 David Helder * src/gnet.h: Include all files on Win32 Tue May 22 23:25:59 2001 David Helder * src/pack.c (strlenn): Fixed sign issue Tue May 22 16:45:01 2001 David Helder * gnet.m4: Fix URL * README (Features): Fix URL * debian/control.in: Add URL Tue May 22 22:21:31 2001 Andrw Lanoix * server.h: #include "gnetconfig.h" * tcp.h: removed 2 unused vars in windows code * gnet-private.c: removed 2 unused vars in windows code * udp.c: gnet_udp_socket_has_packet()[win32 version] change gint arg to u_long arg to get rid of warning Tue May 22 09:59:57 2001 David Helder * src/pack.[hc]: Made int types unsigned where possible. Mon May 21 22:22:01 2001 Andrew Lanoix * udp.c: gnet_udp_socket_new_interface() use GNET_CLOSE_SOCKET instead of close() * conn.h: #include Sun May 20 22:32:19 2001 David Helder * debian/*: Clean ups for 1.1 * src/tcp.c (gnet_tcp_socket_server_new2): Removed * src/*: conn, server, url, and the new iochannel funcs are 'EXPERIMENTAL'. md5, sha, and pack are not. * doc/gnet.sgml, *: More doc cleanups * src/pack.c: Added calcsize docs. * doc/gnet-config.1.in: Added. Based on Owen's glib-config manpage. * debian/rules.in: Install man page Sun May 20 10:22:29 2001 Andrew Lanoix *src/gnet-private.c:[win32 only] workaround for a glib bug that caused problems when one used GNet with GTK *README.win32: Updated Mon May 14 11:13:22 2001 David Helder * src/url.c, inetaddr.c, md5.c (*_hash, *_equal): s/const gpointer/gconstpointer/ Fri May 11 14:58:24 2001 David Helder * tests/unpack.c (main): Fixed the warnings :-) * src/inetaddr.c (gnet_inetaddr_new_any): Added. Thu May 10 10:22:46 2001 David Helder * src/tcp.c (gnet_tcp_socket_server_new_interface): If iface is NULL, the OS will choose the address and port. * src/server.c (gnet_server_new): Allow iface to be NULL * src/pack.c (gnet_calcsize): Added * src/pack.c (gnet_vcalcsize): Exposed Wed Apr 25 14:27:26 2001 David Helder * src/server.[hc] (gnet_server_new): Changed prototype so port not included. Now uses new_interface Tue Apr 24 15:10:19 2001 David Helder * src/md5.c (gnet_md5_get_digest): Added cast to supress warning * src/udp.c (gnet_udp_socket_interface_new): Added * src/udp.c (gnet_udp_socket_new_interface): SO_BROADCAST set by default * src/tcp.c (gnet_tcp_socket_server_interface_new): Added. * src/tcp.c (gnet_tcp_socket_server_new2): Above replaces Mon Apr 23 7:07:21 2001 Andrew Lanoix * src/gnet-private.c (gnet_MainCallBack - Win32 ONLY): Explicitly force GNet to grab only its own messages, Found by Anthony Lee. Mon Apr 9 17:10:09 2001 David Helder * src/iochannel.c (gnet_io_channel_readn): Bug fix from Wolfgang Borgert. Fri Mar 30 11:57:21 2001 David Helder * configure.in: Checking for param.h incorrectly Tue Mar 6 15:31:13 2001 David Helder * src/iochannel.c (gnet_io_channel_readline_strdup): Fixed bug when buffer lengthened (off by one). Found by Simon Li. Sun Mar 4 5:04:45 2001 Andrew Lanoix * src/gnet-private.[ch] * src/iochannel.[ch] * gnet.def Removed Glib 1.2 workaround. * gnet.dsp Link to glib-1.3.lib. * README.win32 Cleanup and further clarify linking with mingw/gcc. Tue Feb 27 15:55:56 2001 David Helder * src/inetaddr.c: Fixed const issues for Windows * src/tcp.c: * src/sha.c: * src/server.[hc]: s/interface/iface because interface is reserved in MS C. * README: Added PreViking link Fri Feb 23 7:44:14 2001 Andrew Lanoix *src/server.c added #include *src/sha.c Don't #include on Windows *src/tcp gnet_tcp_socket_new_async on Windows, needed to add G_IO_ERR to g_io_add_watch() call. *README.win32 Clarify mingw/gcc/cygwin problem. Sat Feb 17 16:17:49 2001 David Helder * tests/Makefile.am: Now compile tests by default * src/*: Added/removed const's * src/md5.c (gnet_md5_copy_string): Added * src/{md5,sha}.c: Added gnet_{sha,md5}_{new_incremental, update, final} for "incremental" hashes Wed Feb 14 20:57:07 2001 David Helder * src/pack.c: Implemented pack_strdup. Removed calcsize - not useful. * src/inetaddr.c (gnet_gethostbyaddr): Fix locking. We did not hold the lock when we accessed the hostent struct. This only affects software that uses threads on systems without gethostby{name,addr}_r * tests/: Moved some examples here * doc/: Rebuilt, cleaned up Tue Jan 23 13:11:03 2001 David Helder * configure.in: Fixed --enable-debug macro * doc/gnet.sgml: Fixed --libs problem * README: Added gpoker * src/iochannel.c (gnet_io_channel_writen): Fixed comment. Thu Dec 14 14:02:50 2000 Andrew Lanoix * Updates to the Win32 GIOChannel socket fix * g_io_channel_win32_new_stream_socket() renamed to gnet_io_channel_win32_new_stream_socket() * gnet_tcp_socket_new_async() Win32 version now uses the GIOChannel fix, also callback on an error was broken Mon Nov 13 19:49:32 2000 David Helder * examples/echoclient-udp.c: Added * examples/echoserver-udp.c: " Wed Nov 8 10:45:46 2000 David Helder * README: Added gPoker Thu Nov 2 19:26:47 2000 Andrew Lanoix * src/tcp.c: gnet_tcp_socket_new_async_cancel() Win32 version did not cleanup properly * src/gnet-private.c: Removed debug code * gnetconfig.h.win32: Defined GNET_WIN32 here if not defined * src/iochannel.[hc]: * src/gnet-private.[hc]: Added Glib of Win32 GIOChannel Socket FIX * src/tcp.c: gnet_tcp_server_accept() Don't force the socket in the Win32 version into blocking mode. * gnet.def: Added g_io_channel_win32_new_stream_socket() * README.win32: Updates Thu Nov 2 15:24:04 2000 David Helder * src/*.h: Added #ifdef GNET_EXPERIMENTAL around experimental stuff. * src/url.c (gnet_url_clone): g_strdup will return NULL if str is NULL - don't check. Mon Oct 30 20:34:29 2000 David Helder * examples/echoserver.c (async_echoserver): Code cleanups Sun Oct 29 22:44:22 2000 David Helder * examples/echo*.c: s/--nonblocking/--async/ since it's asynchronous, not nonblocking. * examples/echoclient.c: Added example showing GConn way. Started showing asynchronous example. UNFINISHED. * src/iochannel.c (gnet_io_channel_readline_check_func): Don't replace \n with \0. This is what readline does. * examples/echoserver.c: Added example showing GServer way * src/server.h (GServerFunc): s/struct _GConn/GConn/ * examples/echoserver.c: Clean-ups Sun Oct 29 17:50:46 2000 David Helder * examples/echoserver.c: Fixed non-blocking server example. It had a couple problems. It should not have switched on the condition, because it's a bit field, not an enum. It should have done better error checking too. * BUGS: Added * src/pack.c: Change 'P' to 'v' for void pointer. Void pointer will always be native size. * src/pack.c: Updated docs Thu Oct 26 16:23:29 2000 David Helder * gnet.spec.in (Group): Integrated Benjamin Kahn's patch. lib/gnet wasn't being include in the dev RPM. Sat Oct 21 01:09:52 2000 David Helder * examples/unpack.c: Added * examples/pack.c: Added more tests * src/pack.c (gnet_vunpack): unpack s is now like pack s. Use r or S for old semantics * src/pack.c (strlenn): Fixed. Fixes unpack s * src/pack.c: Fixed pack/unpack of big endian pointers (like you'd ever do this...) * src/pack.c (gnet_vpack): Fix pack R * src/pack.c (gnet_vpack): p can now be repeated * src/pack.c: Made sure va_arg uses only int or double. This should fix gcc 2.76 warning Joe found. Fri Oct 20 11:27:08 2000 David Helder * src/*.[ch]: Added Copyright line for Andy to files he changed/added to. Thu Oct 19 23:47:01 2000 David Helder * configure.in (GNET_BINARY_AGE): Minor = 5, interface = 0 Thu Oct 19 23:44:17 2000 David Helder * *: Merged GNET_1_0_4_STABLE_BRANCH into HEAD Thu Oct 19 22:48:21 2000 David Helder * *: Release 1.0.4 on GNET_1_0_4_STABLE_BRANCH branch * README.win32: Updates * gnet-config.in (lib_gnet): Fix gnet-config.in Sat Oct 14 11:54:30 2000 David Helder * gnet-config.in (lib_gnet): Fixed cflags for non-/usr prefix systems. * NEWS: Updates (still unreleased) Wed Oct 11 23:31:40 2000 David Helder * TODO: Updates. Wed Oct 11 23:18:04 2000 David Helder * examples/pack.c: Added * examples/hash.c: Added Wed Oct 11 23:16:48 2000 David Helder * src/scheduler.[hc]: Added, but not used yet. * src/md5.[hc]: Added * src/sha.[hc]: Added * src/gnet.h: Added md5 and sha Wed Oct 11 22:57:18 2000 David Helder * src/iochannel.[hc]: Moved functions in gnet.h here * src/iochannel.c ({read,write}_async): Added * src/pack.[hc]: Added. Mostly finished. Needs testing, more docs. * src/conn.[hc]: Added. Needs review, docs. * src/server.[hc]: Added. Needs review, docs. * src/url.[hc]: Added. Very basic, not standards compliant. Needs work. * src/inetaddr.c (gnet_inetaddr_new_nonblock): Added * src/inetaddr.c (gnet_inetaddr_is_*): Added * src/inetaddr.c (gnet_inetaddr_autodetect_internet_interface): Added * src/inetaddr.c (gnet_inetaddr_get_interface_to): " * src/inetaddr.c (gnet_inetaddr_get_internet_interface): " * src/inetaddr.c (gnet_inetaddr_is_internet_domainname): " * src/inetaddr.c,gnet-private.c (gnet_inetaddr_list_interfaces): Moved from private to inetaddr and exposed. * src/tcp.c (gnet_tcp_socket_set_tos): Added * src/tcp.c (gnet_tcp_socket_server_new2): Added. This will become gnet_tcp_socket_server_new() in 1.2. Tue Oct 3 13:26:45 2000 Andrew Lanoix * Added: Gnet.dsp (MS VC 6.0 Project File, builds with Glib 1.2) * Removed references to G_OS_WIN32 in examples Mon Oct 2 00:05:33 2000 Andrew Lanoix * Added: gnetconfig.h.win32, config.h.win32 * Code now compiles with both Glib 1.2, 1.3 on Win32 Mon Oct 2 11:19:12 2000 David Helder * src/gnet-private.c: Remove include config.h Mon Oct 2 11:15:19 2000 David Helder * src/inetaddr.c: Remove include of config.h. Already in gnet-private.h. Sun Oct 1 19:42:07 2000 David Helder * src/tcp.c (gnet_tcp_socket_new_async_cb): Remove the watch before calling the user's callback. This prevents it from being called a second time, which could happen if we run the main loop before we return. Joe Shaw found this bug. * src/inetaddr.c (gnet_inetaddr_new_async_cb): " * src/inetaddr.c (gnet_inetaddr_get_name_async_cb): " Sun Oct 1 13:58:35 2000 David Helder * gnetconfig.h.in: Fixed endif (had string - not ANSI) Sun Oct 1 3:48:33:19 2000 Andrew Lanoix * hostinfo.c: Updated Sun Oct 1 3:46:48:28 2000 Andrew Lanoix * Temp patch to get examples to work on Win32 (dnstest.c echoserver.c echoclient.c) Sun Oct 1 3:41:29:66 2000 Andrew Lanoix * Workaround for win32 linking issue. Moved including winsock2 from inetadder.c to inetaddr.h Thu Sep 28 23:13:30 2000 David Helder * README.win32: Added. Writen by Andy. Thu Sep 28 22:55:57 2000 David Helder * gnetconfig.h.in: Added * Makefile.am: Install in library * gnet-config.h.in: Add gnetconfig.h * src/gnet.h: Fixed version stuff * src/gnet-private.h: Include sys/param if available. * src/*: Small windows fixes Thu Sep 28 21:40:15 2000 David Helder * src/gnet-private.h: Added Andy's 2nd patch. Wed Sep 27 01:01:49 2000 David Helder * *: First pass at merging in Andy's Win32 port. Compiles in Unix, but untested in Unix and Windows. Tue Apr 11 16:59:11 2000 David Helder * *: Release 1.0.3 * README: Updated Jungle Monkey URL Mon Apr 10 20:48:01 2000 David Helder * configure.in (GNET_BINARY_AGE): Upped version to 1.0.3 * src/inetaddr.c (gnet_inetaddr_new_async_cb): If gethostbyname failed, then it's an error. Sun Apr 9 15:19:16 2000 David Helder * autogen.sh: Added Gnome-like autogen script * auto*: Removed Thu Apr 6 16:14:16 2000 David Helder * src/inetaddr.c (gnet_inetaddr_new_async): Don't watch PRI or OUT. * src/inetaddr.c (gnet_inetaddr_get_name_async): Likewise. * src/tcp.c (gnet_tcp_socket_new_async_cancel): Delete the state. * src/tcp.c (gnet_tcp_socket_connect_async_cancel): Delete the state. * src/tcp.c (gnet_tcp_socket_new_async_cb): Bug fix: Mask the condition properly. Delete the socket if there was an error. General clean-ups. * src/inetaddr.c (gnet_inetaddr_get_name_async_cb): Bug fix: Make sure name ends with '\0'. * src/inetaddr.c (gnet_inetaddr_new_async_cb): Bug fix: Mask the condition properly. * src/inetaddr.c (gnet_inetaddr_new_async_cb): Bug fix: Copy len-1 bytes, not len. * src/inetaddr.c (gnet_inetaddr_new_async_cb): If we call back with ERROR, set ia to NULL. Also delete the ia, which fixes a memory leak. * configure.in: Print stuff when checking for --enable-debug Wed Apr 5 14:04:52 2000 David Helder * src/gnet-private.c (gnet_private_inetaddr_list_interfaces): Use ifr_blah macros and don't access ifr directly (which I should have done originally). This fixes a portability issue in FreeBSD 4.0 which changes ifru_flags from a short to a short[2]. * examples/hostinfo.c: Added decl for list_interfaces so it that it will compile. Fri Mar 17 20:07:15 2000 David Helder * src/tcp.c (gnet_tcp_socket_server_accept_nonblock): Clean-up * src/tcp.c (gnet_tcp_socket_server_accept): Check errno against EPROTO only if EPROTO is defined. (It isn't on OpenBSD. Fix by Niels.) Sun Mar 5 14:22:11 2000 David Helder * auto*: Release version 1.0.1 Tue Feb 29 11:18:52 2000 David Helder * AUTO*: Version 1.0.1 (unreleased) * src/gnet.c (gnet_io_channel_readline_strdup): Fixed typo bug where buffer was growing too fast. Found by Carl Armstrong . Mon Feb 28 12:38:31 2000 David Helder * NEWS, etc: Version 1.0.0 * debian/*: Upped version to 1.0.0-2, cleaned up control.in * gnet.spec.in: Upped version to 1.0 Wed Feb 23 10:49:39 2000 David Helder * src/tcp.c (gnet_tcp_socket_server_accept_nonblock): Added. Theoretically, gnet_tcp_socket_server_accept could block even if the channel was readable, so I added this. * src/tcp.[ch], inetaddr.[ch]: - Renaming: GTcpSocketAsyncFunc -> GTcpSocketNewAsyncFunc GTcpSocketAyncStatus -> GTcpSocketNewAyncStatus etc... - gpointer ID's given better names: GTcpSocketNewAsyncID GTcpSocketConnectAsyncID GInetAddrNewAsyncID GInetAddrGetNameAyncID * doc/*, src/*, TODO, README, HACKING: Doc cleanups/improvements * libtool*: Upgrade to libtool 1.3.4 * auto*: Version set to 0.1.10 (for now) Tue Feb 15 17:01:39 2000 David A Helder * debian/changelog: Removed middle initial. Tue Feb 15 10:13:59 2000 David A Helder * doc/*: Updates for new stuff * src/*: Documentation fixes * configure.in: Check for sys/poll.h * src/gnet-private.h: Changed __EMX__ to HAVE_SYS_POLL_H * acconfig.h: Added HAVE_SYS_POLL_H * src/{tcp, inetaddr}.c: Reordered enums so that OK comes first. * src/Makefile.am (EXTRA_DIST): Removed ftp.[ch] from EXTRA_DIST (will remain in repository though). 2000-02-09 Asbjorn Pettersen * src/gnet-private.h: before OS/2 havn't . __EMX__ is an OS/2 define. Tue Feb 8 17:40:58 2000 David A Helder * AUTHORS: Fixed Xavier's email address. Tue Feb 8 10:29:02 2000 David A Helder * TODO: Added some TODO's Sun Feb 6 14:27:20 2000 David A Helder * NEWS: Added 0.1.9 (unreleased) Sun Feb 6 13:18:03 2000 David A Helder * src/*: Renamed "nonblock" to "async" because we're really asynchronous. Nonblock usually means the function will return if it would block, which we don't do. * src/tcp.c: - Added gnet_tcp_socket_new_async_cancel() and gnet_tcp_socket_connect_async_cancel(). - gnet_tcp_socket_new_async() and gnet_tcp_socket_connect_async() now return ID's of connections which can be used for cancels. - gnet_tcp_socket_new_async() now calls callback if there is a failure. * src/inetaddr.c: - Added gnet_inetaddr_new_sync_cancel() and gnet_inetaddr_get_name_async_cancel(). - gnet_inetaddr_new_sync() and gnet_inetaddr_get_name_async() now return ID's of connections which can be used for cancels. * src/gnet-private.h: Added signal.h * examples/dnstest.c: Updated for this stuff * src/*: Added _ref and _unref functions to GInetAddr, GTcpSocket, GUdpSocket, and GMcastSocket. _delete now uses these. (Also, GMcastSocket now unrefs the iochannel - it didn't before. Oops). * src/gnet.[hc]: Added Jacques' gnet_iochannel_readline_strdup * AUTHORS: Add Jacques Fortier Wed Feb 2 13:58:10 2000 David A Helder * Makefile.am (copyweb): Fixed copy to debian server Wed Feb 2 10:31:13 2000 David A Helder * doc/gnet.sgml: Fixed version number stuff, old function names. * src/udp.c: Fixed type in docs for get_iochannel. * debian/changelog: Did a 0.1.8-2 release with fixed documentation. (I did not generate them properly when I did the first released). Tue Feb 1 20:00:23 2000 David A Helder * auto: Upped version to 0.1.8 * Makefile.am (copyweb): Added debian server stuff to copyweb rule. Mon Jan 31 21:30:02 2000 David A Helder * examples/.cvsignore: Added example executables. Mon Jan 31 19:40:45 2000 David A Helder * src/gnet-private.h: Added iochannel member to TcpSocket, UdpSocket, McastSocket * src/{udp,tcp}.c: Use single iochannel. * examples/{hfetch, echoserver}.c: Don't close iochannel. * src/{udp,inetaddr,tcp,mcast}.c: Check if the argument to *_delete is NULL. If it is, don't do anything. * README: Added info on submiting bugs. * TODO: Added "Write manpage for gnet-config". Sun Jan 30 16:34:59 2000 David A Helder * src/inetaddr.c (gnet_inetaddr_new_nonblock): Added 'return' if inet_aton worked. This caused a seg fault. * src/tcp.c (gnet_tcp_socket_new_nonblock): Added some g_return_val_if_fail. * TODO: Reformated, added some comments. 2000-01-30 Soren Sandmann Pedersen * src/inetaddr.c: Use HP-UX' gethostbyaddr_r. Fixed typo in Solaris code (this was a bug - we were calling gethostbyname_r, not gethostbyaddr_r) [DAH]. Sat Jan 29 16:55:41 2000 David A Helder * AUTHORS: Added Soeren Sandmann to AUTHORS 2000-01-29 Soren Sandmann Pedersen * src/inetaddr.c: Use HP-UX' gethostbyname_r * acconfig.h: add GETHOSTBYNAME_R_HPUX * configure.in: detect HP-UX' gethostbyname_r Wed Jan 26 12:37:51 2000 David A Helder * AUTHORS: Fixed Xavier's email address. Wed Jan 26 11:11:07 2000 David A Helder * src/Makefile.am: Don't install gnet-private.h, ftp.{hc} * src/{gnet,inetaddr}.h: Removed include of config.h * src/gnet-private.h: Added include of config.h Tue Jan 25 14:48:11 2000 David A Helder * doc/Makefile.am (scan): Added src/ftp, src/gnet-private to the ignore list * doc/[docs]: Regenerated Tue Jan 25 12:28:52 2000 David A Helder * auto*: Upped version to 0.1.7 * src/gnet.c: Fixed read/write functions. Basically brought in line with Steven's code, which I know to be correct. readn didn't handle EOF properly. * src/tcp.c (gnet_tcp_socket_server_accept): Use select so we don't suck up all the CPU time (duh). * examples/echoclient.c (main): Write the strlen of the line, not strlen + 1. * examples/echoserver.c, hfetch.c: Unref the iochannel after closing it. Tue Jan 25 12:01:33 2000 David A Helder * README: Clean-ups * src/inetaddr.c: Changed snprintf to g_snprintf. Sun Jan 23 14:05:42 2000 David A Helder * auto*: Upped version to 0.1.6 * src/*.h: Added #ifdef __cplusplus... * src/gnet.h, gnet-private.h: Added #ifndef _GNET_H, _GNET_PRIVATE_H * TODO, other docs: Reformating, cleanups Thu Jan 20 12:23:38 2000 David A Helder * doc/.cvsignore, debian/.cvsignore: Added * Makefile.am: Cleaned up and Added RPMs to copyweb rule. Thu Jan 20 12:05:36 2000 David A Helder * HACKING: Updated "How to check out GNet anonymously" for Gnome repository. Thu Jan 20 11:41:17 2000 David A Helder * src/*.[ch]: Moved most includes and definitions to gnet-private.h. This will make porting easier. Wed Jan 19 15:48:29 2000 David A Helder * src/gnet.c (gnet_io_channel_writen, gnet_io_channel_readn): Don't count bytes read/written if there was an error. * src/gnet.c (gnet_io_channel_readline): Try reading again if we get G_IO_ERROR_AGAIN. Tue Jan 18 13:59:57 2000 David A Helder * src/inetaddr.c (gnet_inetaddr_get_name_nonblock): Fixed bug in handling large addresses. * src/inetaddr.c: Fixed bugs in internal gnet_gethostby* functions. Changed them around a bit. Tue Jan 18 12:50:38 2000 David A Helder * debian/changelog: Updated to 0.1.5 * debian/rules.in: Handle libtool naming correctly * debian/libgnet0.1.docs: Added (was just 'docs') Tue Jan 18 12:12:13 2000 David A Helder * configure.in: Added tests for variants of gethostbyname_r. Define _REENTRANT * src/inetaddr.c: Added gnet_gethostbyname and gnet_gethostbyaddr which use appropriate function based on config.h * TODO: Remove this improvement from list * src/gnet-private.h: Changed include to sys/socket.h * src/inetaddr.[ch]: Portablity fixed (thought I did these on the 10th - oops) * configure.in: Upped version to 0.1.5 (not released yet) * src/ftp.[ch]: Added note that it was experimental Mon Jan 17 11:16:39 2000 David A Helder * HACKING: Added (based on Xavier's SUBMIT-PATCH) * TODO: Added more details * src/ftp.[ch]: Added (contributed by Xavier Nicolovici) * gnet.spec.in: Added (contributed by Xavier Nicolovici) * Makefile.am: Added HACKING * configure.in: Added gnet.spec * auto*: Brought up-to-date * debian/changelog: Upped to debian version 2 Fri Jan 14 10:15:53 2000 David A Helder * examples/Makefile.am: Use gnet-config, not ../src * examples/*: Include gnet/gnet.h, not gnet.h * TODO: Added "Build Debian docs package" * AUTHORS: Added Xavier Nicolovici to AUTHORS Thu Jan 13 15:20:36 2000 David A Helder * doc/Makefile.am: Docs now put in prefix/share/doc/libgnet0.1-dev * Makefile.am: Added deb rule that builds .debs * debian/*: Added debian package building stuff Wed Jan 12 15:59:29 2000 David A Helder * ALL: Release 0.1.4 * TODO: Updates * examples/sdr.c: Added additional tests of mcast sockets * src/udp.c (gnet_udp_socket_get_mcast_ttl): Fix type of ttl (wasn't broken in Linux as I thought). * src/mcast.c (gnet_mcast_socket_is_loopback): Fix type of flag (wasn't broken in Linux as I thought). * src/udp.c: gnet_udp_socket_get_MTU removed until we can fix it and port it to Solaris. * src/udp.c: Include sys/sockio.h if we have it. * src/{mcast,udp}.c: Cast 4th arg to *sockopt to (void*). * src/{tcp,mcast,udp}.c: Define socklen_t if necessary. * src/inetaddr.c: Include resolv.h, arpa/nameserv.h, Define INET_ADDRSTRLEN and INET6_ADDRSTRLEN if necessary. Wed Jan 12 11:28:34 2000 David A Helder * .cvsignore: Added .cvsignore files Mon Jan 10 18:16:32 2000 David A Helder * src/gnet-private.c: Include sys/sockio.h if we have it. * configure.in: Check for sys/sockio.h Mon Jan 10 12:40:55 2000 David A Helder * ALL: More docs, release 0.1.3 * TODO: Updates * AUTHORS: Credited Owen Taylor for gnet.m4 and gnet-config * doc/gnet.sgml: Added how-to-compile section * src/inetaddr.c (gnet_inetaddr_get_name): Added * src/inetaddr.c (gnet_inetaddr_new_nonblock): Now returns void * examples/dnstest.c: Demonstrates gnet_inetaddr_get_name * examples/ljoust.c: Added Llama Joust Sun Jan 9 16:40:26 2000 David A Helder * src/gnet.[ch], configure.in: Added gnet_*_version * Makefile.am: Added m4 files for install * acconfig.h: Added * src/Makefile.am (libgnet_la_LDFLAGS): Fixed \ problem Sun Jan 9 16:08:11 2000 David A Helder * ALL: Prefixed functions with gnet_ * src/gnet-private.[ch]: Move private functions here * TODO: Cleaned up, removed some * gnet.m4: Added * gnet-config.in: Added * configure.in: Added to it (from glib, gtk) Thu Jan 6 15:25:39 2000 David A Helder * TODO: Added more notes * NEWS: Fixed this * README: Added more notes * src/inetaddr.c (inetaddr_new_nonblock): Use _exit instead of exit Thu Jan 6 13:26:09 2000 David A Helder * doc/gnet.sgml: Added info on dnstest * configure.in (GNET_MICRO_VERSION): Upped to 1 * TODO: Added a few more TODO's based on emails * README: Added info on how to checkout Gnet * src/inetaddr.[hc]: Added inetaddr_new_nonblock * examples/dnstest.c: Added inetaddr_new_nonblock test. gnet-2.0.8/README.macosx0000644000175000017500000000051410751326732011556 00000000000000 To compile GNet on MacOS X (and NeXT, OpenStep and other similar OS's) you need to disable smart preprocessing. To do this, instead of just running configure run: csh/tcsh: % setenv CFLAGS -traditional-cpp % ./configure sh/bash: % CFLAGS=-traditional-cpp ./configure (This may not be required in 10.1 and later version.) gnet-2.0.8/GNET.DSP0000644000175000017500000001404410751326732010515 00000000000000# Microsoft Developer Studio Project File - Name="gnet" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=gnet - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "GNET.MAK". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "GNET.MAK" CFG="gnet - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "gnet - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "gnet - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "gnet - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GNET_EXPORTS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "." /D "NDEBUG" /D "GNET_EXPERIMENTAL" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GNET_EXPORTS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD LINK32 glib-2.0.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Release/gnet-1.1.dll" !ELSEIF "$(CFG)" == "gnet - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GNET_EXPORTS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "GNET_EXPERIMENTAL" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GNET_EXPORTS" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 glib-2.0.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Debug/gnet-1.1.dll" /pdbtype:sept !ENDIF # Begin Target # Name "gnet - Win32 Release" # Name "gnet - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\conn.c # End Source File # Begin Source File SOURCE=.\conn-http.c # End Source File # Begin Source File SOURCE=".\gnet-private.c" # End Source File # Begin Source File SOURCE=.\gnet.c # End Source File # Begin Source File SOURCE=.\gnet.def # End Source File # Begin Source File SOURCE=.\inetaddr.c # End Source File # Begin Source File SOURCE=.\iochannel.c # End Source File # Begin Source File SOURCE=.\mcast.c # End Source File # Begin Source File SOURCE=.\md5.c # End Source File # Begin Source File SOURCE=.\pack.c # End Source File # Begin Source File SOURCE=.\server.c # End Source File # Begin Source File SOURCE=.\sha.c # End Source File # Begin Source File SOURCE=".\socks-private.c" # End Source File # Begin Source File SOURCE=.\socks.c # End Source File # Begin Source File SOURCE=.\tcp.c # End Source File # Begin Source File SOURCE=.\udp.c # End Source File # Begin Source File SOURCE=.\url.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\config.h # End Source File # Begin Source File SOURCE=.\conn.h # End Source File # Begin Source File SOURCE=.\conn-http.h # End Source File # Begin Source File SOURCE=.\glib.h # End Source File # Begin Source File SOURCE=.\glibconfig.h # End Source File # Begin Source File SOURCE=".\gnet-private.h" # End Source File # Begin Source File SOURCE=.\gnet.h # End Source File # Begin Source File SOURCE=.\gnetconfig.h # End Source File # Begin Source File SOURCE=.\inetaddr.h # End Source File # Begin Source File SOURCE=.\iochannel.h # End Source File # Begin Source File SOURCE=.\mcast.h # End Source File # Begin Source File SOURCE=.\md5.h # End Source File # Begin Source File SOURCE=.\pack.h # End Source File # Begin Source File SOURCE=.\server.h # End Source File # Begin Source File SOURCE=.\sha.h # End Source File # Begin Source File SOURCE=".\socks-private.h" # End Source File # Begin Source File SOURCE=.\socks.h # End Source File # Begin Source File SOURCE=.\tcp.h # End Source File # Begin Source File SOURCE=.\udp.h # End Source File # Begin Source File SOURCE=.\url.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project gnet-2.0.8/src/0000777000175000017500000000000010751404362010254 500000000000000gnet-2.0.8/src/usagi_ifaddrs.c0000644000175000017500000005110610751326730013145 00000000000000#include #ifdef HAVE_LINUX_NETLINK_H /* $USAGI: ifaddrs.c,v 1.20 2002/08/23 05:38:00 yoshfuji Exp $ */ /* * Copyright (C)2000 YOSHIFUJI Hideaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include #include #include #include #include #include /* the L2 protocols */ #include #include #include #include "usagi_ifaddrs.h" #include #ifdef _USAGI_LIBINET6 #include "libc-compat.h" #endif #define __set_errno(e) do { errno = e; } while(0) #define __close(s) close(s) /* ====================================================================== */ struct nlmsg_list { struct nlmsg_list *nlm_next; struct nlmsghdr *nlh; int size; time_t seq; }; struct rtmaddr_ifamap { void *address; void *local; #ifdef IFA_NETMASK void *netmask; #endif void *broadcast; #ifdef HAVE_IFADDRS_IFA_ANYCAST void *anycast; #endif int address_len; int local_len; #ifdef IFA_NETMASK int netmask_len; #endif int broadcast_len; #ifdef HAVE_IFADDRS_IFA_ANYCAST int anycast_len; #endif }; /* ====================================================================== */ static size_t ifa_sa_len (sa_family_t family, int len) { size_t size; switch (family) { case AF_INET: size = sizeof (struct sockaddr_in); break; case AF_INET6: size = sizeof (struct sockaddr_in6); break; case AF_PACKET: size = (size_t) (((struct sockaddr_ll *) NULL)->sll_addr) + len; if (size < sizeof (struct sockaddr_ll)) size = sizeof (struct sockaddr_ll); break; default: size = (size_t) (((struct sockaddr *) NULL)->sa_data) + len; if (size < sizeof (struct sockaddr)) size = sizeof (struct sockaddr); } return size; } static void ifa_make_sockaddr (sa_family_t family, struct sockaddr *sa, void *p, size_t len, uint32_t scope, uint32_t scopeid) { if (sa == NULL) return; switch (family) { case AF_INET: memcpy (&((struct sockaddr_in *) sa)->sin_addr, (char *) p, len); break; case AF_INET6: memcpy (&((struct sockaddr_in6 *) sa)->sin6_addr, (char *) p, len); if (IN6_IS_ADDR_LINKLOCAL (p) || IN6_IS_ADDR_MC_LINKLOCAL (p)) { ((struct sockaddr_in6 *) sa)->sin6_scope_id = scopeid; } break; case AF_PACKET: memcpy (((struct sockaddr_ll *) sa)->sll_addr, (char *) p, len); ((struct sockaddr_ll *) sa)->sll_halen = len; break; default: memcpy (sa->sa_data, p, len); /*XXX*/ break; } sa->sa_family = family; #ifdef HAVE_SOCKADDR_SA_LEN sa->sa_len = ifa_sa_len (family, len); #endif } static struct sockaddr * ifa_make_sockaddr_mask (sa_family_t family, struct sockaddr *sa, uint32_t prefixlen) { int i; char *p = NULL, c; uint32_t max_prefixlen = 0; if (sa == NULL) return NULL; switch (family) { case AF_INET: memset (&((struct sockaddr_in *) sa)->sin_addr, 0, sizeof (((struct sockaddr_in *) sa)->sin_addr)); p = (char *) &((struct sockaddr_in *) sa)->sin_addr; max_prefixlen = 32; break; case AF_INET6: memset (&((struct sockaddr_in6 *) sa)->sin6_addr, 0, sizeof (((struct sockaddr_in6 *) sa)->sin6_addr)); p = (char *) &((struct sockaddr_in6 *) sa)->sin6_addr; #if 0 /* XXX: fill scope-id? */ if (IN6_IS_ADDR_LINKLOCAL (p) || IN6_IS_ADDR_MC_LINKLOCAL (p)) { ((struct sockaddr_in6 *) sa)->sin6_scope_id = scopeid; } #endif max_prefixlen = 128; break; default: return NULL; } sa->sa_family = family; #ifdef HAVE_SOCKADDR_SA_LEN sa->sa_len = ifa_sa_len (family, len); #endif if (p) { if (prefixlen > max_prefixlen) prefixlen = max_prefixlen; for (i = 0; i < (prefixlen / 8); i++) *p++ = 0xff; c = 0xff; c <<= (8 - (prefixlen % 8)); *p = c; } return sa; } /* ====================================================================== */ static int nl_sendreq (int sd, int request, int flags, int *seq) { char reqbuf[NLMSG_ALIGN (sizeof (struct nlmsghdr)) + NLMSG_ALIGN (sizeof (struct rtgenmsg))]; struct sockaddr_nl nladdr; struct nlmsghdr *req_hdr; struct rtgenmsg *req_msg; time_t t = time (NULL); if (seq) *seq = t; memset (&reqbuf, 0, sizeof (reqbuf)); req_hdr = (struct nlmsghdr *) reqbuf; req_msg = (struct rtgenmsg *) NLMSG_DATA (req_hdr); req_hdr->nlmsg_len = NLMSG_LENGTH (sizeof (*req_msg)); req_hdr->nlmsg_type = request; req_hdr->nlmsg_flags = flags | NLM_F_REQUEST; req_hdr->nlmsg_pid = 0; req_hdr->nlmsg_seq = t; req_msg->rtgen_family = AF_UNSPEC; memset (&nladdr, 0, sizeof (nladdr)); nladdr.nl_family = AF_NETLINK; return (sendto (sd, (void *) req_hdr, req_hdr->nlmsg_len, 0, (struct sockaddr *) &nladdr, sizeof (nladdr))); } static int nl_recvmsg (int sd, int request, int seq, void *buf, size_t buflen, int *flags) { struct msghdr msg; struct iovec iov = { buf, buflen }; struct sockaddr_nl nladdr; int read_len; for (;;) { msg.msg_name = (void *) &nladdr; msg.msg_namelen = sizeof (nladdr); msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_control = NULL; msg.msg_controllen = 0; msg.msg_flags = 0; read_len = recvmsg (sd, &msg, 0); if ((read_len < 0 && errno == EINTR) || (msg.msg_flags & MSG_TRUNC)) continue; if (flags) *flags = msg.msg_flags; break; } return read_len; } static int nl_getmsg (int sd, int request, int seq, struct nlmsghdr **nlhp, int *done) { struct nlmsghdr *nh; size_t bufsize = 65536, lastbufsize = 0; void *buff = NULL; int result = 0, read_size; int msg_flags; pid_t pid = getpid (); for (;;) { void *newbuff = realloc (buff, bufsize); if (newbuff == NULL || bufsize < lastbufsize) { result = -1; break; } buff = newbuff; result = read_size = nl_recvmsg (sd, request, seq, buff, bufsize, &msg_flags); if (read_size < 0 || (msg_flags & MSG_TRUNC)) { lastbufsize = bufsize; bufsize *= 2; continue; } if (read_size == 0) break; nh = (struct nlmsghdr *) buff; for (nh = (struct nlmsghdr *) buff; NLMSG_OK (nh, read_size); nh = (struct nlmsghdr *) NLMSG_NEXT (nh, read_size)) { if (nh->nlmsg_pid != pid || nh->nlmsg_seq != seq) continue; if (nh->nlmsg_type == NLMSG_DONE) { (*done)++; break; /* ok */ } if (nh->nlmsg_type == NLMSG_ERROR) { struct nlmsgerr *nlerr = (struct nlmsgerr *) NLMSG_DATA (nh); result = -1; if (nh->nlmsg_len < NLMSG_LENGTH (sizeof (struct nlmsgerr))) __set_errno (EIO); else __set_errno (-nlerr->error); break; } } break; } if (result < 0) if (buff) { int saved_errno = errno; free (buff); __set_errno (saved_errno); } *nlhp = (struct nlmsghdr *) buff; return result; } static int nl_getlist (int sd, int seq, int request, struct nlmsg_list **nlm_list, struct nlmsg_list **nlm_end) { struct nlmsghdr *nlh = NULL; int status; int done = 0; status = nl_sendreq (sd, request, NLM_F_ROOT | NLM_F_MATCH, &seq); if (status < 0) return status; if (seq == 0) seq = (int) time (NULL); while (!done) { status = nl_getmsg (sd, request, seq, &nlh, &done); if (status < 0) return status; if (nlh) { struct nlmsg_list *nlm_next = (struct nlmsg_list *) malloc (sizeof (struct nlmsg_list)); if (nlm_next == NULL) { int saved_errno = errno; free (nlh); __set_errno (saved_errno); status = -1; } else { nlm_next->nlm_next = NULL; nlm_next->nlh = (struct nlmsghdr *) nlh; nlm_next->size = status; nlm_next->seq = seq; if (*nlm_list == NULL) { *nlm_list = nlm_next; *nlm_end = nlm_next; } else { (*nlm_end)->nlm_next = nlm_next; *nlm_end = nlm_next; } } } } return status >= 0 ? seq : status; } /* ---------------------------------------------------------------------- */ static void free_nlmsglist (struct nlmsg_list *nlm0) { struct nlmsg_list *nlm; int saved_errno; if (!nlm0) return; saved_errno = errno; nlm = nlm0; while (nlm) { struct nlmsg_list *old_node = nlm; if (nlm->nlh) free (nlm->nlh); nlm = nlm->nlm_next; free (old_node); } __set_errno (saved_errno); } static void free_data (void *data, void *ifdata) { int saved_errno = errno; if (data != NULL) free (data); if (ifdata != NULL) free (ifdata); __set_errno (saved_errno); } /* ---------------------------------------------------------------------- */ static void nl_close (int sd) { int saved_errno = errno; if (sd >= 0) __close (sd); __set_errno (saved_errno); } /* ---------------------------------------------------------------------- */ static int nl_open (void) { struct sockaddr_nl nladdr; int sd; sd = socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sd < 0) return -1; memset (&nladdr, 0, sizeof (nladdr)); nladdr.nl_family = AF_NETLINK; if (bind (sd, (struct sockaddr *) &nladdr, sizeof (nladdr)) < 0) { nl_close (sd); return -1; } return sd; } /* ====================================================================== */ int usagi_getifaddrs (struct ifaddrs **ifap) { int sd; struct nlmsg_list *nlmsg_list, *nlmsg_end, *nlm; /* - - - - - - - - - - - - - - - */ int icnt; size_t dlen, xlen, nlen; uint32_t max_ifindex = 0; pid_t pid = getpid (); int seq; int result; int build; /* 0 or 1 */ /* ---------------------------------- */ /* initialize */ icnt = dlen = xlen = nlen = 0; nlmsg_list = nlmsg_end = NULL; if (ifap) *ifap = NULL; /* ---------------------------------- */ /* open socket and bind */ sd = nl_open (); if (sd < 0) return -1; /* ---------------------------------- */ /* gather info */ if ((seq = nl_getlist (sd, 0, RTM_GETLINK, &nlmsg_list, &nlmsg_end)) < 0) { free_nlmsglist (nlmsg_list); nl_close (sd); return -1; } if ((seq = nl_getlist (sd, seq + 1, RTM_GETADDR, &nlmsg_list, &nlmsg_end)) < 0) { free_nlmsglist (nlmsg_list); nl_close (sd); return -1; } /* ---------------------------------- */ /* Estimate size of result buffer and fill it */ for (build = 0; build <= 1; build++) { struct ifaddrs *ifl = NULL, *ifa = NULL; struct nlmsghdr *nlh, *nlh0; void *data = NULL, *xdata = NULL, *ifdata = NULL; char *ifname = NULL, **iflist = NULL; uint16_t *ifflist = NULL; struct rtmaddr_ifamap ifamap; if (build) { ifa = data = calloc (1, NLMSG_ALIGN (sizeof (struct ifaddrs[icnt])) + dlen + xlen + nlen); ifdata = calloc (1, NLMSG_ALIGN (sizeof (char *[max_ifindex + 1])) + NLMSG_ALIGN (sizeof (uint16_t[max_ifindex + 1]))); if (ifap != NULL) *ifap = (ifdata != NULL) ? ifa : NULL; else { free_data (data, ifdata); result = 0; break; } if (data == NULL || ifdata == NULL) { free_data (data, ifdata); result = -1; break; } ifl = NULL; data += NLMSG_ALIGN (sizeof (struct ifaddrs)) * icnt; xdata = data + dlen; ifname = xdata + xlen; iflist = ifdata; ifflist = ((void *) iflist) + NLMSG_ALIGN (sizeof (char *[max_ifindex + 1])); } for (nlm = nlmsg_list; nlm; nlm = nlm->nlm_next) { int nlmlen = nlm->size; if (!(nlh0 = nlm->nlh)) continue; for (nlh = nlh0; NLMSG_OK (nlh, nlmlen); nlh = NLMSG_NEXT (nlh, nlmlen)) { struct ifinfomsg *ifim = NULL; struct ifaddrmsg *ifam = NULL; struct rtattr *rta; size_t nlm_struct_size = 0; sa_family_t nlm_family = 0; uint32_t nlm_scope = 0, nlm_index = 0; #ifndef IFA_NETMASK size_t sockaddr_size = 0; uint32_t nlm_prefixlen = 0; #endif size_t rtasize; memset (&ifamap, 0, sizeof (ifamap)); /* check if the message is what we want */ if (nlh->nlmsg_pid != pid || nlh->nlmsg_seq != nlm->seq) continue; if (nlh->nlmsg_type == NLMSG_DONE) { break; /* ok */ } switch (nlh->nlmsg_type) { case RTM_NEWLINK: ifim = (struct ifinfomsg *) NLMSG_DATA (nlh); nlm_struct_size = sizeof (*ifim); nlm_family = ifim->ifi_family; nlm_scope = 0; nlm_index = ifim->ifi_index; nlm_prefixlen = 0; if (build) ifflist[nlm_index] = ifa->ifa_flags = ifim->ifi_flags; break; case RTM_NEWADDR: ifam = (struct ifaddrmsg *) NLMSG_DATA (nlh); nlm_struct_size = sizeof (*ifam); nlm_family = ifam->ifa_family; nlm_scope = ifam->ifa_scope; nlm_index = ifam->ifa_index; nlm_prefixlen = ifam->ifa_prefixlen; if (build) ifa->ifa_flags = ifflist[nlm_index]; break; default: continue; } if (!build) { if (max_ifindex < nlm_index) max_ifindex = nlm_index; } else { if (ifl != NULL) ifl->ifa_next = ifa; } rtasize = NLMSG_PAYLOAD (nlh, nlmlen) - NLMSG_ALIGN (nlm_struct_size); for (rta = (struct rtattr *) (((char *) NLMSG_DATA (nlh)) + NLMSG_ALIGN (nlm_struct_size)); RTA_OK (rta, rtasize); rta = RTA_NEXT (rta, rtasize)) { struct sockaddr **sap = NULL; void *rtadata = RTA_DATA (rta); size_t rtapayload = RTA_PAYLOAD (rta); socklen_t sa_len; switch (nlh->nlmsg_type) { case RTM_NEWLINK: switch (rta->rta_type) { case IFLA_ADDRESS: case IFLA_BROADCAST: if (build) { sap = (rta->rta_type == IFLA_ADDRESS) ? &ifa->ifa_addr : &ifa-> ifa_broadaddr; *sap = (struct sockaddr *) data; } sa_len = ifa_sa_len (AF_PACKET, rtapayload); if (rta->rta_type == IFLA_ADDRESS) sockaddr_size = NLMSG_ALIGN (sa_len); if (!build) { dlen += NLMSG_ALIGN (sa_len); } else { memset (*sap, 0, sa_len); ifa_make_sockaddr (AF_PACKET, *sap, rtadata, rtapayload, 0, 0); ((struct sockaddr_ll *) *sap)->sll_ifindex = nlm_index; ((struct sockaddr_ll *) *sap)->sll_hatype = ifim->ifi_type; data += NLMSG_ALIGN (sa_len); } break; case IFLA_IFNAME: /* Name of Interface */ if (!build) nlen += NLMSG_ALIGN (rtapayload + 1); else { ifa->ifa_name = ifname; if (iflist[nlm_index] == NULL) iflist[nlm_index] = ifa->ifa_name; strncpy (ifa->ifa_name, rtadata, rtapayload); ifa->ifa_name[rtapayload] = '\0'; ifname += NLMSG_ALIGN (rtapayload + 1); } break; case IFLA_STATS: /* Statistics of Interface */ if (!build) xlen += NLMSG_ALIGN (rtapayload); else { ifa->ifa_data = xdata; memcpy (ifa->ifa_data, rtadata, rtapayload); xdata += NLMSG_ALIGN (rtapayload); } break; case IFLA_UNSPEC: break; case IFLA_MTU: break; case IFLA_LINK: break; case IFLA_QDISC: break; default: ; } break; case RTM_NEWADDR: if (nlm_family == AF_PACKET) break; switch (rta->rta_type) { case IFA_ADDRESS: ifamap.address = rtadata; ifamap.address_len = rtapayload; break; case IFA_LOCAL: ifamap.local = rtadata; ifamap.local_len = rtapayload; break; case IFA_BROADCAST: ifamap.broadcast = rtadata; ifamap.broadcast_len = rtapayload; break; #ifdef HAVE_IFADDRS_IFA_ANYCAST case IFA_ANYCAST: ifamap.anycast = rtadata; ifamap.anycast_len = rtapayload; break; #endif case IFA_LABEL: if (!build) nlen += NLMSG_ALIGN (rtapayload + 1); else { ifa->ifa_name = ifname; if (iflist[nlm_index] == NULL) iflist[nlm_index] = ifname; strncpy (ifa->ifa_name, rtadata, rtapayload); ifa->ifa_name[rtapayload] = '\0'; ifname += NLMSG_ALIGN (rtapayload + 1); } break; case IFA_UNSPEC: break; case IFA_CACHEINFO: break; default: ; } } } if (nlh->nlmsg_type == RTM_NEWADDR && nlm_family != AF_PACKET) { if (!ifamap.local) { ifamap.local = ifamap.address; ifamap.local_len = ifamap.address_len; } if (!ifamap.address) { ifamap.address = ifamap.local; ifamap.address_len = ifamap.local_len; } if (ifamap.address_len != ifamap.local_len || (ifamap.address != NULL && memcmp (ifamap.address, ifamap.local, ifamap.address_len))) { /* p2p; address is peer and local is ours */ ifamap.broadcast = ifamap.address; ifamap.broadcast_len = ifamap.address_len; ifamap.address = ifamap.local; ifamap.address_len = ifamap.local_len; } if (ifamap.address) { #ifndef IFA_NETMASK sockaddr_size = NLMSG_ALIGN (ifa_sa_len (nlm_family, ifamap.address_len)); #endif if (!build) dlen += NLMSG_ALIGN (ifa_sa_len (nlm_family, ifamap.address_len)); else { ifa->ifa_addr = (struct sockaddr *) data; ifa_make_sockaddr (nlm_family, ifa->ifa_addr, ifamap.address, ifamap.address_len, nlm_scope, nlm_index); data += NLMSG_ALIGN (ifa_sa_len (nlm_family, ifamap.address_len)); } } #ifdef IFA_NETMASK if (ifamap.netmask) { if (!build) dlen += NLMSG_ALIGN (ifa_sa_len (nlm_family, ifamap.netmask_len)); else { ifa->ifa_netmask = (struct sockaddr *) data; ifa_make_sockaddr (nlm_family, ifa->ifa_netmask, ifamap.netmask, ifamap.netmask_len, nlm_scope, nlm_index); data += NLMSG_ALIGN (ifa_sa_len (nlm_family, ifamap.netmask_len)); } } #endif if (ifamap.broadcast) { if (!build) dlen += NLMSG_ALIGN (ifa_sa_len (nlm_family, ifamap.broadcast_len)); else { ifa->ifa_broadaddr = (struct sockaddr *) data; ifa_make_sockaddr (nlm_family, ifa->ifa_broadaddr, ifamap.broadcast, ifamap.broadcast_len, nlm_scope, nlm_index); data += NLMSG_ALIGN (ifa_sa_len (nlm_family, ifamap.broadcast_len)); } } #ifdef HAVE_IFADDRS_IFA_ANYCAST if (ifamap.anycast) { if (!build) dlen += NLMSG_ALIGN (ifa_sa_len (nlm_family, ifamap.anycast_len)); else { ifa->ifa_anycast = (struct sockaddr *) data; ifa_make_sockaddr (nlm_family, ifa->ifa_anyaddr, ifamap.anycast, ifamap.anycast_len, nlm_scope, nlm_index); data += NLMSG_ALIGN (ifa_sa_len (nlm_family, ifamap.anycast_len)); } } #endif } if (!build) { #ifndef IFA_NETMASK dlen += sockaddr_size; #endif icnt++; } else { if (ifa->ifa_name == NULL) ifa->ifa_name = iflist[nlm_index]; #ifndef IFA_NETMASK if (ifa->ifa_addr && ifa->ifa_addr->sa_family != AF_UNSPEC && ifa->ifa_addr->sa_family != AF_PACKET) { ifa->ifa_netmask = (struct sockaddr *) data; ifa_make_sockaddr_mask (ifa->ifa_addr->sa_family, ifa->ifa_netmask, nlm_prefixlen); } data += sockaddr_size; #endif ifl = ifa++; } } } if (!build) { if (icnt == 0 && (dlen + nlen + xlen == 0)) { if (ifap != NULL) *ifap = NULL; break; /* cannot found any addresses */ } } else free_data (NULL, ifdata); } /* ---------------------------------- */ /* Finalize */ free_nlmsglist (nlmsg_list); nl_close (sd); return 0; } /* ---------------------------------------------------------------------- */ void usagi_freeifaddrs (struct ifaddrs *ifa) { free (ifa); } /* **************************************** */ #endif /* HAVE_LINUX_NETLINK_H */ gnet-2.0.8/src/gnet-private.c0000644000175000017500000002035110751326730012744 00000000000000/* GNet - Networking library * Copyright (C) 2000 David Helder * Copyright (C) 2000-2003 Andrew Lanoix * Copyright (C) 2007 Tim-Philipp Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "gnet-private.h" #include "gnet.h" /* Super-function. When creating a listening socket, we need to create the appropriate socket and set-up an address for binding. These operations depend on the particular interface, or on IPv6 policy if there is no interface. */ static SOCKET _gnet_create_ipv4_listen_socket (int type, int port, struct sockaddr_storage* sa) { struct sockaddr_in* sa_in; sa_in = (struct sockaddr_in*) sa; sa_in->sin_family = AF_INET; GNET_SOCKADDR_SET_SS_LEN(*sa); sa_in->sin_addr.s_addr = g_htonl(INADDR_ANY); sa_in->sin_port = g_htons(port); return socket (AF_INET, type, 0); } static SOCKET _gnet_create_ipv6_listen_socket (int type, int port, struct sockaddr_storage* sa) { #ifdef HAVE_IPV6 struct sockaddr_in6* sa_in6; #ifdef GNET_WIN32 struct addrinfo Hints, *AddrInfo; char port_buff[12]; #endif sa_in6 = (struct sockaddr_in6*) sa; #ifndef GNET_WIN32 /* Unix */ sa_in6->sin6_family = AF_INET6; GNET_SOCKADDR_SET_SS_LEN(*sa); memset(&sa_in6->sin6_addr, 0, sizeof(sa_in6->sin6_addr)); sa_in6->sin6_port = g_htons(port); #else /* Windows */ /* A simple memset does not work for some reason on Windows */ sprintf(port_buff, "%d", port); memset(&Hints, 0, sizeof(Hints)); Hints.ai_family = AF_INET6; Hints.ai_socktype = type; Hints.ai_flags = AI_NUMERICHOST | AI_PASSIVE; pfn_getaddrinfo(NULL, port_buff, &Hints, &AddrInfo); memcpy(sa_in6, AddrInfo->ai_addr, AddrInfo->ai_addrlen); pfn_freeaddrinfo(AddrInfo); #endif return socket (AF_INET6, type, 0); #else return GNET_INVALID_SOCKET; #endif } SOCKET _gnet_create_listen_socket (int type, const GInetAddr* iface, int port, struct sockaddr_storage* sa) { SOCKET sockfd = GNET_INVALID_SOCKET; if (iface) { int family = GNET_INETADDR_FAMILY(iface); *sa = iface->sa; GNET_SOCKADDR_PORT_SET(*sa, g_htons(port)); sockfd = socket (family, type, 0); } else { GIPv6Policy ipv6_policy; ipv6_policy = gnet_ipv6_get_policy(); switch (ipv6_policy) { case GIPV6_POLICY_IPV4_THEN_IPV6: sockfd = _gnet_create_ipv4_listen_socket (type, port, sa); if (!GNET_IS_SOCKET_VALID(sockfd)) sockfd = _gnet_create_ipv6_listen_socket (type, port, sa); break; case GIPV6_POLICY_IPV6_THEN_IPV4: sockfd = _gnet_create_ipv6_listen_socket (type, port, sa); if (!GNET_IS_SOCKET_VALID(sockfd)) sockfd = _gnet_create_ipv4_listen_socket (type, port, sa); break; case GIPV6_POLICY_IPV4_ONLY: sockfd = _gnet_create_ipv4_listen_socket (type, port, sa); break; case GIPV6_POLICY_IPV6_ONLY: sockfd = _gnet_create_ipv6_listen_socket (type, port, sa); break; default: g_assert_not_reached (); break; } } return sockfd; } /* _gnet_io_channel_new: * @sockfd: socket descriptor * * Create a new IOChannel from a descriptor. In GLib 2.0, turn off * encoding and buffering. * * Returns: An iochannel. */ GIOChannel* _gnet_io_channel_new (SOCKET sockfd) { GIOChannel* iochannel; iochannel = GNET_SOCKET_IO_CHANNEL_NEW(sockfd); if (iochannel == NULL) return NULL; g_io_channel_set_encoding (iochannel, NULL, NULL); g_io_channel_set_buffered (iochannel, FALSE); return iochannel; } #ifdef GNET_WIN32 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); BOOL WINAPI DllMain(HINSTANCE hinstDLL, /* handle to DLL module */ DWORD fdwReason, /* reason for calling functionm */ LPVOID lpvReserved /* reserved */) { switch(fdwReason) { case DLL_PROCESS_ATTACH: /* The DLL is being mapped into process's address space */ /* Do any required initialization on a per application basis, return FALSE if failed */ { if( !gnet_initialize_windows_sockets() ) { return FALSE; } /* The WinSock DLL is acceptable. Proceed. */ break; } case DLL_THREAD_ATTACH: /* A thread is created. Do any required initialization on a per thread basis*/ { /*Nothing needs to be done. */ break; } case DLL_THREAD_DETACH: /* Thread exits with cleanup */ { /*Nothing needs to be done. */ break; } case DLL_PROCESS_DETACH: /* The DLL unmapped from process's address space. Do necessary cleanup */ { /*CleanUp WinSock 2 */ WSACleanup(); break; } } return TRUE; } int gnet_initialize_windows_sockets(void) { WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD( 2, 0 ); err = WSAStartup(wVersionRequested, &wsaData); if (err != 0) { return FALSE; } /* Confirm that the WinSock DLL supports 2.0.*/ /* Note that if the DLL supports versions greater */ /* than 2.0 in addition to 2.0, it will still return */ /* 2.0 in wVersion since that is the version we */ /* requested. */ if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0) { /* Tell the user that we could not find a usable */ /* WinSock DLL. */ WSACleanup(); return FALSE; } return TRUE; } void gnet_uninitialize_windows_sockets(void) { WSACleanup(); } #endif /* private utility functions */ guint _gnet_idle_add_full (GMainContext * context, gint priority, GSourceFunc function, gpointer data, GDestroyNotify notify) { GSource *source; guint id; g_return_val_if_fail (function != NULL, 0); if (context == NULL) context = g_main_context_default (); source = g_idle_source_new (); if (priority != G_PRIORITY_DEFAULT_IDLE) g_source_set_priority (source, priority); g_source_set_callback (source, function, data, notify); id = g_source_attach (source, context); g_source_unref (source); return id; } guint _gnet_timeout_add_full (GMainContext * context, gint priority, guint interval, GSourceFunc function, gpointer data, GDestroyNotify notify) { GSource *source; guint id; g_return_val_if_fail (function != NULL, 0); if (context == NULL) context = g_main_context_default (); source = g_timeout_source_new (interval); if (priority != G_PRIORITY_DEFAULT) g_source_set_priority (source, priority); g_source_set_callback (source, function, data, notify); id = g_source_attach (source, context); g_source_unref (source); return id; } guint _gnet_io_watch_add_full (GMainContext * context, gint priority, GIOChannel * channel, GIOCondition condition, GIOFunc function, gpointer data, GDestroyNotify notify) { GSource *source; guint id; g_return_val_if_fail (channel != NULL, 0); g_return_val_if_fail (condition != 0, 0); if (context == NULL) context = g_main_context_default (); source = g_io_create_watch (channel, condition); if (priority != G_PRIORITY_DEFAULT) g_source_set_priority (source, priority); g_source_set_callback (source, (GSourceFunc) function, data, notify); id = g_source_attach (source, context); g_source_unref (source); return id; } void _gnet_source_remove (GMainContext * context, guint source_id) { if (source_id != 0) { GSource *source; if (context == NULL) context = g_main_context_default (); source = g_main_context_find_source_by_id (context, source_id); if (source) g_source_destroy (source); /* else g_warning ("Trying to remove source %u from main context %p, " "but it doesn't exist!", source_id, context); */ } } gnet-2.0.8/src/pack.c0000644000175000017500000006021310751326730011256 00000000000000/* GNet - Networking library * Copyright (C) 2000, 2001 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "pack.h" #include static inline gsize strlenn(const char* str, gsize n); static inline void flipmemcpy(char* dst, const char* src, gsize n); #define MEMCPY(D,S,N) \ do { \ if ((N) == 1) \ *((char*) (D)) = *((char*) (S)); \ else if ((N) == 2) \ { \ ((char*) (D))[0] = ((char*) (S))[0]; \ ((char*) (D))[1] = ((char*) (S))[1]; \ } \ else if ((N) == 4) \ { \ ((char*) (D))[0] = ((char*) (S))[0]; \ ((char*) (D))[1] = ((char*) (S))[1]; \ ((char*) (D))[2] = ((char*) (S))[2]; \ ((char*) (D))[3] = ((char*) (S))[3]; \ } \ else \ { \ memcpy((D), (S), (N)); \ } \ } while(0) #define FLIPMEMCPY(D,S,N) \ do { \ if ((N) == 1) \ *((char*) (D)) = *((char*) (S)); \ else if ((N) == 2) \ { \ ((char*) (D))[0] = ((char*) (S))[1]; \ ((char*) (D))[1] = ((char*) (S))[0]; \ } \ else if ((N) == 4) \ { \ ((char*) (D))[0] = ((char*) (S))[3]; \ ((char*) (D))[1] = ((char*) (S))[2]; \ ((char*) (D))[2] = ((char*) (S))[1]; \ ((char*) (D))[3] = ((char*) (S))[0]; \ } \ else \ { \ flipmemcpy((D), (S), (N)); \ } \ } while(0) /* Get the length of string @str. @str is at most @n characters long. @str need not be NUL-terminated (which is why we pass @n). */ static gsize strlenn(const char* str, gsize n) { gsize len = 0; while (*str++ && len < n) ++len; return len; } static void flipmemcpy(char* dst, const char* src, gsize n) { while (n > 0) { *dst++ = src[n-1]; --n; } } # if (G_BYTE_ORDER == G_LITTLE_ENDIAN) # define LEMEMCPY(D,S,N) MEMCPY(D,S,N) # define BEMEMCPY(D,S,N) FLIPMEMCPY(D,S,N) # else # define BEMEMCPY(D,S,N) MEMCPY(D,S,N) # define LEMEMCPY(D,S,N) FLIPMEMCPY(D,S,N) # endif /* **************************************** */ /* SIZE of type */ /* TYPE is actual data type, VTYPE is type according to vargs, TYPESTD is the standard type (in endian or standard mode) */ #define SIZE(TYPENATIVE, VTYPE, TYPESTD) \ do { \ if (mult == 0) mult = 1; \ n += mult * (!sizemode ? sizeof(TYPENATIVE) : sizeof(TYPESTD)); \ for (; mult != 0; mult--) { TYPENATIVE t = (TYPENATIVE) va_arg (args, VTYPE); t=t;} \ /* mult = 0; */ \ } while(0) /* PACK does MEMCPY regardless of endian */ /* TYPE is actual data type, VTYPE is type according to vargs */ #define PACK(TYPE, VTYPE) \ do { \ for (mult=(mult?mult:1); mult; --mult) \ { \ TYPE t; \ g_return_val_if_fail (n + sizeof(TYPE) <= length, -1); \ t = (TYPE) va_arg (args, VTYPE); \ MEMCPY(buffer, (char*) &t, sizeof(TYPE)); \ buffer += sizeof(TYPE); \ n += sizeof(TYPE); \ } \ mult = 0; \ } while(0) /* PACK2 does memcpy based on endian */ #define PACK2(TYPENATIVE, VTYPE, TYPESTD) \ do { \ for (mult=(mult?mult:1); mult; --mult) \ { \ if (sizemode == 0) \ { \ TYPENATIVE t; \ g_return_val_if_fail (n + sizeof(TYPENATIVE) <= length, -1);\ t = (TYPENATIVE) va_arg (args, VTYPE); \ MEMCPY(buffer, (char*) &t, sizeof(TYPENATIVE)); \ buffer += sizeof(TYPENATIVE); \ n += sizeof(TYPENATIVE); \ } \ else if (sizemode == 1) \ { \ TYPESTD t; \ g_return_val_if_fail (n + sizeof(TYPESTD) <= length, -1); \ t = (TYPESTD) va_arg (args, VTYPE); \ LEMEMCPY(buffer, (char*) &t, sizeof(TYPESTD)); \ buffer += sizeof(TYPESTD); \ n += sizeof(TYPESTD); \ } \ else if (sizemode == 2) \ { \ TYPESTD t; \ g_return_val_if_fail (n + sizeof(TYPESTD) <= length, -1); \ t = (TYPESTD) va_arg (args, VTYPE); \ BEMEMCPY(buffer, (char*) &t, sizeof(TYPESTD)); \ buffer += sizeof(TYPESTD); \ n += sizeof(TYPESTD); \ } \ } \ mult = 0; \ } while(0) /* **************************************** */ /** * gnet_pack * @format: pack data format * @buffer: buffer to pack to * @length: length of @buffer * @Varargs: variables to pack from * * Writes @Varargs to @buffer. @format is a string that describes * the @Varargs and how they are to be packed. This string is a list * of characters, each describing the type of an argument in * @Varargs. * * An example: * * * * char buf[5]; * int myint = 42; * int mybyte = 23; * &space; * gnet_pack("!ib", buf, sizeof(buf), myint, mybyte); * &comstart; Now buf is { 42, 0, 0, 0, 23 }; &comend; * * * * As a shortcut, most types can be prefixed by an integer to specify * how many times the type is repeated. For example, "4i2b" is * equivalent to "iiiibb". This repeat argument is refered below to * as REPEAT. * * Native byte order and sizes are used by default. If the first * character of @format is < then little endian order and standard * sizes are used. If the first character is > or !, then big endian * (or network) order and standard size are used. Standard sizes are * 1 byte for chars, 2 bytes for shorts, and 4 bytes for ints and * longs. * * The types: * * x is a NULL character. It can be used for padding. It does not * correspond to an argument in @Varargs. * * b/B is a signed/unsigned char. * * h/H is a signed/unsigned short. * * i/I is a signed/unsigned int. * * l/L is a signed/unsigned long. * * f/D is a float/double (always native order/size). * * v is a void pointer (always native size). * * s is a zero-terminated string. * * S is a zero-padded string of maximum length REPEAT. We write * up-to a NULL character or REPEAT characters, whichever comes * first. We then write NULL characters up to a total of REPEAT * characters. Special case: if REPEAT is not specified, we write * the string as a non-NULL-terminated string (note that it can't be * unpacked easily then). * * r is a byte array of NEXT bytes. NEXT is the next argument passed * to gnet_pack() and is a gint. * * R is a byte array of REPEAT bytes. REPEAT must be specified. * * p is a Pascal string. The string passed is a NULL-termiated * string of less than 256 character. The string writen is a * non-NULL-terminated string with a byte before the string storing * the string length. REPEAT is repeat. * * Mnemonics: (B)yte, s(H)ort, (I)nteger, (F)loat, (D)ouble, (V)oid * pointer, (S)tring, (R)aw * * Pack was inspired by Python's and Perl's pack. It is more like * Python's than Perl's. Note that in GNet, a repeat of 0 does not * align the data (as in Python). * * Returns: number of bytes packed; -1 on error. * **/ gint gnet_pack (const gchar* format, gchar* buffer, const gint length, ...) { va_list args; gint rv; va_start (args, length); rv = gnet_vpack (format, buffer, length, args); va_end (args); return rv; } /** * gnet_pack_strdup * @format: pack data format * @bufferp: pointer to a buffer (buffer is caller owned) * @Varargs: variables to pack from * * Writes @Varargs into a buffer pointed to by @bufferp. The buffer * is allocated by the function and is caller owned. See gnet_pack() * for more information. * * Returns: bytes packed; -1 on error. * **/ gint gnet_pack_strdup (const gchar* format, gchar** bufferp, ...) { va_list args; gint size; gint rv; g_return_val_if_fail (format, -1); g_return_val_if_fail (bufferp, -1); /* Get size */ va_start (args, bufferp); size = gnet_vcalcsize (format, args); va_end (args); g_return_val_if_fail (size >= 0, -1); if (size == 0) { *bufferp = NULL; return 0; } *bufferp = g_new (gchar, size); /* Pack */ va_start (args, bufferp); rv = gnet_vpack (format, *bufferp, size, args); va_end (args); return rv; } /* **************************************** */ /** * gnet_calcsize * @format: pack data format * @Varargs: variables * * Calculates the size of the buffer needed to pack @Varargs by the * given format. See gnet_pack() for more information. * * Returns: number of bytes required to pack; -1 on error. * **/ gint gnet_calcsize (const gchar* format, ...) { va_list args; gint size; va_start (args, format); size = gnet_vcalcsize (format, args); va_end (args); return size; } /** * gnet_vcalcsize * @format: pack data format * @args: var args * * Var arg interface to gnet_calcsize(). See gnet_calcsize() for * additional information. * * Returns: number of bytes required to pack; -1 on error. * **/ gint gnet_vcalcsize (const gchar* format, va_list args) { gint n = 0; gchar* p = (gchar*) format; guint mult = 0; gint sizemode = 0; /* 1 = little, 2 = big */ if (!format) return 0; switch (*p) { case '@': ++p; break; case '<': sizemode = 1; ++p; break; case '>': case '!': sizemode = 2; ++p; break; } for (; *p; ++p) { switch (*p) { case 'x': { n += mult?mult:1; mult = 0; break; } case 'b': { SIZE(gint8, int, gint8); break; } case 'B': { SIZE(guint8, unsigned int, guint8); break; } case 'h': { SIZE(short, int, gint16); break; } case 'H': { SIZE(unsigned short, unsigned int, guint16); break; } case 'i': { SIZE(int, int, gint32); break; } case 'I': { SIZE(unsigned int, unsigned int, guint32); break; } case 'l': { SIZE(long, long, gint32); break; } case 'L': { SIZE(unsigned long, unsigned long, guint32); break; } case 'f': { SIZE(float, double, float); break; } case 'd': { SIZE(double, double, double); break; } case 'v': { SIZE(void*, void*, void*); break; } case 's': { for (mult=(mult?mult:1); mult; --mult) { char* s; s = va_arg (args, char*); g_return_val_if_fail (s, -1); n += strlen(s) + 1; } mult = 0; break; } case 'S': { if (mult != 0) n += mult; else { char* s; s = va_arg (args, char*); n += strlen(s); } mult = 0; break; } case 'r': { for (mult=(mult?mult:1); mult; --mult) { char* s; int ln; s = va_arg (args, char*); g_return_val_if_fail (s, -1); ln = va_arg (args, int); n += ln; } mult = 0; break; } case 'R': { char* s; s = va_arg (args, char*); g_return_val_if_fail (s, -1); g_return_val_if_fail (mult, -1); n += mult; mult = 0; break; } case 'p': { for (mult=(mult?mult:1); mult; --mult) { char* s; int slen; s = va_arg (args, char*); g_return_val_if_fail (s, -1); slen = strlen(s); n += slen + 1; } mult = 0; break; } case '0':case '1':case '2':case '3':case '4': case '5':case '6':case '7':case '8':case '9': { mult *= 10; mult += (*p - '0'); break; } case ' ':case '\t':case '\n': break; default: g_return_val_if_fail (FALSE, -1); } } return n; } /** * gnet_vpack * @format: pack data format * @buffer: buffer to pack to * @length: length of @buffer * @args: var args * * Var arg interface to gnet_pack(). See gnet_pack() for more * information. * * Returns: bytes packed; -1 on error. * **/ gint gnet_vpack (const gchar* format, gchar* buffer, const gint length, va_list args) { gint n = 0; gchar* p = (gchar*) format; guint mult = 0; gint sizemode = 0; /* 1 = little, 2 = big */ g_return_val_if_fail (format, -1); g_return_val_if_fail (buffer, -1); g_return_val_if_fail (length, -1); switch (*p) { case '@': ++p; break; case '<': sizemode = 1; ++p; break; case '>': case '!': sizemode = 2; ++p; break; } for (; *p; ++p) { switch (*p) { case 'x': { for (mult=(mult?mult:1); mult; --mult) { g_return_val_if_fail (n + 1 <= length, -1); *buffer++ = 0; ++n; } mult = 0; break; } case 'b': { PACK(gint8, int); break; } case 'B': { PACK(guint8, unsigned int); break; } case 'h': { PACK2(short, int, gint16); break; } case 'H': { PACK2(unsigned short, unsigned int, guint16); break; } case 'i': { PACK2(int, int, gint32); break; } case 'I': { PACK2(unsigned int, unsigned int, guint32); break; } case 'l': { PACK2(long, long, gint32); break; } case 'L': { PACK2(unsigned long, unsigned long, guint32); break; } case 'f': { PACK(float, double); break; } case 'd': { PACK(double, double); break; } case 'v': { PACK2(void*, void*, void*); break; } case 's': { for (mult=(mult?mult:1); mult; --mult) { gchar* s; gsize slen; s = va_arg (args, gchar*); g_return_val_if_fail (s, -1); slen = strlen(s); g_return_val_if_fail (n + slen + 1 <= length, -1); memcpy (buffer, s, slen + 1); /* include the 0 */ buffer += slen + 1; n += slen + 1; } mult = 0; break; } case 'S': { gchar* s; s = va_arg (args, gchar*); g_return_val_if_fail (s, -1); if (!mult) { gsize slen; slen = strlen(s); g_return_val_if_fail (n + slen <= length, -1); memcpy (buffer, s, slen); /* don't include the 0 */ buffer += slen; n += slen; } else { guint i; g_return_val_if_fail (n + mult <= length, -1); for (i = 0; i < mult && s[i]; ++i) *buffer++ = s[i]; for (; i < mult; ++i) *buffer++ = 0; n += mult; } mult = 0; break; } case 'r': { for (mult=(mult?mult:1); mult; --mult) { gchar* s; guint ln; s = va_arg (args, gchar*); ln = va_arg (args, guint); g_return_val_if_fail (s, -1); g_return_val_if_fail (n + ln <= length, -1); memcpy(buffer, s, ln); buffer += ln; n += ln; } mult = 0; break; } case 'R': { gchar* s; s = va_arg (args, gchar*); g_return_val_if_fail (s, -1); g_return_val_if_fail (mult, -1); g_return_val_if_fail (n + mult <= length, -1); memcpy (buffer, s, mult); buffer += mult; n += mult; mult = 0; break; } case 'p': { for (mult=(mult?mult:1); mult; --mult) { gchar* s; gsize slen; s = va_arg (args, char*); g_return_val_if_fail (s, -1); slen = strlen(s); g_return_val_if_fail (n < 256, -1); g_return_val_if_fail (n + slen + 1 <= length, -1); *buffer++ = slen; memcpy (buffer, s, slen); buffer += slen; n += slen + 1; } mult = 0; break; } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { mult *= 10; mult += (*p - '0'); break; } case ' ': case '\t': case '\n': break; default: g_return_val_if_fail (FALSE, -1); } } return n; } /* **************************************** */ #define UNPACK(TYPE) \ do { \ for (mult=(mult?mult:1); mult; --mult) \ { \ TYPE* t; \ g_return_val_if_fail (n + sizeof(TYPE) <= length, FALSE); \ t = va_arg (args, TYPE*); \ MEMCPY((char*) t, buffer, sizeof(TYPE)); \ buffer += sizeof(TYPE); \ n += sizeof(TYPE); \ } \ mult = 0; \ } while(0) #define UNPACK2(TYPENATIVE, TYPESTD) \ do { \ for (mult=(mult?mult:1); mult; --mult) \ { \ if (sizemode == 0) \ { \ TYPENATIVE* t; \ g_return_val_if_fail (n + sizeof(TYPENATIVE) <= length, -1); \ t = va_arg (args, TYPENATIVE*); \ MEMCPY((char*) t, buffer, sizeof(TYPENATIVE)); \ buffer += sizeof(TYPENATIVE); \ n += sizeof(TYPENATIVE); \ } \ else if (sizemode == 1) \ { \ TYPESTD* t; \ g_return_val_if_fail (n + sizeof(TYPESTD) <= length, -1); \ t = va_arg (args, TYPESTD*); \ LEMEMCPY((char*) t, buffer, sizeof(TYPESTD)); \ buffer += sizeof(TYPESTD); \ n += sizeof(TYPESTD); \ } \ else if (sizemode == 2) \ { \ TYPESTD* t; \ g_return_val_if_fail (n + sizeof(TYPESTD) <= length, -1); \ t = va_arg (args, TYPESTD*); \ BEMEMCPY((char*) t, buffer, sizeof(TYPESTD)); \ buffer += sizeof(TYPESTD); \ n += sizeof(TYPESTD); \ } \ } \ mult = 0; \ } while(0) /* **************************************** */ /** * gnet_unpack * @format: unpack data format * @buffer: buffer to unpack from * @length: length of @buffer * @Varargs: addresses of variables to unpack to * * Reads the data in @buffer into @Varargs. @format is a string that * describes the @Varargs and how they are to be packed. This string * is a list of characters, each describing the type of an argument * in @Varargs. * * An example: * * * * char buf[5] = { 42, 0, 0, 0, 23 }; * int myint; * int mybyte; * &space; * gnet_unpack("!ib", buf, sizeof(buf), &myint, &mybyte); * &comstart; Now myint is 42 and mybyte is 23 &comend; * * * * In unpack, the arguments must be pointers to the appropriate type. * Strings and byte arrays are allocated dynamicly (by g_new()). The * caller is responsible for g_free()-ing it. * * As a shortcut, most types can be prefixed by an integer to specify * how many times the type is repeated. For example, "4i2b" is * equivalent to "iiiibb". This repeat argument is refered below to * as REPEAT. * * The types: * * x is a pad byte. The byte is skipped and not stored. We do not * check its value. * * b/B is a signed/unsigned char. * * h/H is a signed/unsigned short. * * i/I is a signed/unsigned int. * * l/L is a signed/unsigned long. * * f/D is a float/double (always native order/size). * * v is a void pointer (always native size). * * s is a zero-terminated string. * * S is a zero-padded string of length REPEAT. We read REPEAT * characters or until a NULL character. Any remaining characters * are filled in with 0's. REPEAT must be specified. * * r is a byte array of NEXT bytes. NEXT is the next argument and is * a gint. REPEAT is repeat. * * R is a byte array of REPEAT bytes. REPEAT must be specified. * * p is a Pascal string. The first byte read is the length of the * string and the string follows. The unpacked string will be a * normal, NULL-terminated string. REPEAT is repeat. * * Returns: number of bytes unpacked; -1 on error. The bytes are * unpacked to the variables pointed to by the @Varargs. * **/ gint gnet_unpack (const gchar * format, const gchar * buffer, gint length, ...) { va_list args; gint rv; va_start (args, length); rv = gnet_vunpack (format, buffer, length, args); va_end (args); return rv; } /** * gnet_vunpack * @format: unpack data format * @buffer: buffer to unpack from * @length: length of @buffer * @args: var args * * Var arg interface to gnet_unpack(). See gnet_unpack() for more * information. * * Returns: number of bytes packed; -1 on error. * **/ gint gnet_vunpack (const gchar * format, const gchar * buffer, gint length, va_list args) { gint n = 0; gchar* p = (gchar*) format; guint mult = 0; gint sizemode = 0; /* 1 = little, 2 = big */ g_return_val_if_fail (format, -1); g_return_val_if_fail (buffer, -1); switch (*p) { case '@': ++p; break; case '<': sizemode = 1; ++p; break; case '>': case '!': sizemode = 2; ++p; break; } for (; *p; ++p) { switch (*p) { case 'x': { mult = mult? mult:1; g_return_val_if_fail (n + mult <= length, FALSE); buffer += mult; n += mult; mult = 0; break; } case 'b': { UNPACK(gint8); break; } case 'B': { UNPACK(guint8); break; } case 'h': { UNPACK2(short, gint16); break; } case 'H': { UNPACK2(unsigned short, guint16); break; } case 'i': { UNPACK2(int, gint32); break; } case 'I': { UNPACK2(unsigned int, guint32); break; } case 'l': { UNPACK2(long, gint32); break; } case 'L': { UNPACK2(unsigned long, guint32); break; } case 'f': { UNPACK(float); break; } case 'd': { UNPACK(double); break; } case 'v': { UNPACK2(void*, void*); break; } case 's': { for (mult=(mult?mult:1); mult; --mult) { gchar** sp; gsize slen; sp = va_arg (args, gchar**); g_return_val_if_fail (sp, -1); slen = strlenn(buffer, length - n); g_return_val_if_fail (n + slen <= length, FALSE); *sp = g_new(gchar, slen + 1); memcpy (*sp, buffer, slen); (*sp)[slen] = 0; buffer += slen + 1; n += slen + 1; } mult = 0; break; } case 'S': { gchar** sp; gsize slen; g_return_val_if_fail (mult, -1); sp = va_arg (args, gchar**); g_return_val_if_fail (sp, -1); slen = MIN(mult, strlenn(buffer, length - n)); g_return_val_if_fail ((n + slen) <= length, -1); *sp = g_new(gchar, mult + 1); memcpy (*sp, buffer, slen); while (slen < (mult + 1)) (*sp)[slen++] = '\0'; buffer += mult; n += mult; mult = 0; break; } case 'r': /* r is the same as s, in this case. */ { for (mult=(mult?mult:1); mult; --mult) { gchar** sp; guint ln; sp = va_arg (args, gchar**); ln = va_arg (args, guint); g_return_val_if_fail (sp, -1); g_return_val_if_fail (n + ln <= length, FALSE); *sp = g_new(char, ln); memcpy(*sp, buffer, ln); buffer += ln; n += ln; } mult = 0; break; } case 'R': { gchar** sp; sp = va_arg (args, gchar**); g_return_val_if_fail (sp, -1); g_return_val_if_fail (mult, -1); g_return_val_if_fail (n + mult <= length, -1); *sp = g_new(char, mult); memcpy(*sp, buffer, mult); buffer += mult; n += mult; mult = 0; break; } case 'p': { for (mult=(mult?mult:1); mult; --mult) { gchar** sp; guint slen; sp = va_arg (args, gchar**); g_return_val_if_fail (sp, -1); g_return_val_if_fail (n + 1 <= length, FALSE); slen = *buffer++; ++n; g_return_val_if_fail (n + slen <= length, FALSE); *sp = g_new(gchar, slen + 1); memcpy (*sp, buffer, slen); (*sp)[slen] = 0; buffer += slen; n += slen; } mult = 0; break; } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { mult *= 10; mult += (*p - '0'); break; } case ' ': case '\t': case '\n': break; default: g_return_val_if_fail (FALSE, -1); } } return n; } gnet-2.0.8/src/gnet-private.h0000644000175000017500000003575410751326730012766 00000000000000/* GNet - Networking library * Copyright (C) 2000 David Helder * Copyright (C) 2000-2003 Andrew Lanoix * Copyright (C) 2007 Tim-Philipp Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_PRIVATE_H #define _GNET_PRIVATE_H #include #include #include #include #include #include #include #include #include #ifdef HAVE_SYS_PARAM_H #include #endif #include #include "gnet.h" #include "gnetconfig.h" #ifndef GNET_WIN32 /*********** Unix specific ***********/ #include #include #include #ifdef HAVE_SYS_SOCKIO_H #include #endif #include #include #include #include #include #include #include #include #include /* Need for TOS */ #include #include #include #include #ifndef HAVE_SOCKADDR_STORAGE struct sockaddr_storage { #ifdef HAVE_SOCKADDR_LEN unsigned char ss_len; unsigned char ss_family; #else unsigned short ss_family; #endif char info[126]; }; #endif #ifndef SOCKET #define SOCKET gint #endif #define GNET_CLOSE_SOCKET(SOCKFD) close(SOCKFD) /* Use _gnet_io_channel_new() to create iochannels */ #define GNET_SOCKET_IO_CHANNEL_NEW(SOCKFD) g_io_channel_unix_new(SOCKFD) #define GNET_IS_SOCKET_VALID(S) ((S) >= 0) #define GNET_INVALID_SOCKET (-1) #define STATUS_IS_SOCKET_ERROR(status) ((status) < 0) #define ERROR_IS_CONNECT_IN_PROGRESS() (errno == EINPROGRESS) #else /*********** Windows specific ***********/ #include #include #ifndef socklen_t # define socklen_t gint32 #endif #define in_addr_t guint32 #define STATUS_IS_SOCKET_ERROR(status) ((status) == SOCKET_ERROR) #define ERROR_IS_CONNECT_IN_PROGRESS() (WSAGetLastError () == WSAEWOULDBLOCK) #define GNET_IS_SOCKET_VALID(S) ((S) != INVALID_SOCKET) #define GNET_INVALID_SOCKET (INVALID_SOCKET) #define GNET_CLOSE_SOCKET(SOCKFD) closesocket(SOCKFD) /* Use _gnet_io_channel_new() to create iochannels */ #define GNET_SOCKET_IO_CHANNEL_NEW(SOCKFD) g_io_channel_win32_new_socket(SOCKFD) #endif /*********** End Windows specific ***********/ #ifndef INET_ADDRSTRLEN #define INET_ADDRSTRLEN 16 #endif #ifndef INET6_ADDRSTRLEN #define INET6_ADDRSTRLEN 46 #endif #ifndef IN_LOOPBACKNET /* not defined in Win32 */ #define IN_LOOPBACKNET 127 #endif #ifndef GNET_SOCKADDR_FAMILY_FIELD_NAME # define GNET_SOCKADDR_FAMILY_FIELD_NAME ss_family #endif #define GNET_SOCKADDR_IN(s) (*((struct sockaddr_in*) &s)) #define GNET_SOCKADDR_SA(s) (*((struct sockaddr*) &s)) #define GNET_SOCKADDR_SA4(s) (*((struct sockaddr_in*) &s)) #define GNET_SOCKADDR_FAMILY(s) ((s).GNET_SOCKADDR_FAMILY_FIELD_NAME) #ifdef HAVE_IPV6 #ifndef IN6_ARE_ADDR_EQUAL #define IN6_ARE_ADDR_EQUAL(a,b) \ ((((unsigned int *) (a))[0] == ((unsigned int *) (b))[0]) && \ (((unsigned int *) (a))[1] == ((unsigned int *) (b))[1]) && \ (((unsigned int *) (a))[2] == ((unsigned int *) (b))[2]) && \ (((unsigned int *) (a))[3] == ((unsigned int *) (b))[3])) #endif #define GNET_SOCKADDR_SA6(s) (*((struct sockaddr_in6*) &s)) #define GNET_SOCKADDR_ADDRP(s) ((GNET_SOCKADDR_FAMILY((s)) == AF_INET)?\ (void*)&((struct sockaddr_in*)&s)->sin_addr:\ (void*)&((struct sockaddr_in6*)&s)->sin6_addr) #define GNET_SOCKADDR_ADDR32(s,n)((GNET_SOCKADDR_FAMILY((s)) == AF_INET)?\ ((struct sockaddr_in*)&s)->sin_addr.s_addr:\ *(guint32*)&((struct sockaddr_in6*)&s)->sin6_addr.s6_addr[(n)*4]) #define GNET_SOCKADDR_ADDR32_SET(s,n,a) if (GNET_SOCKADDR_FAMILY((s)) == AF_INET) \ ((struct sockaddr_in*)&s)->sin_addr.s_addr = a; \ else \ *(guint32*)&((struct sockaddr_in6*)&s)->sin6_addr.s6_addr[(n)*4] = a; #define GNET_SOCKADDR_ADDRLEN(s) ((GNET_SOCKADDR_FAMILY((s)) == AF_INET)?\ sizeof(struct in_addr):\ sizeof(struct in6_addr)) #define GNET_SOCKADDR_PORT(s) ((GNET_SOCKADDR_FAMILY((s)) == AF_INET)?\ ((struct sockaddr_in*)&s)->sin_port:\ ((struct sockaddr_in6*)&s)->sin6_port) #define GNET_SOCKADDR_PORT_SET(s, p) if (GNET_SOCKADDR_FAMILY((s)) == AF_INET)\ ((struct sockaddr_in*)&(s))->sin_port = p;\ else \ ((struct sockaddr_in6*)&(s))->sin6_port = p; #define GNET_SOCKADDR_LEN(s) ((GNET_SOCKADDR_FAMILY((s)) == AF_INET)?\ sizeof(struct sockaddr_in):\ sizeof(struct sockaddr_in6)) #else /* NO IPV6 */ #define GNET_SOCKADDR_ADDRP(s) (void*)&((struct sockaddr_in*)&s)->sin_addr #define GNET_SOCKADDR_ADDR32(s,n)((struct sockaddr_in*)&s)->sin_addr.s_addr #define GNET_SOCKADDR_ADDRLEN(s) sizeof(struct in_addr) #define GNET_SOCKADDR_PORT(s) ((struct sockaddr_in*)&s)->sin_port #define GNET_SOCKADDR_LEN(s) sizeof(struct sockaddr_in) #define GNET_SOCKADDR_PORT_SET(s, p) ((struct sockaddr_in*)&(s))->sin_port = p; #endif #ifdef HAVE_SOCKADDR_SA_LEN #define GNET_SOCKADDR_SET_SS_LEN(s) do{(s).ss_len = GNET_SOCKADDR_LEN(s);}while(0) #else #define GNET_SOCKADDR_SET_SS_LEN(s) while(0){} /* do nothing */ #endif #define GNET_INETADDR_SA(i) GNET_SOCKADDR_SA((i)->sa) #define GNET_INETADDR_SA4(i) GNET_SOCKADDR_SA4((i)->sa) #define GNET_INETADDR_SA6(i) GNET_SOCKADDR_SA6((i)->sa) #define GNET_INETADDR_FAMILY(i) GNET_SOCKADDR_FAMILY((i)->sa) #define GNET_INETADDR_ADDRP(i) GNET_SOCKADDR_ADDRP((i)->sa) #define GNET_INETADDR_ADDR32(i,n) GNET_SOCKADDR_ADDR32((i)->sa,(n)) #define GNET_INETADDR_ADDRLEN(i) GNET_SOCKADDR_ADDRLEN((i)->sa) #define GNET_INETADDR_PORT(i) GNET_SOCKADDR_PORT((i)->sa) #define GNET_INETADDR_PORT_SET(i, p) GNET_SOCKADDR_PORT_SET((i)->sa, p) #define GNET_INETADDR_LEN(i) GNET_SOCKADDR_LEN((i)->sa) #define GNET_INETADDR_SET_SS_LEN(i) GNET_SOCKADDR_SET_SS_LEN((i)->sa) #define GNET_ANY_IO_CONDITION (G_IO_IN|G_IO_OUT|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL) G_BEGIN_DECLS /* This is the private declaration and definition file. The things in here are to be used by GNet ONLY. Use at your own risk. If this file includes something that you absolutely must have, write the GNet developers. */ #define GNET_UDP_SOCKET_TYPE_COOKIE 71254329 #define GNET_MCAST_SOCKET_TYPE_COOKIE 49712423 struct _GUdpSocket { guint type; SOCKET sockfd; gint ref_count; GIOChannel* iochannel; struct sockaddr_storage sa; }; struct _GMcastSocket { GUdpSocket udpsocket; }; struct _GTcpSocket { SOCKET sockfd; gint ref_count; /* ATOMIC */ GIOChannel* iochannel; struct sockaddr_storage sa; /* sa is remote host for clients, local host for servers */ GTcpSocketAcceptFunc accept_func; gpointer accept_data; guint accept_watch; }; struct _GInetAddr { gchar* name; gint ref_count; /* ATOMIC */ struct sockaddr_storage sa; }; /* **************************************** */ /* More Windows specific stuff */ #ifdef GNET_WIN32 /* Name-mangled IPv6 structures for primarily Mingw and a few VC .NET 2002 */ #ifndef MAX_ADAPTER_ADDRESS_LENGTH #define MAX_ADAPTER_ADDRESS_LENGTH 8 #endif #ifndef GAA_FLAG_SKIP_UNICAST #define GAA_FLAG_SKIP_UNICAST 0x0001 #endif #ifndef GAA_FLAG_SKIP_ANYCAST #define GAA_FLAG_SKIP_ANYCAST 0x0002 #endif #ifndef GAA_FLAG_SKIP_MULTICAST #define GAA_FLAG_SKIP_MULTICAST 0x0004 #endif #ifndef GAA_FLAG_SKIP_DNS_SERVER #define GAA_FLAG_SKIP_DNS_SERVER 0x0008 #endif /* VC .NET 2002 is missing this too. */ #ifndef GAA_FLAG_INCLUDE_PREFIX #define GAA_FLAG_INCLUDE_PREFIX 0x0010 #endif /* VC .NET 2002 is missing this too. */ #ifndef GAA_FLAG_SKIP_FRIENDLY_NAME #define GAA_FLAG_SKIP_FRIENDLY_NAME 0x0020 #endif #ifndef IPV6_UNICAST_HOPS #define IPV6_UNICAST_HOPS 4 #endif #ifndef IPV6_MULTICAST_LOOP #define IPV6_MULTICAST_LOOP 11 #endif #ifndef IPV6_ADD_MEMBERSHIP #define IPV6_ADD_MEMBERSHIP 12 #endif #ifndef IPV6_DROP_MEMBERSHIP #define IPV6_DROP_MEMBERSHIP 13 #endif #ifndef IPV6_JOIN_GROUP #define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP #endif #ifndef IPV6_LEAVE_GROUP #define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP #endif #ifndef IPV6_MULTICAST_HOPS #define IPV6_MULTICAST_HOPS 10 #endif typedef enum { IpDadStateInvalid_GNET = 0, IpDadStateTentative_GNET, IpDadStateDuplicate_GNET, IpDadStateDeprecated_GNET, IpDadStatePreferred_GNET } IP_DAD_STATE_GNET; typedef enum { IpPrefixOriginOther_GNET = 0, IpPrefixOriginManual_GNET, IpPrefixOriginWellKnown_GNET, IpPrefixOriginDhcp_GNET, IpPrefixOriginRouterAdvertisement_GNET } IP_PREFIX_ORIGIN_GNET; typedef enum { IpSuffixOriginOther_GNET = 0, IpSuffixOriginManual_GNET, IpSuffixOriginWellKnown_GNET, IpSuffixOriginDhcp_GNET, IpSuffixOriginLinkLayerAddress_GNET, IpSuffixOriginRandom_GNET } IP_SUFFIX_ORIGIN_GNET; typedef enum { IfOperStatusUp_GNET = 1, IfOperStatusDown_GNET, IfOperStatusTesting_GNET, IfOperStatusUnknown_GNET, IfOperStatusDormant_GNET, IfOperStatusNotPresent_GNET, IfOperStatusLowerLayerDown_GNET } IF_OPER_STATUS_GNET; typedef struct _IP_ADAPTER_UNICAST_ADDRESS_GNET { union { struct { ULONG Length; DWORD Flags; }; }; struct _IP_ADAPTER_UNICAST_ADDRESS_GNET* Next; SOCKET_ADDRESS Address; IP_PREFIX_ORIGIN_GNET PrefixOrigin; IP_SUFFIX_ORIGIN_GNET SuffixOrigin; IP_DAD_STATE_GNET DadState; ULONG ValidLifetime; ULONG PreferredLifetime; ULONG LeaseLifetime; } IP_ADAPTER_UNICAST_ADDRESS_GNET, *PIP_ADAPTER_UNICAST_ADDRESS_GNET; typedef struct _IP_ADAPTER_ANYCAST_ADDRESS_GNET { union { ULONGLONG Alignment; struct { ULONG Length; DWORD Flags; }; }; struct _IP_ADAPTER_ANYCAST_ADDRESS_GNET* Next; SOCKET_ADDRESS Address; } IP_ADAPTER_ANYCAST_ADDRESS_GNET, *PIP_ADAPTER_ANYCAST_ADDRESS_GNET; typedef struct _IP_ADAPTER_DNS_SERVER_ADDRESS_GNET { union { ULONGLONG Alignment; struct { ULONG Length; DWORD Reserved; }; }; struct _IP_ADAPTER_DNS_SERVER_ADDRESS_GNET* Next; SOCKET_ADDRESS Address; } IP_ADAPTER_DNS_SERVER_ADDRESS_GNET, *PIP_ADAPTER_DNS_SERVER_ADDRESS_GNET; typedef struct _IP_ADAPTER_PREFIX_GNET { union { ULONGLONG Alignment; struct { ULONG Length; DWORD Flags; }; }; struct _IP_ADAPTER_PREFIX_GNET* Next; SOCKET_ADDRESS Address; ULONG PrefixLength; } IP_ADAPTER_PREFIX_GNET, *PIP_ADAPTER_PREFIX_GNET; typedef struct _IP_ADAPTER_MULTICAST_ADDRESS_GNET { union { ULONGLONG _temp; struct { ULONG Length; DWORD Flags; }; }; struct _IP_ADAPTER_MULTICAST_ADDRESS_GNET* Next; SOCKET_ADDRESS Address; } IP_ADAPTER_MULTICAST_ADDRESS_GNET, *PIP_ADAPTER_MULTICAST_ADDRESS_GNET; typedef struct _IP_ADAPTER_ADDRESSES_GNET { union { ULONGLONG Alignment; struct { ULONG Length; DWORD IfIndex; }; }; struct _IP_ADAPTER_ADDRESSES_GNET* Next; PCHAR AdapterName; PIP_ADAPTER_UNICAST_ADDRESS_GNET FirstUnicastAddress; PIP_ADAPTER_ANYCAST_ADDRESS_GNET FirstAnycastAddress; PIP_ADAPTER_MULTICAST_ADDRESS_GNET FirstMulticastAddress; PIP_ADAPTER_DNS_SERVER_ADDRESS_GNET FirstDnsServerAddress; PWCHAR DnsSuffix; PWCHAR Description; PWCHAR FriendlyName; BYTE PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH]; DWORD PhysicalAddressLength; DWORD Flags; DWORD Mtu; DWORD IfType; IF_OPER_STATUS_GNET OperStatus; DWORD Ipv6IfIndex; DWORD ZoneIndices[16]; PIP_ADAPTER_PREFIX_GNET FirstPrefix; } IP_ADAPTER_ADDRESSES_GNET, *PIP_ADAPTER_ADDRESSES_GNET; /* Name-mangled IPv6 structures */ /* Function Pointers to the new IPv6 functions */ HANDLE hLibrary_ws2_32; /* WinSock 2 dll */ HANDLE hLibrary_Iphlpapi; /* for GetAdaptersAddresses() */ typedef int (WINAPI * PFN_GETADDRINFO) (const char*, const char*, const struct addrinfo FAR *, struct addrinfo FAR *FAR *); PFN_GETADDRINFO pfn_getaddrinfo; typedef int (WINAPI * PFN_GETNAMEINFO) (const struct sockaddr FAR *, socklen_t, char FAR *, DWORD, char FAR *, DWORD, int); PFN_GETNAMEINFO pfn_getnameinfo; typedef void (WINAPI * PFN_FREEADDRINFO) (struct addrinfo FAR *); PFN_FREEADDRINFO pfn_freeaddrinfo; typedef DWORD (WINAPI * PFN_GETADAPTERSADDRESSES) (ULONG, DWORD, PVOID, PIP_ADAPTER_ADDRESSES_GNET, PULONG); PFN_GETADAPTERSADDRESSES pfn_getaddaptersaddresses; #endif /* ************************************************************ */ /* Private/Experimental functions */ GIOChannel* _gnet_io_channel_new (SOCKET sockfd); SOCKET _gnet_create_listen_socket (int type, const GInetAddr* iface, int port, struct sockaddr_storage* sa); int gnet_initialize_windows_sockets(void); void gnet_uninitialize_windows_sockets(void); /* Private utility functions */ guint _gnet_idle_add_full (GMainContext * context, gint priority, GSourceFunc function, gpointer data, GDestroyNotify notify); guint _gnet_timeout_add_full (GMainContext * context, gint priority, guint interval, GSourceFunc function, gpointer data, GDestroyNotify notify); guint _gnet_io_watch_add_full (GMainContext * context, gint priority, GIOChannel * channel, GIOCondition condition, GIOFunc function, gpointer data, GDestroyNotify notify); /* will do nothing if source_id is 0 (unlike g_source_remove()) */ void _gnet_source_remove (GMainContext * context, guint source_id); G_END_DECLS #endif /* _GNET_PRIVATE_H */ gnet-2.0.8/src/unix.c0000644000175000017500000002735510751326730011335 00000000000000/* GNet - Networking library * Copyright (C) 2000 David Helder * Copyright (C) 2001 Mark Ferlatte * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "gnet-private.h" #ifndef GNET_WIN32 #include "unix.h" #include #include struct _GUnixSocket { gint sockfd; guint ref_count; GIOChannel *iochannel; struct sockaddr_un sa; gboolean server; gboolean abstract; /* Abstract unix socket? */ }; #define PATH(S) (((struct sockaddr_un *) (&(S)->sa))->sun_path) #ifndef SUN_LEN #define SUN_LEN(sa_un) \ G_STRUCT_OFFSET (struct sockaddr_un, sun_path) + strlen (sa_un->sun_path) #endif /* GNET_SUN_LEN: our own version of SUN_LEN that also works for abstract * sockets where SUN_LEN fails because it doesn't take into account the * initial zero in the path string in the case of abstract sockets */ #define GNET_SUN_LEN(sa_un) gnet_sun_len(sa_un) static gboolean gnet_unix_socket_unlink (const gchar *path); static guint gnet_sun_len (struct sockaddr_un *sa_un) { /* normal unix socket */ if (sa_un->sun_path[0] != '\0') return SUN_LEN (sa_un); /* abstract socket, has a zero byte before the path */ return G_STRUCT_OFFSET (struct sockaddr_un, sun_path) + 1 + strlen (sa_un->sun_path + 1); } static GUnixSocket* gnet_unix_socket_new_internal (const gchar * path, gboolean abstract) { struct sockaddr_un *sa_un; GUnixSocket *s; g_return_val_if_fail (path != NULL, NULL); #ifndef HAVE_ABSTRACT_SOCKETS /* if abstract unix sockets are not available, create a normal unix socket */ abstract = FALSE; #endif /* Create socket */ s = g_new0 (GUnixSocket, 1); sa_un = (struct sockaddr_un *) &s->sa; s->ref_count = 1; s->server = FALSE; s->sockfd = socket (AF_UNIX, SOCK_STREAM, 0); if (!GNET_IS_SOCKET_VALID (s->sockfd)) { g_warning ("socket(%s) failed: %s", path, g_strerror (errno)); g_free(s); return NULL; } if (abstract) { sa_un->sun_path[0] = '\0'; strncpy (sa_un->sun_path + 1, path, sizeof (sa_un->sun_path) - 2); s->abstract = TRUE; } else { strncpy (sa_un->sun_path, path, sizeof (sa_un->sun_path) - 1); } sa_un->sun_family = AF_UNIX; if (connect (s->sockfd, (struct sockaddr*) sa_un, GNET_SUN_LEN (sa_un)) != 0) { g_warning ("connect(%s) failed: %s", path, g_strerror (errno)); GNET_CLOSE_SOCKET (s->sockfd); g_free(s); return NULL; } return s; } /** * gnet_unix_socket_new * @path: path * * Creates a #GUnixSocket and connects to @path. This function will * block to connect. Use this constructor to create a #GUnixSocket * for a client. * * Returns: a new #GUnixSocket; NULL on failure. * **/ GUnixSocket* gnet_unix_socket_new (const gchar * path) { return gnet_unix_socket_new_internal (path, FALSE); } /** * gnet_unix_socket_new_abstract * @path: path * * Creates a #GUnixSocket and connects to @path in the abstract * unix socket domain. This function will block to connect. Use this * constructor to create a #GUnixSocket for a client. * * If the abstract unix sockets are not available on the platform in use, * this function will behave like gnet_unix_socket_new(). * * Returns: a new #GUnixSocket, or NULL on failure. * * Since: 2.0.8 **/ GUnixSocket* gnet_unix_socket_new_abstract (const gchar * path) { return gnet_unix_socket_new_internal (path, TRUE); } /** * gnet_unix_socket_delete * @socket: a #GUnixSocket * * Deletes a #GUnixSocket. * **/ void gnet_unix_socket_delete (GUnixSocket* socket) { if (socket != NULL) gnet_unix_socket_unref (socket); } /** * gnet_unix_socket_ref * @socket: a #GUnixSocket * * Adds a reference to a #GUnixSocket. * **/ void gnet_unix_socket_ref (GUnixSocket* socket) { g_return_if_fail (socket != NULL); socket->ref_count++; } /** * gnet_unix_socket_unref * @socket: a #GUnixSocket * * Removes a reference from a #GUnixSocket. A #GUnixSocket is * deleted when the reference count reaches 0. * **/ void gnet_unix_socket_unref (GUnixSocket* socket) { g_return_if_fail (socket != NULL); socket->ref_count--; if (socket->ref_count == 0) { GNET_CLOSE_SOCKET(socket->sockfd); /* Don't care if this fails. */ if (socket->iochannel) g_io_channel_unref (socket->iochannel); if (socket->server && !socket->abstract) gnet_unix_socket_unlink (PATH (socket)); g_free(socket); } } /** * gnet_unix_socket_get_io_channel * @socket: a #GUnixSocket * * Gets the #GIOChannel of a #GUnixSocket. * * For a client socket, the #GIOChannel represents the data stream. * Use it like you would any other #GIOChannel. * * For a server socket, however, the #GIOChannel represents the * listening socket. When it's readable, there's a connection * waiting to be accepted. * * Every #GUnixSocket has one and only one #GIOChannel. If you ref * the channel, then you must unref it eventually. Do not close the * channel. The channel is closed by GNet when the socket is * deleted. * * Returns: a #GIOChannel. * **/ GIOChannel* gnet_unix_socket_get_io_channel (GUnixSocket* socket) { g_return_val_if_fail(socket != NULL, NULL); if (socket->iochannel == NULL) socket->iochannel = _gnet_io_channel_new (socket->sockfd); return socket->iochannel; } /** * gnet_unix_socket_get_path * @socket: a #GUnixSocket * * Gets the path of a #GUnixSocket. * * Returns: the path. * **/ gchar* gnet_unix_socket_get_path(const GUnixSocket* socket) { g_return_val_if_fail(socket != NULL, NULL); return g_strdup (PATH(socket)); } static GUnixSocket* gnet_unix_socket_server_new_internal (const gchar * path, gboolean abstract) { struct sockaddr_un *sa_un; GUnixSocket *s; gint flags; socklen_t n; g_return_val_if_fail (path != NULL, NULL); #ifndef HAVE_ABSTRACT_SOCKETS /* if abstract unix sockets are not available, create a normal unix socket */ abstract = FALSE; #endif s = g_new0 (GUnixSocket, 1); sa_un = (struct sockaddr_un *) &s->sa; sa_un->sun_family = AF_UNIX; s->ref_count = 1; s->server = TRUE; if (abstract) { sa_un->sun_path[0] = '\0'; strncpy (sa_un->sun_path + 1, path, sizeof (sa_un->sun_path) - 2); s->abstract = TRUE; } else { strncpy (sa_un->sun_path, path, sizeof (sa_un->sun_path) - 1); if (!gnet_unix_socket_unlink (PATH (s))) goto error; } s->sockfd = socket(AF_UNIX, SOCK_STREAM, 0); if (!GNET_IS_SOCKET_VALID(s->sockfd)) { g_warning ("socket(%s) failed: %s", path, g_strerror (errno)); goto error; } flags = fcntl(s->sockfd, F_GETFL, 0); if (flags == -1) { g_warning ("fcntl(%s) failed: %s", path, g_strerror (errno)); goto error; } /* Make the socket non-blocking */ if (fcntl(s->sockfd, F_SETFL, flags | O_NONBLOCK) == -1) { g_warning ("fcntl(%s) failed: %s", path, g_strerror (errno)); goto error; } if (bind (s->sockfd, (struct sockaddr*) sa_un, GNET_SUN_LEN (sa_un)) != 0) goto error; /* Get the socket name FIXME (why? -DAH) */ n = sizeof(s->sa); if (getsockname (s->sockfd, (struct sockaddr*) &s->sa, &n) != 0) goto error; if (listen (s->sockfd, 10) != 0) goto error; return s; error: gnet_unix_socket_delete (s); return NULL; } /** * gnet_unix_socket_server_new * @path: path * * Creates a #GUnixSocket bound to @path. Use this constructor to * create a #GUnixSocket for a server. * * Returns: a new #GUnixSocket; NULL on error. * **/ GUnixSocket* gnet_unix_socket_server_new (const gchar * path) { return gnet_unix_socket_server_new_internal (path, FALSE); } /** * gnet_unix_socket_server_new_abstract * @path: path * * Creates a #GUnixSocket bound to @path in the abstract unix socket * domain. Use this constructor to create a #GUnixSocket for a * server. * * If the abstract unix sockets are not available on the platform in use, * this function will behave the same as gnet_unix_socket_server_new(). * * Returns: a new #GUnixSocket, or NULL on error. * * * Since: 2.0.8 **/ GUnixSocket* gnet_unix_socket_server_new_abstract (const gchar * path) { return gnet_unix_socket_server_new_internal (path, TRUE); } /** * gnet_unix_socket_server_accept * @socket: a #GUnixSocket * * Accepts a connection from a #GUnixSocket. The socket must have * been created using gnet_unix_socket_server_new(). This function * will block. Even if the socket's #GIOChannel is readable, the * function may still block. * * Returns: a new #GUnixSocket representing a new connection; NULL on * error. * **/ GUnixSocket* gnet_unix_socket_server_accept (const GUnixSocket *socket) { gint sockfd; struct sockaddr sa; fd_set fdset; socklen_t n; GUnixSocket *s; g_return_val_if_fail(socket != NULL, NULL); try_again: FD_ZERO(&fdset); FD_SET(socket->sockfd, &fdset); if (select(socket->sockfd + 1, &fdset, NULL, NULL, NULL) == -1) { if (errno == EINTR) goto try_again; return NULL; } n = sizeof(s->sa); if ((sockfd = accept(socket->sockfd, &sa, &n)) == -1) { if (errno == EWOULDBLOCK || errno == ECONNABORTED || #ifdef EPROTO /* OpenBSD does not have EPROTO */ errno == EPROTO || #endif /* EPROTO */ errno == EINTR) goto try_again; return NULL; } s = g_new0(GUnixSocket, 1); s->ref_count = 1; s->sockfd = sockfd; memcpy(&s->sa, &sa, sizeof(s->sa)); return s; } /** * gnet_unix_socket_server_accept_nonblock * @socket: a #GUnixSocket * * Accepts a connection from a #GUnixSocket without blocking. The * socket must have been created using gnet_unix_socket_server_new(). * * Note that if the socket's #GIOChannel is readable, then there is * PROBABLY a new connection. It is possible for the connection * to close by the time this function is called, so it may return * NULL. * * Returns: a new #GUnixSocket representing a new connection; NULL * otherwise. * **/ GUnixSocket* gnet_unix_socket_server_accept_nonblock (const GUnixSocket *socket) { gint sockfd; struct sockaddr sa; fd_set fdset; socklen_t n; GUnixSocket *s; struct timeval tv = {0, 0}; g_return_val_if_fail (socket != NULL, NULL); try_again: FD_ZERO(&fdset); FD_SET(socket->sockfd, &fdset); if(select(socket->sockfd + 1, &fdset, NULL, NULL, &tv) == -1) { if (errno == EINTR) goto try_again; return NULL; } n = sizeof(sa); if ((sockfd = accept(socket->sockfd, &sa, &n)) == -1) { /* If we get an error, return. We don't want to try again as we do in gnet_unix_socket_server_accept() - it might cause a block. */ return NULL; } s = g_new0(GUnixSocket, 1); s->ref_count = 1; s->sockfd = sockfd; memcpy(&s->sa, &sa, sizeof(s->sa)); return s; } static gboolean gnet_unix_socket_unlink(const gchar * path) { struct stat stbuf; g_return_val_if_fail (path != NULL, FALSE); if (stat (path, &stbuf) == 0) { if (S_ISSOCK(stbuf.st_mode)) { if (unlink(path) == 0) { return TRUE; } else { /* Can't unlink */ return FALSE; } } else { /* path is not a socket */ return FALSE; } } else if (errno == ENOENT) { /* File doesn't exist, so we're okay */ return TRUE; } return FALSE; } #endif /* !GNET_WIN32 */ gnet-2.0.8/src/gnet.h0000644000175000017500000000465510751326730011312 00000000000000/* GNet - Networking library * Copyright (C) 2000 David Helder * Copyright (C) 2000 Andrew Lanoix * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_H #define _GNET_H #include #include "gnetconfig.h" #include "inetaddr.h" #include "iochannel.h" #include "udp.h" #include "mcast.h" #include "tcp.h" #include "socks.h" #include "pack.h" #include "uri.h" #include "conn-http.h" #include "conn.h" #include "server.h" #include "md5.h" #include "sha.h" #include "ipv6.h" #include "base64.h" #ifndef GNET_WIN32 # include "unix.h" #endif #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** * GNET_EXPORT: * * Declares a variable exported. Used interally. * **/ #ifdef GNET_WIN32 # define GNET_EXPORT extern __declspec(dllimport) #else # define GNET_EXPORT extern #endif GNET_EXPORT const guint gnet_major_version; GNET_EXPORT const guint gnet_minor_version; GNET_EXPORT const guint gnet_micro_version; GNET_EXPORT const guint gnet_interface_age; GNET_EXPORT const guint gnet_binary_age; /** * GNET_CHECK_VERSION * @major: Major version number * @minor: Minor version number * @micro: Micro version number * * Checks if the version given is compatable with this version of the * library. For example, GNET_CHECK_VERSION(1.2.3) would return TRUE * if the version is 1.2.5, and FALSE if 1.1.0. This can be used in * build tests. * **/ #define GNET_CHECK_VERSION(major,minor,micro) \ (GNET_MAJOR_VERSION > (major) || \ (GNET_MAJOR_VERSION == (major) && GNET_MINOR_VERSION > (minor)) || \ (GNET_MAJOR_VERSION == (major) && GNET_MINOR_VERSION == (minor) && \ GNET_MICRO_VERSION >= (micro))) void gnet_init (void); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _GNET_H */ gnet-2.0.8/src/socks-private.c0000644000175000017500000002541710751326730013141 00000000000000/* GNet - Networking library * Copyright (C) 2001-2002 Marius Eriksen, David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "gnet-private.h" #include "socks.h" #include "socks-private.h" /* **************************************** */ static int socks_negotiate_connect (GTcpSocket *s, const GInetAddr *dst); static int socks4_negotiate_connect (GIOChannel *ioc, const GInetAddr *dst); static int socks5_negotiate_connect (GIOChannel *ioc, const GInetAddr *dst); GTcpSocket* _gnet_socks_tcp_socket_new (const GInetAddr* addr) { GInetAddr* ss_addr = NULL; GTcpSocket* s; int rv; g_return_val_if_fail (addr != NULL, NULL); /* Get SOCKS server */ ss_addr = gnet_socks_get_server(); if (!ss_addr) return NULL; /* Connect to SOCKS server */ s = gnet_tcp_socket_new_direct (ss_addr); gnet_inetaddr_delete (ss_addr); if (!s) return NULL; /* Negotiate connection */ rv = socks_negotiate_connect (s, addr); if (rv < 0) { gnet_tcp_socket_delete (s); return NULL; } return s; } /* **************************************** */ typedef struct { GInetAddr* addr; GTcpSocketNewAsyncFunc func; gpointer data; GDestroyNotify notify; } SocksAsyncData; static void socks_async_cb (GTcpSocket* socket, gpointer data) { SocksAsyncData *ad = (SocksAsyncData *) data; if (socket != NULL) { int rv; rv = socks_negotiate_connect (socket, ad->addr); if (rv < 0) goto error; (ad->func) (socket, ad->data); gnet_inetaddr_delete (ad->addr); if (ad->notify) ad->notify (ad->data); g_free (ad); return; } error: { (ad->func) (NULL, ad->data); gnet_tcp_socket_delete (socket); gnet_inetaddr_delete (ad->addr); if (ad->notify) ad->notify (ad->data); g_free (ad); } } GTcpSocketNewAsyncID _gnet_socks_tcp_socket_new_async_full (const GInetAddr * addr, GTcpSocketNewAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext * context, gint priority) { GTcpSocketNewAsyncID async_id; SocksAsyncData *ad; GInetAddr *ss_addr = NULL; g_return_val_if_fail (addr != NULL, NULL); g_return_val_if_fail (func != NULL, NULL); /* Get SOCKS server */ ss_addr = gnet_socks_get_server(); if (!ss_addr) return NULL; /* Create data */ ad = g_new0 (SocksAsyncData, 1); ad->addr = gnet_inetaddr_clone (addr); ad->func = func; ad->data = data; ad->notify = notify; /* Connect to SOCKS server */ async_id = gnet_tcp_socket_new_async_direct_full (ss_addr, socks_async_cb, ad, (GDestroyNotify) NULL, context, priority); gnet_inetaddr_delete (ss_addr); return async_id; /* async_id might be NULL */ } GTcpSocketNewAsyncID _gnet_socks_tcp_socket_new_async (const GInetAddr * addr, GTcpSocketNewAsyncFunc func, gpointer data) { GTcpSocketNewAsyncID async_id; g_return_val_if_fail (addr != NULL, NULL); g_return_val_if_fail (func != NULL, NULL); async_id = _gnet_socks_tcp_socket_new_async_full (addr, func, data, (GDestroyNotify) NULL, NULL, G_PRIORITY_DEFAULT); return async_id; } /* **************************************** */ static int socks_negotiate_connect (GTcpSocket *s, const GInetAddr *dst) { GIOChannel *ioc; int ver, ret; ioc = gnet_tcp_socket_get_io_channel(s); ver = gnet_socks_get_version(); if (ver == 5) ret = socks5_negotiate_connect (ioc, dst); else if (ver == 4) ret = socks4_negotiate_connect (ioc, dst); else ret = -1; return ret; } static int socks4_negotiate_connect (GIOChannel *ioc, const GInetAddr *dst) { struct socks4_h s4h; struct sockaddr_in *sa_in; gsize len; sa_in = (struct sockaddr_in*)&dst->sa; s4h.vn = 4; s4h.cd = 1; s4h.dport = (short)sa_in->sin_port; s4h.dip = (long)sa_in->sin_addr.s_addr; s4h.userid = 0; if (gnet_io_channel_writen(ioc, &s4h, 9, &len) != G_IO_ERROR_NONE) return -1; if (gnet_io_channel_readn(ioc, &s4h, 8, &len) != G_IO_ERROR_NONE) return -1; if ((s4h.cd != 90) || (s4h.vn != 0)) return -1; return 0; } static int socks5_negotiate_connect (GIOChannel *ioc, const GInetAddr *dst) { unsigned char s5r[3]; struct socks5_h s5h; struct sockaddr_in *sa_in; gsize len; s5r[0] = 5; s5r[1] = 1; /* XXX no authentication yet */ s5r[2] = 0; if (gnet_io_channel_writen(ioc, s5r, 3, &len) != G_IO_ERROR_NONE) return -1; if (gnet_io_channel_readn(ioc, s5r, 2, &len) != G_IO_ERROR_NONE) return -1; if ((s5r[0] != 5) || (s5r[1] != 0)) return -1; sa_in = (struct sockaddr_in*)&dst->sa; /* fill in SOCKS5 request */ s5h.vn = 5; s5h.cd = 1; s5h.rsv = 0; s5h.atyp = 1; s5h.dip = (long)sa_in->sin_addr.s_addr; s5h.dport = (short)sa_in->sin_port; if (gnet_io_channel_writen(ioc, (gchar*)&s5h, 10, &len) != G_IO_ERROR_NONE) return -1; if (gnet_io_channel_readn(ioc, (gchar*)&s5h, 10, &len) != G_IO_ERROR_NONE) return -1; if (s5h.cd != 0) return -1; return 0; } /* **************************************** */ static int socks5_negotiate_bind (GTcpSocket* socket, int port); static gboolean socks_tcp_socket_server_accept_async_cb (GIOChannel* iochannel, GIOCondition condition, gpointer data); GTcpSocket* _gnet_socks_tcp_socket_server_new (gint port) { GInetAddr* ss_addr = NULL; GTcpSocket* s; int rv; /* We only support SOCKS 5 */ if (gnet_socks_get_version () != 5) return NULL; /* Get SOCKS server */ ss_addr = gnet_socks_get_server(); if (!ss_addr) return NULL; /* Connect to SOCKS server */ s = gnet_tcp_socket_new_direct (ss_addr); gnet_inetaddr_delete (ss_addr); if (!s) return NULL; /* Negotiate connection */ rv = socks5_negotiate_bind (s, port); if (rv < 0) { gnet_tcp_socket_delete (s); return NULL; } return s; } static int socks5_negotiate_bind (GTcpSocket* socket, int port) { GIOChannel *ioc; unsigned char s5r[3]; struct socks5_h s5h; gsize len; ioc = gnet_tcp_socket_get_io_channel(socket); s5r[0] = 5; s5r[1] = 1; /* no authentication */ s5r[2] = 0; if (gnet_io_channel_writen(ioc, s5r, 3, &len) != G_IO_ERROR_NONE) goto error; if (gnet_io_channel_readn(ioc, s5r, 2, &len) != G_IO_ERROR_NONE) goto error; if ((s5r[0] != 5) || (s5r[1] != 0)) goto error; /* fill in SOCKS5 request */ s5h.vn = 5; s5h.cd = 2; /* bind */ s5h.rsv = 0; s5h.atyp = 1; s5h.dip = 0; /* FIX: this works with nylon; i will check on rfc */ s5h.dport = g_htons(port); if (gnet_io_channel_writen(ioc, (gchar*)&s5h, 10, &len) != G_IO_ERROR_NONE) goto error; /* this reply simply confirms */ if (gnet_io_channel_readn(ioc, (gchar*)&s5h, 10, &len) != G_IO_ERROR_NONE) goto error; /* make sure we have a connection */ if (s5h.cd != 0) goto error; /* Copy the address */ GNET_SOCKADDR_IN(socket->sa).sin_addr.s_addr = s5h.dip; GNET_SOCKADDR_IN(socket->sa).sin_port = s5h.dport; return 0; error: return -1; } /* XXX 0 server SOCKS compliant? */ GTcpSocket* _gnet_socks_tcp_socket_server_accept (GTcpSocket* socket) { gint server_port; struct socks5_h s5h; gsize len; GIOChannel* iochannel; GIOError error; GTcpSocket* s; GTcpSocket* new_socket; g_return_val_if_fail (socket, NULL); /* Save server port */ server_port = g_ntohs(GNET_SOCKADDR_IN(socket->sa).sin_port); /* this reply reveals the connecting hosts ip and port */ iochannel = gnet_tcp_socket_get_io_channel(socket); error = gnet_io_channel_readn(iochannel, (gchar*) &s5h, 10, &len); if (error != G_IO_ERROR_NONE) return NULL; /* The client socket is the server socket */ /* FIXME: this code should be in tcp.c, just like the struct definition */ s = g_new0(GTcpSocket, 1); s->sockfd = socket->sockfd; GNET_SOCKADDR_IN(s->sa).sin_addr.s_addr = s5h.dip; GNET_SOCKADDR_IN(s->sa).sin_port = s5h.dport; s->ref_count = 1; /* Create a new server socket (we just use the sockfd) */ new_socket = _gnet_socks_tcp_socket_server_new (server_port); if (new_socket == NULL) { g_free (s); /* ok, we copied sockfd */ return NULL; } /* Copy the fd over and delete the new socket */ socket->sockfd = new_socket->sockfd; g_free (new_socket); /* ok, we copied sockfd */ /* Hand over IOChannel */ if (socket->accept_watch) { g_source_remove (socket->accept_watch); socket->accept_watch = 0; } s->iochannel = socket->iochannel; socket->iochannel = NULL; /* Reset the async watch if necessary */ if (socket->accept_func) { GIOChannel* iochannel; /* This will recreate the IOChannel */ iochannel = gnet_tcp_socket_get_io_channel (socket); /* Set the watch on the new IO channel */ socket->accept_watch = g_io_add_watch(iochannel, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL, socks_tcp_socket_server_accept_async_cb, socket); } return s; } void _gnet_socks_tcp_socket_server_accept_async (GTcpSocket * socket, GTcpSocketAcceptFunc accept_func, gpointer user_data) { GIOChannel* iochannel; g_return_if_fail (socket); g_return_if_fail (accept_func); g_return_if_fail (!socket->accept_func); /* Save callback */ socket->accept_func = accept_func; socket->accept_data = user_data; /* Add read watch */ iochannel = gnet_tcp_socket_get_io_channel (socket); socket->accept_watch = g_io_add_watch(iochannel, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL, socks_tcp_socket_server_accept_async_cb, socket); } static gboolean socks_tcp_socket_server_accept_async_cb (GIOChannel* iochannel, GIOCondition condition, gpointer data) { GTcpSocket* server = (GTcpSocket*) data; g_assert (server); if (condition & G_IO_IN) { GTcpSocket* client; client = _gnet_socks_tcp_socket_server_accept (server); if (!client) return TRUE; (server->accept_func)(server, client, server->accept_data); return FALSE; } else /* error */ { gnet_tcp_socket_ref (server); (server->accept_func)(server, NULL, server->accept_data); server->accept_watch = 0; server->accept_func = NULL; server->accept_data = NULL; gnet_tcp_socket_unref (server); return FALSE; } return FALSE; } gnet-2.0.8/src/udp.h0000644000175000017500000000423710751326730011141 00000000000000/* GNet - Networking library * Copyright (C) 2000, 2002-3 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_UDP_H #define _GNET_UDP_H #include "inetaddr.h" #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** * GUdpSocket * * A #GUdpSocket structure represents a UDP socket. The * implementation is hidden. * **/ typedef struct _GUdpSocket GUdpSocket; /* ******************************************** */ /* UDP socket functions */ GUdpSocket* gnet_udp_socket_new (void); GUdpSocket* gnet_udp_socket_new_with_port (gint port); GUdpSocket* gnet_udp_socket_new_full (const GInetAddr* iface, gint port); void gnet_udp_socket_delete (GUdpSocket* socket); void gnet_udp_socket_ref (GUdpSocket* socket); void gnet_udp_socket_unref (GUdpSocket* socket); GIOChannel* gnet_udp_socket_get_io_channel (GUdpSocket* socket); GInetAddr* gnet_udp_socket_get_local_inetaddr (const GUdpSocket* socket); /* ********** */ gint gnet_udp_socket_send (GUdpSocket* socket, const gchar* buffer, gint length, const GInetAddr* dst); gint gnet_udp_socket_receive (GUdpSocket* socket, gchar* buffer, gint length, GInetAddr** src); gboolean gnet_udp_socket_has_packet (const GUdpSocket* socket); /* ********** */ gint gnet_udp_socket_get_ttl (const GUdpSocket* socket); gint gnet_udp_socket_set_ttl (GUdpSocket* socket, gint ttl); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _GNET_UDP_H */ gnet-2.0.8/src/uri.h0000644000175000017500000000511010751326730011137 00000000000000/* GNet - Networking library * Copyright (C) 2000-2001 David Helder, David Bolcsfoldi * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_URI_H #define _GNET_URI_H #include G_BEGIN_DECLS /** * GURI: * @scheme: Scheme (or protocol) * @userinfo: User info * @hostname: Host name * @port: Port number * @path: Path * @query: Query * @fragment: Fragment * * The #GURI structure represents a URI. All fields in this * structure are publicly readable. * **/ typedef struct _GURI GURI; struct _GURI { gchar* scheme; gchar* userinfo; gchar* hostname; gint port; gchar* path; gchar* query; gchar* fragment; }; GURI* gnet_uri_new (const gchar* uri); GURI* gnet_uri_new_fields (const gchar* scheme, const gchar* hostname, const gint port, const gchar* path); GURI* gnet_uri_new_fields_all (const gchar* scheme, const gchar* userinfo, const gchar* hostname, const gint port, const gchar* path, const gchar* query, const gchar* fragment); GURI* gnet_uri_clone (const GURI* uri); void gnet_uri_delete (GURI* uri); gboolean gnet_uri_equal (gconstpointer p1, gconstpointer p2); guint gnet_uri_hash (gconstpointer p); void gnet_uri_escape (GURI* uri); void gnet_uri_unescape (GURI* uri); gchar* gnet_uri_get_string (const GURI* uri); void gnet_uri_set_scheme (GURI* uri, const gchar* scheme); void gnet_uri_set_userinfo (GURI* uri, const gchar* userinfo); void gnet_uri_set_hostname (GURI* uri, const gchar* hostname); void gnet_uri_set_port (GURI* uri, gint port); void gnet_uri_set_path (GURI* uri, const gchar* path); void gnet_uri_set_query (GURI* uri, const gchar* query); void gnet_uri_set_fragment (GURI* uri, const gchar* fragment); gboolean gnet_uri_parse_inplace (GURI * guri, gchar * uri, gchar * hostname, gsize len); G_END_DECLS #endif /* _GNET_URI_H */ gnet-2.0.8/src/server.c0000644000175000017500000000677410751326730011662 00000000000000/* GNet - Networking library * Copyright (C) 2000-2002 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include "gnet-private.h" #include "server.h" static void server_accept_cb (GTcpSocket* server_socket, GTcpSocket* client, gpointer data); /** * gnet_server_new: * @iface: interface to bind to (NULL for all interfaces) * @port: port to bind to (0 for an arbitrary port) * @func: callback to call when a connection is accepted * @user_data: data to pass to callback * * Creates a new #GServer object representing a server. Usually, * @iface is set to NULL to bind to all interfaces and @port is a * specific number. The callback is called whenever a new connection * arrives or if there is a server error. The callback is not called * again after a server error. * * Returns: a new #GServer. * **/ GServer* gnet_server_new (const GInetAddr* iface, gint port, GServerFunc func, gpointer user_data) { GTcpSocket* socket; GServer* server = NULL; g_return_val_if_fail (func, NULL); socket = gnet_tcp_socket_server_new_full (iface, port); if (!socket) return NULL; server = g_new0 (GServer, 1); server->ref_count = 1; server->func = func; server->user_data = user_data; server->socket = socket; server->iface = gnet_tcp_socket_get_local_inetaddr (server->socket); server->port = gnet_tcp_socket_get_port (server->socket); /* Wait for new connections */ gnet_tcp_socket_server_accept_async (server->socket, server_accept_cb, server); return server; } /** * gnet_server_delete: * @server: #GServer to delete. * * Closes and deletes a #GServer. * **/ void gnet_server_delete (GServer* server) { if (server != NULL) gnet_server_unref (server); } /** * gnet_server_ref * @server: a #GServer * * Adds a reference to a #GServer. * **/ void gnet_server_ref (GServer* server) { g_return_if_fail (server); server->ref_count++; } /** * gnet_server_unref * @server: a #GServer * * Removes a reference from a #GServer. A #GServer is deleted when * the reference count reaches 0. * **/ void gnet_server_unref (GServer* server) { server->ref_count--; if (server->ref_count > 0) return; if (server->socket) gnet_tcp_socket_delete (server->socket); if (server->iface) gnet_inetaddr_delete (server->iface); g_free (server); } static void server_accept_cb (GTcpSocket* server_socket, GTcpSocket* client, gpointer data) { GServer* server = (GServer*) data; g_return_if_fail (server); if (client) { GConn* conn; conn = gnet_conn_new_socket (client, NULL, NULL); (server->func)(server, conn, server->user_data); } else { gnet_tcp_socket_server_accept_async_cancel (server_socket); (server->func)(server, NULL, server->user_data); } } gnet-2.0.8/src/unix.h0000644000175000017500000000361210751326730011330 00000000000000/* GNet - Networking library * Copyright (C) 2000 David Helder * Copyright (C) 2001 Mark Ferlatte * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_UNIX_H #define _GNET_UNIX_H #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** * GUnixSocket * * A #GUnixSocket structure represents a Unix socket. The * implementation is hidden. * **/ typedef struct _GUnixSocket GUnixSocket; GUnixSocket* gnet_unix_socket_new (const gchar* path); GUnixSocket* gnet_unix_socket_new_abstract (const gchar* path); void gnet_unix_socket_delete (GUnixSocket* socket); void gnet_unix_socket_ref (GUnixSocket* socket); void gnet_unix_socket_unref (GUnixSocket* socket); GIOChannel* gnet_unix_socket_get_io_channel (GUnixSocket* socket); gchar* gnet_unix_socket_get_path (const GUnixSocket* socket); GUnixSocket* gnet_unix_socket_server_new (const gchar* path); GUnixSocket* gnet_unix_socket_server_new_abstract (const gchar* path); GUnixSocket* gnet_unix_socket_server_accept (const GUnixSocket* socket); GUnixSocket* gnet_unix_socket_server_accept_nonblock (const GUnixSocket* socket); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _GNET_UNIX_H */ gnet-2.0.8/src/Makefile.in0000644000175000017500000005043510751327171012246 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = src DIST_COMMON = $(gnetinclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/gnet-arch.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(gnetincludedir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) libgnet_2_0_la_LIBADD = am_libgnet_2_0_la_OBJECTS = gnet.lo gnet-private.lo ipv6.lo \ inetaddr.lo mcast.lo tcp.lo unix.lo udp.lo iochannel.lo \ socks.lo socks-private.lo md5.lo sha.lo pack.lo uri.lo conn.lo \ conn-http.lo server.lo usagi_ifaddrs.lo base64.lo libgnet_2_0_la_OBJECTS = $(am_libgnet_2_0_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libgnet_2_0_la_SOURCES) DIST_SOURCES = $(libgnet_2_0_la_SOURCES) gnetincludeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(gnetinclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHECK_CFLAGS = @CHECK_CFLAGS@ CHECK_LIBS = @CHECK_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_GTK_DOC_FALSE = @ENABLE_GTK_DOC_FALSE@ ENABLE_GTK_DOC_TRUE = @ENABLE_GTK_DOC_TRUE@ ENABLE_NETWORK_TESTS_FALSE = @ENABLE_NETWORK_TESTS_FALSE@ ENABLE_NETWORK_TESTS_TRUE = @ENABLE_NETWORK_TESTS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GNET_BINARY_AGE = @GNET_BINARY_AGE@ GNET_DEBUG_FLAGS = @GNET_DEBUG_FLAGS@ GNET_GCOV_ENABLED_FALSE = @GNET_GCOV_ENABLED_FALSE@ GNET_GCOV_ENABLED_TRUE = @GNET_GCOV_ENABLED_TRUE@ GNET_INTERFACE_AGE = @GNET_INTERFACE_AGE@ GNET_MAJOR_VERSION = @GNET_MAJOR_VERSION@ GNET_MICRO_VERSION = @GNET_MICRO_VERSION@ GNET_MINOR_VERSION = @GNET_MINOR_VERSION@ GNET_VERSION = @GNET_VERSION@ GREP = @GREP@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ HAVE_CPU_ALPHA_FALSE = @HAVE_CPU_ALPHA_FALSE@ HAVE_CPU_ALPHA_TRUE = @HAVE_CPU_ALPHA_TRUE@ HAVE_CPU_ARM_FALSE = @HAVE_CPU_ARM_FALSE@ HAVE_CPU_ARM_TRUE = @HAVE_CPU_ARM_TRUE@ HAVE_CPU_CRISV32_FALSE = @HAVE_CPU_CRISV32_FALSE@ HAVE_CPU_CRISV32_TRUE = @HAVE_CPU_CRISV32_TRUE@ HAVE_CPU_CRIS_FALSE = @HAVE_CPU_CRIS_FALSE@ HAVE_CPU_CRIS_TRUE = @HAVE_CPU_CRIS_TRUE@ HAVE_CPU_HPPA_FALSE = @HAVE_CPU_HPPA_FALSE@ HAVE_CPU_HPPA_TRUE = @HAVE_CPU_HPPA_TRUE@ HAVE_CPU_I386_FALSE = @HAVE_CPU_I386_FALSE@ HAVE_CPU_I386_TRUE = @HAVE_CPU_I386_TRUE@ HAVE_CPU_IA64_FALSE = @HAVE_CPU_IA64_FALSE@ HAVE_CPU_IA64_TRUE = @HAVE_CPU_IA64_TRUE@ HAVE_CPU_M68K_FALSE = @HAVE_CPU_M68K_FALSE@ HAVE_CPU_M68K_TRUE = @HAVE_CPU_M68K_TRUE@ HAVE_CPU_MIPS_FALSE = @HAVE_CPU_MIPS_FALSE@ HAVE_CPU_MIPS_TRUE = @HAVE_CPU_MIPS_TRUE@ HAVE_CPU_PPC64_FALSE = @HAVE_CPU_PPC64_FALSE@ HAVE_CPU_PPC64_TRUE = @HAVE_CPU_PPC64_TRUE@ HAVE_CPU_PPC_FALSE = @HAVE_CPU_PPC_FALSE@ HAVE_CPU_PPC_TRUE = @HAVE_CPU_PPC_TRUE@ HAVE_CPU_S390_FALSE = @HAVE_CPU_S390_FALSE@ HAVE_CPU_S390_TRUE = @HAVE_CPU_S390_TRUE@ HAVE_CPU_SPARC_FALSE = @HAVE_CPU_SPARC_FALSE@ HAVE_CPU_SPARC_TRUE = @HAVE_CPU_SPARC_TRUE@ HAVE_CPU_X86_64_FALSE = @HAVE_CPU_X86_64_FALSE@ HAVE_CPU_X86_64_TRUE = @HAVE_CPU_X86_64_TRUE@ HAVE_VALGRIND_FALSE = @HAVE_VALGRIND_FALSE@ HAVE_VALGRIND_TRUE = @HAVE_VALGRIND_TRUE@ HTML_DIR = @HTML_DIR@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_WIN32_FALSE = @OS_WIN32_FALSE@ OS_WIN32_TRUE = @OS_WIN32_TRUE@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ VALGRIND_LIBS = @VALGRIND_LIBS@ VALGRIND_PATH = @VALGRIND_PATH@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ @OS_WIN32_TRUE@no_undefined = -no-undefined @OS_WIN32_TRUE@lws2_32 = -lws2_32 INCLUDES = -DG_LOG_DOMAIN=\"GNet\" @GNET_DEBUG_FLAGS@ \ $(GLIB_CFLAGS) $(GTHREAD_CFLAGS) gnetincludedir = $(includedir)/gnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION) lib_LTLIBRARIES = libgnet-2.0.la libgnet_2_0_la_LDFLAGS = \ $(no_undefined) \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ $(GLIB_LIBS) $(GTHREAD_LIBS) $(lws2_32) libgnet_2_0_la_SOURCES = \ gnet.c \ gnet-private.c \ ipv6.c \ inetaddr.c \ mcast.c \ tcp.c \ unix.c \ udp.c \ iochannel.c \ socks.c \ socks-private.c \ md5.c \ sha.c \ pack.c \ uri.c \ conn.c \ conn-http.c \ server.c \ usagi_ifaddrs.c \ base64.c gnetinclude_HEADERS = \ gnet.h \ ipv6.h \ inetaddr.h \ mcast.h \ tcp.h \ unix.h \ udp.h \ iochannel.h \ socks.h \ md5.h \ sha.h \ pack.h \ uri.h \ conn.h \ conn-http.h \ server.h \ base64.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libgnet-2.0.la: $(libgnet_2_0_la_OBJECTS) $(libgnet_2_0_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libgnet_2_0_la_LDFLAGS) $(libgnet_2_0_la_OBJECTS) $(libgnet_2_0_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conn-http.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conn.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnet-private.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnet.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inetaddr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iochannel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ipv6.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mcast.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pack.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socks-private.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socks.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uri.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usagi_ifaddrs.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: install-gnetincludeHEADERS: $(gnetinclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(gnetincludedir)" || $(mkdir_p) "$(DESTDIR)$(gnetincludedir)" @list='$(gnetinclude_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(gnetincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(gnetincludedir)/$$f'"; \ $(gnetincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(gnetincludedir)/$$f"; \ done uninstall-gnetincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(gnetinclude_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(gnetincludedir)/$$f'"; \ rm -f "$(DESTDIR)$(gnetincludedir)/$$f"; \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(gnetincludedir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-gnetincludeHEADERS install-exec-am: install-libLTLIBRARIES install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-gnetincludeHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-gnetincludeHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-gnetincludeHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES @SET_MAKE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gnet-2.0.8/src/conn-http.h0000644000175000017500000003475010751326730012266 00000000000000/* GNet - Networking library * Copyright (C) 2000-2004 David Helder * Copyright (C) 2004 Tim-Philipp Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_CONN_HTTP_H #define _GNET_CONN_HTTP_H #include "conn.h" #include "uri.h" #include "inetaddr.h" G_BEGIN_DECLS /** * GConnHttpHeaderFlags * @GNET_CONN_HTTP_FLAG_SKIP_HEADER_CHECK: do not check whether * the header is a standard header * * Flags for gnet_conn_http_set_header(). * **/ typedef enum { GNET_CONN_HTTP_FLAG_SKIP_HEADER_CHECK = 1 } GConnHttpHeaderFlags; /** * GConnHttpMethod * @GNET_CONN_HTTP_METHOD_GET: HTTP GET method * @GNET_CONN_HTTP_METHOD_POST: HTTP POST method * * HTTP request method. Use with gnet_conn_http_set_method(). * **/ typedef enum { GNET_CONN_HTTP_METHOD_GET, GNET_CONN_HTTP_METHOD_POST } GConnHttpMethod; /** * GConnHttp * * HTTP Connection. The entire GConnHttp struct is opaque and private. * **/ typedef struct _GConnHttp GConnHttp; /** * GConnHttpError * @GNET_CONN_HTTP_ERROR_UNSPECIFIED: connection error * @GNET_CONN_HTTP_ERROR_PROTOCOL_UNSUPPORTED: unsupported protocol (ie. not http) * @GNET_CONN_HTTP_ERROR_HOSTNAME_RESOLUTION: the hostname could not be resolved * * Error codes. Used by #GConnHttpEventError. Note that * errors by the HTTP server will be communicated to the * client via the #GConnHttpEventResponse event. * **/ typedef enum { GNET_CONN_HTTP_ERROR_UNSPECIFIED, GNET_CONN_HTTP_ERROR_PROTOCOL_UNSUPPORTED, GNET_CONN_HTTP_ERROR_HOSTNAME_RESOLUTION } GConnHttpError; /*************************************************************************** * * * Event structures - work similar to GdkEvent * * * ***************************************************************************/ /** * GConnHttpEventType * @GNET_CONN_HTTP_RESOLVED: the host name has been * resolved or host name resolution failed. The event * structure will be a #GConnHttpEventResolved structure * @GNET_CONN_HTTP_CONNECTED: the TCP connection to * the HTTP server has been established * @GNET_CONN_HTTP_RESPONSE: the HTTP server has sent * a response and response headers. The event * structure will be a #GConnHttpEventResponse structure * @GNET_CONN_HTTP_REDIRECT: the HTTP server has sent * a redirect response. The event structure will be a * #GConnHttpEventRedirect structure * @GNET_CONN_HTTP_DATA_PARTIAL: data has been received. * The buffer is caller-owned (ie. owned by GNet), but * may be emptied using gnet_conn_http_steal_buffer(). The * event structure will be a #GConnHttpEventData structure * @GNET_CONN_HTTP_DATA_COMPLETE: data has been received * in full. The buffer is caller-owned (ie. owned by GNet), * but may be emptied using gnet_conn_http_steal_buffer(). The * event structure will be a #GConnHttpEventData structure * @GNET_CONN_HTTP_TIMEOUT: the connection timed out * @GNET_CONN_HTTP_ERROR: #GConnHttp problem (not a server * error response). The event structure will be a * #GConnHttpEventError structure * * GConnHttp event type. * **/ typedef enum { GNET_CONN_HTTP_RESOLVED, /* resolved host name */ GNET_CONN_HTTP_CONNECTED, /* connected to host */ GNET_CONN_HTTP_RESPONSE, /* got response (incl. headers) */ GNET_CONN_HTTP_REDIRECT, /* got redirect */ GNET_CONN_HTTP_DATA_PARTIAL, /* we got some data */ GNET_CONN_HTTP_DATA_COMPLETE, /* we got all data */ GNET_CONN_HTTP_TIMEOUT, /* the connection timed out */ GNET_CONN_HTTP_ERROR /* GConnHttp problem */ } GConnHttpEventType; typedef struct _GConnHttpEvent GConnHttpEvent; typedef struct _GConnHttpEventResolved GConnHttpEventResolved; typedef struct _GConnHttpEventResponse GConnHttpEventResponse; typedef struct _GConnHttpEventRedirect GConnHttpEventRedirect; typedef struct _GConnHttpEventData GConnHttpEventData; typedef struct _GConnHttpEventError GConnHttpEventError; /** * GConnHttpEvent * @type: event type * * GConnHttp Base Event. Check event->type and then cast the event * structure into the corresponding specialised event structure. * **/ struct _GConnHttpEvent { GConnHttpEventType type; /* type of event (see above) */ /*< private >*/ gsize stsize; /* size of underlying event struct */ gpointer padding[4]; /* padding for future expansion */ }; /** * GConnHttpEventResolved * @ia: a #GInetAddr of the resolved host name. * * GConnHttp Host Name Resolved Event. Emitted when the host name has * been resolved to an IP address, primarily to give progress feedback * to the user. @ia will be NULL if the host name could not be resolved. * **/ struct _GConnHttpEventResolved { /*< private >*/ GConnHttpEvent parent; /* GConnHttpEvent structure */ /*< public >*/ GInetAddr *ia; /* GInetAddr of the host name */ /*< private >*/ gpointer padding[4]; /* padding for future expansion */ }; /** * GConnHttpEventRedirect * @num_redirects: number of redirects so far * @max_redirects: maximum number of redirects allowed * @new_location: redirect location, or NULL if not provided * @auto_redirect: FALSE if action by the client is needed. Set * to FALSE to prevent automatic redirection * * Emitted when the server sends a redirect response. * **/ struct _GConnHttpEventRedirect { /*< private >*/ GConnHttpEvent parent; /* GConnHttpEvent structure */ /*< public >*/ guint num_redirects; /* number of redirects so far */ guint max_redirects; /* max. num. of redirects allowed */ gchar *new_location; /* redirect location if provided */ gboolean auto_redirect; /* FALSE if action is needed */ /*< private >*/ gpointer padding[4]; /* padding for future expansion */ }; /** * GConnHttpEventResponse * @response_code: response code from the HTTP server (e.g. 200 or 404) * @header_fields: array of header field strings, NULL-terminated * @header_values: array of header value strings, NULL-terminated * * Emitted when the server has sent a response and response headers. * **/ struct _GConnHttpEventResponse { /*< private >*/ GConnHttpEvent parent; /* GConnHttpEvent structure */ /*< public >*/ guint response_code; /* response code, e.g. 200, or 404 */ gchar **header_fields; /* NULL-terminated array of strings */ gchar **header_values; /* NULL-terminated array of strings */ /*< private >*/ gpointer padding[8]; /* padding for future expansion */ }; /** * GConnHttpEventData * @content_length: set if available, otherwise 0 * @data_received: total amount of data received so far * @buffer: buffer with data received so far. Use * gnet_conn_http_steal_buffer() to empty the buffer. * @buffer_length: buffer length * * Emitted when data has been received. Useful for progress feedback * to the user or to process data before all of it has been received. * The client is responsible for emptying the buffer regularly when the * amount of data received or expected is larger than the amount that * should be kept in memory (e.g. in the case of large binary files). * **/ struct _GConnHttpEventData { /*< private >*/ GConnHttpEvent parent; /* GConnHttpEvent structure */ /*< public >*/ guint64 content_length; /* set if available, otherwise 0 */ guint64 data_received; /* bytes received so far */ const gchar *buffer; /* buffer */ gsize buffer_length; /* buffer length */ /*< private >*/ gpointer padding[8]; /* padding for future expansion */ }; /** * GConnHttpEventError * @code: one of the #GConnHttpError codes * @message: clear-text error message (for debugging purposes only) * * Emitted when an error has occured. Note that HTTP server errors are * communicated to the client by means of a #GConnHttpEventResponse event. * **/ struct _GConnHttpEventError { /*< private >*/ GConnHttpEvent parent; /* GConnHttpEvent structure */ /*< public >*/ GConnHttpError code; /* error code */ gchar *message; /* message (use for debugging only) */ /*< private >*/ gpointer padding[4]; /* padding for future expansion */ }; /*************************************************************************** * * * GConnHttp callback function prototype * * * ***************************************************************************/ /** * GConnHttpFunc * @conn: #GConnHttp * @event: event (caller-owned, do not free) * @user_data: user data specified in gnet_conn_http_run() * or gnet_conn_http_run_async() * * Callback for #GConnHttp. * * Check event->type and then cast the event into the appropriate * event structure. event->type will be one of * * %GNET_CONN_HTTP_RESOLVED: this event occurs when the host name * has been resolved or host name resolution failed * * %GNET_CONN_HTTP_CONNECTED: the TCP connection to the * HTTP server has been established * * %GNET_CONN_HTTP_RESPONSE: the HTTP server has sent a response * and response headers * * %GNET_CONN_HTTP_REDIRECT: the HTTP server has sent a redirect * response * * %GNET_CONN_HTTP_DATA_PARTIAL: data has been read. The buffer is * owned by GNet and you must not modify it or free it. You can * take ownership of the buffer with gnet_conn_http_steal_buffer() * * %GNET_CONN_HTTP_DATA_COMPLETE: data has been received in full. * The buffer is owned by GNet and you must not modify it or free * it. You can acquire ownership of the buffer by calling * gnet_conn_http_steal_buffer() * * %GNET_CONN_HTTP_TIMEOUT: the connection timed out * * %GNET_CONN_HTTP_ERROR: #GConnHttp problem (not a server error response) * **/ typedef void (*GConnHttpFunc) (GConnHttp *conn, GConnHttpEvent *event, gpointer user_data); /*************************************************************************** * * * GConnHttp API functions * * * ***************************************************************************/ GConnHttp *gnet_conn_http_new (void); gboolean gnet_conn_http_set_uri (GConnHttp *conn, const gchar *uri); gboolean gnet_conn_http_set_escaped_uri (GConnHttp *conn, const gchar *uri); gboolean gnet_conn_http_set_header (GConnHttp *conn, const gchar *field, const gchar *value, GConnHttpHeaderFlags flags); void gnet_conn_http_set_max_redirects (GConnHttp *conn, guint num); void gnet_conn_http_set_timeout (GConnHttp *conn, guint timeout); gboolean gnet_conn_http_set_user_agent (GConnHttp *conn, const gchar *agent); gboolean gnet_conn_http_set_method (GConnHttp *conn, GConnHttpMethod method, const gchar *post_data, gsize post_data_len); gboolean gnet_conn_http_set_main_context (GConnHttp *conn, GMainContext *context); void gnet_conn_http_run_async (GConnHttp *conn, GConnHttpFunc func, gpointer user_data); gboolean gnet_conn_http_run (GConnHttp *conn, GConnHttpFunc func, gpointer user_data); gboolean gnet_conn_http_steal_buffer (GConnHttp *conn, gchar **buffer, gsize *length); void gnet_conn_http_cancel (GConnHttp *conn); void gnet_conn_http_delete (GConnHttp *conn); gboolean gnet_http_get (const gchar *url, gchar **buffer, gsize *length, guint *response); G_END_DECLS #endif /* _GNET_CONN_HTTP_H */ gnet-2.0.8/src/Makefile.am0000644000175000017500000000210110751326730012220 00000000000000## Process this file with automake to produce Makefile.in if OS_WIN32 no_undefined = -no-undefined lws2_32 = -lws2_32 endif @SET_MAKE@ INCLUDES = -DG_LOG_DOMAIN=\"GNet\" @GNET_DEBUG_FLAGS@ \ $(GLIB_CFLAGS) $(GTHREAD_CFLAGS) gnetincludedir = $(includedir)/gnet-$(GNET_MAJOR_VERSION).$(GNET_MINOR_VERSION) lib_LTLIBRARIES = libgnet-2.0.la libgnet_2_0_la_LDFLAGS = \ $(no_undefined) \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ $(GLIB_LIBS) $(GTHREAD_LIBS) $(lws2_32) libgnet_2_0_la_SOURCES = \ gnet.c \ gnet-private.c \ ipv6.c \ inetaddr.c \ mcast.c \ tcp.c \ unix.c \ udp.c \ iochannel.c \ socks.c \ socks-private.c \ md5.c \ sha.c \ pack.c \ uri.c \ conn.c \ conn-http.c \ server.c \ usagi_ifaddrs.c \ base64.c gnetinclude_HEADERS = \ gnet.h \ ipv6.h \ inetaddr.h \ mcast.h \ tcp.h \ unix.h \ udp.h \ iochannel.h \ socks.h \ md5.h \ sha.h \ pack.h \ uri.h \ conn.h \ conn-http.h \ server.h \ base64.h gnet-2.0.8/src/uri.c0000644000175000017500000005126610751326730011147 00000000000000/* GNet - Networking library URI parser * Copyright (C) 2000-2003 David Helder, David Bolcsfoldi, Eric Williams * Copyright (C) 2007 Tim-Philipp Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "gnet-private.h" #include "uri.h" static void field_unescape (gchar *str); static gchar* field_escape (gchar *str, guchar mask); #define USERINFO_ESCAPE_MASK 0x01 #define PATH_ESCAPE_MASK 0x02 #define QUERY_ESCAPE_MASK 0x04 #define FRAGMENT_ESCAPE_MASK 0x08 static const guchar neednt_escape_table[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x0f, 0x00, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0e, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x0f, 0x00, 0x0c, 0x0e, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x0f, 0x00, 0x00, 0x0f, 0x00, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; /* Perl code to generate above table: #!/usr/bin/perl $ok = "abcdefghijklmnopqrstuvwxyz" . "ABCDEFGHIJKLMNOPQRSTUVWXYZ" . "0123456789" . "-_.!~*'()"; $userinfo_ok = ';:&=+\$,'; $path_ok = ':\@&=+\$,;/'; $query_ok = ';/?:\@&=+\$,'; $fragment_ok = ';/?:\@&=+\$,'; for ($i = 0; $i < 32; $i++) { print " "; for ($j = 0; $j < 8; $j++) { $num = 0; $letter = chr(($i * 8) + $j); $num |= 0b0001 if (index($userinfo_ok, $letter) != -1); $num |= 0b0010 if (index($path_ok, $letter) != -1); $num |= 0b0100 if (index($query_ok, $letter) != -1); $num |= 0b1000 if (index($fragment_ok, $letter) != -1); $num |= 0b1111 if (index($ok, $letter) != -1); printf "0x%02x, ", $num; } print "\n"; } */ typedef struct { const gchar *str; guint len; } StringPart; #define DUP_STRING_PART(sp) (sp.len > 0) ? g_strndup (sp.str, sp.len) : NULL /* our own ISSPACE. ANSI isspace is locale dependent and g_ascii_isspace() * does not recognise #10 as space */ #define ISSPACE(C) (((C) >= 9 && (C) <= 13) || (C) == ' ') static gboolean gnet_uri_parse (const gchar * uri, StringPart * scheme, StringPart * userinfo, StringPart * hostname, guint * port, StringPart * path, StringPart * query, StringPart * fragment) { const StringPart empty = { NULL, 0 }; const gchar *p, *temp; *scheme = *userinfo = *hostname = *path = *query = *fragment = empty; *port = 0; /* Skip initial whitespaces */ p = uri; while (*p && ISSPACE(*p)) ++p; /* Error out if it's just a string of space */ if (*p == '\0') return FALSE; /* Scheme */ temp = p; while (*p && *p != ':' && *p != '/' && *p != '?' && *p != '#') ++p; if (*p == ':') { scheme->str = temp; scheme->len = (guint) (p - temp); ++p; } else { /* This char is NUL, /, ?, or # */ p = temp; } /* Authority */ if (*p == '/' && p[1] == '/') { p += 2; /* Userinfo */ temp = p; while (*p && *p != '@' && *p != '/' ) /* Look for @ or / */ ++p; if (*p == '@') { /* Found userinfo */ userinfo->str = temp; userinfo->len = (guint) (p - temp); ++p; } else { p = temp; } /* Hostname */ /* Check for no hostname at all (e.g. file:// URIs) */ if (*p == '/') goto path; /* Check for IPv6 canonical hostname in brackets */ if (*p == '[') { p++; /* Skip [ */ temp = p; while (*p && *p != ']') ++p; if ((p - temp) == 0) return FALSE; hostname->str = temp; hostname->len = (guint) (p - temp); if (*p) ++p; /* Skip ] (if there) */ } else { temp = p; while (*p && *p != '/' && *p != '?' && *p != '#' && *p != ':') ++p; if ((p - temp) == 0) return FALSE; hostname->str = temp; hostname->len = (guint) (p - temp); } /* Port */ if (*p == ':') { for (++p; isdigit((int)*p); ++p) *port = (*port) * 10 + (*p - '0'); } } /* Path (we are liberal and won't check if it starts with /) */ path: temp = p; while (*p && *p != '?' && *p != '#') ++p; if (p != temp) { path->str = temp; path->len = (guint) (p - temp); } /* Query */ if (*p == '?') { temp = p + 1; while (*p && *p != '#') ++p; query->str = temp; query->len = (guint) (p - temp); } /* Fragment */ if (*p == '#') { ++p; fragment->str = p; fragment->len = strlen (p); } return TRUE; } static gchar * parse_inplace_munge_string_part (StringPart * part) { if (part->len == 0) return NULL; ((gchar*)part->str)[part->len] = '\0'; return (gchar *) part->str; } /** * gnet_uri_parse_inplace: * @guri: pointer to an uninitialised #GURI structure (usually on the stack) * @uri: a writable URI string (which will be modified by this function!) * @hostname: a preallocated array of size @len, into which the hostname will * be copied if the URI has a hostname. This array should live * as long as @guri may be used, since @guri might reference it. * You may pass NULL here if you know your URIs won't contain a * hostname field * @size: size of @hostname in bytes * * This function parses an URI string very efficiently and without allocating * any memory on the heap. It does this by modifying the passed-in string * @uri and changing field separators into string terminators in place. The * result will then be put into the already-allocated and usually * uninitialised, GURI structure @guri. * * Because the slash (') which separates the hostname from the path in an URI * is needed as the first character of the path, it cannot be turned into a * string terminator for the hostname. This makes it necessary for the caller * (ie. you) to pass in an array where the hostname can be put. * * If the URI has been parsed successfully, the fields of the GURI structure * will either point into the given string @uri (or to @hostname in case of * the hostname field), or be NULL. No freeing or de-initialising of the * GURI structure is required. * * The only gnet_uri_*() functions you are allowed to call with this URI * structure are gnet_uri_clone(), gnet_uri_equal(), gnet_uri_hash(), * gnet_uri_get_string() and gnet_uri_unescape() (the latter unescapes the * string fragments in place, so is safe to use here). * * You must not call any other gnet_uri_*() functions with this GURI, * especially not any gnet_uri_set() functions. * * Under normal circumstances, you should never need to use this function. * Use gnet_uri_new() instead. * * Returns: TRUE if @uri was parsed successfully and #GURI is usable, * or FALSE if there was a failure. * * Since: 2.0.8 * **/ gboolean gnet_uri_parse_inplace (GURI * guri, gchar * uri, gchar * hostname, gsize len) { StringPart scheme, usr, host, path, query, frag; guint port; if (!gnet_uri_parse (uri, &scheme, &usr, &host, &port, &path, &query, &frag)) return FALSE; if (host.len >= len) return FALSE; if (host.len > 0) { if (hostname == NULL) return FALSE; strncpy (hostname, host.str, host.len); hostname[host.len] = '\0'; } guri->scheme = parse_inplace_munge_string_part (&scheme); guri->userinfo = parse_inplace_munge_string_part (&usr); guri->hostname = (host.len > 0) ? hostname : NULL; guri->path = parse_inplace_munge_string_part (&path); guri->query = parse_inplace_munge_string_part (&query); guri->fragment = parse_inplace_munge_string_part (&frag); guri->port = port; return TRUE; } /** * gnet_uri_new * @uri: URI string * * Creates a #GURI from a string. Empty fields are set to NULL. The * parser does not validate the URI -- it will accept some malformed * URI. URIs are usually in the form * scheme://userinfo@hostname:port/path?query#fragment * * URIs created from user input are typically unescaped. URIs * created from machine input (e.g. received over the internet) are * typically escaped. * * Returns: a new #GURI, or NULL if there was a failure. * **/ GURI * gnet_uri_new (const gchar * uri) { StringPart scheme, usr, host, path, query, frag; guint port; GURI *guri; g_return_val_if_fail (uri != NULL, NULL); if (!gnet_uri_parse (uri, &scheme, &usr, &host, &port, &path, &query, &frag)) return NULL; guri = g_new (GURI, 1); guri->scheme = DUP_STRING_PART (scheme); guri->userinfo = DUP_STRING_PART (usr); guri->hostname = DUP_STRING_PART (host); guri->path = DUP_STRING_PART (path); guri->query = DUP_STRING_PART (query); guri->fragment = DUP_STRING_PART (frag); guri->port = port; return guri; } /** * gnet_uri_new_fields * @scheme: scheme * @hostname: host name * @port: port * @path: path * * Creates a #GURI from the fields. This function uses the most * common fields. Use gnet_uri_new_fields_all() to specify all * fields. * * Returns: a new #GURI. * **/ GURI* gnet_uri_new_fields (const gchar* scheme, const gchar* hostname, const gint port, const gchar* path) { GURI* uri = NULL; uri = g_new0 (GURI, 1); if (scheme) uri->scheme = g_strdup (scheme); if (hostname) uri->hostname = g_strdup (hostname); uri->port = port; if (path) uri->path = g_strdup (path); return uri; } /** * gnet_uri_new_fields_all * @scheme: scheme * @userinfo: user info * @hostname: host name * @port: port * @path: path * @query: query * @fragment: fragment * * Creates a #GURI from all fields. * * Returns: a new #GURI. * **/ GURI* gnet_uri_new_fields_all (const gchar* scheme, const gchar* userinfo, const gchar* hostname, const gint port, const gchar* path, const gchar* query, const gchar* fragment) { GURI* uri = NULL; uri = g_new0 (GURI, 1); if (scheme) uri->scheme = g_strdup (scheme); if (userinfo) uri->userinfo = g_strdup (userinfo); if (hostname) uri->hostname = g_strdup (hostname); uri->port = port; if (path) uri->path = g_strdup (path); if (query) uri->query = g_strdup (query); if (fragment) uri->fragment = g_strdup (fragment); return uri; } /** * gnet_uri_clone: * @uri: a #GURI * * Copies a #GURI. * * Returns: a copy of @uri. * **/ GURI* gnet_uri_clone (const GURI* uri) { GURI* uri2; g_return_val_if_fail (uri, NULL); uri2 = g_new0 (GURI, 1); uri2->scheme = g_strdup (uri->scheme); uri2->userinfo = g_strdup (uri->userinfo); uri2->hostname = g_strdup (uri->hostname); uri2->port = uri->port; uri2->path = g_strdup (uri->path); uri2->query = g_strdup (uri->query); uri2->fragment = g_strdup (uri->fragment); return uri2; } /** * gnet_uri_delete: * @uri: a #GURI * * Deletes a #GURI. * **/ void gnet_uri_delete (GURI* uri) { if (uri) { g_free (uri->scheme); g_free (uri->userinfo); g_free (uri->hostname); g_free (uri->path); g_free (uri->query); g_free (uri->fragment); g_free (uri); } } #define SAFESTRCMP(A,B) (((A)&&(B))?(strcmp((A),(B))):((A)||(B))) /** * gnet_uri_equal * @p1: a #GURI * @p2: another #GURI * * Compares two #GURI's for equality. * * Returns: TRUE if they are equal; FALSE otherwise. * **/ gboolean gnet_uri_equal (gconstpointer p1, gconstpointer p2) { const GURI* uri1 = (const GURI*) p1; const GURI* uri2 = (const GURI*) p2; g_return_val_if_fail (uri1, FALSE); g_return_val_if_fail (uri2, FALSE); if (uri1->port == uri2->port && !SAFESTRCMP(uri1->scheme, uri2->scheme) && !SAFESTRCMP(uri1->userinfo, uri2->userinfo) && !SAFESTRCMP(uri1->hostname, uri2->hostname) && !SAFESTRCMP(uri1->path, uri2->path) && !SAFESTRCMP(uri1->query, uri2->query) && !SAFESTRCMP(uri1->fragment, uri2->fragment)) return TRUE; return FALSE; } /** * gnet_uri_hash * @p: a #GURI * * Creates a hash code for @p for use with GHashTable. * * Returns: hash code for @p. * **/ guint gnet_uri_hash (gconstpointer p) { const GURI* uri = (const GURI*) p; guint h = 0; g_return_val_if_fail (uri, 0); if (uri->scheme) h = g_str_hash (uri->scheme); if (uri->userinfo) h ^= g_str_hash (uri->userinfo); if (uri->hostname) h ^= g_str_hash (uri->hostname); h ^= uri->port; if (uri->path) h ^= g_str_hash (uri->path); if (uri->query) h ^= g_str_hash (uri->query); if (uri->fragment) h ^= g_str_hash (uri->fragment); return h; } /** * gnet_uri_escape * @uri: a #GURI * * Escapes the fields in a #GURI. Network protocols use escaped * URIs. People use unescaped URIs. * **/ void gnet_uri_escape (GURI* uri) { g_return_if_fail (uri); uri->userinfo = field_escape (uri->userinfo, USERINFO_ESCAPE_MASK); uri->path = field_escape (uri->path, PATH_ESCAPE_MASK); uri->query = field_escape (uri->query, QUERY_ESCAPE_MASK); uri->fragment = field_escape (uri->fragment, FRAGMENT_ESCAPE_MASK); } /** * gnet_uri_unescape * @uri: a #GURI * * Unescapes the fields in the URI. Network protocols use escaped * URIs. People use unescaped URIs. * **/ void gnet_uri_unescape (GURI* uri) { g_return_if_fail (uri); if (uri->userinfo) field_unescape (uri->userinfo); if (uri->path) field_unescape (uri->path); if (uri->query) field_unescape (uri->query); if (uri->fragment) field_unescape (uri->fragment); } static gchar* field_escape (gchar *signed_str, guchar mask) { gint len; gint i; gboolean must_escape = FALSE; guchar *str; gchar *dst; gint j; str = (guchar*) signed_str; if (str == NULL) return NULL; /* Roughly calculate buffer size */ len = 0; for (i = 0; str[i]; i++) { if (neednt_escape_table[str[i]] & mask) len++; else { len += 3; must_escape = TRUE; } } /* Don't escape if unnecessary */ if (must_escape == FALSE) return signed_str; /* Allocate buffer */ dst = (gchar*) g_malloc(len + 1); /* Copy */ for (i = j = 0; str[i]; i++, j++) { /* Unescaped character */ if (neednt_escape_table[str[i]] & mask) { dst[j] = str[i]; } /* Escaped character */ else { dst[j] = '%'; if (((str[i] & 0xf0) >> 4) < 10) dst[j+1] = ((str[i] & 0xf0) >> 4) + '0'; else dst[j+1] = ((str[i] & 0xf0) >> 4) + 'a' - 10; if ((str[i] & 0x0f) < 10) dst[j+2] = (str[i] & 0x0f) + '0'; else dst[j+2] = (str[i] & 0x0f) + 'a' - 10; j += 2; /* and j is incremented in loop too */ } } dst[j] = '\0'; g_free (signed_str); return dst; } static void field_unescape (gchar* s) { gchar* src; gchar* dst; for (src = dst = s; *src; ++src, ++dst) { if (src[0] == '%' && src[1] != '\0' && src[2] != '\0') { gint high, low; if ('a' <= src[1] && src[1] <= 'f') high = src[1] - 'a' + 10; else if ('A' <= src[1] && src[1] <= 'F') high = src[1] - 'A' + 10; else if ('0' <= src[1] && src[1] <= '9') high = src[1] - '0'; else /* malformed */ goto regular_copy; if ('a' <= src[2] && src[2] <= 'f') low = src[2] - 'a' + 10; else if ('A' <= src[2] && src[2] <= 'F') low = src[2] - 'A' + 10; else if ('0' <= src[2] && src[2] <= '9') low = src[2] - '0'; else /* malformed */ goto regular_copy; *dst = (char)((high << 4) + low); src += 2; } else { regular_copy: /* micro-optimisation: a lot of URIs do not include escape * sequences. By testing the pointer addresses we can avoid * a lot of reading+writing of the same data */ if (dst != src) *dst = *src; } } *dst = '\0'; } /** * gnet_uri_get_string * @uri: a #GURI * * Gets a string representation of a #GURI. This function does not * escape or unescape the fields first. Call gnet_uri_escape() or * gnet_uri_unescape first if necessary. * * Returns: a string. * **/ gchar* gnet_uri_get_string (const GURI* uri) { gchar* rv = NULL; GString* buffer = NULL; g_return_val_if_fail (uri, NULL); buffer = g_string_sized_new (16); if (uri->scheme) g_string_sprintfa (buffer, "%s:", uri->scheme); if (uri->userinfo || uri->hostname || uri->port || (uri->scheme && uri->hostname == NULL && uri->path && *uri->path == '/')) { g_string_append (buffer, "//"); } if (uri->userinfo) { buffer = g_string_append (buffer, uri->userinfo); buffer = g_string_append_c (buffer, '@'); } /* Add brackets around the hostname if it's IPv6 */ if (uri->hostname) { if (strchr(uri->hostname, ':') == NULL) buffer = g_string_append (buffer, uri->hostname); else g_string_sprintfa (buffer, "[%s]", uri->hostname); } if (uri->port) g_string_sprintfa (buffer, ":%d", uri->port); if (uri->path) { if (*uri->path == '/' || !(uri->userinfo || uri->hostname || uri->port)) g_string_append (buffer, uri->path); else g_string_sprintfa (buffer, "/%s", uri->path); } if (uri->query) g_string_sprintfa (buffer, "?%s", uri->query); if (uri->fragment) g_string_sprintfa (buffer, "#%s", uri->fragment); /* Free only GString not data contained, return the data instead */ rv = buffer->str; g_string_free (buffer, FALSE); return rv; } /** * gnet_uri_set_scheme * @uri: a #GURI * @scheme: scheme * * Sets a #GURI's scheme. * **/ void gnet_uri_set_scheme (GURI* uri, const gchar* scheme) { g_return_if_fail (uri); g_free (uri->scheme); uri->scheme = NULL; if (scheme) uri->scheme = g_strdup (scheme); } /** * gnet_uri_set_userinfo * @uri: a #GURI * @userinfo: user info * * Sets a #GURI's user info. * **/ void gnet_uri_set_userinfo (GURI* uri, const gchar* userinfo) { g_return_if_fail (uri); g_free (uri->userinfo); uri->userinfo = NULL; if (userinfo) uri->userinfo = g_strdup (userinfo); } /** * gnet_uri_set_hostname * @uri: a #GURI * @hostname: host name * * Sets a #GURI's host name. * **/ void gnet_uri_set_hostname (GURI* uri, const gchar* hostname) { g_return_if_fail (uri); g_free (uri->hostname); uri->hostname = NULL; if (hostname) uri->hostname = g_strdup (hostname); } /** * gnet_uri_set_port * @uri: a #GURI * @port: port * * Set a #GURI's port. * **/ void gnet_uri_set_port (GURI* uri, gint port) { uri->port = port; } /** * gnet_uri_set_path * @uri: a #GURI * @path: path * * Set a #GURI's path. * **/ void gnet_uri_set_path (GURI* uri, const gchar* path) { g_return_if_fail (uri); g_free (uri->path); uri->path = NULL; if (path) uri->path = g_strdup (path); } /** * gnet_uri_set_query * @uri: a #GURI * @query: query * * Set a #GURI's query. * **/ void gnet_uri_set_query (GURI* uri, const gchar* query) { g_return_if_fail (uri); g_free (uri->query); uri->query = NULL; if (query) uri->query = g_strdup (query); } /** * gnet_uri_set_fragment * @uri: a #GURI * @fragment: fragment * * Set a #GURI's fragment. * **/ void gnet_uri_set_fragment (GURI* uri, const gchar* fragment) { g_return_if_fail (uri); g_free (uri->fragment); uri->fragment = NULL; if (fragment) uri->fragment = g_strdup (fragment); } gnet-2.0.8/src/inetaddr.c0000644000175000017500000021306610751326730012140 00000000000000/* GNet - Networking library * Copyright (C) 2000-2002 David Helder * Copyright (C) 2000-2003 Andrew Lanoix * Copyright (C) 2007 Tim-Philipp Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "gnet-private.h" #include "inetaddr.h" #ifdef HAVE_LINUX_NETLINK_H #include #endif #ifdef HAVE_IFADDRS_H #include #endif typedef struct _GInetAddrNewListState { GStaticMutex mutex; GList *ias; gint port; GInetAddrNewListAsyncFunc func; gpointer data; GDestroyNotify notify; gboolean in_callback; gboolean is_cancelled; gboolean lookup_failed; guint source; GMainContext *context; /* main context (we hold a reference) */ gint priority; } GInetAddrNewListState; typedef struct _GInetAddrNewState { GInetAddrNewListAsyncID list_id; GInetAddrNewAsyncFunc func; gpointer data; GDestroyNotify notify; gboolean in_callback; GStaticMutex mutex; GMainContext *context; /* main context (we hold a reference) */ gint priority; } GInetAddrNewState; typedef struct _GInetAddrReverseAsyncState { GStaticMutex mutex; /* protecting all of the below */ GInetAddr *ia; /* copy of GInetAddr to get the name for */ GInetAddrGetNameAsyncFunc func; /* user-provided callback function */ gpointer data; /* user data for callback function */ GDestroyNotify notify; GMainContext *context; /* main context (we hold a reference) */ gint priority; gchar *name; /* result */ guint source; /* id of idle callback to marshal result * from lookup thread into main thread */ gboolean in_callback; gboolean is_cancelled; } GInetAddrReverseAsyncState; #ifdef GNET_WIN32 #include /* TODO: Use Window's inet_pton/inet_ntop if they ever implement it. */ static int inet_pton(int af, const char* src, void* dst) { int address_length; struct sockaddr_storage sa; struct sockaddr_in *sin = (struct sockaddr_in *)&sa; struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&sa; switch (af) { case AF_INET: address_length = sizeof (struct sockaddr_in); break; case AF_INET6: address_length = sizeof (struct sockaddr_in6); break; default: return -1; } if (WSAStringToAddress ((LPTSTR) src, af, NULL, (LPSOCKADDR) &sa, &address_length) == 0) { switch (af) { case AF_INET: memcpy (dst, &sin->sin_addr, sizeof (struct in_addr)); break; case AF_INET6: memcpy (dst, &sin6->sin6_addr, sizeof (struct in6_addr)); break; } return 1; } return 0; } static const char* inet_ntop(int af, const void* src, char* dst, size_t size) { int address_length; DWORD string_length = size; struct sockaddr_storage sa; struct sockaddr_in *sin = (struct sockaddr_in *)&sa; struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&sa; memset (&sa, 0, sizeof (sa)); switch (af) { case AF_INET: address_length = sizeof (struct sockaddr_in); sin->sin_family = af; memcpy (&sin->sin_addr, src, sizeof (struct in_addr)); break; case AF_INET6: address_length = sizeof (struct sockaddr_in6); sin6->sin6_family = af; memcpy (&sin6->sin6_addr, src, sizeof (struct in6_addr)); break; default: return NULL; } if (WSAAddressToString ((LPSOCKADDR) &sa, address_length, NULL, dst, &string_length) == 0) return dst; return NULL; } #endif /* GNET_WIN32 */ /* **************************************** */ static GList* gnet_gethostbyname(const char* hostname); static gchar* gnet_gethostbyaddr(const struct sockaddr_storage* sa); static void ialist_free (GList* ialist); #if defined(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX) \ || defined(HAVE_GETADDRINFO_GLIB_MUTEX) G_LOCK_DEFINE (dnslock); #endif #if !defined(HAVE_GETADDRINFO) static GList* hostent2ialist (const struct hostent* he); static GList* hostent2ialist (const struct hostent* he) { GList* list = NULL; int i; if (!he) return NULL; for (i = 0; he->h_addr_list[i]; ++i) { GInetAddr* ia; ia = g_new0(GInetAddr, 1); ia->ref_count = 1; GNET_SOCKADDR_FAMILY(ia->sa) = he->h_addrtype; GNET_INETADDR_SET_SS_LEN(ia); memcpy (GNET_SOCKADDR_ADDRP(ia->sa), he->h_addr_list[i], he->h_length); list = g_list_prepend(list, ia); } /* list is returned backwards */ return list; } #endif /* Thread safe gethostbyname. Maps hostname to list of sockaddr_storage pointers. */ static GList* gnet_gethostbyname(const char* hostname) { GList* list = NULL; /* **************************************** */ /* DNS lookup: getaddrinfo() */ #ifdef HAVE_GETADDRINFO { struct addrinfo hints; struct addrinfo* res = NULL; int rv; GIPv6Policy policy; policy = gnet_ipv6_get_policy(); memset (&hints, 0, sizeof(hints)); hints.ai_socktype = SOCK_STREAM; if (policy == GIPV6_POLICY_IPV4_ONLY) hints.ai_family = AF_INET; else if (policy == GIPV6_POLICY_IPV6_ONLY) hints.ai_family = AF_INET6; /* If GLIB_MUTEX is not defined, either getaddrinfo() is thread-safe, or we don't have mutexes. */ # ifdef HAVE_GETADDRINFO_GLIB_MUTEX G_LOCK (dnslock); # endif rv = getaddrinfo (hostname, NULL, &hints, &res); if (rv == 0) { struct addrinfo* i; GList* ipv4_list = NULL; GList* ipv6_list = NULL; for (i = res; i != NULL; i = i->ai_next) { GInetAddr* ia; ia = g_new0(GInetAddr, 1); ia->ref_count = 1; memcpy (&ia->sa, i->ai_addr, i->ai_addrlen); if (i->ai_family == PF_INET) ipv4_list = g_list_prepend (ipv4_list, ia); else if (i->ai_family == PF_INET6) ipv6_list = g_list_prepend (ipv6_list, ia); else g_free (ia); } if (policy == GIPV6_POLICY_IPV4_ONLY) { list = ipv4_list; g_list_free (ipv6_list); } else if (policy == GIPV6_POLICY_IPV4_THEN_IPV6) { list = g_list_concat (ipv6_list, ipv4_list); /* list will be reversed below */ } else if (policy == GIPV6_POLICY_IPV6_ONLY) { list = ipv6_list; g_list_free (ipv4_list); } else if (policy == GIPV6_POLICY_IPV6_THEN_IPV4) { list = g_list_concat (ipv4_list, ipv6_list); /* list will be reversed below */ } } if (res) freeaddrinfo (res); # ifdef HAVE_GETADDRINFO_GLIB_MUTEX G_UNLOCK (dnslock); # endif } #else /* **************************************** */ /* DNS lookup: gethostbyname() */ #ifdef HAVE_GETHOSTBYNAME_THREADSAFE { struct hostent* he; he = gethostbyname(hostname); list = hostent2ialist(he); } #else #ifdef HAVE_GETHOSTBYNAME_R_GLIBC { struct hostent result_buf, *result; size_t len; char* buf; int herr; int rv; len = 1024; buf = g_new(gchar, len); while ((rv = gethostbyname_r (hostname, &result_buf, buf, len, &result, &herr)) == ERANGE) { len *= 2; buf = g_renew (gchar, buf, len); } if (!rv) list = hostent2ialist(result); g_free(buf); } #else #ifdef HAVE_GETHOSTBYNAME_R_SOLARIS { size_t len = 8192; /* Stevens suggest this size should be adequate */ char * buf = NULL; struct hostent result; struct hostent* he; do { buf = g_renew (gchar, buf, len); errno = 0; he = gethostbyname_r (hostname, &result, buf, len, &h_errno); len += 1024; } while (errno == ERANGE); if (he) list = hostent2ialist(&result); done: g_free(buf); } #else #ifdef HAVE_GETHOSTBYNAME_R_HPUX { struct hostent result; struct hostent_data buf; int rv; rv = gethostbyname_r (hostname, &result, &buf); if (!rv) list = hostent2ialist(&result); } #else { struct hostent* he; # ifdef HAVE_GETHOSTBYNAME_R_GLIB_MUTEX G_LOCK (dnslock); # endif he = gethostbyname(hostname); list = hostent2ialist(he); # ifdef HAVE_GETHOSTBYNAME_R_GLIB_MUTEX G_UNLOCK (dnslock); # endif } #endif #endif #endif #endif #endif if (list) list = g_list_reverse (list); return list; } /* Free list of GInetAddr's. We assume name hasn't been allocated. */ static void ialist_free (GList* ialist) { GList* i; if (!ialist) return; for (i = ialist; i != NULL; i = i->next) g_free ((GInetAddr*) i->data); g_list_free (ialist); } /* Thread safe gethostbyaddr (we assume that gethostbyaddr_r follows the same pattern as gethostbyname_r, so we don't have special checks for it in configure.in. Returns: the hostname; NULL on error. */ gchar* gnet_gethostbyaddr(const struct sockaddr_storage* sa) { gchar* rv = NULL; /* We assume if there's getaddrinfo(), then there's getnameinfo(). */ #ifdef HAVE_GETADDRINFO { int gnirv; char host[NI_MAXHOST]; # ifdef HAVE_GETADDRINFO_GLIB_MUTEX G_LOCK (dnslock); # endif again: gnirv = getnameinfo((const struct sockaddr*) sa, GNET_SOCKADDR_LEN(*sa), host, sizeof(host), NULL, 0, NI_NAMEREQD); if (gnirv == 0) rv = g_strdup (host); else if (gnirv == EAGAIN) goto again; else rv = NULL; # ifdef HAVE_GETADDRINFO_GLIB_MUTEX G_UNLOCK (dnslock); # endif } #else #ifdef HAVE_GETHOSTBYNAME_THREADSAFE { const char* sa_addr = GNET_SOCKADDR_ADDRP(*sa); size_t sa_len = GNET_SOCKADDR_ADDRLEN(*sa); int sa_type = GNET_SOCKADDR_FAMILY(*sa); struct hostent* he; he = gethostbyaddr(sa_addr, sa_len, sa_type); if (he != NULL && he->h_name != NULL) rv = g_strdup(he->h_name); } #else #ifdef HAVE_GETHOSTBYNAME_R_GLIBC { const char* sa_addr = GNET_SOCKADDR_ADDRP(*sa); size_t sa_len = GNET_SOCKADDR_ADDRLEN(*sa); int sa_type = GNET_SOCKADDR_FAMILY(*sa); struct hostent result_buf, *result; size_t len; char* buf; int herr; int res; len = 1024; buf = g_new(gchar, len); while ((res = gethostbyaddr_r (sa_addr, sa_len, sa_type, &result_buf, buf, len, &result, &herr)) == ERANGE) { len *= 2; buf = g_renew (gchar, buf, len); } if (res || result == NULL || result->h_name == NULL) goto done; rv = g_strdup(result->h_name); done: g_free(buf); } #else #ifdef HAVE_GET_HOSTBYNAME_R_SOLARIS { const char* sa_addr = GNET_SOCKADDR_ADDRP(*sa); size_t sa_len = GNET_SOCKADDR_ADDRLEN(*sa); int sa_type = GNET_SOCKADDR_FAMILY(*sa); struct hostent result; size_t len; char* buf; int herr; int res; len = 1024; buf = g_new(gchar, len); while ((res = gethostbyaddr_r (sa_addr, sa_len, sa_type, &result, buf, len, &herr)) == ERANGE) { len *= 2; buf = g_renew (gchar, buf, len); } if (res || hp == NULL || hp->h_name == NULL) goto done; rv = g_strdup(result->h_name); done: g_free(buf); } #else #ifdef HAVE_GETHOSTBYNAME_R_HPUX { const char* sa_addr = GNET_SOCKADDR_ADDRP(*sa); size_t sa_len = GNET_SOCKADDR_ADDRLEN(*sa); int sa_type = GNET_SOCKADDR_FAMILY(*sa); struct hostent result; struct hostent_data buf; int res; res = gethostbyaddr_r (sa_addr, sa_len, sa_type, &result, &buf); if (res == 0) rv = g_strdup (result.h_name); } #else #ifdef HAVE_GETHOSTBYNAME_R_GLIB_MUTEX { const char* sa_addr = GNET_SOCKADDR_ADDRP(*sa); size_t sa_len = GNET_SOCKADDR_ADDRLEN(*sa); int sa_type = GNET_SOCKADDR_FAMILY(*sa); struct hostent* he; G_LOCK (dnslock); he = gethostbyaddr(sa_addr, sa_len, sa_type); if (he != NULL && he->h_name != NULL) rv = g_strdup(he->h_name); G_UNLOCK (dnslock); } #else { const char* sa_addr = GNET_SOCKADDR_ADDRP(*sa); size_t sa_len = GNET_SOCKADDR_ADDRLEN(*sa); int sa_type = GNET_SOCKADDR_FAMILY(*sa); struct hostent* he; he = gethostbyaddr(sa_addr, sa_len, sa_type); if (he != NULL && he->h_name != NULL) rv = g_strdup(he->h_name); } #endif #endif #endif #endif #endif #endif return rv; } /* **************************************** */ /** * gnet_inetaddr_new * @hostname: host name * @port: port number (0 if the port doesn't matter) * * Creates a #GInetAddr from a host name and port. This function * makes a DNS lookup on the host name so it may block. The host * name may resolve to multiple addresses. If this occurs, the first * address in the list is returned. Use gnet_inetaddr_new_list() to * get the complete list. * * Returns: a new #GInetAddr; NULL on error. * **/ GInetAddr* gnet_inetaddr_new (const gchar* hostname, gint port) { GList* ialist; GInetAddr* ia = NULL; /* * First attempt nonblocking lookup */ ia = gnet_inetaddr_new_nonblock (hostname, port); if (ia) return ia; ialist = gnet_gethostbyname (hostname); if (!ialist) return NULL; ia = (GInetAddr*) ialist->data; ialist = g_list_remove (ialist, ia); GNET_INETADDR_PORT_SET(ia, g_htons(port)); ialist_free (ialist); return ia; } /** * gnet_inetaddr_new_list: * @hostname: host name * @port: port number (0 if the port doesn't matter) * * Creates a GList of #GInetAddr's from a host name and port. This * function makes a DNS lookup on the host name so it may block. * * Returns: a GList of #GInetAddr structures or NULL on error. * **/ GList* gnet_inetaddr_new_list (const gchar* hostname, gint port) { GInetAddr* ia; GList* ialist; GList* i; g_return_val_if_fail (hostname != NULL, NULL); /* * First attempt nonblocking lookup */ ia = gnet_inetaddr_new_nonblock (hostname, port); if (ia) return g_list_prepend (NULL, ia); /* Try to get the host by name (ie, DNS) */ ialist = gnet_gethostbyname(hostname); if (!ialist) return NULL; /* Set the port */ for (i = ialist; i != NULL; i = i->next) { GInetAddr* ia = (GInetAddr*) i->data; GNET_INETADDR_PORT_SET(ia, g_htons(port)); } return ialist; } /** * gnet_inetaddr_delete_list * @list: GList of #GInetAddr's * * Deletes a GList of #GInetAddr's. * **/ void gnet_inetaddr_delete_list (GList* list) { GList* i; for (i = list; i != NULL; i = i->next) gnet_inetaddr_delete ((GInetAddr*) i->data); g_list_free (list); } /* **************************************** */ /* gnet_inetaddr_new_async() */ static void inetaddr_new_async_cb (GList* ialist, gpointer data); /** * gnet_inetaddr_new_async_full * @hostname: host name * @port: port number (0 if the port doesn't matter) * @func: callback function * @data: data to pass to @func on the callback, or NULL * @notify: function to call to free @data, or NULL * @context: the #GMainContext to use for notifications, or NULL for the * default GLib main context. If in doubt, pass NULL. * @priority: the priority with which to schedule notifications in the * main context, e.g. #G_PRIORITY_DEFAULT or #G_PRIORITY_HIGH. * * Asynchronously creates a #GInetAddr from a host name and port. * The callback is called once the #GInetAddr is created or an error * occurs during lookup. The callback will not be called during the * call to this function. * * See gnet_inetaddr_new_list_async() for implementation notes. * * Returns: the ID of the lookup; NULL on failure. The ID can be used * with gnet_inetaddr_new_async_cancel() to cancel the lookup. * * Since: 2.0.8 **/ GInetAddrNewAsyncID gnet_inetaddr_new_async_full (const gchar * hostname, gint port, GInetAddrNewAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext * context, gint priority) { GInetAddrNewListAsyncID list_id; GInetAddrNewState *state; if (context == NULL) context = g_main_context_default (); state = g_new0 (GInetAddrNewState, 1); g_static_mutex_init (&state->mutex); g_static_mutex_lock (&state->mutex); state->func = func; state->data = data; state->notify = notify; state->context = g_main_context_ref (context); state->priority = priority; list_id = gnet_inetaddr_new_list_async_full (hostname, port, inetaddr_new_async_cb, state, (GDestroyNotify) NULL, context, priority); state->list_id = list_id; g_static_mutex_unlock (&state->mutex); if (list_id == NULL) { if (state->notify) state->notify (state->data); g_main_context_unref (state->context); g_static_mutex_free (&state->mutex); g_free (state); return NULL; } return state; } /** * gnet_inetaddr_new_async * @hostname: host name * @port: port number (0 if the port doesn't matter) * @func: callback function * @data: data to pass to @func on the callback * * Asynchronously creates a #GInetAddr from a host name and port. * The callback is called once the #GInetAddr is created or an error * occurs during lookup. The callback will not be called during the * call to this function. * * See gnet_inetaddr_new_list_async() for implementation notes. * * Returns: the ID of the lookup; NULL on failure. The ID can be used * with gnet_inetaddr_new_async_cancel() to cancel the lookup. * **/ GInetAddrNewAsyncID gnet_inetaddr_new_async (const gchar* hostname, gint port, GInetAddrNewAsyncFunc func, gpointer data) { GInetAddrNewAsyncID async_id; g_return_val_if_fail (hostname != NULL, NULL); g_return_val_if_fail (func != NULL, NULL); async_id = gnet_inetaddr_new_async_full (hostname, port, func, data, (GDestroyNotify) NULL, NULL, G_PRIORITY_DEFAULT); return async_id; } /** * gnet_inetaddr_new_async_cancel * @id: ID of the lookup * * Cancels an asynchronous #GInetAddr creation that was started with * gnet_inetaddr_new_async(). * **/ void gnet_inetaddr_new_async_cancel (GInetAddrNewAsyncID async_id) { GInetAddrNewState* state = (GInetAddrNewState*) async_id; g_return_if_fail (async_id != NULL); if (state->in_callback) return; gnet_inetaddr_new_list_async_cancel (state->list_id); if (state->notify) state->notify (state->data); g_main_context_unref (state->context); g_free (state); } static void inetaddr_new_async_cb (GList* ialist, gpointer data) { GInetAddrNewState* state = (GInetAddrNewState*) data; g_return_if_fail (state); state->in_callback = TRUE; /* make sure we don't proceed before gnet_inetaddr_new_async() * has set state->list_id, which is needed by _async_cancel */ g_static_mutex_lock (&state->mutex); g_static_mutex_unlock (&state->mutex); if (ialist) { GInetAddr* ia; ia = (GInetAddr*) ialist->data; /* Get address */ g_assert (ia); ialist = g_list_remove (ialist, ia); /* Remove from list */ ialist_free (ialist); /* Delete list */ (*state->func)(ia, state->data); } else { (*state->func)(NULL, state->data); } state->in_callback = FALSE; /* abuse _cancel() to free the state */ gnet_inetaddr_new_async_cancel (state); } /* **************************************** */ /* gnet_inetaddr_new_list_async() */ static gboolean inetaddr_new_list_async_nonblock_dispatch (gpointer data); static void* inetaddr_new_list_async_gthread (void* arg); /** * gnet_inetaddr_new_list_async_full * @hostname: host name * @port: port number (0 if the port doesn't matter) * @func: callback function * @data: data to pass to @func on the callback, or NULL * @notify: function to call to free @data, or NULL * @context: the #GMainContext to use for notifications, or NULL for the * default GLib main context. If in doubt, pass NULL. * @priority: the priority with which to schedule notifications in the * main context, e.g. #G_PRIORITY_DEFAULT or #G_PRIORITY_HIGH. * * Asynchronously creates a GList of #GInetAddr's from a host name * and port. The callback is called once the list is created or an * error occurs during lookup. The callback will not be called * during the call to gnet_inetaddr_new_list_async(). The list * passed in the callback is callee owned (meaning that it is your * responsibility to free the list and each #GInetAddr in the list). * * If you need to lookup hundreds of addresses, we recommend calling * g_main_iteration(FALSE) between calls. This will help prevent an * explosion of threads. * * If you need a more robust library for Unix, look at GNU ADNS. * GNU ADNS is under the GNU GPL. This library does not use threads * or processes. * * The Windows version is molded after the Unix GThread version. * * Returns: the ID of the lookup; NULL on failure. The ID can be * used with gnet_inetaddr_new_list_async_cancel() to cancel the * lookup. * * Since: 2.0.8 **/ GInetAddrNewListAsyncID gnet_inetaddr_new_list_async_full (const gchar * hostname, gint port, GInetAddrNewListAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext * context, gint priority) { GInetAddrNewListState *state = NULL; GInetAddr *ia; g_return_val_if_fail (hostname != NULL, NULL); g_return_val_if_fail (func != NULL, NULL); if (context == NULL) context = g_main_context_default (); state = g_new0 (GInetAddrNewListState, 1); g_static_mutex_init (&state->mutex); /* set everything up (must be done before we create the thread) */ state->port = port; state->func = func; state->data = data; state->notify = notify; state->context = g_main_context_ref (context); state->priority = priority; /* First attempt nonblocking lookup */ ia = gnet_inetaddr_new_nonblock (hostname, port); if (ia) { state->ias = g_list_prepend (NULL, ia); state->source = _gnet_idle_add_full (state->context, state->priority, inetaddr_new_list_async_nonblock_dispatch, state, NULL); } else { GError *err = NULL; gpointer *args; args = g_new (gpointer, 2); args[0] = g_strdup (hostname); args[1] = state; if (!g_thread_create (inetaddr_new_list_async_gthread, args, FALSE, &err)) { g_warning ("g_thread_create error: %s\n", err->message); g_error_free (err); if (state->notify) state->notify (state->data); g_main_context_unref (state->context); g_static_mutex_free (&state->mutex); g_free (args[0]); g_free (state); return NULL; } } return state; } /** * gnet_inetaddr_new_list_async * @hostname: host name * @port: port number (0 if the port doesn't matter) * @func: callback function * @data: data to pass to @func on the callback * * Asynchronously creates a GList of #GInetAddr's from a host name * and port. The callback is called once the list is created or an * error occurs during lookup. The callback will not be called * during the call to gnet_inetaddr_new_list_async(). The list * passed in the callback is callee owned (meaning that it is your * responsibility to free the list and each #GInetAddr in the list). * * If you need to lookup hundreds of addresses, we recommend calling * g_main_iteration(FALSE) between calls. This will help prevent an * explosion of threads. * * If you need a more robust library for Unix, look at GNU ADNS. * GNU ADNS is under the GNU GPL. This library does not use threads * or processes. * * The Windows version is molded after the Unix GThread version. * * Returns: the ID of the lookup; NULL on failure. The ID can be * used with gnet_inetaddr_new_list_async_cancel() to cancel the * lookup. * **/ GInetAddrNewListAsyncID gnet_inetaddr_new_list_async (const gchar* hostname, gint port, GInetAddrNewListAsyncFunc func, gpointer data) { GInetAddrNewListAsyncID async_id; g_return_val_if_fail (hostname != NULL, NULL); g_return_val_if_fail (func != NULL, NULL); async_id = gnet_inetaddr_new_list_async_full (hostname, port, func, data, (GDestroyNotify) NULL, NULL, G_PRIORITY_DEFAULT); return async_id; } /* TODO: we could merge this with inetaddr_new_list_async_gthread_dispatch() * if we used the same type of mutex for the structure ... */ static gboolean inetaddr_new_list_async_nonblock_dispatch (gpointer data) { GInetAddrNewListState* state = (GInetAddrNewListState*) data; g_static_mutex_lock (&state->mutex); state->in_callback = TRUE; (*state->func) (state->ias, state->data); state->in_callback = FALSE; if (state->notify) state->notify (state->data); g_main_context_unref (state->context); g_static_mutex_unlock (&state->mutex); g_static_mutex_free (&state->mutex); g_free (state); return FALSE; } static gboolean inetaddr_new_list_async_gthread_dispatch (gpointer data); static void* inetaddr_new_list_async_gthread (void* arg) { void** args = (void**) arg; gchar* name = (gchar*) args[0]; GInetAddrNewListState* state = (GInetAddrNewListState*) args[1]; GList* ialist = NULL; g_free (args); /* Avoid the blocking call in the unlikely case that we've already been * cancelled */ g_static_mutex_lock (&state->mutex); if (state->is_cancelled) goto cancelled; g_static_mutex_unlock (&state->mutex); /* Do lookup (without holding the lock while we're blocking so the main * thread can cancel us without having to wait until we've finished our * blocking call) */ ialist = gnet_gethostbyname (name); /* Lock again */ g_static_mutex_lock (&state->mutex); /* If cancelled, destroy state and exit. The main thread is no * longer using state. */ if (state->is_cancelled) goto cancelled; g_free (name); if (ialist) { GList* i; /* Set the port */ for (i = ialist; i != NULL; i = i->next) { GInetAddr* ia = (GInetAddr*) i->data; GNET_INETADDR_PORT_SET(ia, g_htons(state->port)); } /* Save the list */ state->ias = ialist; } else { /* Flag failure */ state->lookup_failed = TRUE; } /* Add a source for reply */ state->source = _gnet_idle_add_full (state->context, state->priority, inetaddr_new_list_async_gthread_dispatch, state, NULL); /* Unlock */ g_static_mutex_unlock (&state->mutex); /* Thread exits... */ return NULL; cancelled: { ialist_free (ialist); if (state->notify) state->notify (state->data); g_main_context_unref (state->context); g_static_mutex_unlock (&state->mutex); g_static_mutex_free (&state->mutex); g_free (state); g_free (name); return NULL; } } static gboolean inetaddr_new_list_async_gthread_dispatch (gpointer data) { GInetAddrNewListState* state = (GInetAddrNewListState*) data; g_static_mutex_lock (&state->mutex); state->in_callback = TRUE; /* Upcall */ if (!state->lookup_failed) (*state->func)(state->ias, state->data); else (*state->func)(NULL, state->data); state->in_callback = FALSE; /* Delete state */ if (state->notify) state->notify (state->data); g_main_context_unref (state->context); g_static_mutex_unlock (&state->mutex); g_static_mutex_free (&state->mutex); g_free (state); return FALSE; } /** * gnet_inetaddr_new_list_async_cancel * @id: ID of the lookup * * Cancels an asynchronous #GInetAddr list creation that was started * with gnet_inetaddr_new_list_async(). * **/ void gnet_inetaddr_new_list_async_cancel (GInetAddrNewListAsyncID id) { GInetAddrNewListState* state = (GInetAddrNewListState*) id; g_return_if_fail (state); if (state->in_callback) return; /* We don't use in_callback because we'd have to get the mutex to access it and if we're in the callback we'd already have the mutex and deadlock. in_callback was mostly meant to prevent programmer error. */ g_static_mutex_lock (&state->mutex); /* Check if the thread has finished and a reply is pending. If a * reply is pending, cancel it and delete state. */ if (state->source) { _gnet_source_remove (state->context, state->source); ialist_free (state->ias); if (state->notify) state->notify (state->data); g_main_context_unref (state->context); g_static_mutex_unlock (&state->mutex); g_static_mutex_free (&state->mutex); g_free (state); } else { /* Otherwise, the thread is still running. Set the cancelled flag * and allow the thread to complete. When the thread completes, it * will delete state. We can't kill the thread because we'd loose * the resources allocated in gethostbyname_r. */ state->is_cancelled = TRUE; g_static_mutex_unlock (&state->mutex); } } /** * gnet_inetaddr_new_nonblock: * @hostname: host name * @port: port number (0 if the port doesn't matter) * * Creates a #GInetAddr from a host name and port without blocking. * This function does not make a DNS lookup and will fail if creating * the address would require a DNS lookup. * * Returns: a new #GInetAddr, or NULL if there was a failure or the * function would block. * **/ GInetAddr* gnet_inetaddr_new_nonblock (const gchar* hostname, gint port) { GInetAddr* ia = NULL; struct in_addr inaddr; #ifdef HAVE_IPV6 struct in6_addr in6addr; #endif g_return_val_if_fail (hostname, NULL); if (inet_pton(AF_INET, hostname, &inaddr) > 0) { struct sockaddr_in* sa_inp; ia = g_new0(GInetAddr, 1); ia->ref_count = 1; sa_inp = (struct sockaddr_in*) &ia->sa; sa_inp->sin_family = AF_INET; GNET_INETADDR_SET_SS_LEN(ia); sa_inp->sin_addr = inaddr; sa_inp->sin_port = g_htons(port); } #ifdef HAVE_IPV6 else if (inet_pton(AF_INET6, hostname, &in6addr) > 0) { struct sockaddr_in6* sa_inp; ia = g_new0(GInetAddr, 1); ia->ref_count = 1; sa_inp = (struct sockaddr_in6*) &ia->sa; sa_inp->sin6_family = AF_INET6; GNET_INETADDR_SET_SS_LEN(ia); sa_inp->sin6_addr = in6addr; sa_inp->sin6_port = g_htons(port); } #endif else return NULL; return ia; } /** * gnet_inetaddr_new_bytes * @bytes: address in raw bytes * @length: length of @bytes (4 if IPv4, 16 if IPv6) * * Creates a #GInetAddr from raw bytes. The bytes should be in * network byte order (big endian). There should be 4 bytes if it's * an IPv4 address and 16 bytees if it's an IPv6 address. The port * is set to 0. * * Returns: a new #GInetAddr, or NULL if there was a failure. * **/ GInetAddr* gnet_inetaddr_new_bytes (const gchar* bytes, const guint length) { GInetAddr* ia = NULL; g_return_val_if_fail (bytes, NULL); if (length != 4 && length != 16) return NULL; ia = g_new0 (GInetAddr, 1); ia->ref_count = 1; if (length == 4) GNET_INETADDR_FAMILY(ia) = AF_INET; #ifdef HAVE_IPV6 else GNET_INETADDR_FAMILY(ia) = AF_INET6; #endif GNET_INETADDR_SET_SS_LEN(ia); memcpy(GNET_INETADDR_ADDRP(ia), bytes, length); return ia; } /** * gnet_inetaddr_clone: * @inetaddr: a #GInetAddr * * Copies a #GInetAddr. * * Returns: a copy of @inetaddr. * **/ GInetAddr* gnet_inetaddr_clone(const GInetAddr* inetaddr) { GInetAddr* cia; g_return_val_if_fail (inetaddr != NULL, NULL); cia = g_new0(GInetAddr, 1); cia->ref_count = 1; cia->sa = inetaddr->sa; if (inetaddr->name != NULL) cia->name = g_strdup(inetaddr->name); return cia; } /** * gnet_inetaddr_delete * @inetaddr: a #GInetAddr * * Deletes a #GInetAddr. * **/ void gnet_inetaddr_delete (GInetAddr* inetaddr) { if (inetaddr != NULL) gnet_inetaddr_unref (inetaddr); } /** * gnet_inetaddr_ref * @inetaddr: a #GInetAddr * * Adds a reference to a #GInetAddr. * **/ void gnet_inetaddr_ref (GInetAddr* inetaddr) { g_return_if_fail (inetaddr != NULL); g_atomic_int_inc (&inetaddr->ref_count); } /** * gnet_inetaddr_unref * @inetaddr: a #GInetAddr * * Removes a reference from a #GInetAddr. A #GInetAddr is deleted * when the reference count reaches 0. * **/ void gnet_inetaddr_unref (GInetAddr* inetaddr) { g_return_if_fail (inetaddr != NULL); if (g_atomic_int_dec_and_test (&inetaddr->ref_count)) { g_free (inetaddr->name); g_free (inetaddr); } } /** * gnet_inetaddr_get_name: * @inetaddr: a #GInetAddr * * Gets the host name for a #GInetAddr. This functions makes a * reverse DNS lookup on the address so it may block. The canonical * name is returned if the address has no host name. * * Returns: the host name for the @inetaddr; NULL on error. * **/ gchar* gnet_inetaddr_get_name (/* const */ GInetAddr* inetaddr) { g_return_val_if_fail (inetaddr != NULL, NULL); if (inetaddr->name == NULL) { gchar* name; if ((name = gnet_gethostbyaddr(&inetaddr->sa)) != NULL) inetaddr->name = name; else inetaddr->name = gnet_inetaddr_get_canonical_name(inetaddr); } g_return_val_if_fail (inetaddr->name, NULL); return g_strdup(inetaddr->name); } /** * gnet_inetaddr_get_name_nonblock: * @inetaddr: a #GInetAddr * * Gets the host name for a #GInetAddr. This function does not make * a reverse DNS lookup and will fail if getting the name would * require a reverse DNS lookup. * * Returns: the host name for the @inetaddr, or NULL if there was an * error or it would require blocking. * **/ gchar* gnet_inetaddr_get_name_nonblock (GInetAddr* inetaddr) { if (inetaddr->name) return g_strdup(inetaddr->name); return NULL; } static void* inetaddr_get_name_async_gthread (void* arg); /** * gnet_inetaddr_get_name_async_full: * @inetaddr: a #GInetAddr * @func: callback function * @data: data to pass to @func on the callback * @notify: function to call to free @data, or NULL * @context: the #GMainContext to use for notifications, or NULL for the * default GLib main context. If in doubt, pass NULL. * @priority: the priority with which to schedule notifications in the * main context, e.g. #G_PRIORITY_DEFAULT or #G_PRIORITY_HIGH. * * Asynchronously gets the host name for a #GInetAddr. The callback * is called once the reverse DNS lookup is complete. The callback * will not be called during the call to this function. * * See gnet_inetaddr_new_list_async_full() for implementation notes. * * Returns: the ID of the lookup; NULL on failure. The ID can be * used with gnet_inetaddr_get_name_async_cancel() to cancel the * lookup. * * Since: 2.0.8 **/ GInetAddrGetNameAsyncID gnet_inetaddr_get_name_async_full (GInetAddr * inetaddr, GInetAddrGetNameAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext * context, gint priority) { GInetAddrReverseAsyncState *state = NULL; GError *err = NULL; g_return_val_if_fail (inetaddr != NULL, NULL); g_return_val_if_fail (func != NULL, NULL); if (context == NULL) context = g_main_context_default (); state = g_new0 (GInetAddrReverseAsyncState, 1); /* Set up state for callback */ g_static_mutex_init (&state->mutex); state->ia = gnet_inetaddr_clone (inetaddr); state->func = func; state->data = data; state->notify = notify; state->is_cancelled = FALSE; state->in_callback = FALSE; state->source = 0; state->name = NULL; state->context = g_main_context_ref (context); state->priority = priority; if (!g_thread_create (inetaddr_get_name_async_gthread, state, FALSE, &err)) { g_warning ("g_thread_create error: %s\n", err->message); g_error_free (err); gnet_inetaddr_delete (state->ia); if (state->notify) state->notify (state->data); g_main_context_unref (state->context); g_static_mutex_free (&state->mutex); g_free (state); return NULL; } return state; } /** * gnet_inetaddr_get_name_async: * @inetaddr: a #GInetAddr * @func: callback function * @data: data to pass to @func on the callback * * Asynchronously gets the host name for a #GInetAddr. The callback * is called once the reverse DNS lookup is complete. The call back * will not be called during the call to this function. * * See gnet_inetaddr_new_list_async() for implementation notes. * * Returns: the ID of the lookup; NULL on failure. The ID can be * used with gnet_inetaddr_get_name_async_cancel() to cancel the * lookup. * **/ GInetAddrGetNameAsyncID gnet_inetaddr_get_name_async (GInetAddr * inetaddr, GInetAddrGetNameAsyncFunc func, gpointer data) { GInetAddrGetNameAsyncID async_id; async_id = gnet_inetaddr_get_name_async_full (inetaddr, func, data, (GDestroyNotify) NULL, NULL, G_PRIORITY_DEFAULT); return async_id; } /** * gnet_inetaddr_get_name_async_cancel: * @id: ID of the lookup * * Cancels an asynchronous name lookup that was started with * gnet_inetaddr_get_name_async(). This function should only be * called from the application's main thread, ie. the thread in which * context the callback delivering the result would be called (In a * GTK+/GUI application this would be your normal GUI thread). * */ void gnet_inetaddr_get_name_async_cancel (GInetAddrGetNameAsyncID id) { GInetAddrReverseAsyncState* state = (GInetAddrReverseAsyncState*) id; g_return_if_fail (id != NULL); g_return_if_fail (state->in_callback == FALSE); g_static_mutex_lock (&state->mutex); /* Check if the thread has finished and a reply is pending. If a * reply is pending, cancel it and delete state. */ if (state->source) { g_free (state->name); _gnet_source_remove (state->context, state->source); gnet_inetaddr_delete (state->ia); if (state->notify) state->notify (state->data); g_main_context_unref (state->context); g_static_mutex_unlock (&state->mutex); g_static_mutex_free (&state->mutex); memset (state, 0xaa, sizeof (*state)); g_free (state); } else { /* Otherwise, the thread is still running. Set the cancelled flag * and allow the thread to complete. When the thread completes, it * will delete state. We can't kill the thread because we'd loose * the resources allocated in gethostbyname_r. */ state->is_cancelled = TRUE; g_static_mutex_unlock (&state->mutex); } } static gboolean inetaddr_get_name_async_gthread_dispatch (gpointer data) { GInetAddrReverseAsyncState* state = (GInetAddrReverseAsyncState*) data; g_static_mutex_lock (&state->mutex); /* make sure we don't deadlock if user tries to cancel us from callback */ state->in_callback = TRUE; /* Upcall */ (*state->func) (state->name, state->data); /* Delete state */ gnet_inetaddr_delete (state->ia); if (state->notify) state->notify (state->data); g_main_context_unref (state->context); g_static_mutex_unlock (&state->mutex); g_static_mutex_free (&state->mutex); memset (state, 0, sizeof(*state)); g_free (state); return FALSE; } static void* inetaddr_get_name_async_gthread (void* arg) { GInetAddrReverseAsyncState* state = (GInetAddrReverseAsyncState*) arg; gchar* name; g_assert (state->ia != NULL); /* Lock */ g_static_mutex_lock (&state->mutex); /* Do lookup */ if (state->ia->name) { name = g_strdup (state->ia->name); } else { /* Release lock while we block, so we can be cancelled from the main thread * without blocking it until we're done */ g_static_mutex_unlock (&state->mutex); name = gnet_gethostbyaddr(&state->ia->sa); g_static_mutex_lock (&state->mutex); } /* If cancelled, destroy state and exit. The main thread is no longer using state. */ if (state->is_cancelled) { g_free (name); gnet_inetaddr_delete (state->ia); if (state->notify) state->notify (state->data); g_main_context_unref (state->context); g_static_mutex_unlock (&state->mutex); g_static_mutex_free (&state->mutex); g_free (state); return NULL; } /* Copy name to state */ if (name) { state->name = name; } else { /* Lookup failed: name is canonical name */ state->name = gnet_inetaddr_get_canonical_name (state->ia); } /* Add a source for reply */ /* FIXME use context and priority once implemented! */ state->source = _gnet_idle_add_full (state->context, state->priority, inetaddr_get_name_async_gthread_dispatch, state, NULL); /* Unlock */ g_static_mutex_unlock (&state->mutex); /* Thread exits... */ return NULL; } /** * gnet_inetaddr_get_length * @inetaddr: a #GInetAddr * * Get the length of a #GInetAddr's address in bytes. An IPv4 * address is 4 bytes long. An IPv6 address is 16 bytes long. * * Returns: the length in bytes. * **/ gint gnet_inetaddr_get_length (const GInetAddr* inetaddr) { g_return_val_if_fail (inetaddr, 0); return GNET_INETADDR_ADDRLEN(inetaddr); } /** * gnet_inetaddr_get_bytes * @inetaddr: a #GInetAddr * @buffer: buffer to store address in * * Get a #GInetAddr's address as bytes. @buffer should be 4 bytes * long for an IPv4 address or 16 bytes long for an IPv6 address. * Use %GNET_INETADDR_MAX_LEN when allocating a static buffer and * gnet_inetaddr_get_length() when allocating a dynamic buffer. * **/ void gnet_inetaddr_get_bytes (const GInetAddr* inetaddr, gchar* buffer) { g_return_if_fail (inetaddr); g_return_if_fail (buffer); memcpy (buffer, GNET_INETADDR_ADDRP(inetaddr), GNET_INETADDR_ADDRLEN(inetaddr)); } /** * gnet_inetaddr_set_bytes * @inetaddr: a #GInetAddr * @bytes: address in raw bytes * @length: length of @bytes * * Sets the address of a #GInetAddr from bytes. @buffer will be * 4 bytes long for an IPv4 address and 16 bytes long for an IPv6 * address. * **/ void gnet_inetaddr_set_bytes (GInetAddr* inetaddr, const gchar* bytes, gint length) { gint port; g_return_if_fail (inetaddr); g_return_if_fail (bytes); g_return_if_fail (length == 4 || length == 16); /* Save the port. If the family changes and it's location moves, it could be trashed. */ port = GNET_INETADDR_PORT(inetaddr); if (length == 4) GNET_INETADDR_FAMILY(inetaddr) = AF_INET; #ifdef HAVE_IPV6 else if (length == 16) GNET_INETADDR_FAMILY(inetaddr) = AF_INET6; #endif GNET_INETADDR_SET_SS_LEN(inetaddr); memcpy (GNET_INETADDR_ADDRP(inetaddr), bytes, length); GNET_INETADDR_PORT_SET(inetaddr, port); } /** * gnet_inetaddr_get_canonical_name: * @inetaddr: a #GInetAddr * * Gets the canonical name of a #GInetAddr. An IPv4 canonical name * is a dotted decimal name (e.g., 141.213.8.59). An IPv6 canonical * name is a semicoloned hexidecimal name (e.g., 23:de:ad:be:ef). * * Returns: the canonical name; NULL on error. * **/ gchar* gnet_inetaddr_get_canonical_name(const GInetAddr* inetaddr) { gchar buffer[INET6_ADDRSTRLEN]; /* defined in netinet/in.h */ g_return_val_if_fail (inetaddr != NULL, NULL); if (inet_ntop(GNET_INETADDR_FAMILY(inetaddr), GNET_INETADDR_ADDRP(inetaddr), buffer, sizeof(buffer)) == NULL) return NULL; return g_strdup(buffer); } /** * gnet_inetaddr_get_port: * @inetaddr: a #GInetAddr * * Gets the port number of a #GInetAddr. * * Returns: the port number. */ gint gnet_inetaddr_get_port(const GInetAddr* inetaddr) { g_return_val_if_fail(inetaddr != NULL, -1); return (gint) g_ntohs(GNET_INETADDR_PORT(inetaddr)); } /** * gnet_inetaddr_set_port: * @inetaddr: a #GInetAddr * @port: new port number * * Set the port number of a #GInetAddr. * **/ void gnet_inetaddr_set_port(const GInetAddr* inetaddr, gint port) { g_return_if_fail(inetaddr != NULL); GNET_INETADDR_PORT_SET(inetaddr, g_htons(port)); } /* **************************************** */ /** * gnet_inetaddr_is_canonical * @hostname: host name * * Checks if the host name is in canonical form. * * Returns: TRUE if @name is canonical; FALSE otherwise. * **/ gboolean gnet_inetaddr_is_canonical (const gchar* name) { char buf[16]; g_return_val_if_fail (name, FALSE); if (inet_pton(AF_INET, name, buf) > 0) return TRUE; #ifdef HAVE_IPV6 { if (inet_pton(AF_INET6, name, buf) > 0) return TRUE; } #endif return FALSE; } /** * gnet_inetaddr_is_internet * @inetaddr: a #GInetAddr * * Checks if a #GInetAddr is a sensible internet address. This mean * it is not private, reserved, loopback, multicast, or broadcast. * * Note that private and loopback address are often valid addresses, * so this should only be used to check for general internet * connectivity. That is, if the address passes, it is reachable on * the internet. * * Returns: TRUE if the address is an internet address; FALSE * otherwise. * **/ gboolean gnet_inetaddr_is_internet (const GInetAddr* inetaddr) { g_return_val_if_fail(inetaddr != NULL, FALSE); if (!gnet_inetaddr_is_private(inetaddr) && !gnet_inetaddr_is_reserved(inetaddr) && !gnet_inetaddr_is_loopback(inetaddr) && !gnet_inetaddr_is_multicast(inetaddr) && !gnet_inetaddr_is_broadcast(inetaddr)) { return TRUE; } return FALSE; } /** * gnet_inetaddr_is_private * @inetaddr: a #GInetAddr * * Checks if a #GInetAddr is an address reserved for private * networks. For IPv4, this includes: * * 10.0.0.0 - 10.255.255.255 (10/8 prefix) * 172.16.0.0 - 172.31.255.255 (172.16/12 prefix) * 192.168.0.0 - 192.168.255.255 (192.168/16 prefix) * * (from RFC 1918. See also draft-manning-dsua-02.txt) * * For IPv6, this includes link local addresses (fe80::/64) and site * local addresses (fec0::/64). * * Returns: TRUE if @inetaddr is private; FALSE otherwise. * **/ gboolean gnet_inetaddr_is_private (const GInetAddr* inetaddr) { g_return_val_if_fail (inetaddr != NULL, FALSE); if (GNET_INETADDR_FAMILY(inetaddr) == AF_INET) { guint32 addr; addr = GNET_INETADDR_SA4(inetaddr).sin_addr.s_addr; addr = g_ntohl(addr); if ((addr & 0xFF000000) == (10 << 24)) return TRUE; if ((addr & 0xFFF00000) == 0xAC100000) return TRUE; if ((addr & 0xFFFF0000) == 0xC0A80000) return TRUE; } #ifdef HAVE_IPV6 else if (GNET_INETADDR_FAMILY(inetaddr) == AF_INET6) { if (IN6_IS_ADDR_LINKLOCAL(&GNET_INETADDR_SA6(inetaddr).sin6_addr) || IN6_IS_ADDR_SITELOCAL(&GNET_INETADDR_SA6(inetaddr).sin6_addr)) return TRUE; } #endif return FALSE; } /** * gnet_inetaddr_is_reserved: * @inetaddr: a #GInetAddr * * Checks if a #GInetAddr is reserved for some purpose. This * excludes addresses reserved for private networks. * * For IPv4, we check for: * 0.0.0.0/16 (top 16 bits are 0's) * Class E (top 5 bits are 11110) * * For IPv6, we check for the 00000000 prefix. * * Returns: TRUE if @inetaddr is reserved; FALSE otherwise. * **/ gboolean gnet_inetaddr_is_reserved (const GInetAddr* inetaddr) { g_return_val_if_fail (inetaddr != NULL, FALSE); if (GNET_INETADDR_FAMILY(inetaddr) == AF_INET) { guint32 addr; addr = GNET_INETADDR_SA4(inetaddr).sin_addr.s_addr; addr = g_ntohl(addr); if ((addr & 0xFFFF0000) == 0) return TRUE; if ((addr & 0xF8000000) == 0xF0000000) return TRUE; } #ifdef HAVE_IPV6 else if (GNET_INETADDR_FAMILY(inetaddr) == AF_INET6) { guint32 high_addr; high_addr = GNET_INETADDR_ADDR32(inetaddr, 0); high_addr = g_ntohl(high_addr); if ((high_addr & 0xFFFF0000) == 0) /* 0000 0000 prefix */ return TRUE; } #endif return FALSE; } /** * gnet_inetaddr_is_loopback: * @inetaddr: a #GInetAddr * * Checks if a #GInetAddr is a loopback address. The IPv4 loopback * addresses have the prefix 127.0.0.1/24. The IPv6 loopback address * is ::1. * * Returns: TRUE if @inetaddr is a loopback address; FALSE otherwise. * **/ gboolean gnet_inetaddr_is_loopback (const GInetAddr* inetaddr) { g_return_val_if_fail (inetaddr != NULL, FALSE); if (GNET_INETADDR_FAMILY(inetaddr) == AF_INET) { guint32 addr; addr = GNET_INETADDR_SA4(inetaddr).sin_addr.s_addr; addr = g_ntohl(addr); if ((addr & 0xFF000000) == (IN_LOOPBACKNET << 24)) return TRUE; } #ifdef HAVE_IPV6 else if (GNET_INETADDR_FAMILY(inetaddr) == AF_INET6) { if (IN6_IS_ADDR_LOOPBACK(&GNET_INETADDR_SA6(inetaddr).sin6_addr)) return TRUE; } #endif return FALSE; } /** * gnet_inetaddr_is_multicast * @inetaddr: a #GInetAddr * * Checks if a #GInetAddr is a multicast address. IPv4 multicast * addresses are in the range 224.0.0.0 to 239.255.255.255 (ie, the * top four bits are 1110). IPv6 multicast addresses have the prefix * FF. * * Returns: TRUE if @inetaddr is a multicast address; FALSE * otherwise. * **/ gboolean gnet_inetaddr_is_multicast (const GInetAddr* inetaddr) { g_return_val_if_fail (inetaddr != NULL, FALSE); if (GNET_INETADDR_FAMILY(inetaddr) == AF_INET) { if (IN_MULTICAST(g_htonl(GNET_INETADDR_SA4(inetaddr).sin_addr.s_addr))) return TRUE; } #ifdef HAVE_IPV6 else if (GNET_INETADDR_FAMILY(inetaddr) == AF_INET6) { if (IN6_IS_ADDR_MULTICAST(&GNET_INETADDR_SA6(inetaddr).sin6_addr)) return TRUE; } #endif return FALSE; } /** * gnet_inetaddr_is_broadcast * @inetaddr: a #GInetAddr * * Checks if a #GInetAddr is a broadcast address. The broadcast * address is 255.255.255.255. (Network broadcast addresses are * network dependent.) * * Returns: TRUE if @inetaddr is a broadcast address; FALSE * otherwise. * **/ gboolean gnet_inetaddr_is_broadcast (const GInetAddr* inetaddr) { g_return_val_if_fail (inetaddr != NULL, FALSE); if (GNET_INETADDR_FAMILY(inetaddr) == AF_INET) { if (g_htonl(GNET_SOCKADDR_IN(inetaddr->sa).sin_addr.s_addr) == INADDR_BROADCAST) return TRUE; } /* There is no IPv6 broadcast address */ return FALSE; } /** * gnet_inetaddr_is_ipv4: * @inetaddr: a #GInetAddr * * Checks if a #GInetAddr is an IPv4 address. * * Returns: TRUE if @inetaddr is an IPv4 address; FALSE otherwise. * **/ gboolean gnet_inetaddr_is_ipv4 (const GInetAddr* inetaddr) { g_return_val_if_fail (inetaddr != NULL, FALSE); return GNET_INETADDR_FAMILY(inetaddr) == AF_INET; } /** * gnet_inetaddr_is_ipv6: * @inetaddr: a #GInetAddr * * Check if a #GInetAddr is an IPv6 address. * * Returns: TRUE if @inetaddr is an IPv6 address; FALSE otherwise. * **/ gboolean gnet_inetaddr_is_ipv6 (const GInetAddr* inetaddr) { g_return_val_if_fail (inetaddr != NULL, FALSE); #ifdef HAVE_IPV6 return GNET_INETADDR_FAMILY(inetaddr) == AF_INET6; #else return FALSE; #endif } /* **************************************** */ /** * gnet_inetaddr_hash: * @p: Pointer to an #GInetAddr. * * Creates a hash code for a #GInetAddr for use with GHashTable. * * Returns: the hash code for @p. * **/ guint gnet_inetaddr_hash (gconstpointer p) { const GInetAddr* ia; guint32 port; guint32 addr = 0; g_assert(p != NULL); ia = (const GInetAddr*) p; port = (guint32) g_ntohs(GNET_INETADDR_PORT(ia)); /* We do pay attention to network byte order just in case the hash result is saved or sent to a different host. */ if (GNET_INETADDR_FAMILY(ia) == AF_INET) { struct sockaddr_in* sa_in = (struct sockaddr_in*) &ia->sa; addr = g_ntohl(sa_in->sin_addr.s_addr); } #ifdef HAVE_IPV6 else if (GNET_INETADDR_FAMILY(ia) == AF_INET6) { addr = g_ntohl(GNET_INETADDR_ADDR32(ia, 0)) ^ g_ntohl(GNET_INETADDR_ADDR32(ia, 1)) ^ g_ntohl(GNET_INETADDR_ADDR32(ia, 2)) ^ g_ntohl(GNET_INETADDR_ADDR32(ia, 3)); } #endif else g_assert_not_reached(); return (port ^ addr); } /** * gnet_inetaddr_equal: * @p1: a #GInetAddr. * @p2: another #GInetAddr. * * Compares two #GInetAddr's for equality. IPv4 and IPv6 addresses * are always unequal. * * Returns: TRUE if they are equal; FALSE otherwise. * **/ gboolean gnet_inetaddr_equal (gconstpointer p1, gconstpointer p2) { const GInetAddr* ia1 = (const GInetAddr*) p1; const GInetAddr* ia2 = (const GInetAddr*) p2; g_return_val_if_fail (p1, FALSE); g_return_val_if_fail (p2, FALSE); /* Note network byte order doesn't matter */ if (GNET_INETADDR_FAMILY(ia1) != GNET_INETADDR_FAMILY(ia2)) return FALSE; if (GNET_INETADDR_FAMILY(ia1) == AF_INET) { struct sockaddr_in* sa_in1 = (struct sockaddr_in*) &ia1->sa; struct sockaddr_in* sa_in2 = (struct sockaddr_in*) &ia2->sa; if ((sa_in1->sin_addr.s_addr == sa_in2->sin_addr.s_addr) && (sa_in1->sin_port == sa_in2->sin_port)) return TRUE; } #ifdef HAVE_IPV6 else if (GNET_INETADDR_FAMILY(ia1) == AF_INET6) { struct sockaddr_in6* sa_in1 = (struct sockaddr_in6*) &ia1->sa; struct sockaddr_in6* sa_in2 = (struct sockaddr_in6*) &ia2->sa; if (IN6_ARE_ADDR_EQUAL(&sa_in1->sin6_addr, &sa_in2->sin6_addr) && (sa_in1->sin6_port == sa_in2->sin6_port)) return TRUE; } #endif else g_assert_not_reached(); return FALSE; } /** * gnet_inetaddr_noport_equal * @p1: a #GInetAddr * @p2: another #GInetAddr * * Compares two #GInetAddr's for equality, but does not compare the * port numbers. * * Returns: TRUE if they are equal; FALSE otherwise. * **/ gboolean gnet_inetaddr_noport_equal (gconstpointer p1, gconstpointer p2) { const GInetAddr* ia1 = (const GInetAddr*) p1; const GInetAddr* ia2 = (const GInetAddr*) p2; /* Note network byte order doesn't matter */ if (GNET_INETADDR_FAMILY(ia1) != GNET_INETADDR_FAMILY(ia2)) return FALSE; if (GNET_INETADDR_FAMILY(ia1) == AF_INET) { struct sockaddr_in* sa_in1 = (struct sockaddr_in*) &ia1->sa; struct sockaddr_in* sa_in2 = (struct sockaddr_in*) &ia2->sa; if (sa_in1->sin_addr.s_addr == sa_in2->sin_addr.s_addr) return TRUE; } #ifdef HAVE_IPV6 else if (GNET_INETADDR_FAMILY(ia1) == AF_INET6) { if ((GNET_INETADDR_ADDR32(ia1, 0) == GNET_INETADDR_ADDR32(ia2, 0)) && (GNET_INETADDR_ADDR32(ia1, 1) == GNET_INETADDR_ADDR32(ia2, 1)) && (GNET_INETADDR_ADDR32(ia1, 2) == GNET_INETADDR_ADDR32(ia2, 2)) && (GNET_INETADDR_ADDR32(ia1, 3) == GNET_INETADDR_ADDR32(ia2, 3))) return TRUE; } #endif else g_assert_not_reached(); return FALSE; } /* **************************************** */ /** * gnet_inetaddr_get_host_name: * * Gets the host's name. * * Returns: the name of the host; NULL on error. * **/ gchar* gnet_inetaddr_get_host_name (void) { gchar* name; #ifndef GNET_WIN32 struct utsname myname; GInetAddr* addr; /* Get system name */ if (uname(&myname) < 0) return NULL; /* Do forward lookup */ addr = gnet_inetaddr_new (myname.nodename, 0); if (!addr) return NULL; /* Do backwards lookup */ name = gnet_inetaddr_get_name (addr); if (!name) name = g_strdup (myname.nodename); gnet_inetaddr_delete (addr); #else name = g_new0(char, 256); if (gethostname(name, 256)) { g_free(name); return NULL; } #endif return name; } /** * gnet_inetaddr_get_host_addr: * * Get the host's address. * * Returns: the address of the host; NULL on error. * **/ GInetAddr* gnet_inetaddr_get_host_addr (void) { gchar* name; GInetAddr* ia = NULL; name = gnet_inetaddr_get_host_name(); if (name != NULL) { ia = gnet_inetaddr_new(name, 0); g_free(name); } return ia; } /* **************************************** */ static GInetAddr* autodetect_internet_interface_ipv4 (void); static GInetAddr* autodetect_internet_interface_ipv6 (void); /** * gnet_inetaddr_autodetect_internet_interface * * Finds an interface likely to be connected to the internet. This * function can be used to automatically configure peer-to-peer * applications. The function relies on heuristics and does not * always work correctly, especially if the host is behind a NAT. * * Returns: an address of an internet interface; NULL if it couldn't * find one or on error. * **/ GInetAddr* gnet_inetaddr_autodetect_internet_interface (void) { GInetAddr* iface = NULL; GIPv6Policy policy; policy = gnet_ipv6_get_policy(); switch (policy) { case GIPV6_POLICY_IPV4_THEN_IPV6: { iface = autodetect_internet_interface_ipv4(); if (iface) break; iface = autodetect_internet_interface_ipv6(); break; } case GIPV6_POLICY_IPV6_THEN_IPV4: { iface = autodetect_internet_interface_ipv6(); if (iface) break; iface = autodetect_internet_interface_ipv4(); break; } case GIPV6_POLICY_IPV4_ONLY: { iface = autodetect_internet_interface_ipv4(); break; } case GIPV6_POLICY_IPV6_ONLY: { iface = autodetect_internet_interface_ipv6(); break; } } /* If that didn't work, return the first Internet interface. */ if (!iface) iface = gnet_inetaddr_get_internet_interface (); return iface; } static GInetAddr* autodetect_internet_interface_ipv4 (void) { GInetAddr* ia; GInetAddr* iface; /* First try to get the interface with a route to junglemonkey.net (141.213.11.223). This uses the connected UDP socket method described by Stevens. It does not work on all systems. (see Stevens UNPv1 pp 231-3) */ ia = gnet_inetaddr_new_nonblock ("141.213.11.223", 0); g_assert (ia); iface = gnet_inetaddr_get_interface_to (ia); gnet_inetaddr_delete (ia); /* We want an internet interface */ if (iface && gnet_inetaddr_is_internet(iface)) return iface; gnet_inetaddr_delete (iface); return NULL; } static GInetAddr* autodetect_internet_interface_ipv6 (void) { GInetAddr* ia; GInetAddr* iface; /* Try IPv6 using kame.net's address */ ia = gnet_inetaddr_new_nonblock("3FFE:501:4819:2000:210:F3FF:FE03:4D0", 0); g_assert (ia); iface = gnet_inetaddr_get_interface_to (ia); gnet_inetaddr_delete (ia); /* We want an internet interface */ if (iface && gnet_inetaddr_is_internet(iface)) return iface; gnet_inetaddr_delete (iface); return NULL; } /** * gnet_inetaddr_get_interface_to: * @inetaddr: a #GInetAddr * * Figures out which local interface would be used to send a packet * to @inetaddr. This works on some systems, but not others. We * recommend using gnet_inetaddr_autodetect_internet_interface() to * find an Internet interface since it's more likely to work. * * Returns: the address of an interface used to route packets to * @inetaddr; NULL if there is no such interface or the system does * not support this check. * **/ GInetAddr* gnet_inetaddr_get_interface_to (const GInetAddr* inetaddr) { SOCKET sockfd; struct sockaddr_storage myaddr; socklen_t len; GInetAddr* iface; g_return_val_if_fail (inetaddr, NULL); sockfd = socket (GNET_INETADDR_FAMILY(inetaddr), SOCK_DGRAM, 0); if (!GNET_IS_SOCKET_VALID(sockfd)) { g_warning ("socket() failed"); return NULL; } if (connect (sockfd, &GNET_INETADDR_SA(inetaddr), GNET_INETADDR_LEN(inetaddr)) == -1) { GNET_CLOSE_SOCKET(sockfd); return NULL; } len = sizeof (myaddr); if (getsockname (sockfd, (struct sockaddr*) &myaddr, &len) != 0) { GNET_CLOSE_SOCKET(sockfd); return NULL; } iface = g_new0 (GInetAddr, 1); iface->ref_count = 1; iface->sa = myaddr; return iface; } /** * gnet_inetaddr_get_internet_interface * * Finds an internet interface. This function finds the first * interface that is an internet address. IPv6 policy is followed. * * This function does not work on some systems. We recommend using * gnet_inetaddr_autodetect_internet_interface(), which performs * additional checks. * * Returns: the address of an internet interface; NULL if no internet * interfaces or on error. * **/ GInetAddr* gnet_inetaddr_get_internet_interface (void) { GList* interfaces; GList* i; GInetAddr* ipv4_addr = NULL; GInetAddr* ipv6_addr = NULL; GInetAddr* iface = NULL; GIPv6Policy policy; /* Get a list of interfaces */ interfaces = gnet_inetaddr_list_interfaces (); if (interfaces == NULL) return NULL; /* Find the first IPv4 and IPv6 interfaces */ for (i = interfaces; i != NULL; i = i->next) { GInetAddr* ia; ia = (GInetAddr*) i->data; if (gnet_inetaddr_is_internet (ia)) { if (ipv4_addr == NULL && gnet_inetaddr_is_ipv4 (ia)) ipv4_addr = ia; else if (ipv6_addr == NULL && gnet_inetaddr_is_ipv6 (ia)) ipv6_addr = ia; } } /* Choose one based on policy */ policy = gnet_ipv6_get_policy(); switch (policy) { case GIPV6_POLICY_IPV4_THEN_IPV6: { if (ipv4_addr) iface = ipv4_addr; else iface = ipv6_addr; break; } case GIPV6_POLICY_IPV6_THEN_IPV4: { if (ipv6_addr) iface = ipv6_addr; else iface = ipv4_addr; break; } case GIPV6_POLICY_IPV4_ONLY: { iface = ipv4_addr; break; } case GIPV6_POLICY_IPV6_ONLY: { iface = ipv6_addr; break; } } /* Copy the interface */ if (iface != NULL) iface = gnet_inetaddr_clone (iface); /* Delete the interface list */ for (i = interfaces; i != NULL; i = i->next) gnet_inetaddr_delete ((GInetAddr*) i->data); g_list_free (interfaces); return iface; } /** * gnet_inetaddr_is_internet_domainname: * @name: name * * Checks if a name is a sensible internet domain name. This * function uses heuristics. It does not use DNS and will not block. * For example, "localhost" and "10.10.23.42" are not sensible * internet domain names. (10.10.23.42 is a network address, but not * accessible to the internet at large.) * * Returns: TRUE if @name is a sensible Internet domain name; FALSE * otherwise. * **/ gboolean gnet_inetaddr_is_internet_domainname (const gchar* name) { GInetAddr* addr; g_return_val_if_fail (name, FALSE); /* The name can't be localhost or localhost.localdomain */ if (!strcmp(name, "localhost") || !strcmp(name, "localhost.localdomain")) { return FALSE; } /* The name must have a dot in it */ if (!strchr(name, '.')) { return FALSE; } /* If it's dotted decimal, make sure it's valid */ addr = gnet_inetaddr_new_nonblock (name, 0); if (addr) { gboolean rv; rv = gnet_inetaddr_is_internet (addr); gnet_inetaddr_delete (addr); if (!rv) return FALSE; } return TRUE; } /* **************************************** */ #ifndef GNET_WIN32 /* Unix specific version */ /** * gnet_inetaddr_list_interfaces * * Gets a list of #GInetAddr interfaces's on this host. This list * includes all "up" Internet interfaces and the loopback interface, * if it exists. * * On Windows if you do not have IPv6 installed then this function * will return up to 10 interfaces. * * This function may not work on some systems. * * Returns: A list of #GInetAddr's representing available interfaces. * The caller should delete the list and the addresses. * **/ GList* gnet_inetaddr_list_interfaces (void) { GList* list = NULL; /* Use USAGI project's getifaddr() if available. */ #ifdef HAVE_LINUX_NETLINK_H # define HAVE_GETIFADDRS 1 # define getifaddrs usagi_getifaddrs # define freeifaddrs usagi_freeifaddrs #endif #ifdef HAVE_GETIFADDRS int rv; struct ifaddrs* ifs; struct ifaddrs* i; rv = getifaddrs (&ifs); if (rv != 0) return NULL; for (i = ifs; i != NULL; i = i->ifa_next) { struct sockaddr* sa; void* src; size_t len; GInetAddr* ia; /* Skip if not up or is loopback */ if (!(i->ifa_flags & IFF_UP) || (i->ifa_flags & IFF_LOOPBACK)) continue; /* Skip if no address */ if (!i->ifa_addr) continue; /* Get address, or skip if not IPv4 or IPv6 */ sa = (struct sockaddr*) i->ifa_addr; if (sa->sa_family == AF_INET) { src = (void*) &((struct sockaddr_in*) sa)->sin_addr; len = sizeof(struct in_addr); } #ifdef HAVE_IPV6 else if (sa->sa_family == AF_INET6) { src = (char*) &((struct sockaddr_in6*) sa)->sin6_addr; len = sizeof(struct in6_addr); } #endif else continue; ia = g_new0 (GInetAddr, 1); ia->ref_count = 1; GNET_INETADDR_FAMILY(ia) = sa->sa_family; GNET_INETADDR_SET_SS_LEN(ia); memcpy(GNET_INETADDR_ADDRP(ia), src, len); list = g_list_prepend (list, ia); } freeifaddrs (ifs); #else /* Old-fashioned IPv4-only method */ gint len, lastlen; gchar* buf; gchar* ptr; gint sockfd; struct ifconf ifc; struct ifreq* ifr; /* Create a dummy socket */ sockfd = socket(AF_INET, SOCK_DGRAM, 0); if (!GNET_IS_SOCKET_VALID(sockfd)) return NULL; len = 8 * sizeof(struct ifreq); lastlen = 0; /* Get the list of interfaces. We might have to try multiple times if there are a lot of interfaces. */ while(1) { buf = g_new0(gchar, len); ifc.ifc_len = len; ifc.ifc_buf = buf; if (ioctl(sockfd, SIOCGIFCONF, &ifc) < 0) { /* Might have failed because our buffer was too small */ if (errno != EINVAL || lastlen != 0) { g_free(buf); return NULL; } } else { /* Break if we got all the interfaces */ if (ifc.ifc_len == lastlen) break; lastlen = ifc.ifc_len; } /* Did not allocate big enough buffer - try again */ len += 8 * sizeof(struct ifreq); g_free(buf); } /* Create the list. Stevens has a much more complex way of doing this, but his is probably much more correct portable. */ for (ptr = buf; ptr < (buf + ifc.ifc_len); #ifdef HAVE_SOCKADDR_SA_LEN ptr += sizeof(ifr->ifr_name) + ifr->ifr_addr.sa_len #else ptr += sizeof(struct ifreq) #endif ) { struct sockaddr_storage addr; int rv; GInetAddr* ia; ifr = (struct ifreq*) ptr; /* Ignore non-AF_INET */ if (ifr->ifr_addr.sa_family != AF_INET) { #ifdef HAVE_IPV6 if (ifr->ifr_addr.sa_family != AF_INET6) #endif continue; } /* Save the address - the next call will clobber it */ memcpy(&addr, &ifr->ifr_addr, sizeof(addr)); /* Get the flags */ rv = ioctl(sockfd, SIOCGIFFLAGS, ifr); if (rv == -1) continue; /* Ignore entries that aren't up or loopback. Someday we'll write an interface structure and include this stuff. */ if (!(ifr->ifr_flags & IFF_UP) || (ifr->ifr_flags & IFF_LOOPBACK)) continue; /* Create an InetAddr for this one and add it to our list */ ia = g_new0 (GInetAddr, 1); ia->ref_count = 1; ia->sa = addr; list = g_list_prepend (list, ia); } g_free (buf); #endif list = g_list_reverse (list); return list; } #else /* GNET_WIN32 Windows specific version */ GList* gnet_inetaddr_list_interfaces (void) { GList* list; SOCKET s; int wsError; DWORD bytesReturned; SOCKADDR_IN* pAddrInet; u_long SetFlags; INTERFACE_INFO localAddr[10]; /* Assumes there will be no more than 10 IP interfaces */ int numLocalAddr; int i; struct sockaddr_storage addr; GInetAddr *ia; /*SOCKADDR_IN* pAddrInet2; */ /* For testing */ PIP_ADAPTER_ADDRESSES_GNET gaa_struct, p_aa; PIP_ADAPTER_UNICAST_ADDRESS_GNET p_ua; ULONG out_len; DWORD gaa_rv; void* src; size_t len; struct sockaddr* sa; list = NULL; /* IPv6 codepath begin */ if (pfn_getaddaptersaddresses) { /* first call fails but returns needed buffer size */ out_len = 0; gaa_struct = NULL; pfn_getaddaptersaddresses( AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_FRIENDLY_NAME | GAA_FLAG_SKIP_MULTICAST, NULL, gaa_struct, &out_len); gaa_struct = (PIP_ADAPTER_ADDRESSES_GNET)malloc(out_len); gaa_rv = pfn_getaddaptersaddresses( AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_FRIENDLY_NAME |GAA_FLAG_SKIP_MULTICAST, NULL, gaa_struct, &out_len); if (gaa_rv != ERROR_SUCCESS) return NULL; p_aa = gaa_struct; while (p_aa) { p_ua = p_aa->FirstUnicastAddress; while (p_ua) { if (p_ua->Address.lpSockaddr) { sa = (struct sockaddr*) p_ua->Address.lpSockaddr; if (sa->sa_family == AF_INET) { src = (void*) &((struct sockaddr_in*) sa)->sin_addr; len = sizeof(struct in_addr); } else if (sa->sa_family == AF_INET6) { src = (char*) &((struct sockaddr_in6*) sa)->sin6_addr; len = sizeof(struct in6_addr); } else { p_ua = p_ua->Next; continue; } ia = g_new0 (GInetAddr, 1); ia->ref_count = 1; GNET_INETADDR_FAMILY(ia) = sa->sa_family; GNET_INETADDR_SET_SS_LEN(ia); memcpy(GNET_INETADDR_ADDRP(ia), src, len); if (gnet_inetaddr_is_loopback(ia)) { g_free(ia); } else { list = g_list_prepend (list, ia); } } p_ua = p_ua->Next; } p_aa = p_aa->Next; } free(gaa_struct); return list; } /* IPv6 codepath end */ if((s = WSASocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP, NULL, 0, 0)) == INVALID_SOCKET) { return NULL; } /* Enumerate all IP interfaces */ wsError = WSAIoctl(s, SIO_GET_INTERFACE_LIST, NULL, 0, &localAddr, sizeof(localAddr), &bytesReturned, NULL, NULL); if (wsError == SOCKET_ERROR) { closesocket(s); return NULL; } closesocket(s); /* Display interface information */ numLocalAddr = (bytesReturned/sizeof(INTERFACE_INFO)); for (i=0; isa, &addr, sizeof(addr)); ia->ref_count = 1; list = g_list_prepend(list, ia); } } return list; } #endif /* end Windows specific gnet_inetaddr_list_interfaces */ gnet-2.0.8/src/md5.h0000644000175000017500000000215010751326730011026 00000000000000/** This code is in the public domain. See md5.c for details. Authors: Colin Plumb [original author] David Helder [GNet API] */ #ifndef _GNET_MD5_H #define _GNET_MD5_H #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** * GMD5 * * GMD5 is a MD5 hash. * **/ typedef struct _GMD5 GMD5; /** * GNET_MD5_HASH_LENGTH * * Length of the MD5 hash in bytes. **/ #define GNET_MD5_HASH_LENGTH 16 GMD5* gnet_md5_new (const gchar* buffer, guint length); GMD5* gnet_md5_new_string (const gchar* str); GMD5* gnet_md5_clone (const GMD5* md5); void gnet_md5_delete (GMD5* md5); GMD5* gnet_md5_new_incremental (void); void gnet_md5_update (GMD5* md5, const gchar* buffer, guint length); void gnet_md5_final (GMD5* md5); gboolean gnet_md5_equal (gconstpointer p1, gconstpointer p2); guint gnet_md5_hash (gconstpointer p); gchar* gnet_md5_get_digest (const GMD5* md5); gchar* gnet_md5_get_string (const GMD5* md5); void gnet_md5_copy_string (const GMD5* md5, gchar* buffer); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _GNET_MD5_H */ gnet-2.0.8/src/mcast.c0000644000175000017500000004115310751326730011451 00000000000000/* GNet - Networking library * Copyright (C) 2000, 2002-3 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "gnet-private.h" #include "mcast.h" #define GNET_UDP_SOCKET(s) ((GUdpSocket*)(s)) #define GNET_IS_MCAST_SOCKET(s) ((s)&&(GNET_UDP_SOCKET(s)->type == GNET_MCAST_SOCKET_TYPE_COOKIE)) /** * gnet_mcast_socket_new * * Creates a #GMcastSocket bound to all interfaces and an arbitrary * port. * * Returns: a new #GMcastSocket; NULL on error. * **/ GMcastSocket* gnet_mcast_socket_new (void) { return gnet_mcast_socket_new_full (NULL, 0); } /** * gnet_mcast_socket_new_with_port * @port: port to bind to * * Creates a #GMcastSocket bound to all interfaces and port @port. * If @port is 0, an arbitrary port will be used. Use this * constructor if you know the port of the group you will join. Most * applications will use this constructor. * * Returns: a new #GMcastSocket; NULL on error. * **/ GMcastSocket* gnet_mcast_socket_new_with_port (gint port) { return gnet_mcast_socket_new_full (NULL, port); } /** * gnet_mcast_socket_new_full * @iface: interface to bind to (NULL for all interfaces) * @port: port to bind to (0 for an arbitrary port) * * Creates a #GMcastSocket bound to interface @iface and port @port. * If @iface is NULL, all interfaces will be used. If @port is 0, an * arbitrary port will be used. To receive packets from this group, * call gnet_mcast_socket_join_group() next. Loopback is disabled by * default. * * Returns: a new #GMcastSocket; NULL on error. * **/ GMcastSocket* gnet_mcast_socket_new_full (const GInetAddr* iface, gint port) { struct sockaddr_storage sa; GMcastSocket* ms; GUdpSocket* us; const int on = 1; int sockfd; /* Create sockfd and address */ sockfd = _gnet_create_listen_socket (SOCK_DGRAM, iface, port, &sa); if (!GNET_IS_SOCKET_VALID(sockfd)) { g_warning ("socket() failed"); return NULL; } /* Set socket option to share the UDP port */ if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (void*) &on, sizeof(on)) != 0) g_warning("Can't reuse mcast socket\n"); /* Bind to the socket to some local address and port */ if (bind(sockfd, &GNET_SOCKADDR_SA(sa), GNET_SOCKADDR_LEN(sa)) != 0) { GNET_CLOSE_SOCKET (sockfd); return NULL; } /* Create socket */ ms = g_new0(GMcastSocket, 1); us = (GUdpSocket *) ms; us->type = GNET_MCAST_SOCKET_TYPE_COOKIE; us->sockfd = sockfd; us->sa = sa; us->ref_count = 1; gnet_mcast_socket_set_loopback (ms, FALSE); return ms; } /** * gnet_mcast_socket_delete: * @socket: a #GMcastSocket, or NULL * * Deletes a #GMcastSocket. Does nothing if @socket is NULL. * **/ void gnet_mcast_socket_delete (GMcastSocket* socket) { g_return_if_fail (socket == NULL || GNET_IS_MCAST_SOCKET (socket)); gnet_udp_socket_unref ((GUdpSocket *) socket); } /** * gnet_mcast_socket_ref * @socket: a #GMcastSocket * * Adds a reference to a #GMcastSocket. * **/ void gnet_mcast_socket_ref (GMcastSocket* socket) { g_return_if_fail (socket != NULL); g_return_if_fail (GNET_IS_MCAST_SOCKET (socket)); gnet_udp_socket_ref ((GUdpSocket *) socket); } /** * gnet_mcast_socket_unref * @socket: a #GMcastSocket * * Removes a reference from a #GMcastSocket. A #GMcastSocket is * deleted when the reference count reaches 0. * **/ void gnet_mcast_socket_unref (GMcastSocket* socket) { g_return_if_fail (socket != NULL); g_return_if_fail (GNET_IS_MCAST_SOCKET (socket)); gnet_udp_socket_unref ((GUdpSocket *) socket); } /** * gnet_mcast_socket_get_io_channel: * @socket: a #GMcastSocket * * Gets the #GIOChannel of a #GMcastSocket. * * Use the channel with g_io_add_watch() to check if the socket is * readable or writable. If the channel is readable, call * gnet_mcast_socket_receive() to receive a packet. If the channel * is writable, call gnet_mcast_socket_send() to send a packet. This * is not a normal giochannel - do not read from or write to it. * * Every #GMcastSocket has one and only one #GIOChannel. If you ref * the channel, then you must unref it eventually. Do not close the * channel. The channel is closed by GNet when the socket is * deleted. * * Returns: a #GIOChannel. * **/ GIOChannel* gnet_mcast_socket_get_io_channel (GMcastSocket* socket) { g_return_val_if_fail (socket != NULL, NULL); g_return_val_if_fail (GNET_IS_MCAST_SOCKET (socket), NULL); return gnet_udp_socket_get_io_channel((GUdpSocket*) socket); } /** * gnet_mcast_socket_get_local_inetaddr * @socket: a #GMcastSocket * * Gets the local host's address from a #GMcastSocket. * * Returns: a #GInetAddr. * **/ GInetAddr* gnet_mcast_socket_get_local_inetaddr (const GMcastSocket* socket) { g_return_val_if_fail (socket != NULL, NULL); g_return_val_if_fail (GNET_IS_MCAST_SOCKET (socket), NULL); return gnet_udp_socket_get_local_inetaddr((GUdpSocket*) socket); } /** * gnet_mcast_socket_join_group * @socket: a #GMcastSocket * @inetaddr: address of the group * * Joins a multicast group. Join only one group per socket. * * Returns: 0 on success. * **/ gint gnet_mcast_socket_join_group (GMcastSocket* socket, const GInetAddr* inetaddr) { GUdpSocket *udpsocket; gint rv = -1; g_return_val_if_fail (socket != NULL, -1); g_return_val_if_fail (GNET_IS_MCAST_SOCKET (socket), -1); udpsocket = GNET_UDP_SOCKET (socket); if (GNET_INETADDR_FAMILY(inetaddr) == AF_INET) { struct ip_mreq mreq; /* Create the multicast request structure */ memcpy(&mreq.imr_multiaddr, GNET_INETADDR_ADDRP(inetaddr), sizeof(mreq.imr_multiaddr)); mreq.imr_interface.s_addr = g_htonl(INADDR_ANY); /* Join the group */ rv = setsockopt (udpsocket->sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void*) &mreq, sizeof(mreq)); } #ifdef HAVE_IPV6 else if (GNET_INETADDR_FAMILY(inetaddr) == AF_INET6) { struct ipv6_mreq mreq; /* Create the multicast request structure */ memcpy(&mreq.ipv6mr_multiaddr, GNET_INETADDR_ADDRP(inetaddr), sizeof(mreq.ipv6mr_multiaddr)); mreq.ipv6mr_interface = 0; /* Join the group */ rv = setsockopt (udpsocket->sockfd, IPPROTO_IPV6, IPV6_JOIN_GROUP, (void*) &mreq, sizeof(mreq)); } #endif else g_assert_not_reached (); return rv; } /** * gnet_mcast_socket_leave_group * @socket: a #GMcastSocket * @inetaddr: address of the group * * Leaves a mulitcast group. * * Returns: 0 on success. * **/ gint gnet_mcast_socket_leave_group (GMcastSocket* socket, const GInetAddr* inetaddr) { GUdpSocket *udpsocket; gint rv = -1; g_return_val_if_fail (socket != NULL, -1); g_return_val_if_fail (GNET_IS_MCAST_SOCKET (socket), -1); udpsocket = GNET_UDP_SOCKET (socket); if (GNET_INETADDR_FAMILY(inetaddr) == AF_INET) { struct ip_mreq mreq; /* Create the multicast request structure */ memcpy(&mreq.imr_multiaddr, GNET_INETADDR_ADDRP(inetaddr), sizeof(mreq.imr_multiaddr)); mreq.imr_interface.s_addr = g_htonl(INADDR_ANY); /* Join the group */ rv = setsockopt (udpsocket->sockfd, IPPROTO_IP, IP_DROP_MEMBERSHIP, (void*) &mreq, sizeof(mreq)); } #ifdef HAVE_IPV6 else if (GNET_INETADDR_FAMILY(inetaddr) == AF_INET6) { struct ipv6_mreq mreq; /* Create the multicast request structure */ memcpy(&mreq.ipv6mr_multiaddr, GNET_INETADDR_ADDRP(inetaddr), sizeof(mreq.ipv6mr_multiaddr)); mreq.ipv6mr_interface = 0; /* Join the group */ rv = setsockopt (udpsocket->sockfd, IPPROTO_IPV6, IPV6_LEAVE_GROUP, (void*) &mreq, sizeof(mreq)); } #endif else g_assert_not_reached (); return rv; } /** * gnet_mcast_socket_get_ttl * @socket: a #GMcastSocket * * Gets the multicast time-to-live (TTL) of a #GMcastSocket. All IP * multicast packets have a TTL field. This field is decremented by * a router before it forwards the packet. If the TTL reaches zero, * the packet is discarded. The default value is sufficient for most * applications. * * The table below shows the scope for a given TTL. The scope is * only an estimate. * * * TTL and scope * * * * TTL * Scope * * * * * 0 * node local * * * 1 * link local * * * 2-32 * site local * * * 33-64 * region local * * * 65-128 * continent local * * * 129-255 * unrestricted (global) * * * *
* * Returns: the TTL (an integer between 0 and 255), -1 if the kernel * default is being used, or an integer less than -1 on error. * **/ gint gnet_mcast_socket_get_ttl (const GMcastSocket* socket) { GUdpSocket *udpsocket; guchar ttl; socklen_t ttl_size; int rv = -1; g_return_val_if_fail (socket != NULL, -2); g_return_val_if_fail (GNET_IS_MCAST_SOCKET (socket), -2); udpsocket = GNET_UDP_SOCKET (socket); ttl_size = sizeof(ttl); /* Get the IPv4 TTL if the socket is bound to an IPv4 address */ if (GNET_SOCKADDR_FAMILY (udpsocket->sa) == AF_INET) { rv = getsockopt (udpsocket->sockfd, IPPROTO_IP, IP_MULTICAST_TTL, (void*) &ttl, &ttl_size); } /* Get the IPv6 TTL if the socket is bound to an IPv6 address */ #ifdef HAVE_IPV6 else if (GNET_SOCKADDR_FAMILY (udpsocket->sa) == AF_INET6) { rv = getsockopt (udpsocket->sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (void*) &ttl, &ttl_size); } #endif else g_assert_not_reached (); if (rv == -1) return -2; return ttl; } /** * gnet_mcast_socket_set_ttl * @socket: a #GMcastSocket * @ttl: value to set TTL to * * Sets the time-to-live (TTL) default of a #GMcastSocket. Set the TTL * to -1 to use the kernel default. The default value is sufficient * for most applications. * * Returns: 0 if successful. * **/ gint gnet_mcast_socket_set_ttl (GMcastSocket* socket, gint ttl) { GUdpSocket *udpsocket; guchar ttlb; int rv1, rv2; #ifdef HAVE_IPV6 GIPv6Policy policy; #endif g_return_val_if_fail (socket != NULL, -1); g_return_val_if_fail (GNET_IS_MCAST_SOCKET (socket), -1); udpsocket = GNET_UDP_SOCKET (socket); rv1 = -1; rv2 = -1; /* If the bind address is anything IPv4 *or* the bind address is 0::0 IPv6 and IPv6 policy allows IPv4, set IP_TTL. In the latter case, if we bind to 0::0 and the host is dual-stacked, then all IPv4 interfaces will be bound to also. */ if (GNET_SOCKADDR_FAMILY (udpsocket->sa) == AF_INET #ifdef HAVE_IPV6 || (GNET_SOCKADDR_FAMILY (udpsocket->sa) == AF_INET6 && IN6_IS_ADDR_UNSPECIFIED(&GNET_SOCKADDR_SA6(udpsocket->sa).sin6_addr) && ((policy = gnet_ipv6_get_policy()) == GIPV6_POLICY_IPV4_THEN_IPV6 || policy == GIPV6_POLICY_IPV6_THEN_IPV4)) #endif ) { ttlb = ttl; rv1 = setsockopt (udpsocket->sockfd, IPPROTO_IP, IP_MULTICAST_TTL, (void*) &ttlb, sizeof(ttlb)); } /* If the bind address is IPv6, set IPV6_UNICAST_HOPS */ #ifdef HAVE_IPV6 if (GNET_SOCKADDR_FAMILY (udpsocket->sa) == AF_INET6) { ttlb = ttl; rv2 = setsockopt (udpsocket->sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (void*) &ttlb, sizeof(ttlb)); } #endif if (rv1 == -1 && rv2 == -1) return -1; return 0; } /** * gnet_mcast_socket_is_loopback * @socket: a #GMcastSocket * * Checks if a #GMcastSocket has loopback enabled. If loopback is * enabled, all packets sent by the host will also be received by the * host. Loopback is disabled by default. * * Returns: 0 if loopback is disabled, 1 if enabled, and -1 on error. * **/ gint gnet_mcast_socket_is_loopback (const GMcastSocket* socket) { GUdpSocket *udpsocket; socklen_t flag_size; int rv = -1; gint is_loopback = 0; g_return_val_if_fail (socket != NULL, -1); g_return_val_if_fail (GNET_IS_MCAST_SOCKET (socket), -1); udpsocket = GNET_UDP_SOCKET (socket); /* Get IPv4 loopback if it's bound to a IPv4 address */ if (GNET_SOCKADDR_FAMILY (udpsocket->sa) == AF_INET) { guchar flag; flag_size = sizeof (flag); rv = getsockopt (udpsocket->sockfd, IPPROTO_IP, IP_MULTICAST_LOOP, (char *) &flag, &flag_size); if (flag) is_loopback = 1; } /* Otherwise, get IPv6 loopback */ #ifdef HAVE_IPV6 else if (GNET_SOCKADDR_FAMILY (udpsocket->sa) == AF_INET6) { guint flag; flag_size = sizeof (flag); rv = getsockopt (udpsocket->sockfd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (void *) &flag, &flag_size); if (flag) is_loopback = 1; } #endif else g_assert_not_reached(); if (rv == -1) return -1; return is_loopback; } /** * gnet_mcast_socket_set_loopback * @socket: a #GMcastSocket * @enable: should loopback be enabled? * * Enables (or disables) loopback on a #GMcastSocket. Loopback is * disabled by default. * * Returns: 0 if successful. * **/ gint gnet_mcast_socket_set_loopback (GMcastSocket* socket, gboolean enable) { GUdpSocket *udpsocket; int rv1, rv2; #ifdef HAVE_IPV6 GIPv6Policy policy; #endif g_return_val_if_fail (socket != NULL, -1); g_return_val_if_fail (GNET_IS_MCAST_SOCKET (socket), -1); udpsocket = GNET_UDP_SOCKET (socket); rv1 = -1; rv2 = -1; /* Set IPv4 loopback. (As in set_ttl().) */ if (GNET_SOCKADDR_FAMILY (udpsocket->sa) == AF_INET #ifdef HAVE_IPV6 || (GNET_SOCKADDR_FAMILY (udpsocket->sa) == AF_INET6 && IN6_IS_ADDR_UNSPECIFIED(&GNET_SOCKADDR_SA6 (udpsocket->sa).sin6_addr) && ((policy = gnet_ipv6_get_policy()) == GIPV6_POLICY_IPV4_THEN_IPV6 || policy == GIPV6_POLICY_IPV6_THEN_IPV4)) #endif ) { guchar flag; flag = (guchar) enable; rv1 = setsockopt (udpsocket->sockfd, IPPROTO_IP, IP_MULTICAST_LOOP, (char *) &flag, sizeof(flag)); } /* Set IPv6 loopback */ #ifdef HAVE_IPV6 if (GNET_SOCKADDR_FAMILY (udpsocket->sa) == AF_INET6) { guint flag; flag = (guint) enable; rv2 = setsockopt (udpsocket->sockfd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (void *) &flag, sizeof(flag)); } #endif if (rv1 == -1 && rv2 == -1) return -1; return 0; } /** * gnet_mcast_socket_send * @socket: a #GMcastSocket * @buffer: buffer to send * @length: length of buffer * @dst: destination address * * Sends data to a host using a #GMcastSocket. * * Returns: 0 if successful. * **/ gint gnet_mcast_socket_send (GMcastSocket* socket, const gchar* buffer, gint length, const GInetAddr* dst) { return gnet_udp_socket_send((GUdpSocket*) socket, buffer, length, dst); } /** * gnet_mcast_socket_receive * @socket: a #GMcastSocket * @buffer: buffer to write to * @length: length of @buffer * @src: pointer to source address (optional) * * Receives data using a #GMcastSocket. If @src is set, the source * address is stored in the location @src points to. The address is * caller owned. * * Returns: the number of bytes received, -1 if unsuccessful. * **/ gint gnet_mcast_socket_receive (GMcastSocket* socket, gchar* buffer, gint length, GInetAddr** src) { return gnet_udp_socket_receive((GUdpSocket*) socket, buffer, length, src); } /** * gnet_mcast_socket_has_packet: * @socket: a #GMcastSocket * * Tests if a #GMcastSocket has a packet waiting to be received. * * Returns: TRUE if there is packet waiting, FALSE otherwise. * **/ gboolean gnet_mcast_socket_has_packet (const GMcastSocket* socket) { return gnet_udp_socket_has_packet((const GUdpSocket*) socket); } gnet-2.0.8/src/tcp.c0000644000175000017500000010573510751326730011137 00000000000000/* GNet - Networking library * Copyright (C) 2000-2003 David Helder * Copyright (C) 2000-2004 Andrew Lanoix * Copyright (C) 2007 Tim-Philipp Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "gnet-private.h" #include "socks-private.h" #include "tcp.h" static gboolean gnet_tcp_socket_new_async_cb (GIOChannel * iochannel, GIOCondition condition, gpointer data); static void gnet_tcp_socket_connect_inetaddr_cb (GList * ia_list, gpointer data); static void gnet_tcp_socket_connect_tcp_cb (GTcpSocket * socket, gpointer data); typedef struct _GTcpSocketAsyncState { GTcpSocket * socket; GTcpSocketNewAsyncFunc func; gpointer data; GDestroyNotify notify; gint flags; GIOChannel * iochannel; guint connect_watch; #ifdef GNET_WIN32 gint errorcode; #endif GMainContext * context; /* we hold a ref */ gint priority; } GTcpSocketAsyncState; typedef struct _GTcpSocketConnectState { GList * ia_list; GList * ia_next; GInetAddrNewListAsyncID inetaddr_id; GTcpSocketNewAsyncID tcp_id; gboolean in_callback; GTcpSocketConnectAsyncFunc func; gpointer data; GDestroyNotify notify; GMainContext * context; /* we hold a ref */ gint priority; } GTcpSocketConnectState; /** * gnet_tcp_socket_connect * @hostname: host name * @port: port * * Creates a #GTcpSocket and connects to @hostname:@port. This * function blocks (while gnet_tcp_socket_connect_async() does not). * To get the #GInetAddr of the #GTcpSocket, call * gnet_tcp_socket_get_remote_inetaddr(). * * Returns: a new #GTcpSocket; NULL on error. **/ GTcpSocket* gnet_tcp_socket_connect (const gchar* hostname, gint port) { GList* ia_list; GList* i; GTcpSocket* socket; ia_list = gnet_inetaddr_new_list (hostname, port); if (ia_list == NULL) return NULL; socket = NULL; for (i = ia_list; i != NULL; i = i->next) { GInetAddr* ia; ia = (GInetAddr*) i->data; socket = gnet_tcp_socket_new (ia); if (socket) break; } for (i = ia_list; i != NULL; i = i->next) gnet_inetaddr_delete ((GInetAddr*) i->data); g_list_free (ia_list); return socket; } /** * gnet_tcp_socket_connect_async_full * @hostname: host name * @port: port * @func: callback function * @data: data to pass to @func on callback * @notify: function to call to free @data, or NULL * @context: the #GMainContext to use for notifications, or NULL for the * default GLib main context. If in doubt, pass NULL. * @priority: the priority with which to schedule notifications in the * main context, e.g. #G_PRIORITY_DEFAULT or #G_PRIORITY_HIGH. * * Asynchronously creates a #GTcpSocket and connects to * @hostname:@port. The callback is called when the connection is * made or an error occurs. The callback will not be called during * the call to this function. * * Returns: the ID of the connection; NULL on failure. The ID can be * used with gnet_tcp_socket_connect_async_cancel() to cancel the * connection. * * Since: 2.0.8 **/ GTcpSocketConnectAsyncID gnet_tcp_socket_connect_async_full (const gchar * hostname, gint port, GTcpSocketConnectAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext * context, gint priority) { GTcpSocketConnectState* state; g_return_val_if_fail (hostname != NULL, NULL); g_return_val_if_fail (func != NULL, NULL); if (context == NULL) context = g_main_context_default (); state = g_new0 (GTcpSocketConnectState, 1); state->func = func; state->data = data; state->notify = notify; state->context = g_main_context_ref (context); state->priority = priority; state->inetaddr_id = gnet_inetaddr_new_list_async_full (hostname, port, gnet_tcp_socket_connect_inetaddr_cb, state, (GDestroyNotify) NULL, state->context, priority); /* On failure, gnet_inetaddr_new_list_async_full() returns NULL. It will * not call the callback before it returns. */ if (state->inetaddr_id == NULL) { if (state->notify) state->notify (state->data); g_main_context_unref (state->context); g_free (state); return NULL; } return state; } /** * gnet_tcp_socket_connect_async * @hostname: host name * @port: port * @func: callback function * @data: data to pass to @func on callback * * Asynchronously creates a #GTcpSocket and connects to * @hostname:@port. The callback is called when the connection is * made or an error occurs. The callback will not be called during * the call to this function. * * Returns: the ID of the connection; NULL on failure. The ID can be * used with gnet_tcp_socket_connect_async_cancel() to cancel the * connection. * **/ GTcpSocketConnectAsyncID gnet_tcp_socket_connect_async (const gchar * hostname, gint port, GTcpSocketConnectAsyncFunc func, gpointer data) { GTcpSocketConnectAsyncID async_id; g_return_val_if_fail (hostname != NULL, NULL); g_return_val_if_fail (func != NULL, NULL); async_id = gnet_tcp_socket_connect_async_full (hostname, port, func, data, (GDestroyNotify) NULL, NULL, G_PRIORITY_DEFAULT); return async_id; } static void gnet_tcp_socket_connect_inetaddr_cb (GList* ia_list, gpointer data) { GTcpSocketConnectState* state = (GTcpSocketConnectState*) data; if (ia_list != NULL) /* Success */ { state->inetaddr_id = NULL; state->ia_list = ia_list; state->ia_next = ia_list; while (state->ia_next != NULL) { GTcpSocketNewAsyncID tcp_id; GInetAddr* ia; ia = (GInetAddr*) state->ia_next->data; state->ia_next = state->ia_next->next; tcp_id = gnet_tcp_socket_new_async_full (ia, gnet_tcp_socket_connect_tcp_cb, state, (GDestroyNotify) NULL, state->context, state->priority); if (tcp_id) /* Success */ { state->tcp_id = tcp_id; return; } } /* Failure: We could not async connect to any address. In practice, new_async() rarely fails immediately. */ state->in_callback = TRUE; (*state->func)(NULL, GTCP_SOCKET_CONNECT_ASYNC_STATUS_INETADDR_ERROR, state->data); state->in_callback = FALSE; /* FIXME: don't abuse _cancel() as free function for the state */ gnet_tcp_socket_connect_async_cancel (state); } else /* Failure */ { state->in_callback = TRUE; (*state->func)(NULL, GTCP_SOCKET_CONNECT_ASYNC_STATUS_INETADDR_ERROR, state->data); state->in_callback = FALSE; /* FIXME: don't abuse _cancel() as free function for the state */ gnet_tcp_socket_connect_async_cancel (state); } } static void gnet_tcp_socket_connect_tcp_cb (GTcpSocket* socket, gpointer data) { GTcpSocketConnectState* state = (GTcpSocketConnectState*) data; g_return_if_fail (state != NULL); state->tcp_id = NULL; /* Success */ if (socket != NULL) { state->in_callback = TRUE; (*state->func)(socket, GTCP_SOCKET_CONNECT_ASYNC_STATUS_OK, state->data); state->in_callback = FALSE; /* FIXME: don't abuse _cancel() as free function for the state */ gnet_tcp_socket_connect_async_cancel (state); return; } /* Failure: Could not connect to address */ /* Try other addresses */ while (state->ia_next != NULL) { GInetAddr* ia; gpointer tcp_id = NULL; ia = (GInetAddr*) state->ia_next->data; state->ia_next = state->ia_next->next; tcp_id = gnet_tcp_socket_new_async_full (ia, gnet_tcp_socket_connect_tcp_cb, state, (GDestroyNotify) NULL, state->context, state->priority); if (tcp_id) /* Success */ { state->tcp_id = tcp_id; return; } } /* Failure: No more addresses */ state->in_callback = TRUE; (*state->func)(NULL, GTCP_SOCKET_CONNECT_ASYNC_STATUS_TCP_ERROR, state->data); state->in_callback = FALSE; /* FIXME: don't abuse _cancel() as free function for the state */ gnet_tcp_socket_connect_async_cancel (state); } /** * gnet_tcp_socket_connect_async_cancel * @id: ID of the connection * * Cancels an asynchronous connection that was started with * gnet_tcp_socket_connect_async(). * */ void gnet_tcp_socket_connect_async_cancel (GTcpSocketConnectAsyncID id) { GTcpSocketConnectState* state = (GTcpSocketConnectState*) id; g_return_if_fail (state != NULL); /* Ignore if user called in the middle of a callback */ if (state->in_callback) return; if (state->ia_list) { GList* i; for (i = state->ia_list; i != NULL; i = i->next) gnet_inetaddr_delete ((GInetAddr*) i->data); g_list_free (state->ia_list); } if (state->inetaddr_id) gnet_inetaddr_new_list_async_cancel (state->inetaddr_id); if (state->tcp_id) gnet_tcp_socket_new_async_cancel (state->tcp_id); if (state->notify) state->notify (state->data); g_main_context_unref (state->context); g_free (state); } /* **************************************** */ /** * gnet_tcp_socket_new * @addr: address * * Creates a #GTcpSocket and connects to @addr. This function * blocks. SOCKS is used if SOCKS is enabled. * * Returns: a new #GTcpSocket; NULL on error. * **/ GTcpSocket* gnet_tcp_socket_new (const GInetAddr* addr) { g_return_val_if_fail (addr != NULL, NULL); /* Use SOCKS if enabled */ if (gnet_socks_get_enabled()) return _gnet_socks_tcp_socket_new (addr); /* Otherwise, connect directly to the address */ return gnet_tcp_socket_new_direct (addr); } /** * gnet_tcp_socket_new_direct: * @addr: address * * Creates a #GTcpSocket and connects to @addr without using SOCKS. * This function blocks. Most users should use * gnet_tcp_socket_new(). * * Returns: a new #GTcpSocket; NULL on error. * **/ GTcpSocket* gnet_tcp_socket_new_direct (const GInetAddr* addr) { SOCKET sockfd; GTcpSocket* s; int rv; g_return_val_if_fail (addr != NULL, NULL); /* Create socket */ sockfd = socket (GNET_INETADDR_FAMILY(addr), SOCK_STREAM, 0); if (!GNET_IS_SOCKET_VALID(sockfd)) { g_warning ("socket() failed"); return NULL; } /* Create GTcpSocket */ s = g_new0 (GTcpSocket, 1); s->sockfd = sockfd; s->ref_count = 1; s->sa = addr->sa; /* Connect */ rv = connect(sockfd, &GNET_SOCKADDR_SA(s->sa), GNET_SOCKADDR_LEN(s->sa)); if (rv != 0) { GNET_CLOSE_SOCKET(s->sockfd); g_free (s); return NULL; } return s; } /* **************************************** */ /** * gnet_tcp_socket_new_async_full: * @addr: address * @func: callback function * @data: data to pass to @func on callback * @notify: function to call to free @data, or NULL * @context: the #GMainContext to use for notifications, or NULL for the * default GLib main context. If in doubt, pass NULL. * @priority: the priority with which to schedule notifications in the * main context, e.g. #G_PRIORITY_DEFAULT or #G_PRIORITY_HIGH. * * Asynchronously creates a #GTcpSocket and connects to @addr. The * callback is called once the connection is made or an error occurs. * The callback will not be called during the call to this function. * * SOCKS is used if SOCKS is enabled. The SOCKS negotiation will * block. * * Returns: the ID of the connection; NULL on failure. The ID can be * used with gnet_tcp_socket_new_async_cancel() to cancel the * connection. * * Since: 2.0.8 **/ GTcpSocketNewAsyncID gnet_tcp_socket_new_async_full (const GInetAddr * addr, GTcpSocketNewAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext * context, gint priority) { GTcpSocketNewAsyncID async_id; g_return_val_if_fail (addr != NULL, NULL); g_return_val_if_fail (func != NULL, NULL); /* Use SOCKS if enabled, otherwise, connect directly to the address */ if (gnet_socks_get_enabled()) { async_id = _gnet_socks_tcp_socket_new_async_full (addr, func, data, notify, context, priority); } else { async_id = gnet_tcp_socket_new_async_direct_full (addr, func, data, notify, context, priority); } return async_id; } /** * gnet_tcp_socket_new_async: * @addr: address * @func: callback function * @data: data to pass to @func on callback * * Asynchronously creates a #GTcpSocket and connects to @addr. The * callback is called once the connection is made or an error occurs. * The callback will not be called during the call to this function. * * SOCKS is used if SOCKS is enabled. The SOCKS negotiation will * block. * * Returns: the ID of the connection; NULL on failure. The ID can be * used with gnet_tcp_socket_new_async_cancel() to cancel the * connection. * **/ GTcpSocketNewAsyncID gnet_tcp_socket_new_async (const GInetAddr * addr, GTcpSocketNewAsyncFunc func, gpointer data) { g_return_val_if_fail (addr != NULL, NULL); g_return_val_if_fail (func != NULL, NULL); return gnet_tcp_socket_new_async_full (addr, func, data, (GDestroyNotify) NULL, NULL, G_PRIORITY_DEFAULT); } /** * gnet_tcp_socket_new_async_direct_full: * @addr: address * @func: callback function * @data: data to pass to @func on callback * @notify: function to call to free @data, or NULL * @context: the #GMainContext to use for notifications, or NULL for the * default GLib main context. If in doubt, pass NULL. * @priority: the priority with which to schedule notifications in the * main context, e.g. #G_PRIORITY_DEFAULT or #G_PRIORITY_HIGH. * * Asynchronously creates a #GTcpSocket and connects to @addr without * using SOCKS. Most users should use gnet_tcp_socket_new_async() * instead. The callback is called once the connection is made or an * error occurs. The callback will not be called during the call to * this function. * * Returns: the ID of the connection; NULL on failure. The ID can be * used with gnet_tcp_socket_new_async_cancel() to cancel the * connection. * * Since: 2.0.8 **/ GTcpSocketNewAsyncID gnet_tcp_socket_new_async_direct_full (const GInetAddr * addr, GTcpSocketNewAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext * context, gint priority) { SOCKET sockfd; #ifndef GNET_WIN32 gint flags; #else u_long arg; #endif GTcpSocket* s; GTcpSocketAsyncState* state; gint status; g_return_val_if_fail (addr != NULL, NULL); g_return_val_if_fail (func != NULL, NULL); if (context == NULL) context = g_main_context_default (); /* Create socket */ sockfd = socket(GNET_INETADDR_FAMILY(addr), SOCK_STREAM, 0); if (!GNET_IS_SOCKET_VALID(sockfd)) { g_warning ("socket() failed"); return NULL; } /* Force the socket into non-blocking mode */ #ifndef GNET_WIN32 /* Get the flags (should all be 0?) */ flags = fcntl(sockfd, F_GETFL, 0); if (flags == -1) { g_warning ("fcntl() failed"); GNET_CLOSE_SOCKET(sockfd); return NULL; } if (fcntl(sockfd, F_SETFL, flags | O_NONBLOCK) == -1) { g_warning ("fcntl() failed"); GNET_CLOSE_SOCKET(sockfd); return NULL; } #else arg = 1; ioctlsocket(sockfd, FIONBIO, &arg); #endif /* Create our structure */ s = g_new0(GTcpSocket, 1); s->ref_count = 1; s->sockfd = sockfd; /* Connect (but non-blocking!) */ status = connect(s->sockfd, &GNET_INETADDR_SA(addr), GNET_INETADDR_LEN(addr)); if (STATUS_IS_SOCKET_ERROR (status)) { if (!ERROR_IS_CONNECT_IN_PROGRESS ()) { GNET_CLOSE_SOCKET(sockfd); g_free(s); return NULL; } } /* Save address */ s->sa = addr->sa; /* Note that if connect returns 0, then we're already connected and we could call the call back immediately. But, it would probably make things too complicated for the user if we could call the callback before we returned from this function. */ /* Wait for the connection */ state = g_new0 (GTcpSocketAsyncState, 1); state->socket = s; state->func = func; state->data = data; state->notify = notify; #ifndef GNET_WIN32 state->flags = flags; #endif state->iochannel = g_io_channel_ref (gnet_tcp_socket_get_io_channel (s)); state->context = g_main_context_ref (context); state->priority = priority; state->connect_watch = _gnet_io_watch_add_full (state->context, state->priority, state->iochannel, GNET_ANY_IO_CONDITION, gnet_tcp_socket_new_async_cb, state, NULL); return state; } /** * gnet_tcp_socket_new_async_direct * @addr: address * @func: callback function * @data: data to pass to @func on callback * * Asynchronously creates a #GTcpSocket and connects to @addr without * using SOCKS. Most users should use gnet_tcp_socket_new_async() * instead. The callback is called once the connection is made or an * error occurs. The callback will not be called during the call to * this function. * * Returns: the ID of the connection; NULL on failure. The ID can be * used with gnet_tcp_socket_new_async_cancel() to cancel the * connection. * **/ GTcpSocketNewAsyncID gnet_tcp_socket_new_async_direct (const GInetAddr * addr, GTcpSocketNewAsyncFunc func, gpointer data) { GTcpSocketNewAsyncID async_id; g_return_val_if_fail (addr != NULL, NULL); g_return_val_if_fail (func != NULL, NULL); async_id = gnet_tcp_socket_new_async_direct_full (addr, func, data, (GDestroyNotify) NULL, NULL, G_PRIORITY_DEFAULT); return async_id; } static gboolean gnet_tcp_socket_new_async_cb (GIOChannel* iochannel, GIOCondition condition, gpointer data) { GTcpSocketAsyncState* state = (GTcpSocketAsyncState*) data; socklen_t len; gint error; if (!((condition & G_IO_IN) || (condition & G_IO_OUT))) goto error; len = sizeof(error); /* Get the error option */ if (getsockopt(state->socket->sockfd, SOL_SOCKET, SO_ERROR, (void*) &error, &len) < 0) { g_warning ("getsockopt() failed"); goto error; } /* Check if there is an error */ if (error) goto error; #ifndef GNET_WIN32 /* Reset the flags */ if (fcntl(state->socket->sockfd, F_SETFL, state->flags) != 0) { g_warning ("fcntl() failed"); goto error; } #endif /* Success */ (*state->func) (state->socket, state->data); done: state->connect_watch = 0; g_io_channel_unref (state->iochannel); g_main_context_unref (state->context); /* FIXME: is notify really useful in this context? */ if (state->notify) state->notify (state->data); memset (state, 0xaa, sizeof (*state)); g_free (state); return FALSE; /* don't call us again */ /* ERROR */ error: { (*state->func) (NULL, state->data); gnet_tcp_socket_delete (state->socket); goto done; } } /** * gnet_tcp_socket_new_async_cancel * @id: ID of the connection * * Cancels an asynchronous #GTcpSocket creation that was started with * gnet_tcp_socket_new_async(). * **/ void gnet_tcp_socket_new_async_cancel (GTcpSocketNewAsyncID id) { GTcpSocketAsyncState* state = (GTcpSocketAsyncState*) id; if (state->connect_watch) _gnet_source_remove (state->context, state->connect_watch); if (state->iochannel) g_io_channel_unref (state->iochannel); gnet_tcp_socket_delete (state->socket); g_main_context_unref (state->context); if (state->notify) state->notify (state->data); g_free (state); } /** * gnet_tcp_socket_delete * @socket: a #GTcpSocket * * Deletes a #GTcpSocket. * **/ void gnet_tcp_socket_delete (GTcpSocket* socket) { if (socket != NULL) gnet_tcp_socket_unref (socket); } /** * gnet_tcp_socket_ref * @socket: a #GTcpSocket * * Adds a reference to a #GTcpSocket. * **/ void gnet_tcp_socket_ref (GTcpSocket* socket) { g_return_if_fail (socket != NULL); g_atomic_int_inc (&socket->ref_count); } /* returns TRUE if the socket has been deleted (useful for io watches) */ static gboolean gnet_tcp_socket_unref_internal (GTcpSocket * socket) { if (!g_atomic_int_dec_and_test (&socket->ref_count)) return FALSE; if (socket->accept_watch) g_source_remove (socket->accept_watch); GNET_CLOSE_SOCKET (socket->sockfd); /* Don't care if this fails... */ if (socket->iochannel) g_io_channel_unref (socket->iochannel); g_free (socket); return TRUE; } /** * gnet_tcp_socket_unref * @socket: a #GTcpSocket to unreference * * Removes a reference from a #GTcpSocket. A #GTcpSocket is deleted * when the reference count reaches 0. * **/ void gnet_tcp_socket_unref (GTcpSocket* socket) { g_return_if_fail (socket != NULL); gnet_tcp_socket_unref_internal (socket); } /** * gnet_tcp_socket_get_io_channel * @socket: a #GTcpSocket * * Gets the #GIOChannel of a #GTcpSocket. * * For a client socket, the #GIOChannel represents the data stream. * Use it like you would any other #GIOChannel. * * For a server socket however, the #GIOChannel represents the * listening socket. When it's readable, there's a connection * waiting to be accepted. However, using * gnet_tcp_socket_server_accept_async() is more elegant than * watching the #GIOChannel. * * Every #GTcpSocket has one and only one #GIOChannel. If you ref * the channel, then you must unref it eventually. Do not close the * channel. The channel is closed by GNet when the socket is * deleted. * * Returns: a #GIOChannel. * **/ GIOChannel* gnet_tcp_socket_get_io_channel (GTcpSocket* socket) { g_return_val_if_fail (socket != NULL, NULL); if (socket->iochannel == NULL) socket->iochannel = _gnet_io_channel_new(socket->sockfd); return socket->iochannel; } /** * gnet_tcp_socket_get_remote_inetaddr * @socket: a #GTcpSocket * * Gets the address of the remote host from a #GTcpSocket. This * function does not work on server sockets. * * Returns: a #GInetAddr. * **/ GInetAddr* gnet_tcp_socket_get_remote_inetaddr (const GTcpSocket* socket) { GInetAddr* ia; g_return_val_if_fail (socket != NULL, NULL); ia = g_new0(GInetAddr, 1); ia->sa = socket->sa; ia->ref_count = 1; return ia; } /** * gnet_tcp_socket_get_local_inetaddr * @socket: a #GTcpSocket * * Gets the local host's address from a #GTcpSocket. * * Returns: a #GInetAddr, or NULL on error. Unref with gnet_inetaddr_unref() * when no longer needed. * **/ GInetAddr* gnet_tcp_socket_get_local_inetaddr (const GTcpSocket* socket) { socklen_t socklen; struct sockaddr_storage sa; GInetAddr* ia; g_return_val_if_fail (socket, NULL); socklen = sizeof(sa); if (getsockname(socket->sockfd, &GNET_SOCKADDR_SA(sa), &socklen) != 0) return NULL; ia = g_new0(GInetAddr, 1); ia->ref_count = 1; ia->sa = sa; return ia; } /** * gnet_tcp_socket_get_port * @socket: a #GTcpSocket * * Gets the port a server #GTcpSocket is bound to. * * Returns: the port number. * **/ gint gnet_tcp_socket_get_port (const GTcpSocket* socket) { g_return_val_if_fail (socket != NULL, 0); return g_ntohs(GNET_SOCKADDR_PORT(socket->sa)); } /* **************************************** */ /** * gnet_tcp_socket_set_tos * @socket: a #GTcpSocket * @tos: type of service * * Sets the type-of-service (TOS) of the socket. TOS theoretically * controls the connection's quality of service, but most routers * ignore it. Some systems don't even support this function. The * function does nothing if the operating system does not support it. * **/ void gnet_tcp_socket_set_tos (GTcpSocket* socket, GNetTOS tos) { int sotos; g_return_if_fail (socket != NULL); /* Some systems (e.g. OpenBSD) do not have IPTOS_*. Other systems have some of them, but not others. And some systems have them, but with different names (e.g. FreeBSD has IPTOS_MINCOST). If a system does not have a IPTOS, or any of them, then this function does nothing. */ switch (tos) { #ifdef IPTOS_LOWDELAY case GNET_TOS_LOWDELAY: sotos = IPTOS_LOWDELAY; break; #endif #ifdef IPTOS_THROUGHPUT case GNET_TOS_THROUGHPUT: sotos = IPTOS_THROUGHPUT; break; #endif #ifdef IPTOS_RELIABILITY case GNET_TOS_RELIABILITY: sotos = IPTOS_RELIABILITY; break; #endif #ifdef IPTOS_LOWCOST case GNET_TOS_LOWCOST: sotos = IPTOS_LOWCOST; break; #else #ifdef IPTOS_MINCOST /* Called MINCOST in FreeBSD 4.0 */ case GNET_TOS_LOWCOST: sotos = IPTOS_MINCOST; break; #endif #endif default: return; } #ifdef IP_TOS if (setsockopt(socket->sockfd, IPPROTO_IP, IP_TOS, (void*) &sotos, sizeof(sotos)) != 0) g_warning ("Can't set TOS on TCP socket\n"); #endif } /* **************************************** */ /* Server stuff */ /** * gnet_tcp_socket_server_new * * Creates a new #GTcpSocket bound to all interfaces and an arbitrary * port. SOCKS is used if SOCKS is enabled. * * Returns: a new #GTcpSocket; NULL on error. * **/ GTcpSocket* gnet_tcp_socket_server_new (void) { return gnet_tcp_socket_server_new_full (NULL, 0); } /** * gnet_tcp_socket_server_new_with_port * @port: port to bind to (0 for an arbitrary port) * * Creates a new #GTcpSocket bound to all interfaces and port @port. * If @port is 0, an arbitrary port will be used. SOCKS is used if * SOCKS is enabled. * * Returns: a new #GTcpSocket; NULL on error. * **/ GTcpSocket* gnet_tcp_socket_server_new_with_port (gint port) { return gnet_tcp_socket_server_new_full (NULL, port); } /** * gnet_tcp_socket_server_new_full * @iface: Interface to bind to (NULL for all interfaces) * @port: Port to bind to (0 for an arbitrary port) * * Creates and new #GTcpSocket bound to interface @iface and port * @port. If @iface is NULL, the socket is bound to all interfaces. * If @port is 0, the socket is bound to an arbitrary port. SOCKS is * used if SOCKS is enabled and the interface is NULL. * * Returns: a new #GTcpSocket; NULL on error. * **/ GTcpSocket* gnet_tcp_socket_server_new_full (const GInetAddr* iface, gint port) { SOCKET sockfd = 0; struct sockaddr_storage sa; GTcpSocket* s; socklen_t socklen; const int on = 1; #ifndef GNET_WIN32 gint flags; #endif /* Use SOCKS if enabled */ if (!iface && gnet_socks_get_enabled()) return _gnet_socks_tcp_socket_server_new (port); /* Create sockfd and address */ sockfd = _gnet_create_listen_socket (SOCK_STREAM, iface, port, &sa); if (!GNET_IS_SOCKET_VALID(sockfd)) return NULL; /* Set REUSEADDR so we can reuse the port */ if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (void*) &on, sizeof(on)) != 0) g_warning("Can't set reuse on tcp socket\n"); #ifndef GNET_WIN32 /* Unix */ { /* Get the flags (should all be 0?) */ flags = fcntl(sockfd, F_GETFL, 0); if (flags == -1) { g_warning ("fcntl() failed"); goto error; } /* Make the socket non-blocking */ if (fcntl(sockfd, F_SETFL, flags | O_NONBLOCK) == -1) { g_warning ("fcntl() failed"); goto error; } } #else /* Windows */ { u_long arg; /* Make the socket non-blocking */ arg = 1; if (ioctlsocket(sockfd, FIONBIO, &arg)) goto error; } #endif /* Bind */ if (bind(sockfd, &GNET_SOCKADDR_SA(sa), GNET_SOCKADDR_LEN(sa)) != 0) goto error; /* Get the socket name */ socklen = GNET_SOCKADDR_LEN(sa); if (getsockname(sockfd, &GNET_SOCKADDR_SA(sa), &socklen) != 0) goto error; /* Listen */ if (listen(sockfd, 10) != 0) goto error; /* Create TcpSocket */ s = g_new0(GTcpSocket, 1); s->sockfd = sockfd; s->sa = sa; s->ref_count = 1; return s; error: if (sockfd) GNET_CLOSE_SOCKET(sockfd); return NULL; } #ifndef GNET_WIN32 /*********** Unix code ***********/ /** * gnet_tcp_socket_server_accept * @socket: a #GTcpSocket * * Accepts a connection from a #GTcpSocket. The socket must have * been created using gnet_tcp_socket_server_new() (or equivalent). * Even if the socket's #GIOChannel is readable, the function may * still block. * * Returns: a new #GTcpSocket representing a new connection; NULL on * error. * **/ GTcpSocket* gnet_tcp_socket_server_accept (GTcpSocket* socket) { gint sockfd; struct sockaddr_storage sa; socklen_t n; fd_set fdset; GTcpSocket* s; g_return_val_if_fail (socket != NULL, NULL); if (gnet_socks_get_enabled()) return _gnet_socks_tcp_socket_server_accept(socket); try_again: FD_ZERO(&fdset); FD_SET(socket->sockfd, &fdset); if (select(socket->sockfd + 1, &fdset, NULL, NULL, NULL) == -1) { if (errno == EINTR) goto try_again; return NULL; } n = sizeof(s->sa); if ((sockfd = accept(socket->sockfd, (struct sockaddr*) &sa, &n)) == -1) { if (errno == EWOULDBLOCK || errno == ECONNABORTED || #ifdef EPROTO /* OpenBSD does not have EPROTO */ errno == EPROTO || #endif errno == EINTR) goto try_again; return NULL; } s = g_new0(GTcpSocket, 1); s->ref_count = 1; s->sockfd = sockfd; s->sa = sa; return s; } /** * gnet_tcp_socket_server_accept_nonblock * @socket: a #GTcpSocket * * Accepts a connection from a #GTcpSocket without blocking. The * socket must have been created using gnet_tcp_socket_server_new() * (or equivalent). * * Note that if the socket's #GIOChannel is readable, then there is * PROBABLY a new connection. It is possible for the connection * to close by the time this function is called, so it may return * NULL. * * Returns: a new #GTcpSocket representing a new connection; NULL * otherwise. * **/ GTcpSocket* gnet_tcp_socket_server_accept_nonblock (GTcpSocket* socket) { gint sockfd; struct sockaddr_storage sa; socklen_t n; fd_set fdset; GTcpSocket* s; struct timeval tv = {0, 0}; g_return_val_if_fail (socket != NULL, NULL); if (gnet_socks_get_enabled()) return _gnet_socks_tcp_socket_server_accept(socket); try_again: FD_ZERO(&fdset); FD_SET(socket->sockfd, &fdset); if (select(socket->sockfd + 1, &fdset, NULL, NULL, &tv) == -1) { if (errno == EINTR) goto try_again; return NULL; } n = sizeof(sa); if ((sockfd = accept(socket->sockfd, (struct sockaddr*) &sa, &n)) == -1) { /* If we get an error, return. We don't want to try again as we do in gnet_tcp_socket_server_accept() - it might cause a block. */ return NULL; } s = g_new0(GTcpSocket, 1); s->ref_count = 1; s->sockfd = sockfd; s->sa = sa; return s; } #else /*********** Windows code ***********/ GTcpSocket* gnet_tcp_socket_server_accept (GTcpSocket* socket) { SOCKET sockfd; struct sockaddr_storage sa; fd_set fdset; GTcpSocket* s; socklen_t n; g_return_val_if_fail (socket != NULL, NULL); if (gnet_socks_get_enabled()) return _gnet_socks_tcp_socket_server_accept(socket); FD_ZERO(&fdset); FD_SET((unsigned)socket->sockfd, &fdset); if (select((int)socket->sockfd + 1, &fdset, NULL, NULL, NULL) == -1) return NULL; /* Don't force the socket into blocking mode */ n = sizeof(sa); sockfd = accept(socket->sockfd, (struct sockaddr*) &sa, &n); /* if it fails, looping isn't going to help */ if (!GNET_IS_SOCKET_VALID(sockfd)) return NULL; s = g_new0(GTcpSocket, 1); s->ref_count = 1; s->sockfd = sockfd; s->sa = sa; return s; } GTcpSocket* gnet_tcp_socket_server_accept_nonblock (GTcpSocket* socket) { SOCKET sockfd; struct sockaddr_storage sa; fd_set fdset; GTcpSocket* s; u_long arg; socklen_t n; g_return_val_if_fail (socket != NULL, NULL); if (gnet_socks_get_enabled()) return _gnet_socks_tcp_socket_server_accept(socket); FD_ZERO(&fdset); FD_SET((unsigned)socket->sockfd, &fdset); if (select((int)socket->sockfd + 1, &fdset, NULL, NULL, NULL) == -1) return NULL; /* make sure the socket is in non-blocking mode */ arg = 1; if (ioctlsocket(socket->sockfd, FIONBIO, &arg)) return NULL; n = sizeof(sa); sockfd = accept(socket->sockfd, (struct sockaddr*) &sa, &n); /* if it fails, looping isn't going to help */ if (sockfd == INVALID_SOCKET) return NULL; s = g_new0(GTcpSocket, 1); s->ref_count = 1; s->sockfd = sockfd; s->sa = sa; return s; } #endif /*********** End Windows code ***********/ static gboolean tcp_socket_server_accept_async_cb (GIOChannel* iochannel, GIOCondition condition, gpointer data); /** * gnet_tcp_socket_server_accept_async: * @socket: a #GTcpSocket * @accept_func: callback function. * @user_data: data to pass to @func on callback * * Asynchronously accepts a connection from a #GTcpSocket. The * callback is called when a new client has connected or an error * occurs. The socket must have been created using * gnet_tcp_socket_server_new() (or equivalent). * **/ void gnet_tcp_socket_server_accept_async (GTcpSocket* socket, GTcpSocketAcceptFunc accept_func, gpointer user_data) { GIOChannel* iochannel; g_return_if_fail (socket); g_return_if_fail (accept_func); g_return_if_fail (!socket->accept_func); if (gnet_socks_get_enabled()) { _gnet_socks_tcp_socket_server_accept_async (socket, accept_func, user_data); return; } /* Save callback */ socket->accept_func = accept_func; socket->accept_data = user_data; /* Add read watch */ iochannel = gnet_tcp_socket_get_io_channel (socket); socket->accept_watch = g_io_add_watch(iochannel, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL, tcp_socket_server_accept_async_cb, socket); } static gboolean tcp_socket_server_accept_async_cb (GIOChannel* iochannel, GIOCondition condition, gpointer data) { GTcpSocket* server = (GTcpSocket*) data; g_assert (server != NULL); if (condition & G_IO_IN) { GTcpSocket* client; client = gnet_tcp_socket_server_accept_nonblock (server); if (!client) return TRUE; /* Do upcall, protected by a ref */ gnet_tcp_socket_ref (server); (server->accept_func)(server, client, server->accept_data); if (gnet_tcp_socket_unref_internal (server) || !server->accept_watch) return FALSE; } else { gnet_tcp_socket_ref (server); (server->accept_func)(server, NULL, server->accept_data); server->accept_watch = 0; server->accept_func = NULL; server->accept_data = NULL; gnet_tcp_socket_unref (server); return FALSE; } return TRUE; } /** * gnet_tcp_socket_server_accept_async_cancel * @socket: a #GTcpSocket * * Stops asynchronously accepting connections for a #GTcpSocket. The * socket is not closed. * **/ void gnet_tcp_socket_server_accept_async_cancel (GTcpSocket* socket) { g_return_if_fail (socket); if (!socket->accept_watch) return; socket->accept_func = NULL; socket->accept_data = NULL; g_source_remove (socket->accept_watch); socket->accept_watch = 0; } gnet-2.0.8/src/sha.h0000644000175000017500000000222110751326730011113 00000000000000/* This code is free (LGPL compatible). See the top of sha.c for details. Copyright (C) 1995 A.M. Kuchling [original author] Copyright (C) 2000 David Helder [GNet API] */ #ifndef _GNET_SHA_H #define _GNET_SHA_H #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** * GSHA * * GSHA is a SHA hash. * **/ typedef struct _GSHA GSHA; /** * GNET_SHA_HASH_LENGTH * * Length of the SHA hash in bytes. **/ #define GNET_SHA_HASH_LENGTH 20 GSHA* gnet_sha_new (const gchar* buffer, guint length); GSHA* gnet_sha_new_string (const gchar* str); GSHA* gnet_sha_clone (const GSHA* sha); void gnet_sha_delete (GSHA* sha); GSHA* gnet_sha_new_incremental (void); void gnet_sha_update (GSHA* sha, const gchar* buffer, guint length); void gnet_sha_final (GSHA* sha); gboolean gnet_sha_equal (gconstpointer p1, gconstpointer p2); guint gnet_sha_hash (gconstpointer p); gchar* gnet_sha_get_digest (const GSHA* sha); gchar* gnet_sha_get_string (const GSHA* sha); void gnet_sha_copy_string (const GSHA* sha, gchar* buffer); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _GNET_SHA_H */ gnet-2.0.8/src/tcp.h0000644000175000017500000002023510751326730011133 00000000000000/* GNet - Networking library * Copyright (C) 2000-3 David Helder * Copyright (C) 2000 Andrew Lanoix * Copyright (C) 2007 Tim-Philipp Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_TCP_H #define _GNET_TCP_H #include "inetaddr.h" #include G_BEGIN_DECLS /** * GTcpSocket * * A #GTcpSocket structure represents a TCP socket. The * implementation is hidden. * **/ typedef struct _GTcpSocket GTcpSocket; /* **************************************** */ GTcpSocket* gnet_tcp_socket_connect (const gchar* hostname, gint port); GTcpSocket* gnet_tcp_socket_new (const GInetAddr* addr); GTcpSocket* gnet_tcp_socket_new_direct (const GInetAddr* addr); void gnet_tcp_socket_delete (GTcpSocket* socket); void gnet_tcp_socket_ref (GTcpSocket* socket); void gnet_tcp_socket_unref (GTcpSocket* socket); GIOChannel* gnet_tcp_socket_get_io_channel (GTcpSocket* socket); GInetAddr* gnet_tcp_socket_get_remote_inetaddr (const GTcpSocket* socket); GInetAddr* gnet_tcp_socket_get_local_inetaddr (const GTcpSocket* socket); GTcpSocket* gnet_tcp_socket_server_new (void); GTcpSocket* gnet_tcp_socket_server_new_with_port (gint port); GTcpSocket* gnet_tcp_socket_server_new_full (const GInetAddr* iface, gint port); GTcpSocket* gnet_tcp_socket_server_accept (GTcpSocket* socket); GTcpSocket* gnet_tcp_socket_server_accept_nonblock (GTcpSocket* socket); gint gnet_tcp_socket_get_port (const GTcpSocket* socket); /* ********** */ /** * GNetTOS * @GNET_TOS_NONE: Unspecified * @GNET_TOS_LOWDELAY: Low delay * @GNET_TOS_THROUGHPUT: High throughput * @GNET_TOS_RELIABILITY: High reliability * @GNET_TOS_LOWCOST: Low cost * * Type-of-service. * **/ typedef enum { GNET_TOS_NONE, GNET_TOS_LOWDELAY, GNET_TOS_THROUGHPUT, GNET_TOS_RELIABILITY, GNET_TOS_LOWCOST } GNetTOS; void gnet_tcp_socket_set_tos (GTcpSocket* socket, GNetTOS tos); /* **************************************** */ /* Asynchronous functions */ /** * GTcpSocketConnectAsyncID * * ID of an asynchronous connection started with * gnet_tcp_socket_connect_async(). The connection can be canceled * by calling gnet_tcp_socket_connect_async_cancel() with the ID. * **/ typedef struct _GTcpSocketConnectState * GTcpSocketConnectAsyncID; /** * GTcpSocketConnectAsyncStatus * @GTCP_SOCKET_CONNECT_ASYNC_STATUS_OK: Connection succeeded * @GTCP_SOCKET_CONNECT_ASYNC_STATUS_INETADDR_ERROR: Error, address lookup failed * @GTCP_SOCKET_CONNECT_ASYNC_STATUS_TCP_ERROR: Error, could not connect * * Status for connecting via gnet_tcp_socket_connect_async(), passed * by GTcpSocketConnectAsyncFunc. More errors may be added in the * future, so it's best to compare against * %GTCP_SOCKET_CONNECT_ASYNC_STATUS_OK. * **/ typedef enum { GTCP_SOCKET_CONNECT_ASYNC_STATUS_OK, GTCP_SOCKET_CONNECT_ASYNC_STATUS_INETADDR_ERROR, GTCP_SOCKET_CONNECT_ASYNC_STATUS_TCP_ERROR } GTcpSocketConnectAsyncStatus; /** * GTcpSocketConnectAsyncFunc: * @socket: TcpSocket that was connecting (callee owned) * @status: Status of the connection * @data: User data * * Callback for gnet_tcp_socket_connect_async(). * **/ typedef void (*GTcpSocketConnectAsyncFunc) (GTcpSocket * socket, GTcpSocketConnectAsyncStatus status, gpointer data); GTcpSocketConnectAsyncID gnet_tcp_socket_connect_async (const gchar * hostname, gint port, GTcpSocketConnectAsyncFunc func, gpointer data); GTcpSocketConnectAsyncID gnet_tcp_socket_connect_async_full (const gchar * hostname, gint port, GTcpSocketConnectAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext * context, gint priority); void gnet_tcp_socket_connect_async_cancel (GTcpSocketConnectAsyncID id); /* ********** */ /** * GTcpSocketNewAsyncID: * * ID of an asynchronous tcp socket creation started with * gnet_tcp_socket_new_async(). The creation can be canceled by * calling gnet_tcp_socket_new_async_cancel() with the ID. * **/ typedef struct _GTcpSocketAsyncState * GTcpSocketNewAsyncID; /** * GTcpSocketNewAsyncFunc: * @socket: Socket that was connecting * @data: User data * * Callback for gnet_tcp_socket_new_async(). The socket will be * NULL if the connection failed. * **/ typedef void (*GTcpSocketNewAsyncFunc) (GTcpSocket * socket, gpointer data); GTcpSocketNewAsyncID gnet_tcp_socket_new_async (const GInetAddr * addr, GTcpSocketNewAsyncFunc func, gpointer data); GTcpSocketNewAsyncID gnet_tcp_socket_new_async_full (const GInetAddr * addr, GTcpSocketNewAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext * context, gint priority); void gnet_tcp_socket_new_async_cancel (GTcpSocketNewAsyncID id); GTcpSocketNewAsyncID gnet_tcp_socket_new_async_direct (const GInetAddr * addr, GTcpSocketNewAsyncFunc func, gpointer data); GTcpSocketNewAsyncID gnet_tcp_socket_new_async_direct_full (const GInetAddr * addr, GTcpSocketNewAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext * context, gint priority); /* ********** */ /** * GTcpSocketAcceptFunc: * @server: Server socket * @client: Client socket * @data: User data * * Callback for gnet_tcp_socket_server_accept_async(). The socket * had an irrecoverable error if client_socket is NULL. * **/ typedef void (*GTcpSocketAcceptFunc)(GTcpSocket* server, GTcpSocket* client, gpointer data); void gnet_tcp_socket_server_accept_async (GTcpSocket* socket, GTcpSocketAcceptFunc accept_func, gpointer user_data); void gnet_tcp_socket_server_accept_async_cancel (GTcpSocket* socket); G_END_DECLS #endif /* _GNET_TCP_H */ gnet-2.0.8/src/inetaddr.h0000644000175000017500000002127010751326730012137 00000000000000/* GNet - Networking library * Copyright (C) 2000, 2002 David Helder * Copyright (C) 2000 Andrew Lanoix * Copyright (C) 2007 Tim-Philipp Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_INETADDR_H #define _GNET_INETADDR_H #include G_BEGIN_DECLS /** * GInetAddr * * GInetAddr is an internet address. * **/ typedef struct _GInetAddr GInetAddr; /* ********** */ GInetAddr* gnet_inetaddr_new (const gchar* hostname, gint port); GInetAddr* gnet_inetaddr_new_nonblock (const gchar* hostname, gint port); GInetAddr* gnet_inetaddr_new_bytes (const gchar* bytes, const guint length); GList* gnet_inetaddr_new_list (const gchar* hostname, gint port); void gnet_inetaddr_delete_list (GList* list); GInetAddr* gnet_inetaddr_clone (const GInetAddr* inetaddr); void gnet_inetaddr_delete (GInetAddr* inetaddr); void gnet_inetaddr_ref (GInetAddr* inetaddr); void gnet_inetaddr_unref (GInetAddr* inetaddr); gchar* gnet_inetaddr_get_name (/* const */ GInetAddr* inetaddr); gchar* gnet_inetaddr_get_name_nonblock (GInetAddr* inetaddr); gint gnet_inetaddr_get_length (const GInetAddr* inetaddr); void gnet_inetaddr_get_bytes (const GInetAddr* inetaddr, gchar* buffer); void gnet_inetaddr_set_bytes (GInetAddr* inetaddr, const gchar* bytes, gint length); gchar* gnet_inetaddr_get_canonical_name (const GInetAddr* inetaddr); gboolean gnet_inetaddr_is_canonical (const gchar* hostname); gint gnet_inetaddr_get_port (const GInetAddr* inetaddr); void gnet_inetaddr_set_port (const GInetAddr* inetaddr, gint port); gboolean gnet_inetaddr_is_internet (const GInetAddr* inetaddr); gboolean gnet_inetaddr_is_private (const GInetAddr* inetaddr); gboolean gnet_inetaddr_is_reserved (const GInetAddr* inetaddr); gboolean gnet_inetaddr_is_loopback (const GInetAddr* inetaddr); gboolean gnet_inetaddr_is_multicast (const GInetAddr* inetaddr); gboolean gnet_inetaddr_is_broadcast (const GInetAddr* inetaddr); gboolean gnet_inetaddr_is_ipv4 (const GInetAddr* inetaddr); gboolean gnet_inetaddr_is_ipv6 (const GInetAddr* inetaddr); guint gnet_inetaddr_hash (gconstpointer p); gboolean gnet_inetaddr_equal (gconstpointer p1, gconstpointer p2); gboolean gnet_inetaddr_noport_equal (gconstpointer p1, gconstpointer p2); gchar* gnet_inetaddr_get_host_name (void); GInetAddr* gnet_inetaddr_get_host_addr (void); GInetAddr* gnet_inetaddr_autodetect_internet_interface (void); GInetAddr* gnet_inetaddr_get_interface_to (const GInetAddr* inetaddr); GInetAddr* gnet_inetaddr_get_internet_interface (void); gboolean gnet_inetaddr_is_internet_domainname (const gchar* name); GList* gnet_inetaddr_list_interfaces (void); /** * GNET_INETADDR_MAX_LEN * * Maximum length of a #GInetAddr's address in bytes. This can be * used to allocate a buffer large enough for * gnet_inetaddr_get_bytes(). * **/ #define GNET_INETADDR_MAX_LEN 16 /* **************************************** */ /* Asynchronous functions */ /** * GInetAddrNewAsyncID: * * ID of an asynchronous GInetAddr creation/lookup started with * gnet_inetaddr_new_async(). The creation can be canceled by * calling gnet_inetaddr_new_async_cancel() with the ID. * **/ typedef struct _GInetAddrNewState * GInetAddrNewAsyncID; /** * GInetAddrNewAsyncFunc: * @inetaddr: InetAddr that was looked up (callee owned) * @data: User data * * Callback for gnet_inetaddr_new_async(). Callee owns the address. * The address will be NULL if the lookup failed. * **/ typedef void (*GInetAddrNewAsyncFunc) (GInetAddr * inetaddr, gpointer data); GInetAddrNewAsyncID gnet_inetaddr_new_async (const gchar * hostname, gint port, GInetAddrNewAsyncFunc func, gpointer data); GInetAddrNewAsyncID gnet_inetaddr_new_async_full (const gchar * hostname, gint port, GInetAddrNewAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext * context, gint priority); void gnet_inetaddr_new_async_cancel (GInetAddrNewAsyncID id); /** * GInetAddrNewListAsyncID: * * ID of an asynchronous GInetAddr list creation/lookup started with * gnet_inetaddr_new_list_async(). The creation can be canceled by * calling gnet_inetaddr_new_list_async_cancel() with the ID. * **/ typedef struct _GInetAddrNewListState * GInetAddrNewListAsyncID; /** * GInetAddrNewListAsyncFunc: * @list: List of GInetAddr's (callee owned) * @data: User data * * Callback for gnet_inetaddr_new_list_async(). Callee owns the * list of GInetAddrs. The list is NULL if the lookup failed. * **/ typedef void (*GInetAddrNewListAsyncFunc) (GList * list, gpointer data); GInetAddrNewListAsyncID gnet_inetaddr_new_list_async (const gchar * hostname, gint port, GInetAddrNewListAsyncFunc func, gpointer data); GInetAddrNewListAsyncID gnet_inetaddr_new_list_async_full (const gchar * hostname, gint port, GInetAddrNewListAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext * context, gint priority); void gnet_inetaddr_new_list_async_cancel (GInetAddrNewListAsyncID id); /** * GInetAddrGetNameAsyncID: * * ID of an asynchronous InetAddr name lookup started with * gnet_inetaddr_get_name_async(). The lookup can be canceled by * calling gnet_inetaddr_get_name_async_cancel() with the ID. * **/ typedef struct _GInetAddrReverseAsyncState * GInetAddrGetNameAsyncID; /** * GInetAddrGetNameAsyncFunc: * @hostname: Canonical name of the address (callee owned), NULL on failure * @data: User data * * Callback for gnet_inetaddr_get_name_async(). Callee (that is: you) owns * the name. Free it with g_free() when no longer needed. The name will be * NULL if the lookup failed. * **/ typedef void (*GInetAddrGetNameAsyncFunc) (gchar * hostname, gpointer data); GInetAddrGetNameAsyncID gnet_inetaddr_get_name_async (GInetAddr * inetaddr, GInetAddrGetNameAsyncFunc func, gpointer data); GInetAddrGetNameAsyncID gnet_inetaddr_get_name_async_full (GInetAddr * inetaddr, GInetAddrGetNameAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext * context, gint priority); void gnet_inetaddr_get_name_async_cancel (GInetAddrGetNameAsyncID id); G_END_DECLS #endif /* _GNET_INETADDR_H */ gnet-2.0.8/src/pack.h0000644000175000017500000000275310751326730011270 00000000000000/* GNet - Networking library * Copyright (C) 2000, 2001 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_PACK_H #define _GNET_PACK_H #include G_BEGIN_DECLS /* pack */ gint gnet_pack (const gchar * format, gchar * buffer, const gint length, ...); gint gnet_vpack (const gchar * format, gchar * buffer, const gint length, va_list args); gint gnet_pack_strdup (const gchar * format, gchar ** bufferp, ...); /* calculate size */ gint gnet_calcsize (const gchar * format, ...); gint gnet_vcalcsize (const gchar * format, va_list args); /* unpack */ gint gnet_unpack (const gchar * format, const gchar * buffer, gint length, ...); gint gnet_vunpack (const gchar * format, const gchar * buffer, gint length, va_list args); G_END_DECLS #endif /* _GNET_PACK_H */ gnet-2.0.8/src/makefile.mingw0000644000175000017500000000217410751326730013016 00000000000000CC = gcc FLAGS = -g -Wall -mno-cygwin -mcpu=pentium -DGNET_EXPERIMENTAL=1 INCLUDE = -I./ `pkg-config --cflags glib-2.0` LIBS = `pkg-config --libs glib-2.0` -lws2_32 OFILES = gnet-private.o gnet.o ipv6.o inetaddr.o iochannel.o tcp.o udp.o mcast.o socks-private.o socks.o conn.o conn-http.o server.o pack.o md5.o sha.o uri.o base64.o all: $(CC) $(FLAGS) $(INCLUDE) -c gnet-private.c $(CC) $(FLAGS) $(INCLUDE) -c gnet.c $(CC) $(FLAGS) $(INCLUDE) -c ipv6.c $(CC) $(FLAGS) $(INCLUDE) -c inetaddr.c $(CC) $(FLAGS) $(INCLUDE) -c iochannel.c $(CC) $(FLAGS) $(INCLUDE) -c tcp.c $(CC) $(FLAGS) $(INCLUDE) -c udp.c $(CC) $(FLAGS) $(INCLUDE) -c mcast.c $(CC) $(FLAGS) $(INCLUDE) -c socks-private.c $(CC) $(FLAGS) $(INCLUDE) -c socks.c $(CC) $(FLAGS) $(INCLUDE) -c conn.c $(CC) $(FLAGS) $(INCLUDE) -c conn-http.c $(CC) $(FLAGS) $(INCLUDE) -c server.c $(CC) $(FLAGS) $(INCLUDE) -c pack.c $(CC) $(FLAGS) $(INCLUDE) -c md5.c $(CC) $(FLAGS) $(INCLUDE) -c sha.c $(CC) $(FLAGS) $(INCLUDE) -c uri.c $(CC) $(FLAGS) $(INCLUDE) -c base64.c dllwrap $(INCLUDE) --export-all --output-def gnet.def --implib libgnet-2.0.a -o gnet-2.0.dll $(OFILES) $(LIBS) gnet-2.0.8/src/gnet.c0000644000175000017500000001271210751326730011276 00000000000000/* GNet - Networking library * Copyright (C) 2000 David Helder * Copyright (C) 2003 Andrew Lanoix * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "gnet-private.h" #include "gnet.h" const guint gnet_major_version = GNET_MAJOR_VERSION; const guint gnet_minor_version = GNET_MINOR_VERSION; const guint gnet_micro_version = GNET_MICRO_VERSION; const guint gnet_interface_age = GNET_INTERFACE_AGE; const guint gnet_binary_age = GNET_BINARY_AGE; #if !defined(GNET_WIN32) && defined(HAVE_IPV6) #ifndef GNET_WIN32 static gboolean ipv6_detect_envvar (void); static gboolean ipv6_detect_iface (void); #endif #endif #ifdef GNET_WIN32 void gnet_win32_at_exit( void ); /* Here to keep Visual Studio happy. */ void gnet_win32_at_exit() { /* printf("Calling gnet_win32_atexit\n"); */ if (hLibrary_ws2_32) FreeLibrary(hLibrary_ws2_32); if (hLibrary_Iphlpapi) FreeLibrary(hLibrary_Iphlpapi); gnet_uninitialize_windows_sockets(); } #endif /** * gnet_init * * Initializes the GNet library. This should be called at the * beginning of any GNet program and before any call to gtk_init(). * **/ void gnet_init (void) { static gboolean been_here; /* FALSE */ if (been_here) return; /* TODO: use atomic ops once we require Glib-2.4 */ been_here = TRUE; if (!g_thread_supported ()) g_thread_init (NULL); #ifndef GNET_WIN32 /* Auto-detect IPv6 policy. Set it to IPv4 if auto-detection fails. */ #ifdef HAVE_IPV6 if (!ipv6_detect_envvar()) if (!ipv6_detect_iface()) #endif gnet_ipv6_set_policy (GIPV6_POLICY_IPV4_ONLY); /* g_print ("ipv6 policy is %d\n", gnet_ipv6_get_policy()); */ #else /* Windows */ GIPv6Policy policy; #ifdef HAVE_IPV6 hLibrary_ws2_32 = LoadLibrary("ws2_32.dll"); hLibrary_Iphlpapi = LoadLibrary("Iphlpapi.dll"); if (hLibrary_ws2_32) { pfn_getaddrinfo = (PFN_GETADDRINFO) GetProcAddress(hLibrary_ws2_32, "getaddrinfo"); pfn_getnameinfo = (PFN_GETNAMEINFO) GetProcAddress(hLibrary_ws2_32, "getnameinfo"); pfn_freeaddrinfo = (PFN_FREEADDRINFO) GetProcAddress(hLibrary_ws2_32, "freeaddrinfo"); } if (hLibrary_Iphlpapi) { pfn_getaddaptersaddresses = (PFN_GETADAPTERSADDRESSES) GetProcAddress(hLibrary_Iphlpapi, "GetAdaptersAddresses"); } if ((!pfn_getaddrinfo) || (!pfn_getnameinfo) || (!pfn_freeaddrinfo) || (!pfn_getaddaptersaddresses)) { policy = GIPV6_POLICY_IPV4_ONLY; /* printf("This computer CAN NOT support IPv6!\n"); */ } else { policy = GIPV6_POLICY_IPV4_THEN_IPV6; /* printf("This computer CAN support IPv6!\n"); */ } /* Should I check to see if IPv6 interfaces exist? */ #else /* no IPV6 */ policy = GIPV6_POLICY_IPV4_ONLY; #endif gnet_ipv6_set_policy (policy); gnet_initialize_windows_sockets(); /* FIXME: a library should really not set up atexit handlers ... */ atexit(gnet_win32_at_exit); #endif } #if !defined(GNET_WIN32) && defined(HAVE_IPV6) #ifndef GNET_WIN32 /* Try to get policy based on environment variables. We look in the environment variable string for a 4 and a 6. We set policy based on which appear and which appears first. */ static gboolean ipv6_detect_envvar (void) { const gchar* envvar; char* loc4; char* loc6; GIPv6Policy policy; envvar = g_getenv ("GNET_IPV6_POLICY"); if (envvar == NULL) envvar = g_getenv ("IPV6_POLICY"); if (envvar == NULL) return FALSE; loc4 = strchr (envvar, '4'); loc6 = strchr (envvar, '6'); if (loc4 && loc6) { if (loc4 < loc6) policy = GIPV6_POLICY_IPV4_THEN_IPV6; else policy = GIPV6_POLICY_IPV6_THEN_IPV4; } else if (loc4) policy = GIPV6_POLICY_IPV4_ONLY; else if (loc6) policy = GIPV6_POLICY_IPV6_ONLY; else return FALSE; gnet_ipv6_set_policy (policy); return TRUE; } /* Auto-detect IPv6 policy. We get a list of interfaces and set policy based on whether IPv4 and/or IPv6 interfaces exist. Note if we have both IPv4 and IPv6 that we favor IPv4 over IPv6. In my experience, people have better IPv4 connections than IPv6 connections, which tend to be software tunnels. */ static gboolean ipv6_detect_iface (void) { GList* ifaces; GList* i; gboolean have_ipv4 = FALSE; gboolean have_ipv6 = FALSE; GIPv6Policy policy; ifaces = gnet_inetaddr_list_interfaces (); for (i = ifaces; i != NULL; i = i->next) { GInetAddr* iface = (GInetAddr*) i->data; if (gnet_inetaddr_is_ipv4(iface)) have_ipv4 = TRUE; else if (gnet_inetaddr_is_ipv6(iface)) have_ipv6 = TRUE; gnet_inetaddr_delete (iface); } g_list_free (ifaces); if (have_ipv4 && have_ipv6) policy = GIPV6_POLICY_IPV4_THEN_IPV6; else if (have_ipv4 && !have_ipv6) policy = GIPV6_POLICY_IPV4_ONLY; else if (!have_ipv4 && have_ipv6) policy = GIPV6_POLICY_IPV6_ONLY; else return FALSE; gnet_ipv6_set_policy (policy); return TRUE; } #endif #endif gnet-2.0.8/src/usagi_ifaddrs.h0000644000175000017500000000422410751326730013151 00000000000000#include #ifdef HAVE_LINUX_NETLINK_H /* $USAGI: ifaddrs.h,v 1.1 2001/01/26 07:11:49 yoshfuji Exp $ */ /* * Copyright (c) 1995, 1999 * Berkeley Software Design, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp */ #ifndef _IFADDRS_H #define _IFADDRS_H struct ifaddrs { struct ifaddrs *ifa_next; char *ifa_name; unsigned short ifa_flags; struct sockaddr *ifa_addr; struct sockaddr *ifa_netmask; union{ struct sockaddr *ifu_broadaddr; struct sockaddr *ifu_dstaddr; } ifa_ifu; void *ifa_data; }; /* * This may have been defined in . Note that if is * to be included it must be included before this header file. */ #ifndef ifa_broadaddr #define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */ #endif #ifndef ifa_dstaddr #define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of link */ #endif #include __BEGIN_DECLS extern int usagi_getifaddrs (struct ifaddrs **) __THROW; extern void usagi_freeifaddrs (struct ifaddrs *) __THROW; __END_DECLS #endif /* _IFADDRS_H */ #endif /* HAVE_LINUX_NETLINK_H */ gnet-2.0.8/src/sha.c0000644000175000017500000005155710751326730011126 00000000000000/* GNet API added by David Helder 2000-6-11. All additions and changes placed in the public domain. Files originally from: http://www.gxsnmp.org/CVS/gxsnmp/ */ /* * sha.h : Implementation of the Secure Hash Algorithm * * Part of the Python Cryptography Toolkit, version 1.0.0 * * Copyright (C) 1995, A.M. Kuchling * * Distribute and use freely; there are no restrictions on further * dissemination and usage except those imposed by the laws of your * country of residence. * */ /* SHA: NIST's Secure Hash Algorithm */ /* Based on SHA code originally posted to sci.crypt by Peter Gutmann in message <30ajo5$oe8@ccu2.auckland.ac.nz>. Modified to test for endianness on creation of SHA objects by AMK. Also, the original specification of SHA was found to have a weakness by NSA/NIST. This code implements the fixed version of SHA. */ /* Here's the first paragraph of Peter Gutmann's posting: The following is my SHA (FIPS 180) code updated to allow use of the "fixed" SHA, thanks to Jim Gillogly and an anonymous contributor for the information on what's changed in the new version. The fix is a simple change which involves adding a single rotate in the initial expansion function. It is unknown whether this is an optimal solution to the problem which was discovered in the SHA or whether it's simply a bandaid which fixes the problem with a minimum of effort (for example the reengineering of a great many Capstone chips). */ #include #include "sha.h" #include #include #include #include "config.h" /* needed to define GNET_WIN32 */ #ifndef GNET_WIN32 #include #endif /* The SHA block size and message digest sizes, in bytes */ #define SHA_DATASIZE 64 #define SHA_DIGESTSIZE 20 /* The structure for storing SHA info */ typedef struct { guint32 digest[ 5 ]; /* Message digest */ guint32 countLo, countHi; /* 64-bit bit count */ guint32 data[ 16 ]; /* SHA data buffer */ int Endianness; } SHA_CTX; /* Message digest functions */ static void SHAInit(SHA_CTX* shaInfo); static void SHAUpdate(SHA_CTX* shaInfo, guint8 const* buffer, guint count); static void SHAFinal(char *key, SHA_CTX *shaInfo); static void SHATransform(guint32 *digest, guint32 *data ); /* * sha.c : Implementation of the Secure Hash Algorithm * * Part of the Python Cryptography Toolkit, version 1.0.0 * * Copyright (C) 1995, A.M. Kuchling * * Distribute and use freely; there are no restrictions on further * dissemination and usage except those imposed by the laws of your * country of residence. * */ /* SHA: NIST's Secure Hash Algorithm */ /* Based on SHA code originally posted to sci.crypt by Peter Gutmann in message <30ajo5$oe8@ccu2.auckland.ac.nz>. Modified to test for endianness on creation of SHA objects by AMK. Also, the original specification of SHA was found to have a weakness by NSA/NIST. This code implements the fixed version of SHA. */ /* Here's the first paragraph of Peter Gutmann's posting: The following is my SHA (FIPS 180) code updated to allow use of the "fixed" SHA, thanks to Jim Gillogly and an anonymous contributor for the information on what's changed in the new version. The fix is a simple change which involves adding a single rotate in the initial expansion function. It is unknown whether this is an optimal solution to the problem which was discovered in the SHA or whether it's simply a bandaid which fixes the problem with a minimum of effort (for example the reengineering of a great many Capstone chips). */ #include /* The SHA f()-functions. The f1 and f3 functions can be optimized to save one boolean operation each - thanks to Rich Schroeppel, rcs@cs.arizona.edu for discovering this */ /*#define f1(x,y,z) ( ( x & y ) | ( ~x & z ) ) // Rounds 0-19 */ #define f1(x,y,z) ( z ^ ( x & ( y ^ z ) ) ) /* Rounds 0-19 */ #define f2(x,y,z) ( x ^ y ^ z ) /* Rounds 20-39 */ /*#define f3(x,y,z) ( ( x & y ) | ( x & z ) | ( y & z ) ) // Rounds 40-59 */ #define f3(x,y,z) ( ( x & y ) | ( z & ( x | y ) ) ) /* Rounds 40-59 */ #define f4(x,y,z) ( x ^ y ^ z ) /* Rounds 60-79 */ /* The SHA Mysterious Constants */ #define K1 0x5A827999L /* Rounds 0-19 */ #define K2 0x6ED9EBA1L /* Rounds 20-39 */ #define K3 0x8F1BBCDCL /* Rounds 40-59 */ #define K4 0xCA62C1D6L /* Rounds 60-79 */ /* SHA initial values */ #define h0init 0x67452301L #define h1init 0xEFCDAB89L #define h2init 0x98BADCFEL #define h3init 0x10325476L #define h4init 0xC3D2E1F0L /* Note that it may be necessary to add parentheses to these macros if they are to be called with expressions as arguments */ /* 32-bit rotate left - kludged with shifts */ #define ROTL(n,X) ( ( ( X ) << n ) | ( ( X ) >> ( 32 - n ) ) ) /* The initial expanding function. The hash function is defined over an 80-word expanded input array W, where the first 16 are copies of the input data, and the remaining 64 are defined by W[ i ] = W[ i - 16 ] ^ W[ i - 14 ] ^ W[ i - 8 ] ^ W[ i - 3 ] This implementation generates these values on the fly in a circular buffer - thanks to Colin Plumb, colin@nyx10.cs.du.edu for this optimization. The updated SHA changes the expanding function by adding a rotate of 1 bit. Thanks to Jim Gillogly, jim@rand.org, and an anonymous contributor for this information */ #define expand(W,i) ( W[ i & 15 ] = ROTL( 1, ( W[ i & 15 ] ^ W[ (i - 14) & 15 ] ^ \ W[ (i - 8) & 15 ] ^ W[ (i - 3) & 15 ] ) ) ) /* The prototype SHA sub-round. The fundamental sub-round is: a' = e + ROTL( 5, a ) + f( b, c, d ) + k + data; b' = a; c' = ROTL( 30, b ); d' = c; e' = d; but this is implemented by unrolling the loop 5 times and renaming the variables ( e, a, b, c, d ) = ( a', b', c', d', e' ) each iteration. This code is then replicated 20 times for each of the 4 functions, using the next 20 values from the W[] array each time */ #define subRound(a, b, c, d, e, f, k, data) \ ( e += ROTL( 5, a ) + f( b, c, d ) + k + data, b = ROTL( 30, b ) ) /* Initialize the SHA values */ void SHAInit(SHA_CTX * shaInfo ) { #if (G_BYTE_ORDER == G_BIG_ENDIAN) shaInfo->Endianness = 1; #else shaInfo->Endianness = 0; #endif /* Set the h-vars to their initial values */ shaInfo->digest[ 0 ] = h0init; shaInfo->digest[ 1 ] = h1init; shaInfo->digest[ 2 ] = h2init; shaInfo->digest[ 3 ] = h3init; shaInfo->digest[ 4 ] = h4init; /* Initialise bit count */ shaInfo->countLo = shaInfo->countHi = 0; } /* Perform the SHA transformation. Note that this code, like MD5, seems to break some optimizing compilers due to the complexity of the expressions and the size of the basic block. It may be necessary to split it into sections, e.g. based on the four subrounds Note that this corrupts the shaInfo->data area */ void SHATransform(guint32 *digest, guint32 *data ) { guint32 A, B, C, D, E; /* Local vars */ guint32 eData[ 16 ]; /* Expanded data */ /* Set up first buffer and local data buffer */ A = digest[ 0 ]; B = digest[ 1 ]; C = digest[ 2 ]; D = digest[ 3 ]; E = digest[ 4 ]; g_memmove( eData, data, SHA_DATASIZE ); /* Heavy mangling, in 4 sub-rounds of 20 interations each. */ subRound( A, B, C, D, E, f1, K1, eData[ 0 ] ); subRound( E, A, B, C, D, f1, K1, eData[ 1 ] ); subRound( D, E, A, B, C, f1, K1, eData[ 2 ] ); subRound( C, D, E, A, B, f1, K1, eData[ 3 ] ); subRound( B, C, D, E, A, f1, K1, eData[ 4 ] ); subRound( A, B, C, D, E, f1, K1, eData[ 5 ] ); subRound( E, A, B, C, D, f1, K1, eData[ 6 ] ); subRound( D, E, A, B, C, f1, K1, eData[ 7 ] ); subRound( C, D, E, A, B, f1, K1, eData[ 8 ] ); subRound( B, C, D, E, A, f1, K1, eData[ 9 ] ); subRound( A, B, C, D, E, f1, K1, eData[ 10 ] ); subRound( E, A, B, C, D, f1, K1, eData[ 11 ] ); subRound( D, E, A, B, C, f1, K1, eData[ 12 ] ); subRound( C, D, E, A, B, f1, K1, eData[ 13 ] ); subRound( B, C, D, E, A, f1, K1, eData[ 14 ] ); subRound( A, B, C, D, E, f1, K1, eData[ 15 ] ); subRound( E, A, B, C, D, f1, K1, expand( eData, 16 ) ); subRound( D, E, A, B, C, f1, K1, expand( eData, 17 ) ); subRound( C, D, E, A, B, f1, K1, expand( eData, 18 ) ); subRound( B, C, D, E, A, f1, K1, expand( eData, 19 ) ); subRound( A, B, C, D, E, f2, K2, expand( eData, 20 ) ); subRound( E, A, B, C, D, f2, K2, expand( eData, 21 ) ); subRound( D, E, A, B, C, f2, K2, expand( eData, 22 ) ); subRound( C, D, E, A, B, f2, K2, expand( eData, 23 ) ); subRound( B, C, D, E, A, f2, K2, expand( eData, 24 ) ); subRound( A, B, C, D, E, f2, K2, expand( eData, 25 ) ); subRound( E, A, B, C, D, f2, K2, expand( eData, 26 ) ); subRound( D, E, A, B, C, f2, K2, expand( eData, 27 ) ); subRound( C, D, E, A, B, f2, K2, expand( eData, 28 ) ); subRound( B, C, D, E, A, f2, K2, expand( eData, 29 ) ); subRound( A, B, C, D, E, f2, K2, expand( eData, 30 ) ); subRound( E, A, B, C, D, f2, K2, expand( eData, 31 ) ); subRound( D, E, A, B, C, f2, K2, expand( eData, 32 ) ); subRound( C, D, E, A, B, f2, K2, expand( eData, 33 ) ); subRound( B, C, D, E, A, f2, K2, expand( eData, 34 ) ); subRound( A, B, C, D, E, f2, K2, expand( eData, 35 ) ); subRound( E, A, B, C, D, f2, K2, expand( eData, 36 ) ); subRound( D, E, A, B, C, f2, K2, expand( eData, 37 ) ); subRound( C, D, E, A, B, f2, K2, expand( eData, 38 ) ); subRound( B, C, D, E, A, f2, K2, expand( eData, 39 ) ); subRound( A, B, C, D, E, f3, K3, expand( eData, 40 ) ); subRound( E, A, B, C, D, f3, K3, expand( eData, 41 ) ); subRound( D, E, A, B, C, f3, K3, expand( eData, 42 ) ); subRound( C, D, E, A, B, f3, K3, expand( eData, 43 ) ); subRound( B, C, D, E, A, f3, K3, expand( eData, 44 ) ); subRound( A, B, C, D, E, f3, K3, expand( eData, 45 ) ); subRound( E, A, B, C, D, f3, K3, expand( eData, 46 ) ); subRound( D, E, A, B, C, f3, K3, expand( eData, 47 ) ); subRound( C, D, E, A, B, f3, K3, expand( eData, 48 ) ); subRound( B, C, D, E, A, f3, K3, expand( eData, 49 ) ); subRound( A, B, C, D, E, f3, K3, expand( eData, 50 ) ); subRound( E, A, B, C, D, f3, K3, expand( eData, 51 ) ); subRound( D, E, A, B, C, f3, K3, expand( eData, 52 ) ); subRound( C, D, E, A, B, f3, K3, expand( eData, 53 ) ); subRound( B, C, D, E, A, f3, K3, expand( eData, 54 ) ); subRound( A, B, C, D, E, f3, K3, expand( eData, 55 ) ); subRound( E, A, B, C, D, f3, K3, expand( eData, 56 ) ); subRound( D, E, A, B, C, f3, K3, expand( eData, 57 ) ); subRound( C, D, E, A, B, f3, K3, expand( eData, 58 ) ); subRound( B, C, D, E, A, f3, K3, expand( eData, 59 ) ); subRound( A, B, C, D, E, f4, K4, expand( eData, 60 ) ); subRound( E, A, B, C, D, f4, K4, expand( eData, 61 ) ); subRound( D, E, A, B, C, f4, K4, expand( eData, 62 ) ); subRound( C, D, E, A, B, f4, K4, expand( eData, 63 ) ); subRound( B, C, D, E, A, f4, K4, expand( eData, 64 ) ); subRound( A, B, C, D, E, f4, K4, expand( eData, 65 ) ); subRound( E, A, B, C, D, f4, K4, expand( eData, 66 ) ); subRound( D, E, A, B, C, f4, K4, expand( eData, 67 ) ); subRound( C, D, E, A, B, f4, K4, expand( eData, 68 ) ); subRound( B, C, D, E, A, f4, K4, expand( eData, 69 ) ); subRound( A, B, C, D, E, f4, K4, expand( eData, 70 ) ); subRound( E, A, B, C, D, f4, K4, expand( eData, 71 ) ); subRound( D, E, A, B, C, f4, K4, expand( eData, 72 ) ); subRound( C, D, E, A, B, f4, K4, expand( eData, 73 ) ); subRound( B, C, D, E, A, f4, K4, expand( eData, 74 ) ); subRound( A, B, C, D, E, f4, K4, expand( eData, 75 ) ); subRound( E, A, B, C, D, f4, K4, expand( eData, 76 ) ); subRound( D, E, A, B, C, f4, K4, expand( eData, 77 ) ); subRound( C, D, E, A, B, f4, K4, expand( eData, 78 ) ); subRound( B, C, D, E, A, f4, K4, expand( eData, 79 ) ); /* Build message digest */ digest[ 0 ] += A; digest[ 1 ] += B; digest[ 2 ] += C; digest[ 3 ] += D; digest[ 4 ] += E; } /* When run on a little-endian CPU we need to perform byte reversal on an array of longwords. */ static void longReverse(guint32 *buffer, int byteCount, int Endianness ) { guint32 value; if (Endianness==1) return; byteCount /= sizeof( guint32 ); while( byteCount-- ) { value = *buffer; value = ( ( value & 0xFF00FF00L ) >> 8 ) | \ ( ( value & 0x00FF00FFL ) << 8 ); *buffer++ = ( value << 16 ) | ( value >> 16 ); } } /* Update SHA for a block of data */ void SHAUpdate( SHA_CTX *shaInfo, guint8 const *buffer, guint count ) { guint32 tmp; unsigned int dataCount; /* Update bitcount */ tmp = shaInfo->countLo; if ( ( shaInfo->countLo = tmp + ( ( guint32 ) count << 3 ) ) < tmp ) shaInfo->countHi++; /* Carry from low to high */ shaInfo->countHi += count >> 29; /* Get count of bytes already in data */ dataCount = ( int ) ( tmp >> 3 ) & 0x3F; /* Handle any leading odd-sized chunks */ if( dataCount ) { guint8 *p = ( guint8 * ) shaInfo->data + dataCount; dataCount = SHA_DATASIZE - dataCount; if( count < dataCount ) { g_memmove( p, buffer, count ); return; } g_memmove( p, buffer, dataCount ); longReverse( shaInfo->data, SHA_DATASIZE, shaInfo->Endianness); SHATransform( shaInfo->digest, shaInfo->data ); buffer += dataCount; count -= dataCount; } /* Process data in SHA_DATASIZE chunks */ while( count >= SHA_DATASIZE ) { g_memmove( shaInfo->data, buffer, SHA_DATASIZE ); longReverse( shaInfo->data, SHA_DATASIZE, shaInfo->Endianness ); SHATransform( shaInfo->digest, shaInfo->data ); buffer += SHA_DATASIZE; count -= SHA_DATASIZE; } /* Handle any remaining bytes of data. */ g_memmove( shaInfo->data, buffer, count ); } /* Final wrapup - pad to SHA_DATASIZE-byte boundary with the bit pattern 1 0* (64-bit count of bits processed, MSB-first) */ void SHAFinal( char *key, SHA_CTX *shaInfo ) { int count; guint8 *dataPtr; /* Compute number of bytes mod 64 */ count = ( int ) shaInfo->countLo; count = ( count >> 3 ) & 0x3F; /* Set the first char of padding to 0x80. This is safe since there is always at least one byte free */ dataPtr = ( guchar * ) shaInfo->data + count; *dataPtr++ = 0x80; /* Bytes of padding needed to make 64 bytes */ count = SHA_DATASIZE - 1 - count; /* Pad out to 56 mod 64 */ if( count < 8 ) { /* Two lots of padding: Pad the first block to 64 bytes */ memset( dataPtr, 0, count ); longReverse( shaInfo->data, SHA_DATASIZE, shaInfo->Endianness ); SHATransform( shaInfo->digest, shaInfo->data ); /* Now fill the next block with 56 bytes */ memset( shaInfo->data, 0, SHA_DATASIZE - 8 ); } else /* Pad block to 56 bytes */ memset( dataPtr, 0, count - 8 ); /* Append length in bits and transform */ shaInfo->data[ 14 ] = shaInfo->countHi; shaInfo->data[ 15 ] = shaInfo->countLo; longReverse( shaInfo->data, SHA_DATASIZE - 8, shaInfo->Endianness ); SHATransform( shaInfo->digest, shaInfo->data ); longReverse(shaInfo->digest, SHA_DIGESTSIZE, shaInfo->Endianness ); g_memmove(key, shaInfo->digest, SHA_DIGESTSIZE); } /* ************************************************************ */ /* Code below is David Helder's API for GNet */ struct _GSHA { SHA_CTX ctx; guint8 digest[GNET_SHA_HASH_LENGTH]; }; /** * gnet_sha_new: * @buffer: buffer to hash * @length: length of @buffer * * Creates a #GSHA from @buffer. * * Returns: a new #GSHA. * **/ GSHA* gnet_sha_new (const gchar* buffer, guint length) { GSHA* sha; sha = g_new0 (GSHA, 1); SHAInit (&sha->ctx); SHAUpdate (&sha->ctx, (const guchar*) buffer, length); SHAFinal ((gpointer) &sha->digest, &sha->ctx); return sha; } /** * gnet_sha_new_string: * @str: hexidecimal string * * Createss a #GSHA from @str. @str is a hexidecimal string * representing the digest. * * Returns: a new #GSHA. * **/ GSHA* gnet_sha_new_string (const gchar* str) { GSHA* sha; guint i; g_return_val_if_fail (str, NULL); g_return_val_if_fail (strlen(str) == (GNET_SHA_HASH_LENGTH * 2), NULL); sha = g_new0 (GSHA, 1); for (i = 0; i < (GNET_SHA_HASH_LENGTH * 2); ++i) { guint val = 0; switch (str[i]) { case '0': val = 0; break; case '1': val = 1; break; case '2': val = 2; break; case '3': val = 3; break; case '4': val = 4; break; case '5': val = 5; break; case '6': val = 6; break; case '7': val = 7; break; case '8': val = 8; break; case '9': val = 9; break; case 'A': case 'a': val = 10; break; case 'B': case 'b': val = 11; break; case 'C': case 'c': val = 12; break; case 'D': case 'd': val = 13; break; case 'E': case 'e': val = 14; break; case 'F': case 'f': val = 15; break; default: g_return_val_if_fail (FALSE, NULL); } if (i % 2) sha->digest[i / 2] |= val; else sha->digest[i / 2] = val << 4; } return sha; } /** * gnet_sha_clone * @sha: a #GSHA * * Copies a #GSHA. * * Returns: a copy of @sha. * **/ GSHA* gnet_sha_clone (const GSHA* sha) { GSHA* sha2; g_return_val_if_fail (sha, NULL); sha2 = g_new0 (GSHA, 1); sha2->ctx = sha->ctx; memcpy (sha2->digest, sha->digest, sizeof(sha->digest)); return sha2; } /** * gnet_sha_delete * @sha: a #GSHA * * Deletes a #GSHA. * **/ void gnet_sha_delete (GSHA* sha) { g_free (sha); } /** * gnet_sha_new_incremental * * Creates a #GSHA incrementally. After creating a #GSHA, call * gnet_sha_update() one or more times to hash data. Finally, call * gnet_sha_final() to compute the final hash value. * * Returns: a new #GSHA. * **/ GSHA* gnet_sha_new_incremental (void) { GSHA* sha; sha = g_new0 (GSHA, 1); SHAInit (&sha->ctx); return sha; } /** * gnet_sha_update * @sha: a #GSHA * @buffer: buffer to add * @length: length of @buffer * * Updates the hash with @buffer. This may be called several times * on a hash created by gnet_sha_new_incremental() before being * finalized by calling gnet_sha_final(). * **/ void gnet_sha_update (GSHA* sha, const gchar* buffer, guint length) { g_return_if_fail (sha); SHAUpdate (&sha->ctx, (const guchar*) buffer, length); } /** * gnet_sha_final * @sha: a #GSHA * * Calcuates the final hash value of a #GSHA. This should only be * called on a #GSHA created by gnet_sha_new_incremental(). * **/ void gnet_sha_final (GSHA* sha) { g_return_if_fail (sha); SHAFinal ((gpointer) &sha->digest, &sha->ctx); } /* **************************************** */ /** * gnet_sha_get_digest * @sha: a #GSHA * * Gets the raw SHA digest. * * Returns: a callee-owned buffer containing the SHA hash digest. * The buffer is %GNET_SHA_HASH_LENGTH bytes long. * **/ gchar* gnet_sha_get_digest (const GSHA* sha) { g_return_val_if_fail (sha, NULL); return (gchar*) sha->digest; } static const gchar bits2hex[] = "0123456789abcdef"; /** * gnet_sha_get_string * @sha: a #GSHA * * Get the digest represented a human-readable string. * * Returns: a hexadecimal string representing the digest. The string * is 2 * %GNET_SHA_HASH_LENGTH bytes long and NULL terminated. The * string is caller owned. * **/ gchar* gnet_sha_get_string (const GSHA* sha) { gchar* str; g_return_val_if_fail (sha, NULL); str = g_new (gchar, GNET_SHA_HASH_LENGTH * 2 + 1); gnet_sha_copy_string (sha, str); str[GNET_SHA_HASH_LENGTH * 2] = '\0'; return str; } /** * gnet_sha_copy_string * @sha: a #GSHA * @buffer: buffer at least 2 * %GNET_SHA_HASH_LENGTH bytes long * * Copies the digest, represented as a string, into @buffer. The * string is not NULL terminated. * **/ void gnet_sha_copy_string (const GSHA* sha, gchar* buffer) { guint i; g_return_if_fail (sha); g_return_if_fail (buffer); for (i = 0; i < GNET_SHA_HASH_LENGTH; ++i) { buffer[i * 2] = bits2hex[(sha->digest[i] & 0xF0) >> 4]; buffer[(i * 2) + 1] = bits2hex[(sha->digest[i] & 0x0F) ]; } } /** * gnet_sha_equal * @p1: a #GSHA. * @p2: another #GSHA. * * Compares two #GSHA's for equality. * * Returns: TRUE if they are equal; FALSE otherwise. * **/ gboolean gnet_sha_equal (gconstpointer p1, gconstpointer p2) { GSHA* shaa = (GSHA*) p1; GSHA* shab = (GSHA*) p2; guint i; for (i = 0; i < GNET_SHA_HASH_LENGTH; ++i) if (shaa->digest[i] != shab->digest[i]) return FALSE; return TRUE; } /** * gnet_sha_hash * @p: a #GSHA * * Creates a hash code for a #GMD5 for use with GHashTable. This * hash value is not the same as the MD5 digest. * * Returns: the hash code for @p. * **/ guint gnet_sha_hash (gconstpointer p) { const GSHA* sha = (const GSHA*) p; const guint* q; g_return_val_if_fail (sha, 0); q = (const guint*) sha->digest; return (q[0] ^ q[1] ^ q[2] ^ q[3] ^ q[4]); } gnet-2.0.8/src/iochannel.c0000644000175000017500000002172010751326730012300 00000000000000/* GNet - Networking library * Copyright (C) 2000 David Helder * Copyright (C) 2000 Andrew Lanoix * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "gnet-private.h" #include "gnet.h" /** * gnet_io_channel_writen * @channel: channel to write to * @buffer: buffer to read from * @length: length of @buffer * @bytes_writtenp: pointer to integer in which to store the * number of bytes written * * Writes all @length bytes in @buffer to @channel. If * @bytes_writtenp is set, the number of bytes written is stored in * the integer it points to. @bytes_writtenp will be less than * @length if the connection closed or an error occured. * * This function is essentially a wrapper around g_io_channel_write(). * The problem with g_io_channel_write() is that it may not write all * the bytes and will return a short count even when there was not an * error. This is rare, but possible, and often difficult to detect * when it does happen. * * Returns: %G_IO_ERROR_NONE if successful; something else otherwise. * The number of bytes written is stored in the integer pointed to by * @bytes_writtenp. * **/ GIOError gnet_io_channel_writen (GIOChannel* channel, gpointer buffer, gsize length, gsize* bytes_writtenp) { gsize nleft; gsize nwritten; gchar* ptr; GIOError error = G_IO_ERROR_NONE; g_return_val_if_fail (channel, G_IO_ERROR_INVAL); g_return_val_if_fail (bytes_writtenp, G_IO_ERROR_INVAL); ptr = buffer; nleft = length; while (nleft > 0) { if ((error = g_io_channel_write(channel, ptr, nleft, &nwritten)) != G_IO_ERROR_NONE) { if (error == G_IO_ERROR_AGAIN) nwritten = 0; else break; } nleft -= nwritten; ptr += nwritten; } *bytes_writtenp = (length - nleft); return error; } /** * gnet_io_channel_readn: * @channel: channel to read from * @buffer: buffer to write to * @length: length of the buffer * @bytes_readp: pointer to integer for the function to store the * number of of bytes read * * Read exactly @length bytes from @channel into @buffer. If * @bytes_readp is set, the number of bytes read is stored in the * integer it points to. @bytes_readp will be less than @length if the * end-of-file was reached or an error occured. * * This function is essentially a wrapper around g_io_channel_read(). * The problem with g_io_channel_read() is that it may not read all * the bytes requested and will return a short count even when there * was not an error (this is rare, but it can happen and is often * difficult to detect when it does). * * Returns: %G_IO_ERROR_NONE if everything is ok; something else * otherwise. Also, returns the number of bytes read by modifying the * integer pointed to by @bytes_readp. * **/ GIOError gnet_io_channel_readn (GIOChannel* channel, gpointer buffer, gsize length, gsize* bytes_readp) { gsize nleft; gsize nread; gchar* ptr; GIOError error = G_IO_ERROR_NONE; g_return_val_if_fail (channel, G_IO_ERROR_INVAL); g_return_val_if_fail (bytes_readp, G_IO_ERROR_INVAL); ptr = buffer; nleft = length; while (nleft > 0) { if ((error = g_io_channel_read(channel, ptr, nleft, &nread)) != G_IO_ERROR_NONE) { if (error == G_IO_ERROR_AGAIN) nread = 0; else break; } else if (nread == 0) break; nleft -= nread; ptr += nread; } *bytes_readp = (length - nleft); return error; } /** * gnet_io_channel_readline * @channel: channel to read from * @buffer: buffer to write to * @length: length of the buffer * @bytes_readp: pointer to integer in which to store the * number of of bytes read * * Read a line from the channel. The line will be NULL-terminated and * include the newline character. If there is not enough room for the * line, the line is truncated to fit in the buffer. * * Warnings: * * 1. If the buffer is full and the last character is not a newline, * the line was truncated. Do not assume the buffer ends with a * newline. * * 2. @bytes_readp is the number of bytes put in the buffer. It * includes the terminating NULL character. * * 3. NULL characters can appear in the line before the terminating * NULL (e.g., "Hello world\0\n"). If this matters, * check the string length of the buffer against the bytes read. * * I hope this isn't too confusing. Usually the function works as you * expect it to if you have a big enough buffer. If you have the * Stevens book, you should be familiar with the semantics. * * Returns: %G_IO_ERROR_NONE if everything is ok; something else * otherwise. The number of bytes read is stored in the integer * pointed to by @bytes_readp (this number includes the newline). If * an error is returned, the contents of @buffer and @bytes_readp are * undefined. * **/ GIOError gnet_io_channel_readline (GIOChannel* channel, gchar* buffer, gsize length, gsize* bytes_readp) { gsize n, rc; gchar c, *ptr; GIOError error = G_IO_ERROR_NONE; g_return_val_if_fail (channel, G_IO_ERROR_INVAL); g_return_val_if_fail (bytes_readp, G_IO_ERROR_INVAL); ptr = buffer; for (n = 1; n < length; ++n) { try_again: error = gnet_io_channel_readn(channel, &c, 1, &rc); if (error == G_IO_ERROR_NONE && rc == 1) /* read 1 char */ { *ptr++ = c; if (c == '\n') break; } else if (error == G_IO_ERROR_NONE && rc == 0) /* read EOF */ { if (n == 1) /* no data read */ { *bytes_readp = 0; return G_IO_ERROR_NONE; } else /* some data read */ break; } else { if (error == G_IO_ERROR_AGAIN) goto try_again; return error; } } *ptr = 0; *bytes_readp = n; return error; } /** * gnet_io_channel_readline_strdup * @channel: channel to read from * @bufferp: pointer to gchar* in which to store the new buffer * @bytes_readp: pointer to integer in which to store the * number of of bytes read * * Read a line from the channel. The line will be null-terminated and * include the newline character. Similarly to g_strdup_printf, a * buffer large enough to hold the string will be allocated. * * Warnings: * * 1. If the last character of the buffer is not a newline, the line * was truncated by EOF. Do not assume the buffer ends with a * newline. * * 2. @bytes_readp is actually the number of bytes put in the buffer. * It includes the terminating NULL character. * * 3. NULL characters can appear in the line before the terminating * null (e.g., "Hello world\0\n"). If this matters, check the string * length of the buffer against the bytes read. * * Returns: %G_IO_ERROR_NONE if everything is ok; something else * otherwise. The number of bytes read is stored in the integer * pointed to by @bytes_readp (this number includes the newline). The * data pointer is stored in the pointer pointed to by @bufferp. This * data is caller-owned. If an error is returned, the contents of * @bufferp and @bytes_readp are undefined. * **/ GIOError gnet_io_channel_readline_strdup (GIOChannel* channel, gchar** bufferp, gsize* bytes_readp) { gsize rc, n, length; gchar c, *ptr, *buf; GIOError error = G_IO_ERROR_NONE; g_return_val_if_fail (channel, G_IO_ERROR_INVAL); g_return_val_if_fail (bytes_readp, G_IO_ERROR_INVAL); length = 100; buf = (gchar *)g_malloc(length); ptr = buf; n = 1; while (1) { try_again: error = gnet_io_channel_readn(channel, &c, 1, &rc); if (error == G_IO_ERROR_NONE && rc == 1) /* read 1 char */ { *ptr++ = c; if (c == '\n') break; } else if (error == G_IO_ERROR_NONE && rc == 0) /* read EOF */ { if (n == 1) /* no data read */ { *bytes_readp = 0; *bufferp = NULL; g_free(buf); return G_IO_ERROR_NONE; } else /* some data read */ break; } else { if (error == G_IO_ERROR_AGAIN) goto try_again; g_free(buf); return error; } ++n; if (n >= length) { length *= 2; buf = g_realloc(buf, length); ptr = buf + n - 1; } } *ptr = 0; *bufferp = buf; *bytes_readp = n; return error; } gnet-2.0.8/src/mcast.h0000644000175000017500000000562110751326730011456 00000000000000/* GNet - Networking library * Copyright (C) 2000, 2002-3 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_MCAST_H #define _GNET_MCAST_H #include "inetaddr.h" #include "udp.h" #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** * GMcastSocket * * A #GMcastSocket structure represents a IP Multicast socket. The * implementation is hidden. A #GMcastSocket is child of * #GUdpSocket. Use gnet_mcast_socket_to_udp_socket() to safely cast * a #GMcastSocket to a #GUdpSocket. * **/ typedef struct _GMcastSocket GMcastSocket; /* ********** */ GMcastSocket* gnet_mcast_socket_new(void); GMcastSocket* gnet_mcast_socket_new_with_port (gint port); GMcastSocket* gnet_mcast_socket_new_full (const GInetAddr* iface, gint port); void gnet_mcast_socket_delete (GMcastSocket* socket); void gnet_mcast_socket_ref (GMcastSocket* socket); void gnet_mcast_socket_unref (GMcastSocket* socket); GIOChannel* gnet_mcast_socket_get_io_channel (GMcastSocket* socket); GInetAddr* gnet_mcast_socket_get_local_inetaddr (const GMcastSocket* socket); /* ********** */ gint gnet_mcast_socket_join_group (GMcastSocket* socket, const GInetAddr* inetaddr); gint gnet_mcast_socket_leave_group (GMcastSocket* socket, const GInetAddr* inetaddr); gint gnet_mcast_socket_get_ttl (const GMcastSocket* socket); gint gnet_mcast_socket_set_ttl (GMcastSocket* socket, gint ttl); gint gnet_mcast_socket_is_loopback (const GMcastSocket* socket); gint gnet_mcast_socket_set_loopback (GMcastSocket* socket, gboolean enable); /* ********** */ gint gnet_mcast_socket_send (GMcastSocket* socket, const gchar* buffer, gint length, const GInetAddr* dst); gint gnet_mcast_socket_receive (GMcastSocket* socket, gchar* buffer, gint length, GInetAddr** src); gboolean gnet_mcast_socket_has_packet (const GMcastSocket* socket); /** * gnet_mcast_socket_to_udp_socket * @MS: a #GMcastSocket * * Converts a #GMcastSocket to a #GUdpSocket. A #GMcastSocket is a * child of #GUdpSocket. * **/ #define gnet_mcast_socket_to_udp_socket(MS) ((GUdpSocket*) (MS)) #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _GNET_MCAST_H */ gnet-2.0.8/src/base64.h0000644000175000017500000000223310751326730011427 00000000000000/* GNet Base 64 module * Copyright (C) 2003 Free Software Foundation * Created by Alfred Reibenschuh , * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_BASE64_H #define _GNET_BASE64_H #include G_BEGIN_DECLS gchar * gnet_base64_encode (const gchar * src, gint srclen, gint * dstlenp, gboolean strict); gchar * gnet_base64_decode (const gchar * src, gint srclen, gint * dstlenp); G_END_DECLS #endif /* _GNET_BASE64_H */ gnet-2.0.8/src/iochannel.h0000644000175000017500000000310310751326730012300 00000000000000/* GNet - Networking library * Copyright (C) 2000 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_IOCHANNEL_H #define _GNET_IOCHANNEL_H #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ GIOError gnet_io_channel_writen (GIOChannel* channel, gpointer buffer, gsize length, gsize* bytes_writtenp); GIOError gnet_io_channel_readn (GIOChannel* channel, gpointer buffer, gsize length, gsize* bytes_readp); GIOError gnet_io_channel_readline (GIOChannel* channel, gchar* buffer, gsize length, gsize* bytes_readp); GIOError gnet_io_channel_readline_strdup (GIOChannel* channel, gchar** bufferp, gsize* bytes_readp); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _GNET_IOCHANNEL_H */ gnet-2.0.8/src/conn.c0000644000175000017500000007654710751326730011316 00000000000000/* GNet - Networking library * Copyright (C) 2000 David Helder * Copyright (C) 2003-2004 Andrew Lanoix * Copyright (C) 2007 Tim-Philipp Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "conn.h" #include #include /* required for windows */ #include /* needed for g_memmove/memmove */ #include "gnet-private.h" #define IS_CONNECTED(C) ((C)->socket != NULL) #define BUFFER_LEN 1024 /* FIXME: these macros are horrid, get rid of them */ #define IS_WATCHING(C, FLAG) (((C)->watch_flags & (FLAG))?TRUE:FALSE) #define ADD_WATCH(C, FLAG) do { \ if (!IS_WATCHING(C,FLAG)) { \ (C)->watch_flags |= (FLAG); \ if ((C)->iochannel) { \ if ((C)->watch) \ _gnet_source_remove ((C)->context, (C)->watch); \ (C)->watch = _gnet_io_watch_add_full ((C)->context,\ G_PRIORITY_DEFAULT, (C)->iochannel, \ (C)->watch_flags, async_cb, (C), NULL); \ }}} while (0) #define REMOVE_WATCH(C, FLAG) do { \ if (IS_WATCHING(C,FLAG)) { \ (C)->watch_flags &= ~(FLAG); \ if ((C)->iochannel) { \ if ((C)->watch) \ _gnet_source_remove ((C)->context, (C)->watch); \ (C)->watch = 0; \ if ((C)->watch_flags != 0) \ (C)->watch = _gnet_io_watch_add_full ((C)->context, \ G_PRIORITY_DEFAULT, (C)->iochannel, \ (C)->watch_flags, async_cb, (C), NULL); \ }}} while (0) #define UNSET_WATCH (C, FLAG) typedef struct _Write { gchar* buffer; gint length; GDestroyNotify buffer_destroy_cb; } Write; typedef struct _Read { gint mode; } Read; static void ref_internal (GConn* conn); static void unref_internal (GConn* conn); static void conn_new_cb (GTcpSocket* socket, gpointer user_data); static void conn_connect_cb (GTcpSocket* socket, GTcpSocketConnectAsyncStatus status, gpointer user_data); static gboolean async_cb (GIOChannel* iochannel, GIOCondition condition, gpointer data); static void conn_read_full (GConn* conn, gint mode); static void conn_check_read_queue (GConn* conn); static void conn_read_async_cb (GConn* conn); static gboolean process_read_buffer_cb (gpointer data); static gint bytes_processable (GConn* conn); static gint process_read_buffer (GConn* conn); static void conn_write_async_cb (GConn* conn); static void conn_check_write_queue (GConn* conn); static gboolean conn_timeout_cb (gpointer data); /** * gnet_conn_new * @hostname: name of host to connect to * @port: port to connect to * @func: function to call on #GConn events * @user_data: data to pass to @func on callbacks * * Creates a #GConn. A connection is not made until * gnet_conn_connect() is called. The callback @func is called when * events occur. * * Returns: a #GConn. * **/ GConn* gnet_conn_new (const gchar* hostname, gint port, GConnFunc func, gpointer user_data) { GConn* conn; g_return_val_if_fail (hostname, NULL); conn = g_new0 (GConn, 1); conn->ref_count = 1; conn->hostname = g_strdup(hostname); conn->port = port; conn->inetaddr = gnet_inetaddr_new_nonblock (hostname, port); conn->func = func; conn->user_data = user_data; return conn; } /** * gnet_conn_new_inetaddr * @inetaddr: address of host to connect to * @func: function to call on #GConn events * @user_data: data to pass to @func on callbacks * * Creates a #GConn. A connection is not made until * gnet_conn_connect() is called. The callback @func is called when * events occur. * * Returns: a #GConn. * **/ GConn* gnet_conn_new_inetaddr (const GInetAddr* inetaddr, GConnFunc func, gpointer user_data) { GConn* conn; g_return_val_if_fail (inetaddr, NULL); conn = g_new0 (GConn, 1); conn->ref_count = 1; conn->hostname = gnet_inetaddr_get_canonical_name (inetaddr); conn->port = gnet_inetaddr_get_port (inetaddr); conn->inetaddr = gnet_inetaddr_clone (inetaddr); conn->func = func; conn->user_data = user_data; return conn; } /** * gnet_conn_new_socket * @socket: TCP Socket (callee owned) * @func: function to call on #GConn events * @user_data: data to pass to @func on callbacks * * Creates a #GConn. The #GConn is created from the @socket. The * socket is callee owned - do not delete it (meaning: #GConn will take * ownership of the socket). The callback is called when events occur. * * Returns: a #GConn. * **/ GConn* gnet_conn_new_socket (GTcpSocket* socket, GConnFunc func, gpointer user_data) { GConn* conn; g_return_val_if_fail (socket, NULL); conn = g_new0 (GConn, 1); conn->ref_count = 1; conn->socket = socket; conn->iochannel = gnet_tcp_socket_get_io_channel (socket); conn->inetaddr = gnet_tcp_socket_get_remote_inetaddr (socket); conn->hostname = gnet_inetaddr_get_canonical_name (conn->inetaddr); conn->port = gnet_inetaddr_get_port (conn->inetaddr); conn->func = func; conn->user_data = user_data; return conn; } /** * gnet_conn_set_main_context * @conn: a #GConn * @context: a #GMainContext, or NULL to use the default GLib main context * * Sets the GLib #GMainContext to use for asynchronous operations. You should * call this function right after you create @conn. You must not call this * function after the actual connection process has started or watches have * been set up (e.g. for reading, writing or errors). * * You are very unlikely to ever need this function. * * Returns: TRUE on success, FALSE on failure. * * Since: 2.0.8 **/ gboolean gnet_conn_set_main_context (GConn * conn, GMainContext * context) { g_return_val_if_fail (conn != NULL, FALSE); /* Must not be called if already connected or connection pending; should * be okay if the socket is connected but no watches set up yet */ g_return_val_if_fail (conn->connect_id == 0 && conn->new_id == 0, FALSE); g_return_val_if_fail (conn->watch == 0, FALSE); if (conn->context != context) { if (conn->context) g_main_context_unref (conn->context); if (context) conn->context = g_main_context_ref (context); else conn->context = NULL; } return TRUE; } /** * gnet_conn_delete * @conn: a #GConn * * Deletes a #GConn. * * Deprecated: Use g_conn_unref(), which does the same. **/ void gnet_conn_delete (GConn* conn) { if (conn != NULL) gnet_conn_unref(conn); } /** * gnet_conn_ref * @conn: a #GConn * * Adds a reference to a #GConn. * **/ void gnet_conn_ref (GConn* conn) { g_return_if_fail (conn); conn->ref_count++; } /** * gnet_conn_unref * @conn: a #GConn * * Removes a reference from a #GConn. A #GConn is deleted when the * reference count reaches 0. * **/ void gnet_conn_unref (GConn* conn) { g_return_if_fail (conn); conn->ref_count--; if (conn->ref_count > 0 || conn->ref_count_internal > 0) return; gnet_conn_disconnect (conn); g_free (conn->hostname); if (conn->inetaddr) gnet_inetaddr_delete (conn->inetaddr); g_free (conn->buffer); g_free (conn); } /* increment internal ref count. This is used to prevent deletion during a callback. We don't want the conn to be deleted during a callback if we must still access the conn after the callback. */ static void ref_internal (GConn* conn) { g_return_if_fail (conn); conn->ref_count_internal++; } static void unref_internal (GConn* conn) { g_return_if_fail (conn); conn->ref_count_internal--; if (conn->ref_count == 0 && conn->ref_count_internal == 0) { /* set ref_count to 1 to force deletion on unref. */ conn->ref_count = 1; gnet_conn_unref (conn); } } /** * gnet_conn_set_callback * @conn: a #GConn * @func: function to call on #GConn events * @user_data: data to pass to @func on callbacks * * Sets the #GConnEvent callback for a #GConn. The callback @func is * called when events occur. * **/ void gnet_conn_set_callback (GConn* conn, GConnFunc func, gpointer user_data) { g_return_if_fail (conn); conn->func = func; conn->user_data = user_data; } /** * gnet_conn_connect * @conn: a #GConn * * Establishes a connection. If the connection is pending or already * established, this function does nothing. The callback is called * when the connection is established or an error occurs. * **/ void gnet_conn_connect (GConn * conn) { g_return_if_fail (conn != NULL); g_return_if_fail (conn->func != NULL); /* Ignore if connected or connection pending */ if (conn->connect_id != 0 || conn->new_id != 0 || conn->socket != NULL) return; /* Make asynchronous connection */ if (conn->inetaddr) { conn->new_id = gnet_tcp_socket_new_async_full (conn->inetaddr, conn_new_cb, conn, (GDestroyNotify) NULL, conn->context, G_PRIORITY_DEFAULT); } else if (conn->hostname) { conn->connect_id = gnet_tcp_socket_connect_async_full (conn->hostname, conn->port, conn_connect_cb, conn, (GDestroyNotify) NULL, conn->context, G_PRIORITY_DEFAULT); } else { g_return_if_reached (); } } static void conn_new_cb (GTcpSocket* socket, gpointer user_data) { GConn* conn = (GConn*) user_data; GConnEvent event; g_return_if_fail (conn); conn->new_id = NULL; if (socket) { conn->socket = socket; conn->iochannel = gnet_tcp_socket_get_io_channel (socket); conn_check_write_queue (conn); conn_check_read_queue (conn); if (conn->watch_flags) ADD_WATCH(conn, 0); event.type = GNET_CONN_CONNECT; } else { event.type = GNET_CONN_ERROR; } event.buffer = NULL; event.length = 0; (conn->func)(conn, &event, conn->user_data); } static void conn_connect_cb (GTcpSocket* socket, GTcpSocketConnectAsyncStatus status, gpointer user_data) { GConn* conn = (GConn*) user_data; GConnEvent event; g_return_if_fail (conn); conn->connect_id = NULL; if (status == GTCP_SOCKET_CONNECT_ASYNC_STATUS_OK) { conn->socket = socket; conn->inetaddr = gnet_tcp_socket_get_remote_inetaddr (socket); conn->iochannel = gnet_tcp_socket_get_io_channel (socket); conn_check_write_queue (conn); conn_check_read_queue (conn); if (conn->watch_flags) ADD_WATCH(conn, 0); event.type = GNET_CONN_CONNECT; } else { event.type = GNET_CONN_ERROR; } event.buffer = NULL; event.length = 0; (conn->func)(conn, &event, conn->user_data); } static void conn_write_free(Write *write) { if (write->buffer_destroy_cb) write->buffer_destroy_cb(write->buffer); g_free (write); } /** * gnet_conn_disconnect * @conn: a #GConn * * Closes the connection. The connection can later be reestablished * by calling gnet_conn_connect() again. If the connection was not * established, this function does nothing. * **/ void gnet_conn_disconnect (GConn* conn) { GList* i; g_return_if_fail (conn); if (conn->watch) { _gnet_source_remove (conn->context, conn->watch); conn->watch = 0; } conn->watch_flags = 0; conn->watch_readable = FALSE; conn->watch_writable = FALSE; if (conn->iochannel) conn->iochannel = NULL; /* do not unref */ if (conn->socket) { gnet_tcp_socket_delete (conn->socket); conn->socket = NULL; } if (conn->connect_id) { gnet_tcp_socket_connect_async_cancel (conn->connect_id); conn->connect_id = NULL; } if (conn->new_id) { gnet_tcp_socket_new_async_cancel (conn->new_id); conn->new_id = NULL; } for (i = conn->write_queue; i != NULL; i = i->next) { conn_write_free(i->data); } g_list_free (conn->write_queue); conn->write_queue = NULL; conn->bytes_written = 0; for (i = conn->read_queue; i != NULL; i = i->next) { Read* read = i->data; g_free (read); } g_list_free (conn->read_queue); conn->read_queue = NULL; conn->bytes_read = 0; conn->read_eof = FALSE; if (conn->process_buffer_timeout) { _gnet_source_remove (conn->context, conn->process_buffer_timeout); conn->process_buffer_timeout = 0; } if (conn->timer) { _gnet_source_remove (conn->context, conn->timer); conn->timer = 0; } } /** * gnet_conn_is_connected * @conn: a #GConn * * Checks if the connection is established. * * Returns: TRUE if the connection is established, FALSE otherwise. * **/ gboolean gnet_conn_is_connected (const GConn* conn) { g_return_val_if_fail (conn, FALSE); if (IS_CONNECTED(conn)) return TRUE; return FALSE; } /* **************************************** */ static gboolean async_cb (GIOChannel* iochannel, GIOCondition condition, gpointer data) { GConn* conn = (GConn*) data; GConnEvent event = {GNET_CONN_ERROR, NULL, 0}; ref_internal (conn); if (condition & (G_IO_ERR | G_IO_NVAL)) { /* Upcall ERROR */ gnet_conn_disconnect (conn); if (conn->func) (conn->func) (conn, &event, conn->user_data); unref_internal (conn); return FALSE; } if (condition & G_IO_IN) { /* Upcall */ if (conn->watch_readable) /* READABLE */ { GConnEvent event; event.type = GNET_CONN_READABLE; event.buffer = NULL; event.length = 0; g_return_val_if_fail (conn->func, FALSE); (conn->func) (conn, &event, conn->user_data); } else { conn_read_async_cb (conn); /* READ? */ } if (conn->ref_count == 0 || !IS_CONNECTED(conn)) { unref_internal (conn); return FALSE; } } if (condition & G_IO_OUT) { /* Upcall */ if (conn->watch_writable) /* WRITABLE */ { GConnEvent event; event.type = GNET_CONN_WRITABLE; event.buffer = NULL; event.length = 0; g_return_val_if_fail (conn->func, FALSE); (conn->func) (conn, &event, conn->user_data); } else /* WRITE? */ { conn_write_async_cb (conn); } if (conn->ref_count == 0 || !IS_CONNECTED(conn)) { unref_internal (conn); return FALSE; } } if (condition & G_IO_HUP) { gnet_conn_disconnect (conn); event.type = GNET_CONN_CLOSE; if (conn->func) (conn->func) (conn, &event, conn->user_data); } unref_internal (conn); /* Assume we want another callback, even though the source may have been destroyed though. The Glib main loop handles this properly. */ return TRUE; } /* **************************************** */ /** * gnet_conn_read: * @conn: a #GConn * * Begins an asynchronous read. The connection callback is called * when any data has been read. This function may be called again * before the asynchronous read completes. * **/ void gnet_conn_read (GConn* conn) { g_return_if_fail (conn); g_return_if_fail (conn->func); conn_read_full (conn, 0); } /** * gnet_conn_readn: * @conn: a #GConn * @length: Number of bytes to read * * Begins an asynchronous read of exactly @length bytes. The * connection callback is called when the data has been read. This * function may be called again before the asynchronous read * completes. * **/ void gnet_conn_readn (GConn* conn, gint n) { g_return_if_fail (conn); g_return_if_fail (conn->func); g_return_if_fail (n > 0); conn_read_full (conn, n); } /** * gnet_conn_readline: * @conn: a #GConn * * Begins an asynchronous line read. The connection callback is * called when a line has been read. Lines are terminated with \n, * \r, \r\n, or \0. The terminator is \0'ed out in the buffer. The * terminating \0 is accounted for in the buffer length. This * function may be called again before the asynchronous read * completes. * **/ void gnet_conn_readline (GConn* conn) { g_return_if_fail (conn); g_return_if_fail (conn->func); conn_read_full (conn, -1); } static void conn_read_full (GConn* conn, gint mode) { Read* read; g_return_if_fail (conn); /* Create the buffer */ if (!conn->buffer) { conn->buffer = g_malloc (BUFFER_LEN); conn->length = BUFFER_LEN; conn->bytes_read = 0; } /* Add to read queue */ read = g_new0 (Read, 1); read->mode = mode; conn->read_queue = g_list_append (conn->read_queue, read); /* Check the read queue */ conn_check_read_queue (conn); } static void conn_check_read_queue (GConn* conn) { /* Ignore if we are unconnected or there are no reads */ if (!IS_CONNECTED(conn) || !conn->read_queue) return; /* Ignore if we will process the buffer or are already watch IN */ if (conn->process_buffer_timeout || IS_WATCHING(conn, G_IO_IN)) return; /* Set up process_read_buffer_cb() if there's data available and we can process it, OR if we've read EOF. EOF is EOF is handled when it is read, regardless of the read queue. We don't worry about it here. OPTIMIZATION: There may be reads in the queue that cannot be processed given the data we have and we would need to read in more data. We watch IO_IN in this case. */ if ((conn->bytes_read && bytes_processable(conn) > 0) || conn->read_eof) { conn->process_buffer_timeout = _gnet_timeout_add_full (conn->context, G_PRIORITY_DEFAULT, 0, process_read_buffer_cb, conn, NULL); } else { /* Otherwise, if there is no read watch, set one, so we can read * more bytes */ ADD_WATCH(conn, G_IO_IN); } } static void conn_read_async_cb (GConn* conn) { guint bytes_to_read; gchar* buffer_start; GIOError error; gsize bytes_read; /* Resize the buffer if it's full. */ if (conn->length == conn->bytes_read) { conn->length *= 2; conn->buffer = g_realloc(conn->buffer, conn->length); } /* Calculate buffer start and length */ bytes_to_read = conn->length - conn->bytes_read; buffer_start = &conn->buffer[conn->bytes_read]; g_return_if_fail (bytes_to_read > 0); /* Read data into buffer */ error = g_io_channel_read (conn->iochannel, buffer_start, bytes_to_read, &bytes_read); /* Try again later if necessary */ if (error == G_IO_ERROR_AGAIN) return; /* Fail if this is an error */ else if (error != G_IO_ERROR_NONE) { GConnEvent event = {GNET_CONN_ERROR, NULL, 0}; ref_internal (conn); gnet_conn_disconnect (conn); (conn->func) (conn, &event, conn->user_data); unref_internal (conn); return; } /* If we read nothing, that means EOF and we're done. We do not callback with anything that might be in the buffer. */ else if (bytes_read == 0) { conn->read_eof = TRUE; } /* Otherwise, we read something */ else { conn->bytes_read += bytes_read; } /*** Process what we read *** */ /* Process the read buffer */ ref_internal (conn); do { /* Process data */ bytes_read = process_read_buffer (conn); /* conn may be disconnected at this point */ /* Stop if conn deleted */ if (conn->ref_count == 0) { unref_internal (conn); return; } } while (bytes_read > 0); unref_internal (conn); /* conn is still good (though possibly disconnected). Otherwise, we would have returned in the do-loop. */ /* Process EOF if: - we read EOF - the connection is still open - there are reads in the read queue (we won't give the user a CLOSE unless they make a read that triggers it.) */ if (conn->read_eof && IS_CONNECTED(conn) && conn->read_queue) { GConnEvent event = {GNET_CONN_CLOSE, NULL, 0}; /* (we know conn is still good - otherwise it would have been deleted in the do-loop) */ gnet_conn_disconnect (conn); (conn->func) (conn, &event, conn->user_data); return; /* we're done with conn for now */ } /* Remove read watch if no more reads */ if (!conn->read_queue) { REMOVE_WATCH(conn, G_IO_IN); } } /* Called to dispatch reads to user callback */ static gboolean process_read_buffer_cb (gpointer data) { GConn* conn = (GConn*) data; gint bytes_read; g_return_val_if_fail (conn, FALSE); conn->process_buffer_timeout = 0; /* Ignore if nothing to read */ if (conn->bytes_read == 0 || conn->read_queue == NULL) return FALSE; /* Process reads */ ref_internal (conn); do { /* Process data */ bytes_read = process_read_buffer (conn); /* conn may be disconnected at this point */ /* Stop if conn deleted */ if (conn->ref_count == 0) { unref_internal (conn); return FALSE; } } while (bytes_read > 0); unref_internal (conn); /* conn is still good (though possibly disconnected). Otherwise, we would have returned in the do-loop. */ /* Process EOF (if we read EOF) and are still connected */ if (conn->read_eof && IS_CONNECTED(conn)) { GConnEvent event = {GNET_CONN_CLOSE, NULL, 0}; gnet_conn_disconnect (conn); (conn->func) (conn, &event, conn->user_data); return FALSE; /* we're done with conn for now*/ } /* Set read watch if we're still connected and there's more to read */ if (IS_CONNECTED(conn) && conn->read_queue) { ADD_WATCH (conn, G_IO_IN); } return FALSE; } /* Calculate number of bytes that can be processed by the top read */ static gint bytes_processable (GConn* conn) { Read* read; g_return_val_if_fail (conn, 0); /* If there is no data to process or reads to process, return 0 */ if (conn->bytes_read == 0 || conn->read_queue == NULL) return 0; /* Get a read off the queue */ read = (Read*) conn->read_queue->data; switch (read->mode) { /* Read any */ case 0: { return conn->bytes_read; break; } /* Read line */ case -1: { guint i; /* Look for \n, \r, or \r\n */ for (i = 0; i < conn->bytes_read; ++i) { /* \n and \0 */ if (conn->buffer[i] == '\0' || conn->buffer[i] == '\n') return i+1; /* \r Only counted if we know the next character. If it's a \n, it'd need to be \0'ed out. */ else if (conn->buffer[i] == '\r' && ((i+1) < conn->bytes_read)) { if (conn->buffer[i+1] == '\n') return i+2; else return i+1; } } break; } default: /* Read n */ { if (conn->bytes_read >= read->mode) return read->mode; break; } } return 0; } /* Return bytes read */ static gint process_read_buffer (GConn* conn) { Read* read; gint bytes_processed = 0; gint bytes_read = 0; g_return_val_if_fail (conn, FALSE); /* If there is no data to process or reads to process, return 0 */ if (conn->bytes_read == 0 || conn->read_queue == NULL) return 0; /* Get a read off the queue */ read = (Read*) conn->read_queue->data; ref_internal (conn); switch (read->mode) { /* Read any */ case 0: { bytes_processed = bytes_read = conn->bytes_read; break; } /* Read line */ case -1: { guint i; /* Look for \n, \r, or \r\n */ for (i = 0; i < conn->bytes_read; ++i) { /* \0 */ if (conn->buffer[i] == '\0') { bytes_processed = bytes_read = i + 1; break; } /* \n */ else if (conn->buffer[i] == '\n') { conn->buffer[i] = '\0'; bytes_processed = bytes_read = i + 1; break; } /* \r Only counted if we know the next character. If it's a \n, it needs to be \0'ed out. */ else if (conn->buffer[i] == '\r' && ((i+1) < conn->bytes_read)) { if (conn->buffer[i+1] == '\n') { conn->buffer[i] = '\0'; conn->buffer[i+1] = '\0'; bytes_read = i + 1; bytes_processed = i + 2; } else { conn->buffer[i] = '\0'; bytes_processed = bytes_read = i + 1; } break; } } break; } default: /* Read n */ { if (conn->bytes_read >= read->mode) bytes_processed = bytes_read = read->mode; break; } } if (bytes_read) { GConnEvent event; event.type = GNET_CONN_READ; event.buffer = conn->buffer; event.length = bytes_read; (conn->func) (conn, &event, conn->user_data); } /* Note: User may have disconnected after the callback */ /* If read successful and we're still connected, move bytes over and remove read */ if (bytes_processed && IS_CONNECTED(conn)) { g_assert (conn->bytes_read >= bytes_processed);/* Sanity check */ /* Move bytes over */ g_memmove (conn->buffer, &conn->buffer[bytes_processed], conn->bytes_read - bytes_processed); conn->bytes_read -= bytes_processed; /* Remove read from queue */ conn->read_queue = g_list_remove (conn->read_queue, read); g_free (read); } unref_internal (conn); return bytes_processed; } /* **************************************** */ /** * gnet_conn_write_direct * @conn: a #GConn * @buffer: buffer to write from * @length: length of @buffer * @buffer_destroy_cb: function to call when buffer is no longer needed * * Sets up an asynchronous write to @conn from @buffer. The buffer is * created by the caller and will not be copied. The caller needs to * make sure the buffer stays valid until @buffer_destroy_cb is called. * This function can be called again before the asynchronous write * completes. @buffer_destroy_cb may be %NULL. * **/ void gnet_conn_write_direct (GConn* conn, gchar* buffer, gint length, GDestroyNotify buffer_destroy_cb) { Write* write; g_return_if_fail (conn != NULL); g_return_if_fail (buffer != NULL); g_return_if_fail (length >= 0); if (length == 0) return; /* Add to queue */ write = g_new0 (Write, 1); write->buffer = buffer; write->length = length; write->buffer_destroy_cb = buffer_destroy_cb; conn->write_queue = g_list_append (conn->write_queue, write); conn_check_write_queue (conn); } /** * gnet_conn_write * @conn: a #GConn * @buffer: buffer to write from * @length: length of @buffer * * Sets up an asynchronous write to @conn from @buffer. The buffer is * copied, so it may be deleted by the caller. This function can be * called again before the asynchronous write completes. * **/ void gnet_conn_write (GConn* conn, gchar* buffer, gint length) { gchar *copy; g_return_if_fail (conn != NULL); g_return_if_fail (buffer != NULL); g_return_if_fail (length >= 0); if (length == 0) return; copy = g_memdup (buffer, length); gnet_conn_write_direct (conn, copy, length, (GDestroyNotify) g_free); } static void conn_check_write_queue (GConn* conn) { /* Ignore if we are unconnected or there is no writes */ if (!IS_CONNECTED(conn) || !conn->write_queue) return; /* Ignore if we are already watching OUT */ if (IS_WATCHING(conn, G_IO_OUT)) return; /* Watch for write */ ADD_WATCH (conn, G_IO_OUT); } static void conn_write_async_cb (GConn* conn) { Write* write; GIOError error; guint bytes_to_write; gchar* buffer_start; gsize bytes_written; GConnEvent event = {GNET_CONN_ERROR, NULL, 0}; write = (Write*) conn->write_queue->data; g_return_if_fail (write != NULL); /* Calculate start of buffer */ buffer_start = &write->buffer[conn->bytes_written]; bytes_to_write = write->length - conn->bytes_written; /* Write */ error = g_io_channel_write(conn->iochannel, buffer_start, bytes_to_write, &bytes_written); /* Check for error. If error, disconnect and notify */ if (error != G_IO_ERROR_NONE) { gnet_conn_disconnect (conn); (conn->func) (conn, &event, conn->user_data); /* conn may be deleted now */ return; } /* Otherwise, write is good */ /* Increment bytes written count */ conn->bytes_written += bytes_written; /* Check if we're done writing this queued write */ if (conn->bytes_written == write->length) { /* Remove and delete the queued write */ conn->write_queue = g_list_remove (conn->write_queue, write); conn_write_free(write); conn->bytes_written = 0; /* Remove watch if there are no more queued writes */ if (conn->write_queue == NULL) REMOVE_WATCH (conn, G_IO_OUT); /* Notify */ event.type = GNET_CONN_WRITE; (conn->func)(conn, &event, conn->user_data); /* conn may be disconnected or deleted now */ } /* Otherwise, keep watching for output */ return; } /* **************************************** */ /** * gnet_conn_set_watch_error * @conn: a #GConn * @enable: enable the %GNET_CONN_READABLE event? * * Enables (or disables) the %GNET_CONN_ERROR event for a #GConn. If * enabled, the %GNET_CONN_ERROR event occurs when an error occurs. * The @conn is disconnected before the callback is made. * **/ void gnet_conn_set_watch_error (GConn* conn, gboolean enable) { g_return_if_fail (conn); if (enable) ADD_WATCH(conn, G_IO_ERR | G_IO_HUP | G_IO_NVAL); else REMOVE_WATCH(conn, G_IO_ERR | G_IO_HUP | G_IO_NVAL); } /** * gnet_conn_set_watch_readable * @conn: a #GConn * @enable: enable the %GNET_CONN_READABLE event? * * Enables (or disables) the %GNET_CONN_READABLE event for a #GConn. * If enabled, the %GNET_CONN_READABLE event occurs when data can be * read from the socket. Read from the iochannel member of the @conn. * Do not enable this while using gnet_conn_read(), gnet_conn_readn(), * or gnet_conn_readline(). * **/ void gnet_conn_set_watch_readable (GConn* conn, gboolean enable) { g_return_if_fail (conn); g_return_if_fail (conn->func); conn->watch_readable = enable; if (enable) ADD_WATCH (conn, G_IO_IN); else REMOVE_WATCH (conn, G_IO_IN); } /** * gnet_conn_set_watch_writable * @conn: a #GConn * @enable: enable the #GNET_CONN_WRITABLE event? * * Enables (or disables) the %GNET_CONN_WRITABLE event for a #GConn. * If enabled, the #GNET_CONN_WRITABLE event occurs when data can be * written to the socket. Write to the iochannel member of the @conn. * Do not enable this while using gnet_conn_write(). * **/ void gnet_conn_set_watch_writable (GConn* conn, gboolean enable) { g_return_if_fail (conn); conn->watch_writable = enable; if (enable) ADD_WATCH (conn, G_IO_OUT); else REMOVE_WATCH (conn, G_IO_OUT); } /* **************************************** */ /** * gnet_conn_timeout * @conn: a #GConn * @timeout: Timeout (in milliseconds) * * Sets a timeout on a #GConn. When the timer expires, the * %GNET_CONN_STATUS_TIMEOUT event occurs. If there already is a * timeout set on @conn, the old timeout is canceled. Set @timeout * to 0 to cancel the current timeout. * **/ void gnet_conn_timeout (GConn* conn, guint timeout) { g_return_if_fail (conn != NULL); if (conn->timer) { _gnet_source_remove (conn->context, conn->timer); conn->timer = 0; } if (timeout) { g_return_if_fail (conn->func != NULL); conn->timer = _gnet_timeout_add_full (conn->context, G_PRIORITY_DEFAULT, timeout, conn_timeout_cb, conn, (GDestroyNotify) NULL); } } static gboolean conn_timeout_cb (gpointer data) { GConn* conn = (GConn*) data; GConnEvent event; g_return_val_if_fail (conn, FALSE); conn->timer = 0; event.type = GNET_CONN_TIMEOUT; event.buffer = NULL; event.length = 0; (conn->func)(conn, &event, conn->user_data); return FALSE; } gnet-2.0.8/src/socks.c0000644000175000017500000001005210751326730011456 00000000000000/* GNet - Networking library * Copyright (C) 2001-2002 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "socks-private.h" #include "socks.h" G_LOCK_DEFINE_STATIC (socks); static GInetAddr* socks_server = NULL; static gboolean socks_enabled = FALSE; static gint socks_version = 0; /** * gnet_socks_get_enabled * * Determines whether SOCKS support is enabled. * * Returns: TRUE if SOCKS is enabled, FALSE otherwise. * **/ gboolean gnet_socks_get_enabled (void) { return socks_enabled; } /** * gnet_socks_set_enabled * @enabled: is SOCKS support enabled? * * Sets whether SOCKS support is enabled. * **/ void gnet_socks_set_enabled (gboolean enabled) { G_LOCK (socks); socks_enabled = enabled; G_UNLOCK (socks); } /** * gnet_socks_get_server * * Gets the address of the SOCKS server (regardless of whether SOCKS * is enabled). This function checks the gnet_socks_set_server() * value and, if not set, the SOCKS_SERVER environment variable. The * SOCKS_SERVER enviroment variable should be in the form HOSTNAME or * HOSTNAME:PORT. * * Returns: a copy of the address; NULL if there is no server. * **/ GInetAddr* gnet_socks_get_server (void) { GInetAddr* rv = NULL; const gchar* var; G_LOCK (socks); /* If no socks_server, check the environment variable. */ if (!socks_server && (var = g_getenv("SOCKS_SERVER"))) { gchar* hostname; gint port = GNET_SOCKS_PORT; int i; for (i = 0; var[i] && var[i] != ':'; ++i) ; if (i == 0) goto done; hostname = g_strndup (var, i); if (var[i] == ':') { char* ep; port = (gint) strtoul(&var[i+1], &ep, 10); if (*ep != '\0') { g_free (hostname); goto done; } } socks_server = gnet_inetaddr_new (hostname, port); } done: /* Return copy of socks server */ if (socks_server) rv = gnet_inetaddr_clone (socks_server); G_UNLOCK (socks); return rv; } /** * gnet_socks_set_server: * @inetaddr: SOCKS server address * * Sets the address of the SOCKS server. * **/ void gnet_socks_set_server (const GInetAddr* inetaddr) { g_return_if_fail (inetaddr); G_LOCK (socks); if (socks_server) gnet_inetaddr_delete (socks_server); socks_server = gnet_inetaddr_clone (inetaddr); G_UNLOCK (socks); } /** * gnet_socks_get_version * * Gets the SOCKS version GNet uses. This function checks the * gnet_socks_set_version() value and, if not set, the SOCKS_VERSION * environment variable. * * Returns: the SOCKS version. * **/ gint gnet_socks_get_version (void) { gint version; G_LOCK (socks); /* Use version set */ if (socks_version) version = socks_version; else { const gchar* env; /* Use environment variable */ env = g_getenv("SOCKS_VERSION"); version = 0; if (env) version = atoi(env); /* Use the default if no environment variable or the environment variable is bad. */ if (version != 4 && version != 5) version = GNET_SOCKS_VERSION; } G_UNLOCK (socks); return version; } /** * gnet_socks_set_version * @version: SOCKS version * * Sets the SOCKS version GNet uses. GNet only supports versions 4 * and 5. * **/ void gnet_socks_set_version (gint version) { g_return_if_fail (version == 4 || version == 5); G_LOCK (socks); socks_version = version; G_UNLOCK (socks); } gnet-2.0.8/src/conn.h0000644000175000017500000001400110751326730011274 00000000000000/* GNet - Networking library * Copyright (C) 2000 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_CONN_H #define _GNET_CONN_H #include #include "tcp.h" #include "iochannel.h" G_BEGIN_DECLS /** * GConnEventType * @GNET_CONN_ERROR: Connection error * @GNET_CONN_CONNECT: Connection complete * @GNET_CONN_CLOSE: Connection closed * @GNET_CONN_TIMEOUT: Timeout * @GNET_CONN_READ: Read complete * @GNET_CONN_WRITE: Write complete * @GNET_CONN_READABLE: Connection is readable * @GNET_CONN_WRITABLE: Connection is writable * * Event type. Used by #GConnEvent. * **/ typedef enum { GNET_CONN_ERROR, GNET_CONN_CONNECT, GNET_CONN_CLOSE, GNET_CONN_TIMEOUT, GNET_CONN_READ, GNET_CONN_WRITE, GNET_CONN_READABLE, GNET_CONN_WRITABLE } GConnEventType; /** * GConnEvent * @type: event type * @buffer: buffer * @length: buffer length * * GConn Event. @buffer and @length are set only on #GNET_CONN_READ * events. The buffer is caller-owned. * **/ typedef struct _GConnEvent GConnEvent; struct _GConnEvent { GConnEventType type; gchar* buffer; gint length; }; /** * GConn * @hostname: host name * @port: port * @iochannel: IO channel * @socket: socket * @inetaddr: address * @ref_count: [private] * @ref_count_internal: [private] * @connect_id: [private] * @new_id: [private] * @write_queue: [private] * @bytes_written: [private] * @buffer: [private] * @length: [private] * @bytes_read: [private] * @read_eof: [private] * @read_queue: [private] * @process_buffer_timeout: [private] * @watch_readable: [private] * @watch_writable: [private] * @watch_flags: [private] * @watch: [private] * @timer: [private] * @func: [private] * @user_data: [private] * * TCP Connection. Some of the fields are public, but do not set * these fields. * **/ typedef struct _GConn GConn; /** * GConnFunc * @conn: #GConn * @event: event (caller owned) * @user_data: user data specified in gnet_conn_new() * * Callback for #GConn. * * Possible events: * * %GNET_CONN_ERROR: #GConn error. The event occurs if the connection * fails somehow. The connection is closed before this event occurs. * * %GNET_CONN_CONNECT: Completion of gnet_conn_connect(). * * %GNET_CONN_CLOSE: Connection has been closed. The event does not * occur as a result of calling gnet_conn_disconnect(), * gnet_conn_unref(), or gnet_conn_delete(). * * %GNET_CONN_TIMEOUT: Timer set by gnet_conn_timeout() expires. * * %GNET_CONN_READ: Data has been read. This event occurs as a result * of calling gnet_conn_read(), gnet_conn_readn(), or * gnet_conn_readline(). buffer and length are set in the event * object. The buffer is caller owned. * * %GNET_CONN_WRITE: Data has been written. This event occurs as a * result of calling gnet_conn_write() or gnet_conn_write_direct(). * * %GNET_CONN_READABLE: The connection is readable. * * %GNET_CONN_WRITABLE: The connection is writable. * **/ typedef void (*GConnFunc)(GConn* conn, GConnEvent* event, gpointer user_data); struct _GConn { /* Public */ gchar* hostname; gint port; GIOChannel* iochannel; GTcpSocket* socket; GInetAddr* inetaddr; /* Private */ guint ref_count; guint ref_count_internal; /* Connect */ GTcpSocketConnectAsyncID connect_id; GTcpSocketNewAsyncID new_id; /* Write */ GList* write_queue; guint bytes_written; /* Read */ gchar* buffer; guint length; guint bytes_read; gboolean read_eof; GList* read_queue; guint process_buffer_timeout; /* Readable/writable */ gboolean watch_readable; gboolean watch_writable; /* IO watch */ guint watch_flags; guint watch; /* Timer */ guint timer; /* User data */ GConnFunc func; gpointer user_data; GMainContext * context; gint priority; }; /* ********** */ GConn* gnet_conn_new (const gchar* hostname, gint port, GConnFunc func, gpointer user_data); GConn* gnet_conn_new_inetaddr (const GInetAddr* inetaddr, GConnFunc func, gpointer user_data); GConn* gnet_conn_new_socket (GTcpSocket* socket, GConnFunc func, gpointer user_data); void gnet_conn_delete (GConn* conn); void gnet_conn_ref (GConn* conn); void gnet_conn_unref (GConn* conn); void gnet_conn_set_callback (GConn* conn, GConnFunc func, gpointer user_data); gboolean gnet_conn_set_main_context (GConn * conn, GMainContext * context); /* ********** */ void gnet_conn_connect (GConn* conn); void gnet_conn_disconnect (GConn* conn); gboolean gnet_conn_is_connected (const GConn* conn); /* ********** */ void gnet_conn_read (GConn* conn); void gnet_conn_readn (GConn* conn, gint length); void gnet_conn_readline (GConn* conn); void gnet_conn_write (GConn* conn, gchar* buffer, gint length); void gnet_conn_write_direct (GConn* conn, gchar* buffer, gint length, GDestroyNotify buffer_destroy_cb); void gnet_conn_set_watch_readable (GConn* conn, gboolean enable); void gnet_conn_set_watch_writable (GConn* conn, gboolean enable); void gnet_conn_set_watch_error (GConn* conn, gboolean enable); void gnet_conn_timeout (GConn* conn, guint timeout); G_END_DECLS #endif /* _GNET_CONN_H */ gnet-2.0.8/src/ipv6.c0000644000175000017500000000253310751326730011225 00000000000000/* GNet - Networking library * Copyright (C) 2002 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "ipv6.h" G_LOCK_DEFINE_STATIC (ipv6); static GIPv6Policy ipv6_policy = GIPV6_POLICY_IPV4_ONLY; /** * gnet_ipv6_get_policy * * Gets the IPv6 policy. * * Returns: IPv6 policy. **/ GIPv6Policy gnet_ipv6_get_policy (void) { GIPv6Policy policy; G_LOCK (ipv6); policy = ipv6_policy; G_UNLOCK (ipv6); return policy; } /** * gnet_ipv6_set_policy * @policy: IPv6 policy * * Sets the IPv6 policy. * **/ void gnet_ipv6_set_policy (GIPv6Policy policy) { G_LOCK (ipv6); ipv6_policy = policy; G_UNLOCK (ipv6); } gnet-2.0.8/src/conn-http.c0000644000175000017500000013460610751326730012262 00000000000000/* GNet - Networking library * Copyright (C) 2000 David Helder * Copyright (C) 2004 Tim-Philipp Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /*************************************************************************** * * * TODO: * * - support http_proxy environment variable (possible also via API) * * - support authentication * * - read RFC for Http/1.1 from cover to cover and check compliance * * - think about how to make an HTTPS easy - maybe add public vfuncs? * * * ***************************************************************************/ #include "conn-http.h" #include "gnetconfig.h" #include #include #define GNET_CONN_HTTP_DEFAULT_MAX_REDIRECTS 5 #define GNET_CONN_HTTP_BUF_INCREMENT 8192 /* 8kB */ #define CONN_HTTP_MAGIC_SEQUENCE 499138271 #define GNET_IS_CONN_HTTP(conn) ((conn)&&(((GConnHttp*)(conn))->stamp == CONN_HTTP_MAGIC_SEQUENCE)) typedef enum { STATUS_NONE = 0, STATUS_SENT_REQUEST, STATUS_RECV_HEADERS, STATUS_RECV_BODY_NONCHUNKED, STATUS_RECV_CHUNK_SIZE, STATUS_RECV_CHUNK_BODY, STATUS_ERROR, STATUS_DONE } GConnHttpStatus; struct _GConnHttp { guint stamp; /* magic cookie instead of a type system */ GInetAddrNewAsyncID ia_id; GInetAddr *ia; GConn *conn; gboolean connection_close; /* Connection: close header was given */ GConnHttpFunc func; gpointer func_data; guint num_redirects; guint max_redirects; gchar *redirect_location; /* set if auto-redirection is required after body is received */ GURI *uri; GList *req_headers; /* request headers we send */ GList *resp_headers; /* response headers we got */ guint response_code; GConnHttpMethod method; GConnHttpStatus status; guint timeout; gchar *post_data; gsize post_data_len; gsize post_data_term_len; /* for extra \n\r etc. */ gsize content_length; gsize content_recv; gboolean got_content_length; /* set if we got a content_length header */ gboolean tenc_chunked; /* Transfer-Encoding: chunked */ gchar *buffer; gsize bufalloc; /* number of bytes allocated */ gsize buflen; /* number of bytes of data in the buffer */ GMainContext *context; /* we hold a reference, may be NULL */ GMainLoop *loop; guint refcount; /* used internally only, if >1 we are in the callback */ }; typedef struct _GConnHttpHdr GConnHttpHdr; struct _GConnHttpHdr { gchar *field; gchar *value; /* NULL = not set */ }; static const gchar *gen_headers[] = { "Cache-Control", "Connection", "Date", "Pragma", "Trailer", "Transfer-Encoding", "Upgrade", "Via", "Warning" }; static const gchar *req_headers[] = { "Accept", "Accept-Charset", "Accept-Encoding", "Accept-Language", "Authorization", "Expect", "From", "Host", "If-Match", "If-Modified-Since", "If-None-Match", "If-Range", "If-Unmodified-Since", "Max-Forwards", "Proxy-Authorization", "Range", "Referer", "TE", "User-Agent", "Content-Length" /* for POST request */ }; #define is_general_header(field) (is_in_str_arr(gen_headers,G_N_ELEMENTS(gen_headers),field)) #define is_request_header(field) (is_in_str_arr(req_headers,G_N_ELEMENTS(req_headers),field)) static void gnet_conn_http_delete_internal (GConnHttp *conn); /*************************************************************************** * * gnet_conn_http_append_to_buf * ***************************************************************************/ static void gnet_conn_http_append_to_buf (GConnHttp *conn, const gchar *data, gsize datalen) { g_return_if_fail (conn != NULL); g_return_if_fail (data != NULL); if (conn->buflen + datalen >= conn->bufalloc) { while (conn->buflen + datalen >= conn->bufalloc) conn->bufalloc += GNET_CONN_HTTP_BUF_INCREMENT; /* alloc one more to make sure buffer can be NUL-terminated later */ conn->buffer = g_realloc (conn->buffer, conn->bufalloc + 1); } if (datalen > 0) { memcpy (conn->buffer + conn->buflen, data, datalen); conn->buflen += datalen; } } /*************************************************************************** * * gnet_conn_http_reset * * reset certain values, but not the connection or URI or address * ***************************************************************************/ static void gnet_conn_http_reset (GConnHttp *conn) { GList *node; conn->num_redirects = 0; conn->max_redirects = GNET_CONN_HTTP_DEFAULT_MAX_REDIRECTS; g_free(conn->redirect_location); conn->redirect_location = NULL; conn->connection_close = FALSE; conn->content_length = 0; conn->content_recv = 0; conn->tenc_chunked = FALSE; conn->got_content_length = FALSE; /* Note: we keep the request headers as they are*/ for (node = conn->resp_headers; node; node = node->next) { GConnHttpHdr *hdr = (GConnHttpHdr*)node->data; g_free(hdr->field); g_free(hdr->value); memset(hdr, 0xff, sizeof(GConnHttpHdr)); g_free(hdr); } g_list_free(conn->resp_headers); conn->resp_headers = NULL; conn->response_code = 0; if (conn->method != GNET_CONN_HTTP_METHOD_POST) { g_free(conn->post_data); conn->post_data = NULL; conn->post_data_len = 0; } /* alloc one more to make sure buffer can be NUL-terminated later */ conn->buffer = g_realloc (conn->buffer, GNET_CONN_HTTP_BUF_INCREMENT + 1); conn->bufalloc = GNET_CONN_HTTP_BUF_INCREMENT; conn->buflen = 0; conn->status = STATUS_NONE; } /** * gnet_conn_http_new * * Creates a #GConnHttp. * * Returns: a #GConnHttp. * **/ GConnHttp * gnet_conn_http_new (void) { GConnHttp *conn; conn = g_new0 (GConnHttp, 1); conn->stamp = CONN_HTTP_MAGIC_SEQUENCE; /* alloc one more to make sure buffer can be NUL-terminated later */ conn->buffer = g_malloc (GNET_CONN_HTTP_BUF_INCREMENT + 1); conn->bufalloc = GNET_CONN_HTTP_BUF_INCREMENT; conn->buflen = 0; /* set default user agent */ gnet_conn_http_set_user_agent (conn, NULL); gnet_conn_http_set_method (conn, GNET_CONN_HTTP_METHOD_GET, NULL, 0); gnet_conn_http_set_header (conn, "Accept", "*/*", 0); gnet_conn_http_set_header (conn, "Connection", "Keep-Alive", 0); gnet_conn_http_set_timeout (conn, 30*1000); /* 30 secs */ conn->refcount = 1; return conn; } /*************************************************************************** * * gnet_conn_http_new_event * ***************************************************************************/ static GConnHttpEvent * gnet_conn_http_new_event (GConnHttpEventType type) { GConnHttpEvent *event = NULL; gsize stsize = 0; switch (type) { case GNET_CONN_HTTP_RESOLVED: stsize = sizeof(GConnHttpEventResolved); break; case GNET_CONN_HTTP_RESPONSE: stsize = sizeof(GConnHttpEventResponse); break; case GNET_CONN_HTTP_REDIRECT: stsize = sizeof(GConnHttpEventRedirect); break; case GNET_CONN_HTTP_DATA_PARTIAL: case GNET_CONN_HTTP_DATA_COMPLETE: stsize = sizeof(GConnHttpEventData); break; case GNET_CONN_HTTP_ERROR: stsize = sizeof(GConnHttpEventError); break; case GNET_CONN_HTTP_CONNECTED: default: stsize = sizeof(GConnHttpEvent); break; } event = (GConnHttpEvent*) g_malloc0(stsize); event->type = type; event->stsize = stsize; return event; } /*************************************************************************** * * gnet_conn_http_free_event * ***************************************************************************/ static void gnet_conn_http_free_event (GConnHttpEvent *event) { g_return_if_fail (event != NULL); g_return_if_fail (event->stsize > 0); switch (event->type) { case GNET_CONN_HTTP_RESPONSE: g_strfreev(((GConnHttpEventResponse*)event)->header_fields); g_strfreev(((GConnHttpEventResponse*)event)->header_values); break; case GNET_CONN_HTTP_REDIRECT: g_free(((GConnHttpEventRedirect*)event)->new_location); break; case GNET_CONN_HTTP_ERROR: g_free(((GConnHttpEventError*)event)->message); break; default: break; } /* poison struct */ memset(event, 0xff, event->stsize); g_free(event); } /*************************************************************************** * * gnet_conn_http_emit_event * * Calls user callback with given event. You MUST check whether the * connection has been deleted from the user callback via checking * conn->recount == 0 and calling _delete_internal() if so at some * point before giving control back to the main loop. * ***************************************************************************/ static void gnet_conn_http_emit_event (GConnHttp *conn, GConnHttpEvent *event) { g_return_if_fail (conn != NULL); g_return_if_fail (event != NULL); ++conn->refcount; if (conn->func) conn->func (conn, event, conn->func_data); g_return_if_fail (conn->refcount > 0); --conn->refcount; } /*************************************************************************** * * gnet_conn_http_emit_error_event * ***************************************************************************/ static void gnet_conn_http_emit_error_event (GConnHttp *conn, GConnHttpError code, const gchar *format, ...) { GConnHttpEventError *ev_err; GConnHttpEvent *ev; va_list args; g_return_if_fail (conn != NULL); conn->status = STATUS_ERROR; ev = gnet_conn_http_new_event(GNET_CONN_HTTP_ERROR); ev_err = (GConnHttpEventError*)ev; ev_err->code = code; va_start(args, format); ev_err->message = g_strdup_vprintf(format, args); va_end(args); gnet_conn_http_emit_event(conn, ev); gnet_conn_http_free_event(ev); if (conn->loop) g_main_loop_quit(conn->loop); } /*************************************************************************** * * is_in_str_arr * ***************************************************************************/ static gboolean is_in_str_arr (const gchar **arr, guint num, const gchar *field) { guint i; g_return_val_if_fail (arr != NULL, FALSE); g_return_val_if_fail (field != NULL, FALSE); for (i = 0; i < num; ++i) { if (g_ascii_strcasecmp(arr[i], field) == 0) return TRUE; } return FALSE; } /** * gnet_conn_http_set_header * @conn: a #GConnHttp * @field: a header field, e.g. "Accept" * @value: the header field value, e.g. "text/html" * @flags: one or more flags of #GConnHttpHeaderFlags, or 0 * * Set header field to send with the HTTP request. * * Returns: TRUE if the header field has been set or changed * **/ gboolean gnet_conn_http_set_header (GConnHttp *conn, const gchar *field, const gchar *value, GConnHttpHeaderFlags flags) { GConnHttpHdr *hdr; GList *node; g_return_val_if_fail (conn != NULL, FALSE); g_return_val_if_fail (field != NULL, FALSE); g_return_val_if_fail (GNET_IS_CONN_HTTP (conn), FALSE); /* Don't allow 'Host' to be set explicitely * we'll do that ourselves */ if (g_ascii_strcasecmp(field, "Host") == 0) return FALSE; /* only allow uncommon header fields if * explicitely allowed via the flags */ if ((flags & GNET_CONN_HTTP_FLAG_SKIP_HEADER_CHECK) == 0) { if (!(is_general_header(field) || is_request_header(field))) return FALSE; } for (node = conn->req_headers; node; node = node->next) { hdr = (GConnHttpHdr*)node->data; if (g_str_equal(hdr->field, field)) { g_free(hdr->value); hdr->value = g_strdup(value); return TRUE; } } hdr = g_new0 (GConnHttpHdr, 1); hdr->field = g_strdup(field); hdr->value = g_strdup(value); conn->req_headers = g_list_append(conn->req_headers, hdr); return TRUE; } /** * gnet_conn_http_set_user_agent * @conn: a #GConnHttp * @agent: the user agent string to send (will be supplemented by a GNet * version number comment) * * Convenience function. Wraps gnet_conn_http_set_header(). * * Returns: TRUE if the user agent string has been changed. * **/ gboolean gnet_conn_http_set_user_agent (GConnHttp *conn, const gchar *agent) { gboolean ret; gchar *full; g_return_val_if_fail (GNET_IS_CONN_HTTP (conn), FALSE); if (agent == NULL) { agent = (const gchar *) g_get_prgname (); if (agent == NULL) agent = "GNet"; } full = g_strdup_printf ("%s (GNet-%u.%u.%u)", agent, GNET_MAJOR_VERSION, GNET_MINOR_VERSION, GNET_MICRO_VERSION); ret = gnet_conn_http_set_header (conn, "User-Agent", full, 0); g_free (full); return ret; } static gboolean gnet_conn_http_set_uri_internal (GConnHttp *conn, const gchar *uri, gboolean uri_is_escaped) { gchar *old_hostname = NULL; g_assert (conn != NULL && uri != NULL); if (conn->uri) { old_hostname = g_strdup(conn->uri->hostname); gnet_uri_delete(conn->uri); conn->uri = NULL; } /* Add 'http://' prefix if no scheme/protocol is specified */ if (strstr(uri,"://") == NULL) { gchar *full_uri = g_strconcat("http://", uri, NULL); conn->uri = gnet_uri_new(full_uri); g_free(full_uri); } else { if (g_ascii_strncasecmp(uri, "http:", 5) != 0) return FALSE; /* unsupported protocol */ conn->uri = gnet_uri_new(uri); } if (conn->uri && old_hostname && g_ascii_strcasecmp(conn->uri->hostname, old_hostname) != 0) { if (conn->ia) { gnet_inetaddr_delete(conn->ia); conn->ia = NULL; } if (conn->conn) { gnet_conn_unref(conn->conn); conn->conn = NULL; } } g_free(old_hostname); if (conn->uri == NULL) return FALSE; gnet_uri_set_scheme(conn->uri, "http"); if (!uri_is_escaped) gnet_uri_escape (conn->uri); return TRUE; } /** * gnet_conn_http_set_uri * @conn: a #GConnHttp * @uri: URI string * * Sets the URI to GET or POST, e.g. http://www.foo.com/bar.html. @uri is * assumed to be unescaped, so all special URI characters will be escaped. * * Returns: TRUE if the URI has been accepted. * **/ gboolean gnet_conn_http_set_uri (GConnHttp *conn, const gchar *uri) { g_return_val_if_fail (conn != NULL, FALSE); g_return_val_if_fail (uri != NULL, FALSE); g_return_val_if_fail (GNET_IS_CONN_HTTP (conn), FALSE); return gnet_conn_http_set_uri_internal (conn, uri, FALSE); } /** * gnet_conn_http_set_escaped_uri * @conn: a #GConnHttp * @uri: URI string with special characters already escaped * * Sets the URI to GET or POST, e.g. http://www.foo.com/My%%20Documents/bar.txt * * Returns: TRUE if the URI has been accepted. * **/ gboolean gnet_conn_http_set_escaped_uri (GConnHttp *conn, const gchar *uri) { g_return_val_if_fail (conn != NULL, FALSE); g_return_val_if_fail (uri != NULL, FALSE); g_return_val_if_fail (GNET_IS_CONN_HTTP (conn), FALSE); return gnet_conn_http_set_uri_internal (conn, uri, TRUE); } /** * gnet_conn_http_set_method * @conn: a #GConnHttp * @method: a #GConnHttpMethod * @post_data: post data to send with POST method, or NULL * @post_data_len: the length of the post data to send with POST method, or 0 * * Sets the HTTP request method. Default is the GET method. * * Returns: TRUE if the method has been changed successfully. * **/ gboolean gnet_conn_http_set_method (GConnHttp *conn, GConnHttpMethod method, const gchar *post_data, gsize post_data_len) { g_return_val_if_fail (conn != NULL, FALSE); g_return_val_if_fail (GNET_IS_CONN_HTTP (conn), FALSE); switch (method) { case GNET_CONN_HTTP_METHOD_GET: conn->method = method; return TRUE; case GNET_CONN_HTTP_METHOD_POST: { g_return_val_if_fail (post_data != NULL, FALSE); g_return_val_if_fail (post_data_len > 0, FALSE); conn->method = method; g_free(conn->post_data); conn->post_data = g_memdup(post_data, post_data_len); conn->post_data = g_realloc(conn->post_data, post_data_len + 2 + 2 + 1); conn->post_data_len = post_data_len; conn->post_data[conn->post_data_len+0] = '\r'; conn->post_data[conn->post_data_len+1] = '\n'; conn->post_data[conn->post_data_len+2] = '\r'; conn->post_data[conn->post_data_len+3] = '\n'; conn->post_data[conn->post_data_len+4] = '\000'; conn->post_data_term_len = 0; while (conn->post_data_len < 4 || !g_str_equal(conn->post_data + conn->post_data_len + conn->post_data_term_len - 4, "\r\n\r\n")) conn->post_data_term_len += 2; return TRUE; } default: break; } return FALSE; } /*************************************************************************** * * gnet_conn_http_conn_connected * ***************************************************************************/ static void gnet_conn_http_conn_connected (GConnHttp *conn) { const gchar *resource; GString *request; GList *node; gchar *res; gnet_conn_http_reset(conn); gnet_conn_timeout(conn->conn, conn->timeout); request = g_string_new(NULL); res = gnet_uri_get_string(conn->uri); resource = res + strlen(conn->uri->scheme) + strlen("://") + strlen(conn->uri->hostname); if (*resource == ':') { resource = strchr(resource, '/'); if (resource == NULL || *resource == 0x00) resource = "/"; } switch (conn->method) { case GNET_CONN_HTTP_METHOD_GET: g_string_append_printf (request, "GET %s HTTP/1.1\r\n", resource); break; case GNET_CONN_HTTP_METHOD_POST: { gchar buf[16]; /* Note: this must be 1.1 */ g_string_append_printf (request, "POST %s HTTP/1.1\r\n", resource); g_snprintf(buf, sizeof(buf), "%u", (guint) conn->post_data_len); gnet_conn_http_set_header (conn, "Expect", "100-continue", 0); gnet_conn_http_set_header (conn, "Content-Length", buf, 0); } break; default: g_warning("Unknown http method in %s\n", __FUNCTION__); return; } for (node = conn->req_headers; node; node = node->next) { GConnHttpHdr *hdr = (GConnHttpHdr*)node->data; if (hdr->field && hdr->value && *hdr->field && *hdr->value) { g_string_append_printf(request, "%s: %s\r\n", hdr->field, hdr->value); } } if (conn->uri->port == 80) { g_string_append_printf(request, "Host: %s\r\n", conn->uri->hostname); } else { g_string_append_printf(request, "Host: %s:%u\r\n", conn->uri->hostname, conn->uri->port); } g_string_append(request, "\r\n"); /* g_print ("Sending:\n%s\n", request->str); */ gnet_conn_write(conn->conn, request->str, request->len); conn->status = STATUS_SENT_REQUEST; /* read response */ gnet_conn_readline(conn->conn); g_string_free(request, TRUE); g_free(res); } /*************************************************************************** * * gnet_conn_http_done * * Finished receiving data * ***************************************************************************/ static void gnet_conn_http_done (GConnHttp *conn) { GConnHttpEventData *ev_data; GConnHttpEvent *ev; conn->status = STATUS_DONE; gnet_conn_timeout (conn->conn, 0); /* we don't want to emit a DATA_COMPLETE event * if we are getting redirected, do we? */ if (conn->redirect_location == NULL) { ev = gnet_conn_http_new_event (GNET_CONN_HTTP_DATA_COMPLETE); ev_data = (GConnHttpEventData*)ev; ev_data->buffer = conn->buffer; ev_data->buffer_length = conn->buflen; ev_data->content_length = conn->content_length; ev_data->data_received = conn->content_recv; gnet_conn_http_emit_event (conn, ev); gnet_conn_http_free_event (ev); } if (conn->connection_close) gnet_conn_disconnect(conn->conn); /* need to do auto-redirect now? */ if (conn->redirect_location && conn->refcount > 0) { if (gnet_conn_http_set_uri (conn, conn->redirect_location)) { /* send request with new URI */ gnet_conn_http_run_async (conn, conn->func, conn->func_data); return; /* do not quit own loop just yet */ } gnet_conn_http_emit_error_event (conn, GNET_CONN_HTTP_ERROR_UNSPECIFIED, "Auto-redirect failed for some reason."); } if (conn->loop) g_main_loop_quit(conn->loop); } /*************************************************************************** * * gnet_conn_http_conn_parse_response_headers * ***************************************************************************/ static void gnet_conn_http_conn_parse_response_headers (GConnHttp *conn) { GConnHttpEventRedirect *ev_redirect; GConnHttpEventResponse *ev_response; GConnHttpEvent *ev; const gchar *new_location = NULL; guint num_headers, n; GList *node; num_headers = g_list_length(conn->resp_headers); ev = gnet_conn_http_new_event (GNET_CONN_HTTP_RESPONSE); ev_response = (GConnHttpEventResponse*)ev; ev_response->header_fields = g_new0(gchar *, num_headers+1); ev_response->header_values = g_new0(gchar *, num_headers+1); ev_response->response_code = conn->response_code; n = 0; conn->tenc_chunked = FALSE; for (node = conn->resp_headers; node; node = node->next) { GConnHttpHdr *hdr = (GConnHttpHdr*)node->data; ev_response->header_fields[n] = g_strdup(hdr->field); /* better safe than sorry */ ev_response->header_values[n] = g_strdup(hdr->value); if (g_ascii_strcasecmp(hdr->field, "Content-Length") == 0) { conn->content_length = atoi(hdr->value); conn->got_content_length = TRUE; } else if (g_ascii_strcasecmp(hdr->field, "Transfer-Encoding") == 0 && g_ascii_strcasecmp(hdr->value, "chunked") == 0) { conn->tenc_chunked = TRUE; } else if (g_ascii_strcasecmp(hdr->field, "Location") == 0) { new_location = hdr->value; } /* Note: amazon sends garbled 'Connection' string, but it * might also be some apache module problem */ else if (g_ascii_strcasecmp(hdr->field, "Connection") == 0 || g_ascii_strcasecmp(hdr->field, "Cneonction") == 0 || g_ascii_strcasecmp(hdr->field, "nnCoection") == 0) { conn->connection_close = (g_ascii_strcasecmp(hdr->value, "close") == 0); } else { ; } ++n; } /* send generic response event first */ gnet_conn_http_emit_event (conn, ev); gnet_conn_http_free_event (ev); /* If not a redirection code, continue normally */ if (conn->response_code < 300 || conn->response_code >= 400) return; /* continue */ ev = gnet_conn_http_new_event (GNET_CONN_HTTP_REDIRECT); ev_redirect = (GConnHttpEventRedirect*)ev; ev_redirect->num_redirects = conn->num_redirects; ev_redirect->max_redirects = conn->max_redirects; ev_redirect->auto_redirect = TRUE; if (conn->response_code == 301 && conn->method == GNET_CONN_HTTP_METHOD_POST) ev_redirect->auto_redirect = FALSE; if (conn->num_redirects >= conn->max_redirects) ev_redirect->auto_redirect = FALSE; /* No Location: header field? tough luck, can't do much */ ev_redirect->new_location = g_strdup(new_location); if (new_location == NULL) ev_redirect->auto_redirect = FALSE; /* send generic redirect event (dispatch first to give * the client a chance to stop us before we do the * automatic redirection) */ gnet_conn_http_emit_event (conn, ev); /* do the redirect later after receiving the body (if any) */ if (ev_redirect->auto_redirect) { g_free (conn->redirect_location); conn->redirect_location = g_strdup(new_location); } gnet_conn_http_free_event (ev); return; /* continue and receive body */ } /*************************************************************************** * * gnet_conn_http_conn_recv_response * ***************************************************************************/ static void gnet_conn_http_conn_recv_response (GConnHttp *conn, gchar *data, gsize len) { gchar *endptr, *start; /* after a 100 Continue response, skip everything until we get a * proper next response (there may be headers and there should * definitely be an empty line following the 100 Continue response) */ if (conn->method == GNET_CONN_HTTP_METHOD_POST && conn->response_code == 100 && !g_str_has_prefix (data, "HTTP/") && !g_str_has_prefix (data, "http/")) { gnet_conn_readline(conn->conn); return; } /* This should be a response line */ if (g_ascii_strncasecmp (data, "ICY ", 4) != 0 && g_ascii_strncasecmp (data, "HTTP/", 5) != 0) { goto unsupported_proto; } start = strchr (data, ' '); if (start == NULL) goto malformed_response; /* FIXME: should we also check the HTTP protocol version? */ conn->response_code = (guint) strtol(start+1, &endptr, 10); /* read first header */ gnet_conn_readline(conn->conn); /* may we continue the POST request? */ if (conn->response_code == 100 && conn->method == GNET_CONN_HTTP_METHOD_POST) { gnet_conn_write(conn->conn, conn->post_data, conn->post_data_len + conn->post_data_term_len); conn->status = STATUS_SENT_REQUEST; /* expecting the response for the content next */ return; } /* note: redirection is handled after we have all headers */ conn->status = STATUS_RECV_HEADERS; /* response ok - expect headers next */ return; /* ERRORS */ unsupported_proto: { conn->response_code = 0; gnet_conn_http_emit_error_event (conn, GNET_CONN_HTTP_ERROR_PROTOCOL_UNSUPPORTED, "Not a HTTP or ICY protocol response: '%s'", data); return; } malformed_response: { conn->response_code = 0; gnet_conn_http_emit_error_event (conn, GNET_CONN_HTTP_ERROR_PROTOCOL_UNSUPPORTED, "Malformed response: '%s'", data); return; } } /*************************************************************************** * * gnet_conn_http_conn_recv_headers * ***************************************************************************/ static void gnet_conn_http_conn_recv_headers (GConnHttp *conn, gchar *data, gsize len) { gchar *colon; /* End of headers? */ if (*data == 0x00 || g_str_equal(data,"\r\n") || g_str_equal(data,"\r") || g_str_equal(data,"\n")) { gnet_conn_http_conn_parse_response_headers (conn); if (conn->got_content_length && conn->content_length == 0) { /* no body to receive */ gnet_conn_http_done (conn); return; } else if (conn->tenc_chunked) { /* read line with chunk size of first data chunk */ gnet_conn_readline(conn->conn); conn->status = STATUS_RECV_CHUNK_SIZE; return; } else { gnet_conn_read(conn->conn); conn->status = STATUS_RECV_BODY_NONCHUNKED; return; } g_return_if_reached(); } /* this is a normal header line then */ colon = strchr(data, ':'); if (colon) { GConnHttpHdr *hdr; *colon = 0x00; hdr = g_new0 (GConnHttpHdr, 1); hdr->field = g_strdup(data); hdr->value = g_strstrip(g_strdup(colon+1)); conn->resp_headers = g_list_append(conn->resp_headers, hdr); } /* read next header line */ gnet_conn_readline(conn->conn); } /*************************************************************************** * * gnet_conn_http_conn_recv_chunk_size * ***************************************************************************/ static void gnet_conn_http_conn_recv_chunk_size (GConnHttp *conn, gchar *data, gsize len) { gchar *endptr; gsize chunksize; chunksize = (gsize) strtol (data, &endptr, 16); if (chunksize == 0) { gnet_conn_http_done(conn); return; } gnet_conn_readn(conn->conn, chunksize+2); /* including \r\n */ conn->status = STATUS_RECV_CHUNK_BODY; } /*************************************************************************** * * gnet_conn_http_conn_recv_chunk_body * ***************************************************************************/ static void gnet_conn_http_conn_recv_chunk_body (GConnHttp *conn, gchar *data, gsize len) { /* do not count the '\r\n' at the end of a block */ if (len >=2 && data[len-2] == '\r' && data[len-1] == '\n') len -= 2; conn->content_recv += len; gnet_conn_http_append_to_buf(conn, data, len); /* we don't want to emit data events if we're * getting redirected anyway, do we? */ if (conn->redirect_location == NULL) { GConnHttpEventData *ev_data; GConnHttpEvent *ev; ev = gnet_conn_http_new_event(GNET_CONN_HTTP_DATA_PARTIAL); ev_data = (GConnHttpEventData*)ev; ev_data->buffer = conn->buffer; ev_data->buffer_length = conn->buflen; ev_data->content_length = conn->content_length; ev_data->data_received = conn->content_recv; gnet_conn_http_emit_event(conn, ev); gnet_conn_http_free_event(ev); } /* read line with chunk size of next chunk */ gnet_conn_readline(conn->conn); conn->status = STATUS_RECV_CHUNK_SIZE; } /*************************************************************************** * * gnet_conn_http_conn_recv_nonchunked_data * ***************************************************************************/ static void gnet_conn_http_conn_recv_nonchunked_data (GConnHttp *conn, gchar *data, gsize len) { if (conn->content_length > 0) { conn->content_recv += len; gnet_conn_http_append_to_buf(conn, data, len); if (conn->content_recv >= conn->content_length) { gnet_conn_http_done(conn); return; } gnet_conn_read(conn->conn); } else { conn->content_recv += len; gnet_conn_http_append_to_buf (conn, data, len); gnet_conn_read (conn->conn); } /* we don't want to emit data events if we're * getting redirected anyway, do we? */ if (conn->redirect_location == NULL) { GConnHttpEventData *ev_data; GConnHttpEvent *ev; ev = gnet_conn_http_new_event(GNET_CONN_HTTP_DATA_PARTIAL); ev_data = (GConnHttpEventData*)ev; ev_data->buffer = conn->buffer; ev_data->buffer_length = conn->buflen; ev_data->content_length = conn->content_length; ev_data->data_received = conn->content_recv; gnet_conn_http_emit_event(conn, ev); gnet_conn_http_free_event(ev); } } /*************************************************************************** * * gnet_conn_http_conn_got_data * ***************************************************************************/ static void gnet_conn_http_conn_got_data (GConnHttp *conn, gchar *data, gsize len) { gnet_conn_timeout (conn->conn, conn->timeout); switch (conn->status) { /* sent request - so this must be the response code */ case STATUS_SENT_REQUEST: gnet_conn_http_conn_recv_response(conn, data, len); break; case STATUS_RECV_HEADERS: gnet_conn_http_conn_recv_headers(conn, data, len); break; case STATUS_RECV_BODY_NONCHUNKED: gnet_conn_http_conn_recv_nonchunked_data(conn, data, len); break; case STATUS_RECV_CHUNK_SIZE: gnet_conn_http_conn_recv_chunk_size(conn, data, len); break; case STATUS_RECV_CHUNK_BODY: gnet_conn_http_conn_recv_chunk_body(conn, data, len); break; default: gnet_conn_http_emit_error_event(conn, GNET_CONN_HTTP_ERROR_UNSPECIFIED, "%s: should not be reached. conn->status = %u", G_STRLOC, conn->status); break; } } /*************************************************************************** * * gnet_conn_http_conn_cb * * GConn callback function * ***************************************************************************/ static void gnet_conn_http_conn_cb (GConn *c, GConnEvent *event, GConnHttp *httpconn) { GConnHttpEvent *ev; g_return_if_fail (GNET_IS_CONN_HTTP (httpconn)); switch (event->type) { case GNET_CONN_ERROR: gnet_conn_disconnect(httpconn->conn); gnet_conn_http_emit_error_event(httpconn, GNET_CONN_HTTP_ERROR_UNSPECIFIED, "GNET_CONN_ERROR (unspecified Gnet GConn error)"); if (httpconn->loop) g_main_loop_quit(httpconn->loop); break; case GNET_CONN_CONNECT: gnet_conn_http_conn_connected(httpconn); break; case GNET_CONN_CLOSE: gnet_conn_disconnect(httpconn->conn); /* _done() will take care of redirection and main loop quitting */ gnet_conn_http_done(httpconn); break; case GNET_CONN_TIMEOUT: ev = gnet_conn_http_new_event(GNET_CONN_HTTP_TIMEOUT); gnet_conn_http_emit_event(httpconn, ev); gnet_conn_http_free_event(ev); if (httpconn->loop) g_main_loop_quit(httpconn->loop); break; case GNET_CONN_READ: /* Note: GConn translates reads of 0 bytes into CLOSE for us */ gnet_conn_http_conn_got_data(httpconn, event->buffer, event->length); break; case GNET_CONN_WRITE: case GNET_CONN_READABLE: case GNET_CONN_WRITABLE: break; } if (httpconn->refcount == 0) gnet_conn_http_delete_internal (httpconn); } /*************************************************************************** * * gnet_conn_http_ia_cb * * GInetAddr async resolve callback function * ***************************************************************************/ static void gnet_conn_http_ia_cb (GInetAddr *ia, GConnHttp *conn) { conn->ia_id = 0; g_return_if_fail (GNET_IS_CONN_HTTP (conn)); if (ia != conn->ia || ia == NULL) { GConnHttpEventResolved *ev_resolved; GConnHttpEvent *ev; conn->ia = ia; ev = gnet_conn_http_new_event (GNET_CONN_HTTP_RESOLVED); ev_resolved = (GConnHttpEventResolved*)ev; ev_resolved->ia = conn->ia; gnet_conn_http_emit_event (conn, ev); gnet_conn_http_free_event (ev); if (conn->refcount == 0) { gnet_conn_http_delete_internal (conn); return; } } /* could not resolve hostname? => emit error event and quit */ if (ia == NULL) { if (conn->loop) g_main_loop_quit(conn->loop); gnet_conn_http_emit_error_event (conn, GNET_CONN_HTTP_ERROR_HOSTNAME_RESOLUTION, "Could not resolve hostname '%s'", conn->uri->hostname); return; } if (conn->conn == NULL) { conn->conn = gnet_conn_new_inetaddr (ia, (GConnFunc) gnet_conn_http_conn_cb, conn); if (conn->conn == NULL) { gnet_conn_http_emit_error_event(conn, GNET_CONN_HTTP_ERROR_UNSPECIFIED, "%s: Could not create GConn object.", G_STRLOC); return; } gnet_conn_set_main_context (conn->conn, conn->context); gnet_conn_timeout(conn->conn, conn->timeout); gnet_conn_connect(conn->conn); gnet_conn_set_watch_error(conn->conn, TRUE); return; } /* re-use existing connection? */ if (!gnet_conn_is_connected (conn->conn)) { gnet_conn_timeout(conn->conn, conn->timeout); gnet_conn_connect(conn->conn); } else { gnet_conn_http_conn_connected(conn); } } /** * gnet_conn_http_run_async * @conn: a #GConnHttp * @func: callback function to communicate progress and errors, or NULL * @user_data: user data to pass to callback function, or NULL * * Starts connecting and sending the specified http request. Will * return immediately. Assumes there is an existing and running * default Gtk/GLib/Gnome main loop. * **/ void gnet_conn_http_run_async (GConnHttp *conn, GConnHttpFunc func, gpointer user_data) { g_return_if_fail (conn != NULL); g_return_if_fail (GNET_IS_CONN_HTTP (conn)); g_return_if_fail (func != NULL || user_data == NULL); g_return_if_fail (conn->uri != NULL); g_return_if_fail (conn->ia_id == 0); conn->func = func; conn->func_data = user_data; if (conn->uri->port == 0) gnet_uri_set_port(conn->uri, 80); // FIXME: 8080 for http proxies if (conn->ia == NULL) { conn->ia_id = gnet_inetaddr_new_async_full (conn->uri->hostname, conn->uri->port, (GInetAddrNewAsyncFunc) gnet_conn_http_ia_cb, conn, (GDestroyNotify) NULL, conn->context, G_PRIORITY_DEFAULT); } else { gnet_conn_http_ia_cb(conn->ia, conn); } } /** * gnet_conn_http_run * @conn: a #GConnHttp * @func: callback function to communicate progress and errors, or NULL * @user_data: user data to pass to callback function, or NULL * * Starts connecting and sending the specified http request. Will * return once the operation has finished and either an error has * occured, or the data has been received in full. * * This function will run its own main loop in the default GLib main context * (or the user-specified main context, if one was specified with * gnet_conn_http_set_main_context()), which means that if your application * is based on Gtk+ or sets up GLib timeouts or idle callbacks, it is * possible that those callback functions are invoked while you are waiting * for gnet_conn_http_run() to return. This means you shouldn't make * assumptions about any state you set up before calling this function, * because it might have been changed again from within a callback in the * mean time (if this can happen or not depends on your callbacks and what * they do of course). * * Returns: TRUE if no error occured before connecting * **/ gboolean gnet_conn_http_run (GConnHttp *conn, GConnHttpFunc func, gpointer user_data) { g_return_val_if_fail (conn != NULL, FALSE); g_return_val_if_fail (GNET_IS_CONN_HTTP (conn), FALSE); g_return_val_if_fail (conn->uri != NULL, FALSE); g_return_val_if_fail (conn->ia_id == 0, FALSE); conn->func = func; conn->func_data = user_data; if (conn->uri->port == 0) gnet_uri_set_port(conn->uri, 80); // FIXME: 8080 for http proxies if (conn->ia == NULL) { conn->ia_id = gnet_inetaddr_new_async_full (conn->uri->hostname, conn->uri->port, (GInetAddrNewAsyncFunc) gnet_conn_http_ia_cb, conn, (GDestroyNotify) NULL, conn->context, G_PRIORITY_DEFAULT); } else { gnet_conn_http_ia_cb(conn->ia, conn); } conn->loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (conn->loop); if (conn->status == STATUS_DONE) { if (conn->content_length > 0) return (conn->content_recv >= conn->content_length); return (conn->content_recv > 0); } return FALSE; } /** * gnet_conn_http_steal_buffer * @conn: a #GConnHttp * @buffer: where to store a pointer to the buffer data * @length: where to store the length of the buffer data * * Empties the current buffer and returns the contents. The * main purpose of this function is to make it possible to * just use gnet_conn_http_run(), check its return value, and * then get the buffer data without having to install a * callback function. Also needed to empty the buffer regularly * while receiving large amounts of data. * * The caller (you) needs to free the buffer with g_free() when done. * * Returns: TRUE if buffer and length have been set * **/ gboolean gnet_conn_http_steal_buffer (GConnHttp *conn, gchar **buffer, gsize *length) { g_return_val_if_fail (conn != NULL, FALSE); g_return_val_if_fail (buffer != NULL, FALSE); g_return_val_if_fail (length != NULL, FALSE); g_return_val_if_fail (GNET_IS_CONN_HTTP (conn), FALSE); if (conn->status == STATUS_NONE || conn->status == STATUS_SENT_REQUEST || conn->status == STATUS_ERROR) return FALSE; *length = conn->buflen; *buffer = conn->buffer; /* we allocated +1 bytes earlier on, so that there * is always space for an additional NUL here */ conn->buffer[conn->buflen] = '\0'; /* alloc one more to make sure buffer can be NUL-terminated later */ conn->buffer = g_malloc (GNET_CONN_HTTP_BUF_INCREMENT + 1); conn->bufalloc = GNET_CONN_HTTP_BUF_INCREMENT; conn->buflen = 0; return TRUE; } /** * gnet_conn_http_set_max_redirects * @conn: a #GConnHttp * @num: the maximum number of allowed automatic redirects * * Sets the maximum allowed number of automatic redirects. * Note that the HTTP protocol specification (RFC2616) specifies * occasions where the client must not redirect automatically * without user intervention. In those cases, no automatic redirect * will be performed, even if the limit has not been reached yet. * **/ void gnet_conn_http_set_max_redirects (GConnHttp *conn, guint num) { g_return_if_fail (conn != NULL); g_return_if_fail (num > 100); conn->max_redirects = num; } /*************************************************************************** * * gnet_conn_http_delete_internal * ***************************************************************************/ static void gnet_conn_http_delete_internal (GConnHttp *conn) { g_return_if_fail (conn != NULL); g_return_if_fail (conn->refcount == 0); if (conn->ia_id > 0) gnet_inetaddr_new_async_cancel(conn->ia_id); if (conn->ia) gnet_inetaddr_delete(conn->ia); if (conn->conn) gnet_conn_unref(conn->conn); /* concatenate them into resp_headers, so that * they will be freed in gnet_conn_http_reset() */ conn->resp_headers = g_list_concat(conn->resp_headers, conn->req_headers); conn->req_headers = NULL; gnet_conn_http_reset(conn); if (conn->uri) gnet_uri_delete(conn->uri); if (conn->loop != NULL && g_main_loop_is_running(conn->loop)) { g_warning("conn->loop != NULL and still running. This indicates" "\ta bug in your code! You are not allowed to call\n" "\tgnet_conn_http_delete() before gnet_conn_http_run()\n" "\thas returned. Use gnet_conn_http_cancel() instead.\n"); } if (conn->loop) g_main_loop_unref(conn->loop); if (conn->context) g_main_context_unref (conn->context); g_free(conn->post_data); g_free(conn->buffer); memset(conn, 0xff, sizeof(GConnHttp)); g_free(conn); } /** * gnet_conn_http_delete * @conn: a #GConnHttp * * Deletes a #GConnHttp and frees all associated resources. * **/ void gnet_conn_http_delete (GConnHttp *conn) { g_return_if_fail (conn != NULL); g_return_if_fail (GNET_IS_CONN_HTTP (conn)); g_return_if_fail (conn->refcount > 0); --conn->refcount; /* if the refcount was greater than 1, we are * still calling out into the user callback. * In that case, keep the object alive for now, * but invalidate it */ if (conn->refcount > 0) { conn->stamp = 0; return; } gnet_conn_http_delete_internal (conn); } /** * gnet_conn_http_cancel * @conn: a #GConnHttp * * Cancels the current http transfer (if any) and makes * gnet_conn_http_run() return immediately. Will do nothing * if the transfer was started with gnet_conn_http_run_async(). * **/ void gnet_conn_http_cancel (GConnHttp *conn) { g_return_if_fail (conn != NULL); g_return_if_fail (GNET_IS_CONN_HTTP (conn)); if (conn->loop) g_main_loop_quit(conn->loop); } /** * gnet_conn_http_set_timeout * @conn: a #GConnHttp * @timeout: timeout in milliseconds * * Sets a timeout on the http connection. * **/ void gnet_conn_http_set_timeout (GConnHttp *conn, guint timeout) { g_return_if_fail (conn != NULL); g_return_if_fail (GNET_IS_CONN_HTTP (conn)); conn->timeout = timeout; } /*************************************************************************** * * gnet_http_get_cb * ***************************************************************************/ static void gnet_http_get_cb (GConnHttp *conn, GConnHttpEvent *event, gpointer user_data) { guint *p_response = (guint*) user_data; if (p_response != NULL && event->type == GNET_CONN_HTTP_RESPONSE) { GConnHttpEventResponse *revent; revent = (GConnHttpEventResponse*) event; *p_response = revent->response_code; } } /** * gnet_http_get * @url: a URI, e.g. http://www.foo.com * @buffer: where to store a pointer to the data retrieved * @length: where to store the length of the data retrieved * @response: where to store the last HTTP response code * received from the HTTP server, or NULL. * * Convenience function that just retrieves * the provided URI without the need to * set up a full #GConnHttp. Uses * gnet_conn_http_run() internally. * * Caller (you) needs to free the buffer with g_free() when * no longer needed. * * This function will run its own main loop in the default GLib main context, * which means that if your application is based on Gtk+ or sets up GLib * timeouts or idle callbacks, it is possible that those callback functions * are invoked while you are waiting for gnet_http_get() to return. This * means you shouldn't make assumptions about any state you set up before * calling this function, because it might have been changed again from * within a callback in the mean time (if this can happen or not depends on * your callbacks and what they do of course). * * Returns: TRUE if @buffer, @length and @response are set, * otherwise FALSE. * **/ gboolean gnet_http_get (const gchar *url, gchar **buffer, gsize *length, guint *response) { GConnHttp *conn; gboolean ret; g_return_val_if_fail (url != NULL && *url != 0x00, FALSE); g_return_val_if_fail (buffer != NULL, FALSE); g_return_val_if_fail (length != NULL, FALSE); if (response) *response = 0; ret = FALSE; conn = gnet_conn_http_new(); if (gnet_conn_http_set_uri(conn,url)) { if (gnet_conn_http_run(conn, gnet_http_get_cb, response)) { if (gnet_conn_http_steal_buffer(conn, buffer, length)) { ret = TRUE; } } } gnet_conn_http_delete(conn); return ret; } /** * gnet_conn_http_set_main_context: * @conn: a #GConnHttp * @context: a #GMainContext, or NULL to use the default GLib main context * * Sets the GLib #GMainContext to use for asynchronous operations. You should * call this function right after you create @conn. You must not call this * function after the actual connection process has started. * * You are very unlikely to ever need this function. * * Returns: TRUE on success, FALSE on failure. * * Since: 2.0.8 **/ gboolean gnet_conn_http_set_main_context (GConnHttp * conn, GMainContext * context) { g_return_val_if_fail (conn != NULL, FALSE); g_return_val_if_fail (GNET_IS_CONN_HTTP (conn), FALSE); g_return_val_if_fail (conn->conn == NULL && conn->ia_id == NULL, FALSE); if (conn->context != context) { if (conn->context) g_main_context_unref (conn->context); if (context) conn->context = g_main_context_ref (context); else conn->context = NULL; } return TRUE; } gnet-2.0.8/src/udp.c0000644000175000017500000003331310751326730011131 00000000000000/* GNet - Networking library * Copyright (C) 2000-2003 David Helder * Copyright (C) 2000-2003 Andrew Lanoix * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "gnet-private.h" #include "udp.h" #define GNET_UDP_SOCKET_TYPE(s) (((GUdpSocket*)(s))->type) #define GNET_IS_UDP_SOCKET(s) ((s) && (GNET_UDP_SOCKET_TYPE(s) == GNET_UDP_SOCKET_TYPE_COOKIE \ || GNET_UDP_SOCKET_TYPE(s) == GNET_MCAST_SOCKET_TYPE_COOKIE)) /** * gnet_udp_socket_new * * Creates a #GUdpSocket bound to all interfaces and an arbitrary * port. * * Returns: a new #GUdpSocket; NULL on error. * **/ GUdpSocket* gnet_udp_socket_new (void) { return gnet_udp_socket_new_full (NULL, 0); } /** * gnet_udp_socket_new_with_port: * @port: port to bind to (0 for an arbitrary port) * * Creates a #GUdpSocket bound to all interfaces and port @port. If * @port is 0, an arbitrary port will be used. * * Returns: a new #GUdpSocket; NULL on error. * **/ GUdpSocket* gnet_udp_socket_new_with_port (gint port) { return gnet_udp_socket_new_full (NULL, port); } /** * gnet_udp_socket_new_full * @iface: interface to bind to (NULL for all interfaces) * @port: port to bind to (0 for an arbitrary port) * * Creates a #GUdpSocket bound to interface @iface and port @port. * If @iface is NULL, all interfaces will be used. If @port is 0, an * arbitrary port will be used. * * Returns: a new #GUdpSocket; NULL on error. * **/ GUdpSocket* gnet_udp_socket_new_full (const GInetAddr* iface, gint port) { SOCKET sockfd; struct sockaddr_storage sa; GUdpSocket* s; const int on = 1; /* Create sockfd and address */ sockfd = _gnet_create_listen_socket (SOCK_DGRAM, iface, port, &sa); if (!GNET_IS_SOCKET_VALID(sockfd)) { g_warning ("socket() failed"); return NULL; } /* Set broadcast option. This allows the user to broadcast packets. It has no effect otherwise. */ if (setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, (void*) &on, sizeof(on)) != 0) { g_warning ("setsockopt() failed"); GNET_CLOSE_SOCKET(sockfd); return NULL; } /* Bind to the socket to some local address and port */ if (bind(sockfd, &GNET_SOCKADDR_SA(sa), GNET_SOCKADDR_LEN(sa)) != 0) { GNET_CLOSE_SOCKET(sockfd); return NULL; } /* Create UDP socket */ s = g_new0 (GUdpSocket, 1); s->type = GNET_UDP_SOCKET_TYPE_COOKIE; s->sockfd = sockfd; s->sa = sa; s->ref_count = 1; return s; } /** * gnet_udp_socket_delete: * @socket: a #GUdpSocket, or NULL * * Deletes a #GUdpSocket. Does nothing if @socket is NULL. * **/ void gnet_udp_socket_delete (GUdpSocket* socket) { if (socket != NULL) { g_return_if_fail (GNET_IS_UDP_SOCKET (socket)); gnet_udp_socket_unref (socket); } } /** * gnet_udp_socket_ref * @socket: #GUdpSocket to reference * * Adds a reference to a #GUdpSocket. * **/ void gnet_udp_socket_ref (GUdpSocket* socket) { g_return_if_fail (socket != NULL); g_return_if_fail (GNET_IS_UDP_SOCKET (socket)); g_atomic_int_inc (&socket->ref_count); } /** * gnet_udp_socket_unref * @socket: a #GUdpSocket * * Removes a reference from a #GUdpScoket. A #GUdpSocket is deleted * when the reference count reaches 0. * **/ void gnet_udp_socket_unref (GUdpSocket* socket) { g_return_if_fail (socket != NULL); g_return_if_fail (GNET_IS_UDP_SOCKET (socket)); if (g_atomic_int_dec_and_test (&socket->ref_count)) { GNET_CLOSE_SOCKET (socket->sockfd); /* Don't care if this fails... */ if (socket->iochannel) g_io_channel_unref (socket->iochannel); socket->type = 0; g_free (socket); } } /** * gnet_udp_socket_get_io_channel * @socket: a #GUdpSocket * * Gets the #GIOChannel of a #GUdpSocket. * * Use the channel with g_io_add_watch() to check if the socket is * readable or writable. If the channel is readable, call * gnet_udp_socket_receive() to receive a packet. If the channel is * writable, call gnet_udp_socket_send() to send a packet. This is * not a normal giochannel - do not read from or write to it. * * Every #GUdpSocket has one and only one #GIOChannel. If you ref * the channel, then you must unref it eventually. Do not close the * channel. The channel is closed by GNet when the socket is * deleted. * * Before deleting the UDP socket, make sure to remove any watches you have * added with g_io_add_watch() again with g_source_remove() using the integer * id returned by g_io_add_watch(). You may find your program stuck in a busy * loop at 100% CPU utilisation if you forget to do this. * * Returns: a #GIOChannel. * **/ GIOChannel* gnet_udp_socket_get_io_channel (GUdpSocket* socket) { g_return_val_if_fail (socket != NULL, NULL); g_return_val_if_fail (GNET_IS_UDP_SOCKET (socket), NULL); if (socket->iochannel == NULL) socket->iochannel = _gnet_io_channel_new (socket->sockfd); return socket->iochannel; } /** * gnet_udp_socket_get_local_inetaddr * @socket: a #GUdpSocket * * Gets the local host's address from a #GUdpSocket. * * Returns: a #GInetAddr. * **/ GInetAddr* gnet_udp_socket_get_local_inetaddr (const GUdpSocket* socket) { socklen_t socklen; struct sockaddr_storage sa; GInetAddr* ia; g_return_val_if_fail (socket, NULL); g_return_val_if_fail (GNET_IS_UDP_SOCKET (socket), NULL); socklen = sizeof(sa); if (getsockname(socket->sockfd, &GNET_SOCKADDR_SA(sa), &socklen) != 0) return NULL; ia = g_new0(GInetAddr, 1); ia->ref_count = 1; ia->sa = sa; return ia; } /** * gnet_udp_socket_send * @socket: a #GUdpSocket * @buffer: buffer to send * @length: length of @buffer * @dst: destination address * * Sends data to a host using a #GUdpSocket. * * Returns: 0 if successful; something else on error. * **/ gint gnet_udp_socket_send (GUdpSocket* socket, const gchar* buffer, gint length, const GInetAddr* dst) { gint bytes_sent; struct sockaddr_storage sa; g_return_val_if_fail (socket != NULL, -1); g_return_val_if_fail (GNET_IS_UDP_SOCKET (socket), -1); g_return_val_if_fail (dst != NULL, -1); g_return_val_if_fail (buffer != NULL, -1); /* Address of dst must be address of socket */ #ifdef HAVE_IPV6 if (GNET_INETADDR_FAMILY(dst) != GNET_SOCKADDR_FAMILY(socket->sa)) { /* If dst is IPv4, map to IPv6 */ if (GNET_INETADDR_FAMILY(dst) == AF_INET && GNET_SOCKADDR_FAMILY(socket->sa) == AF_INET6) { GNET_SOCKADDR_FAMILY(sa) = AF_INET6; GNET_SOCKADDR_SET_SS_LEN(sa); GNET_SOCKADDR_PORT_SET(sa, GNET_INETADDR_PORT(dst)); GNET_SOCKADDR_ADDR32_SET(sa, 0, 0); GNET_SOCKADDR_ADDR32_SET(sa, 1, 0); GNET_SOCKADDR_ADDR32_SET(sa, 2, g_htonl(0xffff)); GNET_SOCKADDR_ADDR32_SET(sa, 3, GNET_INETADDR_ADDR32(dst, 0)); } /* If dst is IPv6, map to IPv4 if possible */ else if (GNET_INETADDR_FAMILY(dst) == AF_INET6 && GNET_SOCKADDR_FAMILY(socket->sa) == AF_INET && IN6_IS_ADDR_V4MAPPED(&GNET_INETADDR_SA6(dst).sin6_addr)) { GNET_SOCKADDR_FAMILY(sa) = AF_INET; GNET_SOCKADDR_SET_SS_LEN(sa); GNET_SOCKADDR_PORT_SET(sa, GNET_INETADDR_PORT(dst)); GNET_SOCKADDR_ADDR32_SET(sa, 0, GNET_INETADDR_ADDR32(dst, 3)); } else return -1; } /* Addresses match - just copy the address */ else #endif { sa = dst->sa; } bytes_sent = sendto (socket->sockfd, (void*) buffer, length, 0, (struct sockaddr*) &sa, GNET_SOCKADDR_LEN(sa)); if (bytes_sent != length) return -1; return 0; } /** * gnet_udp_socket_receive * @socket: a #GUdpSocket * @buffer: buffer to write to * @length: length of @buffer * @src: pointer to source address (optional) * * Receives data using a #GUdpSocket. If @src is set, the source * address is stored in the location @src points to. The address is * caller owned. * * Returns: the number of bytes received, -1 on error. * **/ gint gnet_udp_socket_receive (GUdpSocket* socket, gchar* buffer, gint length, GInetAddr** src) { gint bytes_received; struct sockaddr_storage sa; socklen_t sa_len = sizeof (struct sockaddr_storage); g_return_val_if_fail (socket != NULL, -1); g_return_val_if_fail (buffer != NULL, -1); g_return_val_if_fail (GNET_IS_UDP_SOCKET (socket), -1); bytes_received = recvfrom (socket->sockfd, (void*) buffer, length, 0, (struct sockaddr*) &sa, &sa_len); if (bytes_received == -1) return -1; if (src) { (*src) = g_new0 (GInetAddr, 1); (*src)->sa = sa; (*src)->ref_count = 1; } return bytes_received; } #ifndef GNET_WIN32 /*********** Unix code ***********/ /** * gnet_udp_socket_has_packet * @socket: a #GUdpSocket * * Tests if a #GUdpSocket has a packet waiting to be received. * * Returns: TRUE if there is packet waiting, FALSE otherwise. * **/ gboolean gnet_udp_socket_has_packet (const GUdpSocket* socket) { fd_set readfds; struct timeval timeout = {0, 0}; g_return_val_if_fail (socket != NULL, FALSE); g_return_val_if_fail (GNET_IS_UDP_SOCKET (socket), FALSE); FD_ZERO (&readfds); FD_SET (socket->sockfd, &readfds); if ((select(socket->sockfd + 1, &readfds, NULL, NULL, &timeout)) == 1) { return TRUE; } return FALSE; } #else /*********** Windows code ***********/ gboolean gnet_udp_socket_has_packet (const GUdpSocket* socket) { gint bytes_received; gchar data[1]; guint packetlength; u_long arg; gint error; g_return_val_if_fail (socket != NULL, FALSE); g_return_val_if_fail (GNET_IS_UDP_SOCKET (socket), FALSE); arg = 1; ioctlsocket(socket->sockfd, FIONBIO, &arg); /* set to non-blocking mode */ packetlength = 1; bytes_received = recvfrom(socket->sockfd, (void*) data, packetlength, MSG_PEEK, NULL, NULL); error = WSAGetLastError(); arg = 0; ioctlsocket(socket->sockfd, FIONBIO, &arg); /* set blocking mode */ if (bytes_received == SOCKET_ERROR) { if (WSAEMSGSIZE != error) { return FALSE; } /* else, the buffer was not big enough, which is fine since we just want to see if a packet is there..*/ } if (bytes_received) return TRUE; return FALSE; } #endif /*********** End Windows code ***********/ /** * gnet_udp_socket_get_ttl * @socket: a #GUdpSocket * * Gets the time-to-live (TTL) default of a #GUdpSocket. All UDP * packets have a TTL field. This field is decremented by a router * before it forwards the packet. If the TTL reaches zero, the * packet is discarded. The default value is sufficient for most * applications. * * Returns: the TTL (an integer between 0 and 255), -1 if the kernel * default is being used, or an integer less than -1 on error. * **/ gint gnet_udp_socket_get_ttl (const GUdpSocket* socket) { int ttl; socklen_t ttl_size; int rv = -2; g_return_val_if_fail (socket != NULL, FALSE); g_return_val_if_fail (GNET_IS_UDP_SOCKET (socket), FALSE); ttl_size = sizeof(ttl); /* Get the IPv4 TTL if it's bound to an IPv4 address */ if (GNET_SOCKADDR_FAMILY(socket->sa) == AF_INET) { rv = getsockopt(socket->sockfd, IPPROTO_IP, IP_TTL, (void*) &ttl, &ttl_size); } /* Or, get the IPv6 TTL if it's bound to an IPv6 address */ #ifdef HAVE_IPV6 else if (GNET_SOCKADDR_FAMILY(socket->sa) == AF_INET6) { rv = getsockopt(socket->sockfd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, (void*) &ttl, &ttl_size); } #endif else g_assert_not_reached(); if (rv == -1) return -2; return ttl; } /** * gnet_udp_socket_set_ttl * @socket: a #GUdpSocket * @ttl: value to set TTL to * * Sets the time-to-live (TTL) default of a #GUdpSocket. Set the TTL * to -1 to use the kernel default. The default value is sufficient * for most applications. * * Returns: 0 if successful. * **/ gint gnet_udp_socket_set_ttl (GUdpSocket* socket, gint ttl) { int rv1, rv2; #ifdef HAVE_IPV6 GIPv6Policy policy; #endif g_return_val_if_fail (socket != NULL, FALSE); g_return_val_if_fail (GNET_IS_UDP_SOCKET (socket), FALSE); rv1 = -1; rv2 = -1; /* If the bind address is anything IPv4 *or* the bind address is 0::0 IPv6 and IPv6 policy allows IPv4, set IP_TTL. In the latter case, if we bind to 0::0 and the host is dual-stacked, then all IPv4 interfaces will be bound to also. */ if (GNET_SOCKADDR_FAMILY(socket->sa) == AF_INET #ifdef HAVE_IPV6 || (GNET_SOCKADDR_FAMILY(socket->sa) == AF_INET6 && IN6_IS_ADDR_UNSPECIFIED(&GNET_SOCKADDR_SA6(socket->sa).sin6_addr) && ((policy = gnet_ipv6_get_policy()) == GIPV6_POLICY_IPV4_THEN_IPV6 || policy == GIPV6_POLICY_IPV6_THEN_IPV4)) #endif ) { rv1 = setsockopt(socket->sockfd, IPPROTO_IP, IP_TTL, (void*) &ttl, sizeof(ttl)); } /* If the bind address is IPv6, set IPV6_UNICAST_HOPS */ #ifdef HAVE_IPV6 if (GNET_SOCKADDR_FAMILY(socket->sa) == AF_INET6) { rv2 = setsockopt(socket->sockfd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, (void*) &ttl, sizeof(ttl)); } #endif if (rv1 == -1 && rv2 == -1) return -1; return 0; } gnet-2.0.8/src/base64.c0000644000175000017500000002307210751326730011426 00000000000000/*********************************************************************** * _ _ __ _ _ * __ _ _ __ ___| |_ | |__ __ _ ___ ___ / /_ | || | * / _` | '_ \ / _ \ __| | '_ \ / _` / __|/ _ \ '_ \| || |_ * | (_| | | | | __/ |_ | |_) | (_| \__ \ __/ (_) |__ _| * \__, |_| |_|\___|\__| |_.__/ \__,_|___/\___|\___/ |_| * |___/ * * created by Alfred Reibenschuh , * under the GNU Library General Public License (see below). * *********************************************************************** * * Copyright (C) 2003 Free Software Foundation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ***********************************************************************/ /* FIXME: use new GLib functions once we depend on GLib >= 2.12 */ #include "base64.h" #include #include static const gchar gnet_Base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; #define gnet_Pad64 '=' static const guchar gnet_Base64_rank[256] = { 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, /* 0x00-0x0f */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, /* 0x10-0x1f */ 255,255,255,255,255,255,255,255,255,255,255, 62,255,255,255, 63, /* 0x20-0x2f */ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,255,255,255,255,255,255, /* 0x30-0x3f */ 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, /* 0x40-0x4f */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,255,255,255,255,255, /* 0x50-0x5f */ 255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, /* 0x60-0x6f */ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,255,255,255,255,255, /* 0x70-0x7f */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, /* 0x80-0x8f */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, /* 0x90-0x9f */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, /* 0xa0-0xaf */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, /* 0xb0-0xbf */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, /* 0xc0-0xcf */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, /* 0xd0-0xdf */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, /* 0xe0-0xef */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, /* 0xf0-0xff */ }; /** * gnet_base64_encode * @src: source buffer * @srclen: length of the source buffer * @dstlenp: length of the buffer returned (including the terminating \0) * @strict: insert new lines as required by RFC 2045 * * Convert a buffer from binary to base64 representation. Set * @strict to TRUE to insert a newline every 72th character. This is * required by RFC 2045, but some applications don't require this. * * If @srclen is 0, an empty string will be returned (not NULL). * * Returns: a newly-allocated and NUL-terminated string containing the * input data in base64 coding. Free with g_free() when no longer needed. * **/ gchar* gnet_base64_encode (const gchar* src, gint srclen, gint* dstlenp, gboolean strict) { gchar* dst; gint dstpos; guchar input[3]; guchar output[4]; gint ocnt; gint i; g_return_val_if_fail (src != NULL, NULL); g_return_val_if_fail (srclen >= 0, NULL); g_return_val_if_fail (dstlenp != NULL, NULL); if (srclen == 0) return g_strdup (""); /* Calculate required length of dst. 4 bytes of dst are needed for every 3 bytes of src. */ *dstlenp = (((srclen + 2) / 3) * 4)+5; if (strict) *dstlenp += (*dstlenp / 72); /* Handle trailing \n */ dst = g_new(gchar, *dstlenp ); /* bulk encoding */ dstpos = 0; ocnt = 0; while (srclen >= 3) { /* Convert 3 bytes of src to 4 bytes of output output[0] = input[0] 7:2 output[1] = input[0] 1:0 input[1] 7:4 output[2] = input[1] 3:0 input[2] 7:6 output[3] = input[1] 5:0 */ input[0] = *src++; input[1] = *src++; input[2] = *src++; srclen -= 3; output[0] = (input[0] >> 2); output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); output[3] = (input[2] & 0x3f); g_assert ((dstpos + 4) < *dstlenp); /* Map output to the Base64 alphabet */ dst[dstpos++] = gnet_Base64[(guint) output[0]]; dst[dstpos++] = gnet_Base64[(guint) output[1]]; dst[dstpos++] = gnet_Base64[(guint) output[2]]; dst[dstpos++] = gnet_Base64[(guint) output[3]]; /* Add a newline if strict and */ if (strict) if ((++ocnt % (72/4)) == 0) dst[dstpos++] = '\n'; } /* Now worry about padding with remaining 1 or 2 bytes */ if (srclen != 0) { input[0] = input[1] = input[2] = '\0'; for (i = 0; i < srclen; i++) input[i] = *src++; output[0] = (input[0] >> 2); output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); g_assert ((dstpos + 4) < *dstlenp); dst[dstpos++] = gnet_Base64[(guint) output[0]]; dst[dstpos++] = gnet_Base64[(guint) output[1]]; if (srclen == 1) dst[dstpos++] = gnet_Pad64; else dst[dstpos++] = gnet_Base64[(guint) output[2]]; dst[dstpos++] = gnet_Pad64; } g_assert (dstpos <= *dstlenp); dst[dstpos] = '\0'; *dstlenp = dstpos + 1; return dst; } /** * gnet_base64_decode * @src: the source buffer * @srclen: the length of the source buffer, or -1 for strlen(@src). * @dstlenp: where to return the length of the returned output buffer * * Convert a buffer from base64 to binary representation. This * function is liberal in what it will accept. It ignores non-base64 * symbols. * * Returns: newly-allocated buffer. Free with g_free() when no longer * needed. The integer pointed to by @dstlenp is set to the length of * that buffer. * **/ gchar* gnet_base64_decode (const gchar* src, gint srclen, gint* dstlenp) { gchar* dst; gint dstidx, state, ch = 0; gchar res; guchar pos; g_return_val_if_fail (src != NULL, NULL); g_return_val_if_fail (dstlenp != NULL, NULL); if (srclen <= 0) srclen = strlen(src); state = 0; dstidx = 0; res = 0; dst = g_new(gchar, srclen+1); *dstlenp = srclen+1; while (srclen-- > 0) { ch = *src++; if (gnet_Base64_rank[ch]==255) /* Skip any non-base64 anywhere */ continue; if (ch == gnet_Pad64) break; pos = gnet_Base64_rank[ch]; switch (state) { case 0: if (dst != NULL) { dst[dstidx] = (pos << 2); } state = 1; break; case 1: if (dst != NULL) { dst[dstidx] |= (pos >> 4); res = ((pos & 0x0f) << 4); } dstidx++; state = 2; break; case 2: if (dst != NULL) { dst[dstidx] = res | (pos >> 2); res = (pos & 0x03) << 6; } dstidx++; state = 3; break; case 3: if (dst != NULL) { dst[dstidx] = res | pos; } dstidx++; state = 0; break; default: break; } } /* * We are done decoding Base-64 chars. Let's see if we ended * on a byte boundary, and/or with erroneous trailing characters. */ if (ch == gnet_Pad64) /* We got a pad char. */ { switch (state) { case 0: /* Invalid = in first position */ case 1: /* Invalid = in second position */ return NULL; case 2: /* Valid, means one byte of info */ /* Skip any number of spaces. */ while (srclen-- > 0) { ch = *src++; if (gnet_Base64_rank[ch] != 255) break; } /* Make sure there is another trailing = sign. */ if (ch != gnet_Pad64) { g_free(dst); *dstlenp = 0; return NULL; } /* FALLTHROUGH */ case 3: /* Valid, means two bytes of info */ /* * We know this char is an =. Is there anything but * whitespace after it? */ while (srclen-- > 0) { ch = *src++; if (gnet_Base64_rank[ch] != 255) { g_free(dst); *dstlenp = 0; return NULL; } } /* * Now make sure for cases 2 and 3 that the "extra" * bits that slopped past the last full byte were * zeros. If we don't check them, they become a * subliminal channel. */ if (dst != NULL && res != 0) { g_free(dst); *dstlenp = 0; return NULL; } default: break; } } else { /* * We ended by seeing the end of the string. Make sure we * have no partial bytes lying around. */ if (state != 0) { g_free(dst); *dstlenp = 0; return NULL; } } dst[dstidx]=0; *dstlenp = dstidx; return dst; } gnet-2.0.8/src/ipv6.h0000644000175000017500000000325110751326730011230 00000000000000/* GNet - Networking library * Copyright (C) 2002 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_IPV6_H #define _GNET_IPV6_H #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** * GIPv6Policy * @GIPV6_POLICY_IPV4_THEN_IPV6: Use IPv4, then IPv6 * @GIPV6_POLICY_IPV6_THEN_IPV4: Use IPv6, then IPv4 * @GIPV6_POLICY_IPV4_ONLY: Use IPv4 only * @GIPV6_POLICY_IPV6_ONLY: Use IPv6 only * * Policy for IPv6 use in GNet. This affects domain name resolution * and server binding. gnet_init() attempts to set a reasonable * default based on environment variables or the interfaces available * on the host. * **/ typedef enum { GIPV6_POLICY_IPV4_THEN_IPV6, GIPV6_POLICY_IPV6_THEN_IPV4, GIPV6_POLICY_IPV4_ONLY, GIPV6_POLICY_IPV6_ONLY } GIPv6Policy; GIPv6Policy gnet_ipv6_get_policy (void); void gnet_ipv6_set_policy (GIPv6Policy policy); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _GNET_IPV6_H */ gnet-2.0.8/src/socks.h0000644000175000017500000000331710751326730011471 00000000000000/* GNet - Networking library * Copyright (C) 2001-2002 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_SOCKS_H #define _GNET_SOCKS_H /* This module is experimental, buggy, and unstable. Use at your own risk. To use this module, define GNET_EXPERIMENTAL before including gnet.h. */ #ifdef GNET_EXPERIMENTAL #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** * GNET_SOCKS_PORT * * Default port for the SOCKS protocol. **/ #define GNET_SOCKS_PORT 1080 /** * GNET_SOCKS_VERSION * * Default version of the SOCKS protocol. **/ #define GNET_SOCKS_VERSION 5 gboolean gnet_socks_get_enabled (void); void gnet_socks_set_enabled (gboolean enabled); GInetAddr* gnet_socks_get_server (void); void gnet_socks_set_server (const GInetAddr* inetaddr); gint gnet_socks_get_version (void); void gnet_socks_set_version (gint version); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* GNET_EXPERIMENTAL */ #endif /* _GNET_SOCKS_H */ gnet-2.0.8/src/server.h0000644000175000017500000000472610751326730011662 00000000000000/* GNet - Networking library * Copyright (C) 2000-2002 David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_SERVER_H #define _GNET_SERVER_H #include #include "gnetconfig.h" #include "tcp.h" #include "conn.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** * GServer * @iface: interface address * @port: port number * @socket: TCP server socket * @ref_count: [private] * @func: callback function * @user_data: user data for callback * * #GServer is a high-level interface to a TCP server socket. The * callback is called with a #GConn whenever a new connection is * made. * **/ typedef struct _GServer GServer; /** * GServerFunc: * @server: server * @conn: new connection (or NULL if error) * @user_data: user data specified in gnet_server_new() * * Callback for gnet_server_new(). When a client connects, this * callback is called with a new connection. If the server fails, * this callback is called with @conn set to NULL. The callback is * not called again. * * If @conn is non-NULL, the address (IP, port) of the client that * established the connection can be found in the inetaddr member of * the #GConn structure. * **/ typedef void (*GServerFunc)(GServer* server, GConn* conn, gpointer user_data); struct _GServer { GInetAddr* iface; gint port; GTcpSocket* socket; guint ref_count; GServerFunc func; gpointer user_data; }; GServer* gnet_server_new (const GInetAddr* iface, gint port, GServerFunc func, gpointer user_data); void gnet_server_delete (GServer* server); void gnet_server_ref (GServer* server); void gnet_server_unref (GServer* server); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _GNET_SERVER_H */ gnet-2.0.8/src/socks-private.h0000644000175000017500000000474510751326730013147 00000000000000/* GNet - Networking library * Copyright (C) 2001-2002 Marius Eriksen, David Helder * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _GNET_SOCKS_PRIVATE_H #define _GNET_SOCKS_PRIVATE_H #include "gnet-private.h" struct socks4_h { guint8 vn; guint8 cd; guint16 dport; guint32 dip; guint8 userid; }; struct socks5_h { guint8 vn; guint8 cd; guint8 rsv; guint8 atyp; guint32 dip; guint16 dport; }; /* SOCKS client */ GTcpSocket * _gnet_socks_tcp_socket_new (const GInetAddr* addr); GTcpSocketNewAsyncID _gnet_socks_tcp_socket_new_async (const GInetAddr * addr, GTcpSocketNewAsyncFunc func, gpointer data); GTcpSocketNewAsyncID _gnet_socks_tcp_socket_new_async_full (const GInetAddr * addr, GTcpSocketNewAsyncFunc func, gpointer data, GDestroyNotify notify, GMainContext * context, gint priority); /* SOCKS server */ GTcpSocket * _gnet_socks_tcp_socket_server_new (gint port); GTcpSocket * _gnet_socks_tcp_socket_server_accept (GTcpSocket * s); void _gnet_socks_tcp_socket_server_accept_async (GTcpSocket * s, GTcpSocketAcceptFunc accept_func, gpointer user_data); #endif /* _GNET_SOCKS_PRIVATE_H */ gnet-2.0.8/src/md5.c0000644000175000017500000003476610751326730011043 00000000000000/* GNet API added by David Helder 2000-6-11. All additions and changes placed in the public domain. Files originally from: http://www.gxsnmp.org/CVS/gxsnmp/ */ /* * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * * Equivalent code is available from RSA Data Security, Inc. * This code has been tested against that, and is equivalent, * except that you don't need to include two pages of legalese * with every copy. * * To compute the message digest of a chunk of bytes, declare an * MD5Context structure, pass it to MD5Init, call MD5Update as * needed on buffers full of bytes, and then call MD5Final, which * will fill a supplied 16-byte array with the digest. */ #include "md5.h" #include #include /* ************************************************************ */ /* Code below is from Colin Plumb implementation */ struct MD5Context { guint32 buf[4]; guint32 bits[2]; guchar in[64]; int doByteReverse; }; static void MD5Init(struct MD5Context *context); static void MD5Update(struct MD5Context *context, guchar const *buf, guint len); static void MD5Final(guchar digest[16], struct MD5Context *context); static void MD5Transform(guint32 buf[4], guint32 const in[16]); /* * This is needed to make RSAREF happy on some MS-DOS compilers. */ typedef struct MD5Context MD5_CTX; static void byteReverse(guint8 *buf, guint longs); /* * Note: this code is harmless on little-endian machines. */ void byteReverse(guint8 *buf, guint longs) { guint32 t; do { t = (guint32) ((guint) buf[3] << 8 | buf[2]) << 16 | ((guint) buf[1] << 8 | buf[0]); *(guint32 *) buf = t; buf += 4; } while (--longs); } /* * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ void MD5Init(struct MD5Context *ctx) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; ctx->buf[2] = 0x98badcfe; ctx->buf[3] = 0x10325476; ctx->bits[0] = 0; ctx->bits[1] = 0; #if (G_BYTE_ORDER == G_BIG_ENDIAN) ctx->doByteReverse = 1; #else ctx->doByteReverse = 0; #endif } /* * Update context to reflect the concatenation of another buffer full * of bytes. */ void MD5Update(struct MD5Context *ctx, guint8 const *buf, guint len) { guint32 t; /* Update bitcount */ t = ctx->bits[0]; if ((ctx->bits[0] = t + ((guint32) len << 3)) < t) ctx->bits[1]++; /* Carry from low to high */ ctx->bits[1] += len >> 29; t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ /* Handle any leading odd-sized chunks */ if (t) { guint8 *p = (guint8 *) ctx->in + t; t = 64 - t; if (len < t) { g_memmove(p, buf, len); return; } g_memmove(p, buf, t); if (ctx->doByteReverse) byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (guint32 *) ctx->in); buf += t; len -= t; } /* Process data in 64-byte chunks */ while (len >= 64) { g_memmove(ctx->in, buf, 64); if (ctx->doByteReverse) byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (guint32 *) ctx->in); buf += 64; len -= 64; } /* Handle any remaining bytes of data. */ g_memmove(ctx->in, buf, len); } /* * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ void MD5Final(guint8 digest[16], struct MD5Context *ctx) { guint count; guint8 *p; /* Compute number of bytes mod 64 */ count = (ctx->bits[0] >> 3) & 0x3F; /* Set the first char of padding to 0x80. This is safe since there is always at least one byte free */ p = ctx->in + count; *p++ = 0x80; /* Bytes of padding needed to make 64 bytes */ count = 64 - 1 - count; /* Pad out to 56 mod 64 */ if (count < 8) { /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); if (ctx->doByteReverse) byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (guint32 *) ctx->in); /* Now fill the next block with 56 bytes */ memset(ctx->in, 0, 56); } else { /* Pad block to 56 bytes */ memset(p, 0, count - 8); } if (ctx->doByteReverse) byteReverse(ctx->in, 14); /* Append length in bits and transform */ ((guint32 *) ctx->in)[14] = ctx->bits[0]; ((guint32 *) ctx->in)[15] = ctx->bits[1]; MD5Transform(ctx->buf, (guint32 *) ctx->in); if (ctx->doByteReverse) byteReverse((guint8 *) ctx->buf, 4); g_memmove(digest, ctx->buf, 16); memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ } /* The four core functions - F1 is optimized somewhat */ /* #define F1(x, y, z) (x & y | ~x & z) */ #define F1(x, y, z) (z ^ (x & (y ^ z))) #define F2(x, y, z) F1(z, x, y) #define F3(x, y, z) (x ^ y ^ z) #define F4(x, y, z) (y ^ (x | ~z)) /* This is the central step in the MD5 algorithm. */ #define MD5STEP(f, w, x, y, z, data, s) \ ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) /* * The core of the MD5 algorithm, this alters an existing MD5 hash to * reflect the addition of 16 longwords of new data. MD5Update blocks * the data and converts bytes into longwords for this routine. */ void MD5Transform(guint32 buf[4], guint32 const in[16]) { register guint32 a, b, c, d; a = buf[0]; b = buf[1]; c = buf[2]; d = buf[3]; MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); buf[0] += a; buf[1] += b; buf[2] += c; buf[3] += d; } /* ************************************************************ */ /* Code below is David Helder's API for GNet */ struct _GMD5 { struct MD5Context ctx; guint8 digest[GNET_MD5_HASH_LENGTH]; }; /** * gnet_md5_new: * @buffer: buffer to hash * @length: length of @buffer * * Creates a #GMD5 from @buffer. * * Returns: a new #GMD5. * **/ GMD5* gnet_md5_new (const gchar* buffer, guint length) { GMD5* md5; md5 = g_new0 (GMD5, 1); MD5Init (&md5->ctx); MD5Update (&md5->ctx, (const guchar*) buffer, length); MD5Final ((gpointer) &md5->digest, &md5->ctx); return md5; } /** * gnet_md5_new_string: * @str: hexidecimal string * * Creates a #GMD5 from @str. @str is a hexidecimal string * representing the digest. * * Returns: a new #GMD5. * **/ GMD5* gnet_md5_new_string (const gchar* str) { GMD5* md5; guint i; g_return_val_if_fail (str, NULL); g_return_val_if_fail (strlen(str) >= (GNET_MD5_HASH_LENGTH * 2), NULL); md5 = g_new0 (GMD5, 1); for (i = 0; i < (GNET_MD5_HASH_LENGTH * 2); ++i) { guint val = 0; switch (str[i]) { case '0': val = 0; break; case '1': val = 1; break; case '2': val = 2; break; case '3': val = 3; break; case '4': val = 4; break; case '5': val = 5; break; case '6': val = 6; break; case '7': val = 7; break; case '8': val = 8; break; case '9': val = 9; break; case 'A': case 'a': val = 10; break; case 'B': case 'b': val = 11; break; case 'C': case 'c': val = 12; break; case 'D': case 'd': val = 13; break; case 'E': case 'e': val = 14; break; case 'F': case 'f': val = 15; break; default: g_return_val_if_fail (FALSE, NULL); } if (i % 2) md5->digest[i / 2] |= val; else md5->digest[i / 2] = val << 4; } return md5; } /** * gnet_md5_clone * @md5: a #GMD5 * * Copies a #GMD5. * * Returns: a copy of @md5. * **/ GMD5* gnet_md5_clone (const GMD5* md5) { GMD5* md52; g_return_val_if_fail (md5, NULL); md52 = g_new0 (GMD5, 1); md52->ctx = md5->ctx; memcpy (md52->digest, md5->digest, sizeof(md5->digest)); return md52; } /** * gnet_md5_delete * @md5: a #GMD5 * * Deletes a #GMD5. * **/ void gnet_md5_delete (GMD5* md5) { g_free (md5); } /** * gnet_md5_new_incremental * * Creates a #GMD5 incrementally. After creating a #GMD5, call * gnet_md5_update() one or more times to hash data. Finally, call * gnet_md5_final() to compute the final hash value. * * Returns: a new #GMD5. * **/ GMD5* gnet_md5_new_incremental (void) { GMD5* md5; md5 = g_new0 (GMD5, 1); MD5Init (&md5->ctx); return md5; } /** * gnet_md5_update * @md5: a #GMD5 * @buffer: buffer to add * @length: length of @buffer * * Updates the hash with @buffer. This may be called several times * on a hash created by gnet_md5_new_incremental() before being * finalized by calling gnet_md5_final(). * **/ void gnet_md5_update (GMD5* md5, const gchar* buffer, guint length) { g_return_if_fail (md5); MD5Update (&md5->ctx, (const guchar*) buffer, length); } /** * gnet_md5_final * @md5: a #GMD5 * * Calcuates the final hash value of a #GMD5. This should only be * called on an #GMD5 created by gnet_md5_new_incremental(). * **/ void gnet_md5_final (GMD5* md5) { g_return_if_fail (md5); MD5Final ((gpointer) &md5->digest, &md5->ctx); } /* **************************************** */ /** * gnet_md5_equal * @p1: first #GMD5. * @p2: second #GMD5. * * Compares two #GMD5's for equality. * * Returns: TRUE if they are equal; FALSE otherwise. * **/ gint gnet_md5_equal (gconstpointer p1, gconstpointer p2) { GMD5* md5a = (GMD5*) p1; GMD5* md5b = (GMD5*) p2; guint i; for (i = 0; i < GNET_MD5_HASH_LENGTH; ++i) if (md5a->digest[i] != md5b->digest[i]) return FALSE; return TRUE; } /** * gnet_md5_hash * @p: a #GMD5 * * Creates a hash code for a #GMD5 for use with GHashTable. This * hash value is not the same as the MD5 digest. * * Returns: the hash code for @p. * **/ guint gnet_md5_hash (gconstpointer p) { const GMD5* md5 = (const GMD5*) p; const guint* q; g_return_val_if_fail (md5, 0); q = (const guint*) md5->digest; return (q[0] ^ q[1] ^ q[2] ^ q[3]); } /** * gnet_md5_get_digest * @md5: a #GMD5 * * Gets the raw MD5 digest. * * Returns: a callee-owned buffer containing the MD5 hash digest. * The buffer is %GNET_MD5_HASH_LENGTH bytes long. * **/ gchar* gnet_md5_get_digest (const GMD5* md5) { g_return_val_if_fail (md5, NULL); return (gchar*) md5->digest; } static const gchar bits2hex[] = "0123456789abcdef"; /** * gnet_md5_get_string * @md5: a #GMD5 * * Gets the digest represented a human-readable string. * * Returns: a hexadecimal string representing the digest. The string * is 2 * %GNET_MD5_HASH_LENGTH bytes long and NULL terminated. The * string is caller owned. * **/ gchar* gnet_md5_get_string (const GMD5* md5) { gchar* str; guint i; g_return_val_if_fail (md5, NULL); str = g_new (gchar, GNET_MD5_HASH_LENGTH * 2 + 1); str[GNET_MD5_HASH_LENGTH * 2] = '\0'; for (i = 0; i < GNET_MD5_HASH_LENGTH; ++i) { str[i * 2] = bits2hex[(md5->digest[i] & 0xF0) >> 4]; str[(i * 2) + 1] = bits2hex[(md5->digest[i] & 0x0F) ]; } return str; } /** * gnet_md5_copy_string * @md5: a #GMD5 * @buffer: buffer at least 2 * %GNET_MD5_HASH_LENGTH bytes long * * Copies the digest, represented as a string, into @buffer. The * string is not NULL terminated. * **/ void gnet_md5_copy_string (const GMD5* md5, gchar* buffer) { guint i; g_return_if_fail (md5); g_return_if_fail (buffer); for (i = 0; i < GNET_MD5_HASH_LENGTH; ++i) { buffer[i * 2] = bits2hex[(md5->digest[i] & 0xF0) >> 4]; buffer[(i * 2) + 1] = bits2hex[(md5->digest[i] & 0x0F) ]; } } gnet-2.0.8/AUTHORS0000644000175000017500000000216610751326732010462 00000000000000GNet AUTHORS ------------ GNet authors and other contributors Lead Developers --------------- Tim-Philipp Müller David Helder Authors ------- David Helder Original version, Debs Xavier Nicolovici gnet.spec.in Soeren Sandmann HP-UX portability fixes Jacques Fortier iochannel_readline_strdup() Andrew Lanoix Win32 port Eric Cronin MacOSX port David Bolcsfoldi URL improvements Marius Eriksen SOCKS support Mark Ferlatte Unix sockets Eric Williams URL escape code Alfred Reibenschuh Base64 module Tim-Philipp Müller HTTP Conn module Zeeshan Ali Abstract unix socket support Credits ------- Owen Taylor Config files based on his GLib/Gtk versions gnet-2.0.8/README0000644000175000017500000001076010751326732010271 00000000000000 GNet README ----------- GNet is a simple network library. It is written in C, object-oriented, and built upon GLib. It is intended to be easy to use and port. GNet comes with documentation and examples. It is licensed under the GNU Library General Public Licence. Features: * TCP "client" and "server" sockets * UDP and IP Multicast sockets * High-level TCP connection and server objects * Asynchronous socket IO * Internet address abstraction * Asynchronous DNS lookup * IPv4 and IPv6 support * Byte packing and unpacking * URI parsing * SHA and MD5 hashes * Base64 encoding and decoding * SOCKS support * High-level HTTP connection object GNet has been ported to Linux, *BSD, MacOSX, Solaris, HP, MacOS X, and Windows. It may work on other operating systems also. GNet requires GLib 2.x, available at www.gtk.org. Or, if you have a system with packages (e.g., Red Hat or Debian), look for the latest glib package (glib2-devel or libglib2.0-dev usually). Comments and questions should be sent to gnet@gnetlibrary.org. The GNet homepage is at . Install ======= In a nutshell: > ./configure > make > make install If gethostbyname() and gethostbyaddr() are thread-safe, pass the --enable-threadsafe-gethostbyname() to configure. (If it is and you don't do this, it will still function correctly.) Similarly, if getaddrinfo() and getnameinfo() are thread-safe, pass the --enable-threadsafe-getaddrinfo() to configure The flag --with-html-dir=DIR controls the directory the HTML documentation goes into. By default it will go into DATADIR/doc/libgnet-X.Y, which DATADIR is /usr/local/share on most Unix machines. Use this flag if you want it to go somewhere else. INSTALL is the standard autoconf INSTALL file. Bugs ==== Bug reports should be submitted through . Our bug page is: See BUGS for known bugs. Mailing lists ============= Go to to join the mailing lists and view the archives. Name Purpose gnet-announce Announcements about GNet gnet-discuss Discussion of GNet for users and programmers gnet-dev Discussion of GNet for the developers of GNet Developer info ============== API documentation lives on the GNet homepage (specifically, at ) NOTE ON EXPERIMENTAL FEATURES. The URL, Server, and Conn modules are experimental and part of the IOChannel module is also experimental. The GNet development team believes these modules are useful and usable, but are not yet completely confident in them. The API to these modules may change and there may still be bugs in them. For example, the URL module is incomplete and the new IOChannel functions should be audited again. If you are feeling adventurous and want to use these functions, define GNET_EXPERIMENTAL. Otherwise, your compiler should warn or fail if they are used. We welcome bug fixes, improvements, and comments on the experimental modules. Our hope is that adventurous programmers will use these modules and help in their further development. The Nylon SOCKS server is required for SOCKS server socket support. SOCKS server sockets are weird. Marius, a Nylon and GNet developer, changed the semantics in Nylon to make SOCKS integration in GNet easier/possible. GNet SOCKS clients should work with any SOCKS server. The Nylon homepage is . Hacking ======= If you are interested in contributing to GNet, please see 'HACKING'. This includes information on how to get GNet from the repository and how to submit patches. License ======= Read COPYING for information on the license. GNet is under the GNU Lesser General Public License. Applications that use GNet ========================== eDonkey2000 GTK frontend eDonkey2000 (DFS) frontend http://ed2k-gtk-gui.sourceforge.net Gnome Chinese Checkers board game http://gchch.sourceforge.net/ Gnome Jabber instant messaging and chat http://gnome-jabber.sourceforge.net Jungle Monkey distributed file sharing program http://www.junglemonkey.net Mail Notify mail notification applet http://www.nongnu.org/mailnotify/ MSI multi-simulation interface http://msi.sourceforge.net> PAN Gnome newsreader http://pan.rebelbase.com PreViking telephony middleware http://www.bellworldwide.net/previking/ Sussen network scanner http://sussen.sourceforge.net/ Workrave rest break reminder http://www.workrave.org/ gnet-2.0.8/gnet.spec0000644000175000017500000000616110751327206011217 00000000000000# Note that this is NOT a relocatable package %define ver 2.0.8 %define libver 2.0 %define rel 1 %define prefix /usr Summary: Gnet, a network library Name: gnet2 Version: %ver Release: %rel Copyright: LGPL Group: Libraries/Network Source0: gnet-%{PACKAGE_VERSION}.tar.gz URL: http://www.gnetlibrary.org BuildRoot: /var/tmp/gnet-%{PACKAGE_VERSION}-root Docdir: %{prefix}/doc Packager: Xavier Nicolovici Requires: glib >= 1.2 %description Gnet is a simple network library. It is writen in C, object-oriented, and built upon GLib. It is intended to be small, fast, easy-to-use, and easy to port. Features: * TCP "client" and "server" sockets * UDP and IP Multicast * Internet address abstraction * Asynchronous socket IO * Asynchronous DNS lookup * Byte packing and unpacking * URLs (Experimental) * Server and Conn objects (Experimental) Comments and questions should be sent to gnet@gnetlibrary.org. The Gnet homepage is at . %package devel Summary: Header files for the Gnet library Group: Development/Libraries %description devel Gnet is a simple network library. It is writen in C, object-oriented, and built upon GLib. This package allows you to develop applications that use the Gnet library. %prep %setup -q -n gnet-%{version} %build %ifarch alpha CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="-s" ./configure --host=alpha-redhat-linux\ --prefix=%{prefix} \ --with-html-dir=/usr/share/gtk-doc/html \ --with-gnu-ld %else CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="-s" ./configure \ --prefix=%{prefix} \ --with-gnu-ld \ --with-html-dir=/usr/share/gtk-doc/html %endif make %{_smp_mflags} %install rm -rf $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT install %post /sbin/ldconfig %postun /sbin/ldconfig %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-, root, root) %doc README COPYING ChangeLog NEWS TODO AUTHORS INSTALL HACKING %{prefix}/lib/libgnet-%{libver}.so.* %files devel %defattr(-, root, root) %{prefix}/share/gtk-doc/* %{prefix}/share/aclocal/* %{prefix}/lib/pkgconfig/* %{prefix}/include/gnet-%{libver} %{prefix}/lib/gnet-%{libver} %{prefix}/lib/libgnet-%{libver}.*a %{prefix}/lib/libgnet-%{libver}.so %changelog * Sun Apr 27 2003 Bas Mevissen - Updated to coexist with gnet-1.x.x RPM's * Mon Mar 03 2003 Jeff Bonggren - Removed Docdir directive. - Updated the files section. - Changed 'prefix' to 'DESTDIR' in install to fix gtk-doc install. - Added %{_smp_mflags} for faster make on SMP machines. - Added --with-html-dir=/usr/share/gtk-doc/html to configure line. * Thu Oct 26 2000 Benjamin Kahn - Added missing file in lib/gnet * Mon Feb 28 2000 David Helder - Updated for version 1.0 * Sat Jan 15 2000 Xavier Nicolovici - Moved lib*.so and lib*a to the devel package - Creation of a gnet.spec.in for autoconf process * Wed Jan 14 2000 Xavier Nicolovici - HTML documentation has been move to /usr/doc/gnet-{version}/html * Thu Jan 13 2000 Xavier Nicolovici - First try at an RPM gnet-2.0.8/INSTALL0000644000175000017500000002200510751326732010435 00000000000000Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for variables by setting them in the environment. You can do that on the command line like this: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Environment Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it cannot guess the host type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the host platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. In this case, you should also specify the build platform with `--build=TYPE', because, in this case, it may not be possible to guess the build platform (it sometimes involves compiling and running simple test programs, and this can't be done if the compiler is a cross compiler). Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Environment Variables ===================== Variables not defined in a site shell script can be set in the environment passed to configure. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. gnet-2.0.8/ltmain.sh0000644000175000017500000060512310660367353011237 00000000000000# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION="1.5.24 Debian 1.5.24-1ubuntu1" TIMESTAMP=" (1.1220.2.456 2007/06/24 02:25:32)" # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $mkdir "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || { $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 exit $EXIT_FAILURE } fi $echo "X$my_tmpdir" | $Xsed } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ $SED -n -e '1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 exit $EXIT_FAILURE fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) extracted_serial=`expr $extracted_serial + 1` my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then exit $exit_status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist ${rm}r unfat-$$ cd "$darwin_orig_dir" else cd "$darwin_orig_dir" func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches fi # $run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" disable_libs=no # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) echo "\ $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $? ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $? ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag preserve_args="$preserve_args --tag" ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi case $disable_libs in no) ;; shared) build_libtool_libs=no build_old_libs=yes ;; static) build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ;; esac # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, and some SunOS ksh mistreat backslash-escaping # in scan sets (worked around with variable expansion), # and furthermore cannot handle '|' '&' '(' ')' in scan sets # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.[fF][09]?) xform=[fF][09]. ;; *.for) xform=for ;; *.java) xform=java ;; *.obj) xform=obj ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` case $qlibobj in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qlibobj="\"$qlibobj\"" ;; esac test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` case $qsrcfile in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qsrcfile="\"$qsrcfile\"" ;; esac $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; darwin_framework|darwin_framework_skip) test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework|-arch|-isysroot) case " $CC " in *" ${arg} ${1} "* | *" ${arg} ${1} "*) prev=darwin_framework_skip ;; *) compiler_flags="$compiler_flags $arg" prev=darwin_framework ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" notinst_path="$notinst_path $dir" fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. -model) compile_command="$compile_command $arg" compiler_flags="$compiler_flags $arg" finalize_command="$finalize_command $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -module) module=yes continue ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC # -F/path gives path to uninstalled frameworks, gcc on darwin # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" compiler_flags="$compiler_flags $arg" continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then exit $exit_status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $absdir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes ; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows|none) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then major=`expr $current - $age` else major=`expr $current - $age + 1` fi case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then case $archive_cmds in *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; esac else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac else $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ " case $host in *cygwin* | *mingw* ) $echo >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { " ;; * ) $echo >> "$output_objdir/$dlsyms" "\ const struct { " ;; esac $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` else compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` fi ;; * ) compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` ;; esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $exit_status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) output_name=`basename $output` output_path=`dirname $output` cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" return 127; } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \$*\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "copying selected object files to avoid basename conflicts..." if test -z "$gentop"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$gentop"; then exit $exit_status fi fi save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase counter=`expr $counter + 1` case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" $run ln "$obj" "$gentop/$newobj" || $run cp "$obj" "$gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` else relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else if test ! -f "$dir/$dlname"; then $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: gnet-2.0.8/config.sub0000755000175000017500000007763110614436542011405 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-01-18' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: gnet-2.0.8/configure0000755000175000017500000320755710751327172011336 00000000000000#! /bin/sh # From configure.ac Revision: 1.58 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for gnet 2.0.8. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` ;; esac echo=${ECHO-echo} if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else # Restart under the correct shell. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if (echo_test_string=`eval $cmd`) 2>/dev/null && echo_test_string=`eval $cmd` && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break fi done fi if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} else # Try using printf. echo='printf %s\n' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. ECHO=$echo if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" fi tagnames=${tagnames+${tagnames},}CXX tagnames=${tagnames+${tagnames},}F77 exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='gnet' PACKAGE_TARNAME='gnet' PACKAGE_VERSION='2.0.8' PACKAGE_STRING='gnet 2.0.8' PACKAGE_BUGREPORT='gnet@gnetlibrary.org' ac_unique_file="src/gnet.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT GNET_MAJOR_VERSION GNET_MINOR_VERSION GNET_MICRO_VERSION GNET_VERSION GNET_INTERFACE_AGE GNET_BINARY_AGE LT_RELEASE LT_CURRENT LT_REVISION LT_AGE LT_CURRENT_MINUS_AGE OS_WIN32_TRUE OS_WIN32_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP GREP EGREP HAVE_CPU_I386_TRUE HAVE_CPU_I386_FALSE HAVE_CPU_PPC_TRUE HAVE_CPU_PPC_FALSE HAVE_CPU_PPC64_TRUE HAVE_CPU_PPC64_FALSE HAVE_CPU_ALPHA_TRUE HAVE_CPU_ALPHA_FALSE HAVE_CPU_ARM_TRUE HAVE_CPU_ARM_FALSE HAVE_CPU_SPARC_TRUE HAVE_CPU_SPARC_FALSE HAVE_CPU_HPPA_TRUE HAVE_CPU_HPPA_FALSE HAVE_CPU_MIPS_TRUE HAVE_CPU_MIPS_FALSE HAVE_CPU_S390_TRUE HAVE_CPU_S390_FALSE HAVE_CPU_IA64_TRUE HAVE_CPU_IA64_FALSE HAVE_CPU_M68K_TRUE HAVE_CPU_M68K_FALSE HAVE_CPU_X86_64_TRUE HAVE_CPU_X86_64_FALSE HAVE_CPU_CRIS_TRUE HAVE_CPU_CRIS_FALSE HAVE_CPU_CRISV32_TRUE HAVE_CPU_CRISV32_FALSE GNET_DEBUG_FLAGS ENABLE_NETWORK_TESTS_TRUE ENABLE_NETWORK_TESTS_FALSE SED LN_S ECHO AR RANLIB DLLTOOL AS OBJDUMP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG GLIB_CFLAGS GLIB_LIBS GTHREAD_CFLAGS GTHREAD_LIBS HTML_DIR ENABLE_GTK_DOC_TRUE ENABLE_GTK_DOC_FALSE GTK_DOC_USE_LIBTOOL_TRUE GTK_DOC_USE_LIBTOOL_FALSE HAVE_CHECK_TRUE HAVE_CHECK_FALSE CHECK_CFLAGS CHECK_LIBS VALGRIND_PATH HAVE_VALGRIND_TRUE HAVE_VALGRIND_FALSE VALGRIND_CFLAGS VALGRIND_LIBS GNET_GCOV_ENABLED_TRUE GNET_GCOV_ENABLED_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC CXXCPP F77 FFLAGS PKG_CONFIG GLIB_CFLAGS GLIB_LIBS GTHREAD_CFLAGS GTHREAD_LIBS CHECK_CFLAGS CHECK_LIBS VALGRIND_CFLAGS VALGRIND_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures gnet 2.0.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/gnet] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of gnet 2.0.8:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-debug=no/minimum/yes turn on debugging (default=minimum --enable-network-tests enable tests that use the network (default: yes) --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-threadsafe-getaddrinfo assume getaddrinfo() is threadsafe --enable-threadsafe-gethostbyname assume gethostbyname() is threadsafe --enable-gtk-doc use gtk-doc to build documentation default=no Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use both] --with-tags[=TAGS] include additional configurations [automatic] --with-html-dir=PATH path to installed docs Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags PKG_CONFIG path to pkg-config utility GLIB_CFLAGS C compiler flags for GLIB, overriding pkg-config GLIB_LIBS linker flags for GLIB, overriding pkg-config GTHREAD_CFLAGS C compiler flags for GTHREAD, overriding pkg-config GTHREAD_LIBS linker flags for GTHREAD, overriding pkg-config CHECK_CFLAGS C compiler flags for CHECK, overriding pkg-config CHECK_LIBS linker flags for CHECK, overriding pkg-config VALGRIND_CFLAGS C compiler flags for VALGRIND, overriding pkg-config VALGRIND_LIBS linker flags for VALGRIND, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF gnet configure 2.0.8 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by gnet $as_me 2.0.8, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6; } if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6; } if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6; } if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 echo "$as_me: error: invalid value of canonical target" >&2;} { (exit 1); exit 1; }; };; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version="1.9" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm -f conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$AWK" && break done { echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } SET_MAKE= else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=gnet VERSION=2.0.8 cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' { echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE # On making releases: # GNET_MICRO_VERSION += 1; # GNET_INTERFACE_AGE += 1; # GNET_BINARY_AGE += 1; # if any functions have been added, set GNET_INTERFACE_AGE to 0. # if backwards compatibility has been broken, # set GNET_BINARY_AGE _and_ GNET_INTERFACE_AGE to 0. GNET_MAJOR_VERSION=2 GNET_MINOR_VERSION=0 GNET_MICRO_VERSION=8 GNET_INTERFACE_AGE=0 GNET_BINARY_AGE=8 GNET_VERSION=$GNET_MAJOR_VERSION.$GNET_MINOR_VERSION.$GNET_MICRO_VERSION # libtool versioning LT_RELEASE=$GNET_MAJOR_VERSION.$GNET_MINOR_VERSION LT_CURRENT=`expr $GNET_MICRO_VERSION - $GNET_INTERFACE_AGE` LT_REVISION=$GNET_INTERFACE_AGE LT_AGE=`expr $GNET_BINARY_AGE - $GNET_INTERFACE_AGE` LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE` # Define version stuff cat >>confdefs.h <<_ACEOF #define GNET_MAJOR_VERSION $GNET_MAJOR_VERSION _ACEOF cat >>confdefs.h <<_ACEOF #define GNET_MINOR_VERSION $GNET_MINOR_VERSION _ACEOF cat >>confdefs.h <<_ACEOF #define GNET_MICRO_VERSION $GNET_MICRO_VERSION _ACEOF cat >>confdefs.h <<_ACEOF #define GNET_INTERFACE_AGE $GNET_INTERFACE_AGE _ACEOF cat >>confdefs.h <<_ACEOF #define GNET_BINARY_AGE $GNET_BINARY_AGE _ACEOF { echo "$as_me:$LINENO: checking for Win32" >&5 echo $ECHO_N "checking for Win32... $ECHO_C" >&6; } case "$host" in *-*-mingw*) gnet_native_win32=yes # Why not use G_OS_WIN32? cat >>confdefs.h <<_ACEOF #define GNET_WIN32 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_IPV6 1 _ACEOF ;; *) gnet_native_win32=no ;; esac { echo "$as_me:$LINENO: result: $gnet_native_win32" >&5 echo "${ECHO_T}$gnet_native_win32" >&6; } if test "$gnet_native_win32" = "yes"; then OS_WIN32_TRUE= OS_WIN32_FALSE='#' else OS_WIN32_TRUE='#' OS_WIN32_FALSE= fi ############################################################### # Check Host CPU type (needed for abi test among other things) DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi { echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6; } { echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext { echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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 : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" 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 "echo \"\$as_me:$LINENO: $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 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_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _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 "echo \"\$as_me:$LINENO: $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 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 : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _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 "echo \"\$as_me:$LINENO: $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 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 # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _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 "echo \"\$as_me:$LINENO: $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 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 : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _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 "echo \"\$as_me:$LINENO: $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 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 # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else 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 <$ac_header> _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 "echo \"\$as_me:$LINENO: $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 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 eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done case "x${host_cpu}" in xi?86 | xk? | xi?86_64) HAVE_CPU_I386=yes cat >>confdefs.h <<\_ACEOF #define HAVE_CPU_I386 1 _ACEOF case "x${host_cpu}" in xi386 | xi486) ;; *) cat >>confdefs.h <<\_ACEOF #define HAVE_RDTSC 1 _ACEOF ;; esac ;; xpowerpc) HAVE_CPU_PPC=yes cat >>confdefs.h <<\_ACEOF #define HAVE_CPU_PPC 1 _ACEOF ;; xpowerpc64) HAVE_CPU_PPC64=yes cat >>confdefs.h <<\_ACEOF #define HAVE_CPU_PPC64 1 _ACEOF ;; xalpha*) HAVE_CPU_ALPHA=yes cat >>confdefs.h <<\_ACEOF #define HAVE_CPU_ALPHA 1 _ACEOF ;; xarm*) HAVE_CPU_ARM=yes cat >>confdefs.h <<\_ACEOF #define HAVE_CPU_ARM 1 _ACEOF ;; xsparc*) HAVE_CPU_SPARC=yes cat >>confdefs.h <<\_ACEOF #define HAVE_CPU_SPARC 1 _ACEOF ;; xmips*) HAVE_CPU_MIPS=yes cat >>confdefs.h <<\_ACEOF #define HAVE_CPU_MIPS 1 _ACEOF ;; xhppa*) HAVE_CPU_HPPA=yes cat >>confdefs.h <<\_ACEOF #define HAVE_CPU_HPPA 1 _ACEOF ;; xs390*) HAVE_CPU_S390=yes cat >>confdefs.h <<\_ACEOF #define HAVE_CPU_S390 1 _ACEOF ;; xia64*) HAVE_CPU_IA64=yes cat >>confdefs.h <<\_ACEOF #define HAVE_CPU_IA64 1 _ACEOF ;; xm68k*) HAVE_CPU_M68K=yes cat >>confdefs.h <<\_ACEOF #define HAVE_CPU_M68K 1 _ACEOF ;; xx86_64) HAVE_CPU_X86_64=yes cat >>confdefs.h <<\_ACEOF #define HAVE_CPU_X86_64 1 _ACEOF ;; xcris) HAVE_CPU_CRIS=yes cat >>confdefs.h <<\_ACEOF #define HAVE_CPU_CRIS 1 _ACEOF ;; xcrisv32) HAVE_CPU_CRISV32=yes cat >>confdefs.h <<\_ACEOF #define HAVE_CPU_CRISV32 1 _ACEOF ;; esac { echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } if test "${ac_cv_c_bigendian+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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 # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # It does not; compile a test program. if test "$cross_compiling" = yes; then # try to guess the endianness by grepping values into an object file ac_cv_c_bigendian=unknown cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () { _ascii (); _ebcdic (); ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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 if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else 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 int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in yes) cat >>confdefs.h <<\_ACEOF #define WORDS_BIGENDIAN 1 _ACEOF ;; no) ;; *) { { echo "$as_me:$LINENO: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&5 echo "$as_me: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac if test "x$HAVE_CPU_I386" = "xyes"; then HAVE_CPU_I386_TRUE= HAVE_CPU_I386_FALSE='#' else HAVE_CPU_I386_TRUE='#' HAVE_CPU_I386_FALSE= fi if test "x$HAVE_CPU_PPC" = "xyes"; then HAVE_CPU_PPC_TRUE= HAVE_CPU_PPC_FALSE='#' else HAVE_CPU_PPC_TRUE='#' HAVE_CPU_PPC_FALSE= fi if test "x$HAVE_CPU_PPC64" = "xyes"; then HAVE_CPU_PPC64_TRUE= HAVE_CPU_PPC64_FALSE='#' else HAVE_CPU_PPC64_TRUE='#' HAVE_CPU_PPC64_FALSE= fi if test "x$HAVE_CPU_ALPHA" = "xyes"; then HAVE_CPU_ALPHA_TRUE= HAVE_CPU_ALPHA_FALSE='#' else HAVE_CPU_ALPHA_TRUE='#' HAVE_CPU_ALPHA_FALSE= fi if test "x$HAVE_CPU_ARM" = "xyes"; then HAVE_CPU_ARM_TRUE= HAVE_CPU_ARM_FALSE='#' else HAVE_CPU_ARM_TRUE='#' HAVE_CPU_ARM_FALSE= fi if test "x$HAVE_CPU_SPARC" = "xyes"; then HAVE_CPU_SPARC_TRUE= HAVE_CPU_SPARC_FALSE='#' else HAVE_CPU_SPARC_TRUE='#' HAVE_CPU_SPARC_FALSE= fi if test "x$HAVE_CPU_HPPA" = "xyes"; then HAVE_CPU_HPPA_TRUE= HAVE_CPU_HPPA_FALSE='#' else HAVE_CPU_HPPA_TRUE='#' HAVE_CPU_HPPA_FALSE= fi if test "x$HAVE_CPU_MIPS" = "xyes"; then HAVE_CPU_MIPS_TRUE= HAVE_CPU_MIPS_FALSE='#' else HAVE_CPU_MIPS_TRUE='#' HAVE_CPU_MIPS_FALSE= fi if test "x$HAVE_CPU_S390" = "xyes"; then HAVE_CPU_S390_TRUE= HAVE_CPU_S390_FALSE='#' else HAVE_CPU_S390_TRUE='#' HAVE_CPU_S390_FALSE= fi if test "x$HAVE_CPU_IA64" = "xyes"; then HAVE_CPU_IA64_TRUE= HAVE_CPU_IA64_FALSE='#' else HAVE_CPU_IA64_TRUE='#' HAVE_CPU_IA64_FALSE= fi if test "x$HAVE_CPU_M68K" = "xyes"; then HAVE_CPU_M68K_TRUE= HAVE_CPU_M68K_FALSE='#' else HAVE_CPU_M68K_TRUE='#' HAVE_CPU_M68K_FALSE= fi if test "x$HAVE_CPU_X86_64" = "xyes"; then HAVE_CPU_X86_64_TRUE= HAVE_CPU_X86_64_FALSE='#' else HAVE_CPU_X86_64_TRUE='#' HAVE_CPU_X86_64_FALSE= fi if test "x$HAVE_CPU_CRIS" = "xyes"; then HAVE_CPU_CRIS_TRUE= HAVE_CPU_CRIS_FALSE='#' else HAVE_CPU_CRIS_TRUE='#' HAVE_CPU_CRIS_FALSE= fi if test "x$HAVE_CPU_CRISV32" = "xyes"; then HAVE_CPU_CRISV32_TRUE= HAVE_CPU_CRISV32_FALSE='#' else HAVE_CPU_CRISV32_TRUE='#' HAVE_CPU_CRISV32_FALSE= fi cat >>confdefs.h <<_ACEOF #define HOST_CPU "$host_cpu" _ACEOF #################### # Debug # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then enableval=$enable_debug; else enable_debug=minimum fi { echo "$as_me:$LINENO: checking debug level" >&5 echo $ECHO_N "checking debug level... $ECHO_C" >&6; } if test "x$enable_debug" = "xyes"; then if test x$cflags_set != xset ; then case " $CFLAGS " in *[\ \ ]-g[\ \ ]*) ;; *) CFLAGS="$CFLAGS -g" ;; esac fi GNET_DEBUG_FLAGS="-DG_ENABLE_DEBUG" else if test "x$enable_debug" = "xno"; then GNET_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS" fi fi { echo "$as_me:$LINENO: result: $enable_debug" >&5 echo "${ECHO_T}$enable_debug" >&6; } # Network tests { echo "$as_me:$LINENO: checking whether to run network tests" >&5 echo $ECHO_N "checking whether to run network tests... $ECHO_C" >&6; } # Check whether --enable-network_tests was given. if test "${enable_network_tests+set}" = set; then enableval=$enable_network_tests; else enable_network_tests=no fi if test "x${enable_network_tests}" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define GNET_ENABLE_NETWORK_TESTS 1 _ACEOF { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x${enable_network_tests}" = "xyes"; then ENABLE_NETWORK_TESTS_TRUE= ENABLE_NETWORK_TESTS_FALSE='#' else ENABLE_NETWORK_TESTS_TRUE='#' ENABLE_NETWORK_TESTS_FALSE= fi if test "$gnet_native_win32" = "yes"; then if test x$enable_static = xyes -o x$enable_static = x; then { echo "$as_me:$LINENO: WARNING: Disabling static library build, must build as DLL on Windows." >&5 echo "$as_me: WARNING: Disabling static library build, must build as DLL on Windows." >&2;} enable_static=no fi if test x$enable_shared = xno; then { echo "$as_me:$LINENO: WARNING: Enabling shared library build, must build as DLL on Windows." >&5 echo "$as_me: WARNING: Enabling shared library build, must build as DLL on Windows." >&2;} fi enable_shared=yes fi ############################### # Check for programs ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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 : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" 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 "echo \"\$as_me:$LINENO: $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 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_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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 : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" 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 "echo \"\$as_me:$LINENO: $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 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_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } SET_MAKE= else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi { echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; } if test "${lt_cv_path_SED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$lt_ac_prog$ac_exec_ext"; }; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done fi SED=$lt_cv_path_SED { echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6; } # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } else { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; } if test "${lt_cv_ld_reload_flag+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_ld_reload_flag='-r' fi { echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac { echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; } if test "${lt_cv_path_NM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi { echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 echo "${ECHO_T}$lt_cv_path_NM" >&6; } NM="$lt_cv_path_NM" { echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6; } fi { echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5 echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; } if test "${lt_cv_deplibs_check_method+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix4* | aix5*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; nto-qnx*) lt_cv_deplibs_check_method=unknown ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; } file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line 7310 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; } if test "${lt_cv_cc_needs_belf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then lt_cv_cc_needs_belf=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) LD="${LD-ld} -64" ;; esac ;; esac fi rm -rf conftest* ;; *-*-cygwin* | *-*-mingw* | *-*-pw32*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_DLLTOOL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { echo "$as_me:$LINENO: result: $DLLTOOL" >&5 echo "${ECHO_T}$DLLTOOL" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5 echo "${ECHO_T}$ac_ct_DLLTOOL" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_AS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AS="${ac_tool_prefix}as" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then { echo "$as_me:$LINENO: result: $AS" >&5 echo "${ECHO_T}$AS" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_AS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AS="as" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then { echo "$as_me:$LINENO: result: $ac_ct_AS" >&5 echo "${ECHO_T}$ac_ct_AS" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_AS" = x; then AS="false" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS fi else AS="$ac_cv_prog_AS" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_OBJDUMP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { echo "$as_me:$LINENO: result: $OBJDUMP" >&5 echo "${ECHO_T}$OBJDUMP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5 echo "${ECHO_T}$ac_ct_OBJDUMP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi ;; esac need_locks="$enable_libtool_lock" for ac_header in dlfcn.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&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 <$ac_header> _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 "echo \"\$as_me:$LINENO: $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 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 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 { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _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 "echo \"\$as_me:$LINENO: $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 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 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 { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to gnet@gnetlibrary.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu depcc="$CXX" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; } if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _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 "echo \"\$as_me:$LINENO: $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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _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 "echo \"\$as_me:$LINENO: $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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { echo "$as_me:$LINENO: result: $CXXCPP" >&5 echo "${ECHO_T}$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _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 "echo \"\$as_me:$LINENO: $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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _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 "echo \"\$as_me:$LINENO: $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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then { echo "$as_me:$LINENO: result: $F77" >&5 echo "${ECHO_T}$F77" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$F77" && break done fi if test -z "$F77"; then ac_ct_F77=$F77 for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 echo "${ECHO_T}$ac_ct_F77" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_F77" && break done if test "x$ac_ct_F77" = x; then F77="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac F77=$ac_ct_F77 fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } rm -f a.out # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F { echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; } if test "${ac_cv_f77_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ choke me #endif end _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 "echo \"\$as_me:$LINENO: $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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_f77_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; } ac_ext=$ac_save_ext ac_test_FFLAGS=${FFLAGS+set} ac_save_FFLAGS=$FFLAGS FFLAGS= { echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_f77_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else FFLAGS=-g cat >conftest.$ac_ext <<_ACEOF program main end _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 "echo \"\$as_me:$LINENO: $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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_f77_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_f77_g=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; } if test "$ac_test_FFLAGS" = set; then FFLAGS=$ac_save_FFLAGS elif test $ac_cv_prog_f77_g = yes; then if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-g -O2" else FFLAGS="-g" fi else if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-O2" else FFLAGS= fi fi G77=`test $ac_compiler_gnu = yes && echo yes` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! # find the maximum length of command line arguments { echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; } if test "${lt_cv_sys_max_cmd_len+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done teststring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; } else { echo "$as_me:$LINENO: result: none" >&5 echo "${ECHO_T}none" >&6; } fi # Check for command to grab the raw symbol name followed by C symbol from nm. { echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; } if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32*) symcode='[ABCDGISTW]' ;; hpux*) # Its linker distinguishes data from code symbols if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; linux* | k*bsd*-gnu) if test "$host_cpu" = ia64; then symcode='[ABCDGIRSTW]' lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Now try to grab the symbols. nlist=conftest.nm if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if grep ' nm_test_var$' "$nlist" >/dev/null; then if grep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = { EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { echo "$as_me:$LINENO: result: failed" >&5 echo "${ECHO_T}failed" >&6; } else { echo "$as_me:$LINENO: result: ok" >&5 echo "${ECHO_T}ok" >&6; } fi { echo "$as_me:$LINENO: checking for objdir" >&5 echo $ECHO_N "checking for objdir... $ECHO_C" >&6; } if test "${lt_cv_objdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 echo "${ECHO_T}$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Constants: rm="rm -f" # Global variables: default_ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" ofile="$default_ofile" with_gnu_ld="$lt_cv_prog_gnu_ld" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="${ac_tool_prefix}ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 echo "${ECHO_T}$ac_ct_AR" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi else AR="$ac_cv_prog_AR" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; } if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { echo "$as_me:$LINENO: checking for file" >&5 echo $ECHO_N "checking for file... $ECHO_C" >&6; } if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac enable_dlopen=no enable_win32_dll=yes # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Check whether --with-pic was given. if test "${with_pic+set}" = set; then withval=$with_pic; pic_mode="$withval" else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Use C for the default configuration in the libtool script tagname= lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' { echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:9869: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:9873: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= { echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; *) lt_prog_compiler_pic='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' ;; esac ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; esac ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 echo "${ECHO_T}$lt_prog_compiler_pic" >&6; } # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; } if test "${lt_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:10159: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:10163: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works=yes fi fi $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; } if test x"$lt_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } if test "${lt_prog_compiler_static_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works=yes fi else lt_prog_compiler_static_works=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; } if test x"$lt_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:10263: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:10267: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6; } if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } runpath_var= allow_undefined_flag= enable_shared_with_static_runtimes=no archive_cmds= archive_expsym_cmds= old_archive_From_new_cmds= old_archive_from_expsyms_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported link_all_deplibs=unknown hardcode_automatic=no module_cmds= module_expsym_cmds= always_export_symbols=no export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; *) tmp_sharedflag='-shared' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi link_all_deplibs=no else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_libdir_separator=':' link_all_deplibs=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='' link_all_deplibs=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs=no ;; esac fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld='-rpath $libdir' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac fi { echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc=no else archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 echo "${ECHO_T}$archive_cmds_need_lc" >&6; } ;; esac fi ;; esac { echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'` else lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` sys_lib_search_path_spec=`echo $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi { echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var" || \ test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { echo "$as_me:$LINENO: result: $hardcode_action" >&5 echo "${ECHO_T}$hardcode_action" >&6; } if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi striplib= old_striplib= { echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi ;; *) { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } ;; esac fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) { echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; } if test "${ac_cv_func_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shl_load to an innocuous variant, in case declares shl_load. For example, HP-UX 11i declares gettimeofday. */ #define shl_load innocuous_shl_load /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shl_load /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_shl_load || defined __stub___shl_load choke me #endif int main () { return shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6; } if test $ac_cv_func_shl_load = yes; then lt_cv_dlopen="shl_load" else { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; } if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; } if test $ac_cv_lib_dld_shl_load = yes; then lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" else { echo "$as_me:$LINENO: checking for dlopen" >&5 echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; } if test "${ac_cv_func_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define dlopen to an innocuous variant, in case declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dlopen /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_dlopen || defined __stub___dlopen choke me #endif int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6; } if test $ac_cv_func_dlopen = yes; then lt_cv_dlopen="dlopen" else { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; } if test "${ac_cv_lib_svld_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_svld_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; } if test $ac_cv_lib_svld_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; } if test "${ac_cv_lib_dld_dld_link+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_dld_dld_link=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; } if test $ac_cv_lib_dld_dld_link = yes; then lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; } if test "${lt_cv_dlopen_self+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 echo "${ECHO_T}$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; } if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # Report which library types will actually be built { echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6; } { echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6; } { echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6; } # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler \ CC \ LD \ lt_prog_compiler_wl \ lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_prog_compiler_no_builtin_flag \ export_dynamic_flag_spec \ thread_safe_flag_spec \ whole_archive_flag_spec \ enable_shared_with_static_runtimes \ old_archive_cmds \ old_archive_from_new_cmds \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ archive_cmds \ archive_expsym_cmds \ postinstall_cmds \ postuninstall_cmds \ old_archive_from_expsyms_cmds \ allow_undefined_flag \ no_undefined_flag \ export_symbols_cmds \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ hardcode_automatic \ module_cmds \ module_expsym_cmds \ lt_cv_prog_compiler_c_o \ fix_srcfile_path \ exclude_expsyms \ include_expsyms; do case $var in old_archive_cmds | \ old_archive_from_new_cmds | \ archive_cmds | \ archive_expsym_cmds | \ module_cmds | \ module_expsym_cmds | \ old_archive_from_expsyms_cmds | \ export_symbols_cmds | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="${ofile}T" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 $rm -f "$cfgfile" { echo "$as_me:$LINENO: creating $ofile" >&5 echo "$as_me: creating $ofile" >&6;} cat <<__EOF__ >> "$cfgfile" #! $SHELL # `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= # ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # ### END LIBTOOL CONFIG __EOF__ case $host_os in aix3*) cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || \ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" # Check whether --with-tags was given. if test "${with_tags+set}" = set; then withval=$with_tags; tagnames="$withval" fi if test -f "$ltmain" && test -n "$tagnames"; then if test ! -f "${ofile}"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} fi if test -z "$LTCC"; then eval "`$SHELL ${ofile} --config | grep '^LTCC='`" if test -z "$LTCC"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} else { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} fi fi if test -z "$LTCFLAGS"; then eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for tagname in $tagnames; do IFS="$lt_save_ifs" # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in "") ;; *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 echo "$as_me: error: invalid tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null then { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} { (exit 1); exit 1; }; } fi # Update the list of available tags. if test -n "$tagname"; then echo appending configuration tag \"$tagname\" to $ofile case $tagname in CXX) if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_flag_spec_ld_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } else { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported whole_archive_flag_spec_CXX='' link_all_deplibs_CXX=yes if test "$GXX" = yes ; then lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_CXX=no ;; esac fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd[12]*) # C++ shared libraries reported to be fairly broken before switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; gnu*) ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC*) # Portland Group C++ compiler archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd='echo' else ld_shlibs_CXX=no fi ;; osf3*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | grep -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. # So that behaviour is only enabled if SCOABSPATH is set to a # non-empty value in the environment. Most likely only useful for # creating official distributions of packages. # This is a hack until libtool officially supports absolute path # names for shared libraries. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no # The `*' in the case matches for architectures that use `case' in # $output_verbose_cmd can trigger glob expansion during the loop # eval without this substitution. output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` for p in `eval $output_verbose_link_cmd`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" \ || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $rm -f confest.$objext # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= { echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix4* | aix5*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' ;; esac ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; icpc* | ecpc*) # Intel C++ lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC*) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; } # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; } if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:15145: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:15149: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_CXX=yes fi fi $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6; } if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } if test "${lt_prog_compiler_static_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_CXX=yes fi else lt_prog_compiler_static_works_CXX=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6; } if test x"$lt_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_CXX=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:15249: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:15253: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6; } if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix4* | aix5*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw*) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' ;; linux* | k*bsd*-gnu) link_all_deplibs_CXX=no ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac { echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_CXX=no else archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; } ;; esac fi ;; esac { echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi { echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || \ test -n "$runpath_var_CXX" || \ test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 echo "${ECHO_T}$hardcode_action_CXX" >&6; } if test "$hardcode_action_CXX" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_CXX \ CC_CXX \ LD_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_static_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ export_dynamic_flag_spec_CXX \ thread_safe_flag_spec_CXX \ whole_archive_flag_spec_CXX \ enable_shared_with_static_runtimes_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ postinstall_cmds_CXX \ postuninstall_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ export_symbols_cmds_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_separator_CXX \ hardcode_automatic_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ lt_cv_prog_compiler_c_o_CXX \ fix_srcfile_path_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX; do case $var in old_archive_cmds_CXX | \ old_archive_from_new_cmds_CXX | \ archive_cmds_CXX | \ archive_expsym_cmds_CXX | \ module_cmds_CXX | \ module_expsym_cmds_CXX | \ old_archive_from_expsyms_cmds_CXX | \ export_symbols_cmds_CXX | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU C compiler? with_gcc=$GCC_CXX # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_CXX # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_CXX old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_CXX # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_CXX # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_CXX # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_CXX # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ldcxx=$with_gnu_ld with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld else tagname="" fi ;; F77) if test -n "$F77" && test "X$F77" != "Xno"; then ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu archive_cmds_need_lc_F77=no allow_undefined_flag_F77= always_export_symbols_F77=no archive_expsym_cmds_F77= export_dynamic_flag_spec_F77= hardcode_direct_F77=no hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_minus_L_F77=no hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= link_all_deplibs_F77=unknown old_archive_cmds_F77=$old_archive_cmds no_undefined_flag_F77= whole_archive_flag_spec_F77= enable_shared_with_static_runtimes_F77=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o objext_F77=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` { echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6; } { echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6; } { echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6; } GCC_F77="$G77" LD_F77="$LD" lt_prog_compiler_wl_F77= lt_prog_compiler_pic_F77= lt_prog_compiler_static_F77= { echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_static_F77='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_F77='-fno-common' ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_F77=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_F77=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_F77='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' else lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' ;; esac ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_F77='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_F77='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_F77='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_F77='-non_shared' ;; newsos6) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-fpic' lt_prog_compiler_static_F77='-Bstatic' ;; ccc*) lt_prog_compiler_wl_F77='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' lt_prog_compiler_wl_F77='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' lt_prog_compiler_wl_F77='' ;; esac ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_F77='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; rdos*) lt_prog_compiler_static_F77='-non_shared' ;; solaris*) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_F77='-Qoption ld ';; *) lt_prog_compiler_wl_F77='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_F77='-Qoption ld ' lt_prog_compiler_pic_F77='-PIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_F77='-Kconform_pic' lt_prog_compiler_static_F77='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; unicos*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_can_build_shared_F77=no ;; uts4*) lt_prog_compiler_pic_F77='-pic' lt_prog_compiler_static_F77='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_F77=no ;; esac fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; } # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_F77"; then { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; } if test "${lt_prog_compiler_pic_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_F77=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_F77" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:16826: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:16830: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_F77=yes fi fi $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6; } if test x"$lt_prog_compiler_pic_works_F77" = xyes; then case $lt_prog_compiler_pic_F77 in "" | " "*) ;; *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; esac else lt_prog_compiler_pic_F77= lt_prog_compiler_can_build_shared_F77=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_F77= ;; *) lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } if test "${lt_prog_compiler_static_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_F77=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_F77=yes fi else lt_prog_compiler_static_works_F77=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6; } if test x"$lt_prog_compiler_static_works_F77" = xyes; then : else lt_prog_compiler_static_F77= fi { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_F77=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:16930: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:16934: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6; } if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } runpath_var= allow_undefined_flag_F77= enable_shared_with_static_runtimes_F77=no archive_cmds_F77= archive_expsym_cmds_F77= old_archive_From_new_cmds_F77= old_archive_from_expsyms_cmds_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= thread_safe_flag_spec_F77= hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_direct_F77=no hardcode_minus_L_F77=no hardcode_shlibpath_var_F77=unsupported link_all_deplibs_F77=unknown hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= always_export_symbols_F77=no export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_F77= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_F77=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_F77='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_F77= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_F77=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_F77=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_F77=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_F77=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_F77='-L$libdir' allow_undefined_flag_F77=unsupported always_export_symbols_F77=no enable_shared_with_static_runtimes_F77=yes export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_F77=no fi ;; interix[3-9]*) hardcode_direct_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; *) tmp_sharedflag='-shared' ;; esac archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi link_all_deplibs_F77=no else ld_shlibs_F77=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_F77=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_F77=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac ;; sunos4*) archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac if test "$ld_shlibs_F77" = no; then runpath_var= hardcode_libdir_flag_spec_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_F77=unsupported always_export_symbols_F77=yes archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_F77=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_F77=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_F77='' hardcode_direct_F77=yes hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_F77=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_F77=yes hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_libdir_separator_F77= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_F77=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_F77='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_F77="-z nodefs" archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_F77=' ${wl}-bernotok' allow_undefined_flag_F77=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_F77='$convenience' archive_cmds_need_lc_F77=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # see comment about different semantics on the GNU ld section ld_shlibs_F77=no ;; bsdi[45]*) export_dynamic_flag_spec_F77=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_F77=' ' allow_undefined_flag_F77=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_F77='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_F77='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_F77=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_F77=no hardcode_direct_F77=no hardcode_automatic_F77=yes hardcode_shlibpath_var_F77=unsupported whole_archive_flag_spec_F77='' link_all_deplibs_F77=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_F77=no ;; esac fi ;; dgux*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; freebsd1*) ld_shlibs_F77=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes export_dynamic_flag_spec_F77='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_F77='+b $libdir' hardcode_direct_F77=no hardcode_shlibpath_var_F77=no ;; *) hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: link_all_deplibs_F77=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; newsos6) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_shlibpath_var_F77=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-R$libdir' ;; *) archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs_F77=no fi ;; os2*) hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes allow_undefined_flag_F77=unsupported archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' fi hardcode_libdir_separator_F77=: ;; solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs_F77=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; sysv4) case $host_vendor in sni) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_F77='$CC -r -o $output$reload_objs' hardcode_direct_F77=no ;; motorola) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_F77=no ;; sysv4.3*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no export_dynamic_flag_spec_F77='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_F77=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_F77='${wl}-z,text' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_F77='${wl}-z,text' allow_undefined_flag_F77='${wl}-z,nodefs' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes export_dynamic_flag_spec_F77='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; *) ld_shlibs_F77=no ;; esac fi { echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 echo "${ECHO_T}$ld_shlibs_F77" >&6; } test "$ld_shlibs_F77" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_F77" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_F77=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_F77 in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_F77 pic_flag=$lt_prog_compiler_pic_F77 compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_F77 allow_undefined_flag_F77= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_F77=no else archive_cmds_need_lc_F77=yes fi allow_undefined_flag_F77=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; } ;; esac fi ;; esac { echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi { echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } hardcode_action_F77= if test -n "$hardcode_libdir_flag_spec_F77" || \ test -n "$runpath_var_F77" || \ test "X$hardcode_automatic_F77" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_F77" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && test "$hardcode_minus_L_F77" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_F77=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_F77=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_F77=unsupported fi { echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 echo "${ECHO_T}$hardcode_action_F77" >&6; } if test "$hardcode_action_F77" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_F77 \ CC_F77 \ LD_F77 \ lt_prog_compiler_wl_F77 \ lt_prog_compiler_pic_F77 \ lt_prog_compiler_static_F77 \ lt_prog_compiler_no_builtin_flag_F77 \ export_dynamic_flag_spec_F77 \ thread_safe_flag_spec_F77 \ whole_archive_flag_spec_F77 \ enable_shared_with_static_runtimes_F77 \ old_archive_cmds_F77 \ old_archive_from_new_cmds_F77 \ predep_objects_F77 \ postdep_objects_F77 \ predeps_F77 \ postdeps_F77 \ compiler_lib_search_path_F77 \ archive_cmds_F77 \ archive_expsym_cmds_F77 \ postinstall_cmds_F77 \ postuninstall_cmds_F77 \ old_archive_from_expsyms_cmds_F77 \ allow_undefined_flag_F77 \ no_undefined_flag_F77 \ export_symbols_cmds_F77 \ hardcode_libdir_flag_spec_F77 \ hardcode_libdir_flag_spec_ld_F77 \ hardcode_libdir_separator_F77 \ hardcode_automatic_F77 \ module_cmds_F77 \ module_expsym_cmds_F77 \ lt_cv_prog_compiler_c_o_F77 \ fix_srcfile_path_F77 \ exclude_expsyms_F77 \ include_expsyms_F77; do case $var in old_archive_cmds_F77 | \ old_archive_from_new_cmds_F77 | \ archive_cmds_F77 | \ archive_expsym_cmds_F77 | \ module_cmds_F77 | \ module_expsym_cmds_F77 | \ old_archive_from_expsyms_cmds_F77 | \ export_symbols_cmds_F77 | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_F77 # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_F77 # Is the compiler the GNU C compiler? with_gcc=$GCC_F77 # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_F77 # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_F77 # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_F77 pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_F77 # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_F77 old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_F77 archive_expsym_cmds=$lt_archive_expsym_cmds_F77 postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_F77 module_expsym_cmds=$lt_module_expsym_cmds_F77 # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_F77 # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_F77 # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_F77 # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_F77 # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_F77 # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_F77 # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_F77 # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_F77 # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_F77 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_F77 # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_F77 # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_F77 # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_F77 # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_F77 # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_F77 # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_F77 # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; GCJ) if test -n "$GCJ" && test "X$GCJ" != "Xno"; then # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o objext_GCJ=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no old_archive_cmds_GCJ=$old_archive_cmds lt_prog_compiler_no_builtin_flag_GCJ= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' { echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:19130: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:19134: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl_GCJ= lt_prog_compiler_pic_GCJ= lt_prog_compiler_static_GCJ= { echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_static_GCJ='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_GCJ='-fno-common' ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_GCJ=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_GCJ=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_GCJ='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' else lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' ;; esac ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_GCJ='-non_shared' ;; newsos6) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-fpic' lt_prog_compiler_static_GCJ='-Bstatic' ;; ccc*) lt_prog_compiler_wl_GCJ='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' lt_prog_compiler_wl_GCJ='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' lt_prog_compiler_wl_GCJ='' ;; esac ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_GCJ='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; rdos*) lt_prog_compiler_static_GCJ='-non_shared' ;; solaris*) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_GCJ='-Qoption ld ';; *) lt_prog_compiler_wl_GCJ='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_GCJ='-Qoption ld ' lt_prog_compiler_pic_GCJ='-PIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_GCJ='-Kconform_pic' lt_prog_compiler_static_GCJ='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; unicos*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_can_build_shared_GCJ=no ;; uts4*) lt_prog_compiler_pic_GCJ='-pic' lt_prog_compiler_static_GCJ='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_GCJ=no ;; esac fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; } # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_GCJ"; then { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; } if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_pic_works_GCJ=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_GCJ" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:19420: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:19424: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_GCJ=yes fi fi $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6; } if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then case $lt_prog_compiler_pic_GCJ in "" | " "*) ;; *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; esac else lt_prog_compiler_pic_GCJ= lt_prog_compiler_can_build_shared_GCJ=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_GCJ= ;; *) lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_GCJ=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_GCJ=yes fi else lt_prog_compiler_static_works_GCJ=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6; } if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then : else lt_prog_compiler_static_GCJ= fi { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_GCJ=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:19524: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:19528: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6; } if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } runpath_var= allow_undefined_flag_GCJ= enable_shared_with_static_runtimes_GCJ=no archive_cmds_GCJ= archive_expsym_cmds_GCJ= old_archive_From_new_cmds_GCJ= old_archive_from_expsyms_cmds_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= thread_safe_flag_spec_GCJ= hardcode_libdir_flag_spec_GCJ= hardcode_libdir_flag_spec_ld_GCJ= hardcode_libdir_separator_GCJ= hardcode_direct_GCJ=no hardcode_minus_L_GCJ=no hardcode_shlibpath_var_GCJ=unsupported link_all_deplibs_GCJ=unknown hardcode_automatic_GCJ=no module_cmds_GCJ= module_expsym_cmds_GCJ= always_export_symbols_GCJ=no export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_GCJ= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_GCJ=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_GCJ= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_GCJ=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_GCJ=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_GCJ=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_GCJ=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_GCJ='-L$libdir' allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=no enable_shared_with_static_runtimes_GCJ=yes export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_GCJ=no fi ;; interix[3-9]*) hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; *) tmp_sharedflag='-shared' ;; esac archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi link_all_deplibs_GCJ=no else ld_shlibs_GCJ=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_GCJ=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_GCJ=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac ;; sunos4*) archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac if test "$ld_shlibs_GCJ" = no; then runpath_var= hardcode_libdir_flag_spec_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=yes archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_GCJ=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_GCJ=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_GCJ='' hardcode_direct_GCJ=yes hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_GCJ=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_GCJ=yes hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_libdir_separator_GCJ= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_GCJ=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_GCJ='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_GCJ="-z nodefs" archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_GCJ=' ${wl}-bernotok' allow_undefined_flag_GCJ=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_GCJ='$convenience' archive_cmds_need_lc_GCJ=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # see comment about different semantics on the GNU ld section ld_shlibs_GCJ=no ;; bsdi[45]*) export_dynamic_flag_spec_GCJ=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_GCJ=' ' allow_undefined_flag_GCJ=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_GCJ='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_GCJ=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_GCJ=no hardcode_direct_GCJ=no hardcode_automatic_GCJ=yes hardcode_shlibpath_var_GCJ=unsupported whole_archive_flag_spec_GCJ='' link_all_deplibs_GCJ=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_GCJ=no ;; esac fi ;; dgux*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; freebsd1*) ld_shlibs_GCJ=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no ;; *) hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: link_all_deplibs_GCJ=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; newsos6) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_shlibpath_var_GCJ=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' ;; *) archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs_GCJ=no fi ;; os2*) hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes allow_undefined_flag_GCJ=unsupported archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' fi hardcode_libdir_separator_GCJ=: ;; solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs_GCJ=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; sysv4) case $host_vendor in sni) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_GCJ='$CC -r -o $output$reload_objs' hardcode_direct_GCJ=no ;; motorola) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_GCJ=no ;; sysv4.3*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no export_dynamic_flag_spec_GCJ='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_GCJ=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_GCJ='${wl}-z,text' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_GCJ='${wl}-z,text' allow_undefined_flag_GCJ='${wl}-z,nodefs' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; *) ld_shlibs_GCJ=no ;; esac fi { echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 echo "${ECHO_T}$ld_shlibs_GCJ" >&6; } test "$ld_shlibs_GCJ" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_GCJ" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_GCJ=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_GCJ in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_GCJ pic_flag=$lt_prog_compiler_pic_GCJ compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ allow_undefined_flag_GCJ= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_GCJ=no else archive_cmds_need_lc_GCJ=yes fi allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; } ;; esac fi ;; esac { echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi { echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } hardcode_action_GCJ= if test -n "$hardcode_libdir_flag_spec_GCJ" || \ test -n "$runpath_var_GCJ" || \ test "X$hardcode_automatic_GCJ" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_GCJ" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && test "$hardcode_minus_L_GCJ" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_GCJ=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_GCJ=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_GCJ=unsupported fi { echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 echo "${ECHO_T}$hardcode_action_GCJ" >&6; } if test "$hardcode_action_GCJ" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_GCJ \ CC_GCJ \ LD_GCJ \ lt_prog_compiler_wl_GCJ \ lt_prog_compiler_pic_GCJ \ lt_prog_compiler_static_GCJ \ lt_prog_compiler_no_builtin_flag_GCJ \ export_dynamic_flag_spec_GCJ \ thread_safe_flag_spec_GCJ \ whole_archive_flag_spec_GCJ \ enable_shared_with_static_runtimes_GCJ \ old_archive_cmds_GCJ \ old_archive_from_new_cmds_GCJ \ predep_objects_GCJ \ postdep_objects_GCJ \ predeps_GCJ \ postdeps_GCJ \ compiler_lib_search_path_GCJ \ archive_cmds_GCJ \ archive_expsym_cmds_GCJ \ postinstall_cmds_GCJ \ postuninstall_cmds_GCJ \ old_archive_from_expsyms_cmds_GCJ \ allow_undefined_flag_GCJ \ no_undefined_flag_GCJ \ export_symbols_cmds_GCJ \ hardcode_libdir_flag_spec_GCJ \ hardcode_libdir_flag_spec_ld_GCJ \ hardcode_libdir_separator_GCJ \ hardcode_automatic_GCJ \ module_cmds_GCJ \ module_expsym_cmds_GCJ \ lt_cv_prog_compiler_c_o_GCJ \ fix_srcfile_path_GCJ \ exclude_expsyms_GCJ \ include_expsyms_GCJ; do case $var in old_archive_cmds_GCJ | \ old_archive_from_new_cmds_GCJ | \ archive_cmds_GCJ | \ archive_expsym_cmds_GCJ | \ module_cmds_GCJ | \ module_expsym_cmds_GCJ | \ old_archive_from_expsyms_cmds_GCJ | \ export_symbols_cmds_GCJ | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_GCJ # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_GCJ # Is the compiler the GNU C compiler? with_gcc=$GCC_GCJ # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_GCJ # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_GCJ # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_GCJ pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_GCJ # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_GCJ old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_GCJ archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_GCJ module_expsym_cmds=$lt_module_expsym_cmds_GCJ # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_GCJ # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_GCJ # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_GCJ # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_GCJ # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_GCJ # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_GCJ # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_GCJ # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_GCJ # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_GCJ # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_GCJ # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_GCJ # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_GCJ # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_GCJ # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; RC) # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o objext_RC=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_RC \ CC_RC \ LD_RC \ lt_prog_compiler_wl_RC \ lt_prog_compiler_pic_RC \ lt_prog_compiler_static_RC \ lt_prog_compiler_no_builtin_flag_RC \ export_dynamic_flag_spec_RC \ thread_safe_flag_spec_RC \ whole_archive_flag_spec_RC \ enable_shared_with_static_runtimes_RC \ old_archive_cmds_RC \ old_archive_from_new_cmds_RC \ predep_objects_RC \ postdep_objects_RC \ predeps_RC \ postdeps_RC \ compiler_lib_search_path_RC \ archive_cmds_RC \ archive_expsym_cmds_RC \ postinstall_cmds_RC \ postuninstall_cmds_RC \ old_archive_from_expsyms_cmds_RC \ allow_undefined_flag_RC \ no_undefined_flag_RC \ export_symbols_cmds_RC \ hardcode_libdir_flag_spec_RC \ hardcode_libdir_flag_spec_ld_RC \ hardcode_libdir_separator_RC \ hardcode_automatic_RC \ module_cmds_RC \ module_expsym_cmds_RC \ lt_cv_prog_compiler_c_o_RC \ fix_srcfile_path_RC \ exclude_expsyms_RC \ include_expsyms_RC; do case $var in old_archive_cmds_RC | \ old_archive_from_new_cmds_RC | \ archive_cmds_RC | \ archive_expsym_cmds_RC | \ module_cmds_RC | \ module_expsym_cmds_RC | \ old_archive_from_expsyms_cmds_RC | \ export_symbols_cmds_RC | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_RC # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_RC # Is the compiler the GNU C compiler? with_gcc=$GCC_RC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_RC # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_RC # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_RC pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_RC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_RC old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_RC archive_expsym_cmds=$lt_archive_expsym_cmds_RC postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_RC module_expsym_cmds=$lt_module_expsym_cmds_RC # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_RC # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_RC # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_RC # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_RC # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_RC # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_RC # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_RC # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_RC # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_RC # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_RC # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_RC # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_RC # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_RC # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_RC # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_RC # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_RC # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_RC # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ;; *) { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 echo "$as_me: error: Unsupported tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac # Append the new tag name to the list of available tags. if test -n "$tagname" ; then available_tags="$available_tags $tagname" fi fi done IFS="$lt_save_ifs" # Now substitute the updated list of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then mv "${ofile}T" "$ofile" chmod +x "$ofile" else rm -f "${ofile}T" { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 echo "$as_me: error: unable to update list of available tagged configurations." >&2;} { (exit 1); exit 1; }; } fi fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion { echo "$as_me:$LINENO: checking for long" >&5 echo $ECHO_N "checking for long... $ECHO_C" >&6; } if test "${ac_cv_type_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else 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 typedef long ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_cv_type_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 echo "${ECHO_T}$ac_cv_type_long" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of long" >&5 echo $ECHO_N "checking size of long... $ECHO_C" >&6; } if test "${ac_cv_sizeof_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. 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 typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_lo=0 ac_mid=0 while :; do 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 typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_hi=-1 ac_mid=-1 while :; do 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 typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` 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 typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long=$ac_lo;; '') if test "$ac_cv_type_long" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long=0 fi ;; esac else 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 typedef long ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_long" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF { echo "$as_me:$LINENO: checking for void*" >&5 echo $ECHO_N "checking for void*... $ECHO_C" >&6; } if test "${ac_cv_type_voidp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else 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 typedef void* ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_cv_type_voidp=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_voidp=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_voidp" >&5 echo "${ECHO_T}$ac_cv_type_voidp" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of void*" >&5 echo $ECHO_N "checking size of void*... $ECHO_C" >&6; } if test "${ac_cv_sizeof_voidp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. 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 typedef void* ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_lo=0 ac_mid=0 while :; do 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 typedef void* ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 typedef void* ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_hi=-1 ac_mid=-1 while :; do 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 typedef void* ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` 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 typedef void* ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_voidp=$ac_lo;; '') if test "$ac_cv_type_voidp" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (void*) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (void*) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_voidp=0 fi ;; esac else 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 typedef void* ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_voidp=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_voidp" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (void*) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (void*) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_voidp=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_voidp" >&5 echo "${ECHO_T}$ac_cv_sizeof_voidp" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_VOIDP $ac_cv_sizeof_voidp _ACEOF #################### # Mac OS X # MacOSX doesn't define socklen_t, so we must define it to be an # 'int'. On all other systems, it's size_t. case $build in *-apple-darwin*) cat >>confdefs.h <<\_ACEOF #define GNET_APPLE_DARWIN 1 _ACEOF esac ############################### # Check for libraries { echo "$as_me:$LINENO: checking for main in -lsocket" >&5 echo $ECHO_N "checking for main in -lsocket... $ECHO_C" >&6; } if test "${ac_cv_lib_socket_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_socket_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_main=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_socket_main" >&5 echo "${ECHO_T}$ac_cv_lib_socket_main" >&6; } if test $ac_cv_lib_socket_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF LIBS="-lsocket $LIBS" fi { echo "$as_me:$LINENO: checking for main in -lnsl" >&5 echo $ECHO_N "checking for main in -lnsl... $ECHO_C" >&6; } if test "${ac_cv_lib_nsl_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_nsl_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_main=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_main" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_main" >&6; } if test $ac_cv_lib_nsl_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSL 1 _ACEOF LIBS="-lnsl $LIBS" fi { echo "$as_me:$LINENO: checking for main in -lresolv" >&5 echo $ECHO_N "checking for main in -lresolv... $ECHO_C" >&6; } if test "${ac_cv_lib_resolv_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lresolv $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_resolv_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_resolv_main=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_main" >&5 echo "${ECHO_T}$ac_cv_lib_resolv_main" >&6; } if test $ac_cv_lib_resolv_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBRESOLV 1 _ACEOF LIBS="-lresolv $LIBS" fi GLIB_REQ=2.6.0 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 echo "${ECHO_T}$PKG_CONFIG" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { echo "$as_me:$LINENO: checking for GLIB_CFLAGS" >&5 echo $ECHO_N "checking for GLIB_CFLAGS... $ECHO_C" >&6; } if test "${pkg_cv_GLIB_CFLAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$ac_cv_env_GLIB_CFLAGS_set" = "xset"; then pkg_cv_GLIB_CFLAGS=$ac_cv_env_GLIB_CFLAGS_value elif test -n "$PKG_CONFIG"; then if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \" glib-2.0 >= \$GLIB_REQ \" >/dev/null 2>&1") >&5 ($PKG_CONFIG --exists " glib-2.0 >= $GLIB_REQ " >/dev/null 2>&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then pkg_cv_GLIB_CFLAGS=`$PKG_CONFIG --cflags " glib-2.0 >= $GLIB_REQ " 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi fi { echo "$as_me:$LINENO: result: $pkg_cv_GLIB_CFLAGS" >&5 echo "${ECHO_T}$pkg_cv_GLIB_CFLAGS" >&6; } { echo "$as_me:$LINENO: checking for GLIB_LIBS" >&5 echo $ECHO_N "checking for GLIB_LIBS... $ECHO_C" >&6; } if test "${pkg_cv_GLIB_LIBS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$ac_cv_env_GLIB_LIBS_set" = "xset"; then pkg_cv_GLIB_LIBS=$ac_cv_env_GLIB_LIBS_value elif test -n "$PKG_CONFIG"; then if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \" glib-2.0 >= \$GLIB_REQ \" >/dev/null 2>&1") >&5 ($PKG_CONFIG --exists " glib-2.0 >= $GLIB_REQ " >/dev/null 2>&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then pkg_cv_GLIB_LIBS=`$PKG_CONFIG --libs " glib-2.0 >= $GLIB_REQ " 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi fi { echo "$as_me:$LINENO: result: $pkg_cv_GLIB_LIBS" >&5 echo "${ECHO_T}$pkg_cv_GLIB_LIBS" >&6; } if test $pkg_failed = yes; then GLIB_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors " glib-2.0 >= $GLIB_REQ "` # Put the nasty error message in config.log where it belongs echo "$GLIB_PKG_ERRORS" 1>&5 { { echo "$as_me:$LINENO: error: GLib-2.x development files not found (or version too old): Cannot find glib-2.0 >= $GLIB_REQ Please check the following: * Do you have the glib2 _development_ package installed? (usually called glib2-devel, libglib2.0-dev or similar) If ls -l /usr/lib/pkgconfig/glib-2.0.pc reports that the file does not exist, then you are missing the development package. If this is the case, you are most likely missing a whole bunch of other -devel packages as well (e.g. gtk2-devel, libglade2-devel, gstreamer-devel), so you might want to install them all in one go. If you installed glib2 from source, this point does not apply to you. * Do you have glib2 installed more than once, e.g. once from package and once from source? (if both ls /usr/lib/libglib-2.0* and ls /usr/local/lib/libglib-2.0* show results, you need to fix your installation. * Did you install glib from source? If yes, you might need to point pkg-config to the location of the glib-2.0.pc file by doing something like export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig and then running ./configure again. " >&5 echo "$as_me: error: GLib-2.x development files not found (or version too old): Cannot find glib-2.0 >= $GLIB_REQ Please check the following: * Do you have the glib2 _development_ package installed? (usually called glib2-devel, libglib2.0-dev or similar) If ls -l /usr/lib/pkgconfig/glib-2.0.pc reports that the file does not exist, then you are missing the development package. If this is the case, you are most likely missing a whole bunch of other -devel packages as well (e.g. gtk2-devel, libglade2-devel, gstreamer-devel), so you might want to install them all in one go. If you installed glib2 from source, this point does not apply to you. * Do you have glib2 installed more than once, e.g. once from package and once from source? (if both ls /usr/lib/libglib-2.0* and ls /usr/local/lib/libglib-2.0* show results, you need to fix your installation. * Did you install glib from source? If yes, you might need to point pkg-config to the location of the glib-2.0.pc file by doing something like export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig and then running ./configure again. " >&2;} { (exit 1); exit 1; }; } elif test $pkg_failed = untried; then { { echo "$as_me:$LINENO: error: GLib-2.x development files not found (or version too old): Cannot find glib-2.0 >= $GLIB_REQ Please check the following: * Do you have the glib2 _development_ package installed? (usually called glib2-devel, libglib2.0-dev or similar) If ls -l /usr/lib/pkgconfig/glib-2.0.pc reports that the file does not exist, then you are missing the development package. If this is the case, you are most likely missing a whole bunch of other -devel packages as well (e.g. gtk2-devel, libglade2-devel, gstreamer-devel), so you might want to install them all in one go. If you installed glib2 from source, this point does not apply to you. * Do you have glib2 installed more than once, e.g. once from package and once from source? (if both ls /usr/lib/libglib-2.0* and ls /usr/local/lib/libglib-2.0* show results, you need to fix your installation. * Did you install glib from source? If yes, you might need to point pkg-config to the location of the glib-2.0.pc file by doing something like export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig and then running ./configure again. " >&5 echo "$as_me: error: GLib-2.x development files not found (or version too old): Cannot find glib-2.0 >= $GLIB_REQ Please check the following: * Do you have the glib2 _development_ package installed? (usually called glib2-devel, libglib2.0-dev or similar) If ls -l /usr/lib/pkgconfig/glib-2.0.pc reports that the file does not exist, then you are missing the development package. If this is the case, you are most likely missing a whole bunch of other -devel packages as well (e.g. gtk2-devel, libglade2-devel, gstreamer-devel), so you might want to install them all in one go. If you installed glib2 from source, this point does not apply to you. * Do you have glib2 installed more than once, e.g. once from package and once from source? (if both ls /usr/lib/libglib-2.0* and ls /usr/local/lib/libglib-2.0* show results, you need to fix your installation. * Did you install glib from source? If yes, you might need to point pkg-config to the location of the glib-2.0.pc file by doing something like export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig and then running ./configure again. " >&2;} { (exit 1); exit 1; }; } else GLIB_CFLAGS=$pkg_cv_GLIB_CFLAGS GLIB_LIBS=$pkg_cv_GLIB_LIBS : fi pkg_failed=no { echo "$as_me:$LINENO: checking for GTHREAD_CFLAGS" >&5 echo $ECHO_N "checking for GTHREAD_CFLAGS... $ECHO_C" >&6; } if test "${pkg_cv_GTHREAD_CFLAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$ac_cv_env_GTHREAD_CFLAGS_set" = "xset"; then pkg_cv_GTHREAD_CFLAGS=$ac_cv_env_GTHREAD_CFLAGS_value elif test -n "$PKG_CONFIG"; then if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"gthread-2.0 >= \$GLIB_REQ\" >/dev/null 2>&1") >&5 ($PKG_CONFIG --exists "gthread-2.0 >= $GLIB_REQ" >/dev/null 2>&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then pkg_cv_GTHREAD_CFLAGS=`$PKG_CONFIG --cflags "gthread-2.0 >= $GLIB_REQ" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi fi { echo "$as_me:$LINENO: result: $pkg_cv_GTHREAD_CFLAGS" >&5 echo "${ECHO_T}$pkg_cv_GTHREAD_CFLAGS" >&6; } { echo "$as_me:$LINENO: checking for GTHREAD_LIBS" >&5 echo $ECHO_N "checking for GTHREAD_LIBS... $ECHO_C" >&6; } if test "${pkg_cv_GTHREAD_LIBS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$ac_cv_env_GTHREAD_LIBS_set" = "xset"; then pkg_cv_GTHREAD_LIBS=$ac_cv_env_GTHREAD_LIBS_value elif test -n "$PKG_CONFIG"; then if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"gthread-2.0 >= \$GLIB_REQ\" >/dev/null 2>&1") >&5 ($PKG_CONFIG --exists "gthread-2.0 >= $GLIB_REQ" >/dev/null 2>&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then pkg_cv_GTHREAD_LIBS=`$PKG_CONFIG --libs "gthread-2.0 >= $GLIB_REQ" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi fi { echo "$as_me:$LINENO: result: $pkg_cv_GTHREAD_LIBS" >&5 echo "${ECHO_T}$pkg_cv_GTHREAD_LIBS" >&6; } if test $pkg_failed = yes; then GTHREAD_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gthread-2.0 >= $GLIB_REQ"` # Put the nasty error message in config.log where it belongs echo "$GTHREAD_PKG_ERRORS" 1>&5 { { echo "$as_me:$LINENO: error: The impossible happened" >&5 echo "$as_me: error: The impossible happened" >&2;} { (exit 1); exit 1; }; } elif test $pkg_failed = untried; then { { echo "$as_me:$LINENO: error: The impossible happened" >&5 echo "$as_me: error: The impossible happened" >&2;} { (exit 1); exit 1; }; } else GTHREAD_CFLAGS=$pkg_cv_GTHREAD_CFLAGS GTHREAD_LIBS=$pkg_cv_GTHREAD_LIBS : fi # These SUBSTs are primarily for gnet-config and gnet.pc # make double sure GLib was compiled with GThread support { echo "$as_me:$LINENO: checking if GLib was compiled with support for threads" >&5 echo $ECHO_N "checking if GLib was compiled with support for threads... $ECHO_C" >&6; } SAVED_CFLAGS="$CFLAGS" CFLAGS="$GTHREAD_CFLAGS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #ifndef G_THREADS_ENABLED #error "GNet requires a GLib with support for threads" #endif ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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 { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } { { echo "$as_me:$LINENO: error: GNet requires a GLib with support for threads enabled!" >&5 echo "$as_me: error: GNet requires a GLib with support for threads enabled!" >&2;} { (exit 1); exit 1; }; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$SAVED_CFLAGS" # Check for IPv6 support on unix # (will be done at runtime on win32) if test "x$gnet_native_win32" != "xyes" then { echo "$as_me:$LINENO: checking for IPv6 availability" >&5 echo $ECHO_N "checking for IPv6 availability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then cat >>confdefs.h <<\_ACEOF #define HAVE_IPV6 1 _ACEOF { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ############################### # Check for headers { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi for ac_header in sys/sockio.h sys/param.h ifaddrs.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&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 <$ac_header> _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 "echo \"\$as_me:$LINENO: $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 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 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 { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _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 "echo \"\$as_me:$LINENO: $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 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 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 { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------- ## ## Report this to gnet@gnetlibrary.org ## ## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking for linux/netlink.h" >&5 echo $ECHO_N "checking for linux/netlink.h... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _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 "echo \"\$as_me:$LINENO: $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 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 { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_LINUX_NETLINK_H 1 _ACEOF else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi rm -f conftest.err conftest.$ac_ext ############################### # Check for types { echo "$as_me:$LINENO: checking for socklen_t" >&5 echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include socklen_t x; int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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 { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int accept (int, struct sockaddr *, size_t *); int main () { ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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 { echo "$as_me:$LINENO: result: size_t" >&5 echo "${ECHO_T}size_t" >&6; } cat >>confdefs.h <<\_ACEOF #define socklen_t size_t _ACEOF else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: result: int" >&5 echo "${ECHO_T}int" >&6; } cat >>confdefs.h <<\_ACEOF #define socklen_t int _ACEOF fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ############################### # Check for structures { echo "$as_me:$LINENO: checking for struct sockaddr.sa_len" >&5 echo $ECHO_N "checking for struct sockaddr.sa_len... $ECHO_C" >&6; } if test "${ac_cv_member_struct_sockaddr_sa_len+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static struct sockaddr ac_aggr; if (ac_aggr.sa_len) return 0; ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_cv_member_struct_sockaddr_sa_len=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static struct sockaddr ac_aggr; if (sizeof ac_aggr.sa_len) return 0; ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_cv_member_struct_sockaddr_sa_len=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_sockaddr_sa_len=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_member_struct_sockaddr_sa_len" >&5 echo "${ECHO_T}$ac_cv_member_struct_sockaddr_sa_len" >&6; } if test $ac_cv_member_struct_sockaddr_sa_len = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_SOCKADDR_SA_LEN 1 _ACEOF fi { echo "$as_me:$LINENO: checking for struct sockaddr_storage" >&5 echo $ECHO_N "checking for struct sockaddr_storage... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct sockaddr_storage s; s ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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 have_sockaddr_storage=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 have_sockaddr_storage=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "$have_sockaddr_storage" = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_SOCKADDR_STORAGE 1 _ACEOF { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } { echo "$as_me:$LINENO: checking for struct sockaddr_storage family field" >&5 echo $ECHO_N "checking for struct sockaddr_storage family field... $ECHO_C" >&6; } gnet_sockaddr_family_field_name="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct sockaddr_storage s; s.ss_family = AF_INET; ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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 gnet_sockaddr_family_field_name=ss_family else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test -z "${gnet_sockaddr_family_field_name}" ; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct sockaddr_storage s; s.__ss_family = AF_INET; ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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 gnet_sockaddr_family_field_name=__ss_family else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test -z "${gnet_sockaddr_family_field_name}" ; then { { echo "$as_me:$LINENO: error: can't figure out 'family' field of struct sockaddr_storage" >&5 echo "$as_me: error: can't figure out 'family' field of struct sockaddr_storage" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: $gnet_sockaddr_family_field_name" >&5 echo "${ECHO_T}$gnet_sockaddr_family_field_name" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } gnet_sockaddr_family_field_name=ss_family fi cat >>confdefs.h <<_ACEOF #define GNET_SOCKADDR_FAMILY_FIELD_NAME $gnet_sockaddr_family_field_name _ACEOF ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for abstract socket namespace availability" >&5 echo $ECHO_N "checking for abstract socket namespace availability... $ECHO_C" >&6; } if test "${ac_cv_gnet_have_abstract_sockets+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include #include #include #include int main () { int listen_fd, len; struct sockaddr_un addr; listen_fd = socket (PF_UNIX, SOCK_STREAM, 0); if (listen_fd < 0) { perror ("socket() failed: "); exit (1); } memset (&addr, '\0', sizeof (addr)); addr.sun_family = AF_UNIX; strcpy (addr.sun_path, "X/tmp/gnet-fake-socket-path-used-in-configure-test"); len = SUN_LEN (&addr); /* calculate size before adding the \0 */ addr.sun_path[0] = '\0'; /* this is what makes it abstract */ if (bind (listen_fd, (struct sockaddr*) &addr, len) < 0) { perror ("Abstract socket namespace bind() failed: "); exit (1); } exit (0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_gnet_have_abstract_sockets=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_gnet_have_abstract_sockets=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_gnet_have_abstract_sockets" >&5 echo "${ECHO_T}$ac_cv_gnet_have_abstract_sockets" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x$ac_cv_gnet_have_abstract_sockets = xyes ; then cat >>confdefs.h <<\_ACEOF #define HAVE_ABSTRACT_SOCKETS 1 _ACEOF fi ############################### # Compiler characteristics { echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _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 "echo \"\$as_me:$LINENO: $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 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_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi # Use reentract functions, and compile expiramental stuff CFLAGS="$CFLAGS -D_REENTRANT -DGNET_EXPERIMENTAL" ############################### # Check for library functions # Most of this code checks for variants of gethostbyname(). For # simplicity and curiosity, we check for all variants, though only one # working variant is needed. # Look for getifaddrs() { echo "$as_me:$LINENO: checking for getifaddrs" >&5 echo $ECHO_N "checking for getifaddrs... $ECHO_C" >&6; } if test "${ac_cv_func_getifaddrs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define getifaddrs to an innocuous variant, in case declares getifaddrs. For example, HP-UX 11i declares gettimeofday. */ #define getifaddrs innocuous_getifaddrs /* System header to define __stub macros and hopefully few prototypes, which can conflict with char getifaddrs (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef getifaddrs /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getifaddrs (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_getifaddrs || defined __stub___getifaddrs choke me #endif int main () { return getifaddrs (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_getifaddrs=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_getifaddrs=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_getifaddrs" >&5 echo "${ECHO_T}$ac_cv_func_getifaddrs" >&6; } if test $ac_cv_func_getifaddrs = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETIFADDRS 1 _ACEOF fi # The user may be able to tell us if a function is thread-safe. We # know of no good way to test this programaticly. # On some systems, getaddrinfo() is thread-safe # Check whether --enable-threadsafe_getaddrinfo was given. if test "${enable_threadsafe_getaddrinfo+set}" = set; then enableval=$enable_threadsafe_getaddrinfo; fi # On some systems, gethostbyname() is thread-safe # Check whether --enable-threadsafe_gethostbyname was given. if test "${enable_threadsafe_gethostbyname+set}" = set; then enableval=$enable_threadsafe_gethostbyname; fi # Look for getaddrinfo(). If we have that, we don't need # gethostbyname(). We assume if the system has getaddrinfo(), they # have getnameinfo(). { echo "$as_me:$LINENO: checking for getaddrinfo" >&5 echo $ECHO_N "checking for getaddrinfo... $ECHO_C" >&6; } if test "${ac_cv_func_getaddrinfo+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define getaddrinfo to an innocuous variant, in case declares getaddrinfo. For example, HP-UX 11i declares gettimeofday. */ #define getaddrinfo innocuous_getaddrinfo /* System header to define __stub macros and hopefully few prototypes, which can conflict with char getaddrinfo (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef getaddrinfo /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getaddrinfo (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_getaddrinfo || defined __stub___getaddrinfo choke me #endif int main () { return getaddrinfo (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_getaddrinfo=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_getaddrinfo=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_getaddrinfo" >&5 echo "${ECHO_T}$ac_cv_func_getaddrinfo" >&6; } if test $ac_cv_func_getaddrinfo = yes; then # have getaddrinfo() HAVE_GETADDRINFO=yes cat >>confdefs.h <<\_ACEOF #define HAVE_GETADDRINFO 1 _ACEOF # Check for threadsafe getaddrinfo() { echo "$as_me:$LINENO: checking for threadsafe getaddrinfo()" >&5 echo $ECHO_N "checking for threadsafe getaddrinfo()... $ECHO_C" >&6; } if test "x$enable_threadsafe_getaddrinfo" = "xyes" ; then HAVE_GETADDRINFO_THREADSAFE=yes { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_GETADDRINFO_THREADSAFE 1 _ACEOF else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } # If there is no threadsafe getaddrinfo, use a Glib mutex. if test "x$GTHREAD_CFLAGS" != "x"; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETADDRINFO_GLIB_MUTEX 1 _ACEOF HAVE_GETADDRINFO_GLIB_MUTEX=yes else { echo "$as_me:$LINENO: WARNING: You do not have a thread-safe getaddrinfo() or GLib threads. Calls to getaddrinfo() (called by the GNet address functions) may not be thread-safe. This build of GNet could malfunction if used in programs that use threads. If your system has a thread-safe version of getaddrinfo(), pass the option --enable-threadsafe-getaddrinfo to configure. The function's manpage may be able to tell you whether it is thread-safe or not. " >&5 echo "$as_me: WARNING: You do not have a thread-safe getaddrinfo() or GLib threads. Calls to getaddrinfo() (called by the GNet address functions) may not be thread-safe. This build of GNet could malfunction if used in programs that use threads. If your system has a thread-safe version of getaddrinfo(), pass the option --enable-threadsafe-getaddrinfo to configure. The function's manpage may be able to tell you whether it is thread-safe or not. " >&2;} fi fi else # no getaddrinfo() { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi # Check if the user told use gethostbyname() is thread-safe. { echo "$as_me:$LINENO: checking for threadsafe gethostbyname()" >&5 echo $ECHO_N "checking for threadsafe gethostbyname()... $ECHO_C" >&6; } if test "x$enable_threadsafe_gethostbyname" = "xyes" ; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_GETHOSTBYNAME_THREADSAFE 1 _ACEOF HAVE_GETHOSTBYNAME_THREADSAFE=yes else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi # Look for a gethostbyname_r() we can use. We assume that if the # system has gethostbyname_r(), they also have gethostbyaddr_r(). # First, look for the glibc varient { echo "$as_me:$LINENO: checking for glibc gethostbyname_r" >&5 echo $ECHO_N "checking for glibc gethostbyname_r... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { struct hostent result_buf; char buf[1024]; struct hostent *result; int h_erropp; gethostbyname_r("localhost", &result_buf, buf, sizeof(buf), &result, &h_erropp); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_GETHOSTBYNAME_R_GLIBC 1 _ACEOF HAVE_GETHOSTBYNAME_R=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext # Whups, maybe we're on Solaris or Irix { echo "$as_me:$LINENO: checking for Solaris/Irix gethostbyname_r" >&5 echo $ECHO_N "checking for Solaris/Irix gethostbyname_r... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { struct hostent result; char buf[1024]; int h_errnop; gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_GETHOSTBYNAME_R_SOLARIS 1 _ACEOF HAVE_GETHOSTBYNAME_R=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext # Or not. Perhaps we're on HP-UX? { echo "$as_me:$LINENO: checking for HP-UX gethostbyname_r" >&5 echo $ECHO_N "checking for HP-UX gethostbyname_r... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { struct hostent result; char buf[1024]; gethostbyname_r("localhost", &result, buf); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_GETHOSTBYNAME_R_HPUX 1 _ACEOF HAVE_GETHOSTBYNAME_R=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext # If there is no gethostbyname_r, use Glib threads. if test -z "$HAVE_GETHOSTBYNAME_THREADSAFE" -a -z "$HAVE_GETHOSTBYNAME_R" -a "$GTHREAD_CFLAGS"; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETHOSTBYNAME_R_GLIB_MUTEX 1 _ACEOF HAVE_GETHOSTBYNAME_R=yes fi # Duh-oh. We don't have _any_ thread-safety, so warn the builder if test -z "$HAVE_GETADDRINFO_THREADSAFE" -a -z "$HAVE_GETHOSTBYNAME_THREADSAFE" -a -z "$HAVE_GETHOSTBYNAME_R"; then { echo "$as_me:$LINENO: WARNING: You do not have a thread-safe gethostbyname_r() or GLib threads. Calls to gethostbyname() (called by the GNet address functions) may not be thread-safe. This build of GNet could malfunction if used in programs that use threads. If your system has a thread-safe version of gethostbyname(), pass the option --enable-threadsafe-gethostbyname to configure. The function's manpage may be able to tell you whether it is thread-safe or not. " >&5 echo "$as_me: WARNING: You do not have a thread-safe gethostbyname_r() or GLib threads. Calls to gethostbyname() (called by the GNet address functions) may not be thread-safe. This build of GNet could malfunction if used in programs that use threads. If your system has a thread-safe version of gethostbyname(), pass the option --enable-threadsafe-gethostbyname to configure. The function's manpage may be able to tell you whether it is thread-safe or not. " >&2;} fi # If the compiler is gcc, turn on as many warnings as possible if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -Wall -Wstrict-prototypes \ -Wmissing-prototypes -Wmissing-declarations" if test "x$enable_debug" = "xyes"; then CFLAGS="$CFLAGS -Werror" fi if test "x$enable_ansi" = "xyes"; then CFLAGS="$CFLAGS -ansi" CFLAGS="$CFLAGS -pedantic" fi fi ############################### # GTK-DOC ############################### # Check whether --with-html-dir was given. if test "${with_html_dir+set}" = set; then withval=$with_html_dir; else with_html_dir='${datadir}/gtk-doc/html' fi HTML_DIR="$with_html_dir" # Check whether --enable-gtk-doc was given. if test "${enable_gtk_doc+set}" = set; then enableval=$enable_gtk_doc; else enable_gtk_doc=no fi have_gtk_doc=no if test x$enable_gtk_doc = xyes; then if test -z "$PKG_CONFIG"; then # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 echo "${ECHO_T}$PKG_CONFIG" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test "$PKG_CONFIG" != "no" && $PKG_CONFIG --exists gtk-doc; then have_gtk_doc=yes fi gtk_doc_min_version=1.2 if test "$have_gtk_doc" = yes; then { echo "$as_me:$LINENO: checking gtk-doc version >= $gtk_doc_min_version" >&5 echo $ECHO_N "checking gtk-doc version >= $gtk_doc_min_version... $ECHO_C" >&6; } if $PKG_CONFIG --atleast-version $gtk_doc_min_version gtk-doc; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } have_gtk_doc=no fi fi if test "$have_gtk_doc" != yes; then enable_gtk_doc=no fi fi if test x$enable_gtk_doc = xyes; then ENABLE_GTK_DOC_TRUE= ENABLE_GTK_DOC_FALSE='#' else ENABLE_GTK_DOC_TRUE='#' ENABLE_GTK_DOC_FALSE= fi if test -n "$LIBTOOL"; then GTK_DOC_USE_LIBTOOL_TRUE= GTK_DOC_USE_LIBTOOL_FALSE='#' else GTK_DOC_USE_LIBTOOL_TRUE='#' GTK_DOC_USE_LIBTOOL_FALSE= fi ############################### # libcheck unit test framework ############################### #dnl check for "check", unit testing library/header #AM_PATH_CHECK([0.9.4], # [ # HAVE_CHECK=yes # AC_MSG_NOTICE(CHECK_CFLAGS: $CHECK_CFLAGS) # AC_MSG_NOTICE(CHECK_LIBS: $CHECK_LIBS) # ], [ # HAVE_CHECK=no # ]) #AM_CONDITIONAL(HAVE_CHECK, test "x$HAVE_CHECK" = "xyes") pkg_failed=no { echo "$as_me:$LINENO: checking for CHECK_CFLAGS" >&5 echo $ECHO_N "checking for CHECK_CFLAGS... $ECHO_C" >&6; } if test "${pkg_cv_CHECK_CFLAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$ac_cv_env_CHECK_CFLAGS_set" = "xset"; then pkg_cv_CHECK_CFLAGS=$ac_cv_env_CHECK_CFLAGS_value elif test -n "$PKG_CONFIG"; then if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"check >= 0.9.4\" >/dev/null 2>&1") >&5 ($PKG_CONFIG --exists "check >= 0.9.4" >/dev/null 2>&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then pkg_cv_CHECK_CFLAGS=`$PKG_CONFIG --cflags "check >= 0.9.4" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi fi { echo "$as_me:$LINENO: result: $pkg_cv_CHECK_CFLAGS" >&5 echo "${ECHO_T}$pkg_cv_CHECK_CFLAGS" >&6; } { echo "$as_me:$LINENO: checking for CHECK_LIBS" >&5 echo $ECHO_N "checking for CHECK_LIBS... $ECHO_C" >&6; } if test "${pkg_cv_CHECK_LIBS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$ac_cv_env_CHECK_LIBS_set" = "xset"; then pkg_cv_CHECK_LIBS=$ac_cv_env_CHECK_LIBS_value elif test -n "$PKG_CONFIG"; then if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"check >= 0.9.4\" >/dev/null 2>&1") >&5 ($PKG_CONFIG --exists "check >= 0.9.4" >/dev/null 2>&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then pkg_cv_CHECK_LIBS=`$PKG_CONFIG --libs "check >= 0.9.4" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi fi { echo "$as_me:$LINENO: result: $pkg_cv_CHECK_LIBS" >&5 echo "${ECHO_T}$pkg_cv_CHECK_LIBS" >&6; } if test $pkg_failed = yes; then CHECK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "check >= 0.9.4"` # Put the nasty error message in config.log where it belongs echo "$CHECK_PKG_ERRORS" 1>&5 if false; then HAVE_CHECK_TRUE= HAVE_CHECK_FALSE='#' else HAVE_CHECK_TRUE='#' HAVE_CHECK_FALSE= fi elif test $pkg_failed = untried; then if false; then HAVE_CHECK_TRUE= HAVE_CHECK_FALSE='#' else HAVE_CHECK_TRUE='#' HAVE_CHECK_FALSE= fi else CHECK_CFLAGS=$pkg_cv_CHECK_CFLAGS CHECK_LIBS=$pkg_cv_CHECK_LIBS if true; then HAVE_CHECK_TRUE= HAVE_CHECK_FALSE='#' else HAVE_CHECK_TRUE='#' HAVE_CHECK_FALSE= fi fi # Extract the first word of "valgrind", so it can be a program name with args. set dummy valgrind; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_VALGRIND_PATH+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $VALGRIND_PATH in [\\/]* | ?:[\\/]*) ac_cv_path_VALGRIND_PATH="$VALGRIND_PATH" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_VALGRIND_PATH="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_VALGRIND_PATH" && ac_cv_path_VALGRIND_PATH="no" ;; esac fi VALGRIND_PATH=$ac_cv_path_VALGRIND_PATH if test -n "$VALGRIND_PATH"; then { echo "$as_me:$LINENO: result: $VALGRIND_PATH" >&5 echo "${ECHO_T}$VALGRIND_PATH" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi { echo "$as_me:$LINENO: checking whether valgrind.h is available" >&5 echo $ECHO_N "checking whether valgrind.h is available... $ECHO_C" >&6; } if test ! "x$VALGRIND_PATH" = "xno"; then HAVE_VALGRIND_TRUE= HAVE_VALGRIND_FALSE='#' else HAVE_VALGRIND_TRUE='#' HAVE_VALGRIND_FALSE= fi pkg_failed=no { echo "$as_me:$LINENO: checking for VALGRIND_CFLAGS" >&5 echo $ECHO_N "checking for VALGRIND_CFLAGS... $ECHO_C" >&6; } if test "${pkg_cv_VALGRIND_CFLAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$ac_cv_env_VALGRIND_CFLAGS_set" = "xset"; then pkg_cv_VALGRIND_CFLAGS=$ac_cv_env_VALGRIND_CFLAGS_value elif test -n "$PKG_CONFIG"; then if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"valgrind > 2.1\" >/dev/null 2>&1") >&5 ($PKG_CONFIG --exists "valgrind > 2.1" >/dev/null 2>&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then pkg_cv_VALGRIND_CFLAGS=`$PKG_CONFIG --cflags "valgrind > 2.1" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi fi { echo "$as_me:$LINENO: result: $pkg_cv_VALGRIND_CFLAGS" >&5 echo "${ECHO_T}$pkg_cv_VALGRIND_CFLAGS" >&6; } { echo "$as_me:$LINENO: checking for VALGRIND_LIBS" >&5 echo $ECHO_N "checking for VALGRIND_LIBS... $ECHO_C" >&6; } if test "${pkg_cv_VALGRIND_LIBS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$ac_cv_env_VALGRIND_LIBS_set" = "xset"; then pkg_cv_VALGRIND_LIBS=$ac_cv_env_VALGRIND_LIBS_value elif test -n "$PKG_CONFIG"; then if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"valgrind > 2.1\" >/dev/null 2>&1") >&5 ($PKG_CONFIG --exists "valgrind > 2.1" >/dev/null 2>&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then pkg_cv_VALGRIND_LIBS=`$PKG_CONFIG --libs "valgrind > 2.1" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi fi { echo "$as_me:$LINENO: result: $pkg_cv_VALGRIND_LIBS" >&5 echo "${ECHO_T}$pkg_cv_VALGRIND_LIBS" >&6; } if test $pkg_failed = yes; then VALGRIND_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "valgrind > 2.1"` # Put the nasty error message in config.log where it belongs echo "$VALGRIND_PKG_ERRORS" 1>&5 { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } elif test $pkg_failed = untried; then { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } else VALGRIND_CFLAGS=$pkg_cv_VALGRIND_CFLAGS VALGRIND_LIBS=$pkg_cv_VALGRIND_LIBS { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_VALGRIND 1 _ACEOF fi if test "xyes" = "xno"; then GNET_GCOV_ENABLED_TRUE= GNET_GCOV_ENABLED_FALSE='#' else GNET_GCOV_ENABLED_TRUE='#' GNET_GCOV_ENABLED_FALSE= fi ############################### # Outputs ############################### ac_config_headers="$ac_config_headers config.h" ac_config_files="$ac_config_files Makefile src/Makefile examples/Makefile examples/xmlrpc/Makefile macros/Makefile tests/Makefile tests/check/Makefile doc/Makefile doc/version.xml gnetconfig.h gnet.spec gnet-2.0.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${OS_WIN32_TRUE}" && test -z "${OS_WIN32_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"OS_WIN32\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"OS_WIN32\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CPU_I386_TRUE}" && test -z "${HAVE_CPU_I386_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPU_I386\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CPU_I386\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CPU_PPC_TRUE}" && test -z "${HAVE_CPU_PPC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPU_PPC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CPU_PPC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CPU_PPC64_TRUE}" && test -z "${HAVE_CPU_PPC64_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPU_PPC64\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CPU_PPC64\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CPU_ALPHA_TRUE}" && test -z "${HAVE_CPU_ALPHA_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPU_ALPHA\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CPU_ALPHA\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CPU_ARM_TRUE}" && test -z "${HAVE_CPU_ARM_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPU_ARM\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CPU_ARM\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CPU_SPARC_TRUE}" && test -z "${HAVE_CPU_SPARC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPU_SPARC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CPU_SPARC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CPU_HPPA_TRUE}" && test -z "${HAVE_CPU_HPPA_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPU_HPPA\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CPU_HPPA\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CPU_MIPS_TRUE}" && test -z "${HAVE_CPU_MIPS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPU_MIPS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CPU_MIPS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CPU_S390_TRUE}" && test -z "${HAVE_CPU_S390_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPU_S390\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CPU_S390\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CPU_IA64_TRUE}" && test -z "${HAVE_CPU_IA64_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPU_IA64\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CPU_IA64\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CPU_M68K_TRUE}" && test -z "${HAVE_CPU_M68K_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPU_M68K\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CPU_M68K\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CPU_X86_64_TRUE}" && test -z "${HAVE_CPU_X86_64_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPU_X86_64\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CPU_X86_64\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CPU_CRIS_TRUE}" && test -z "${HAVE_CPU_CRIS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPU_CRIS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CPU_CRIS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CPU_CRISV32_TRUE}" && test -z "${HAVE_CPU_CRISV32_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPU_CRISV32\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CPU_CRISV32\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_NETWORK_TESTS_TRUE}" && test -z "${ENABLE_NETWORK_TESTS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_NETWORK_TESTS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_NETWORK_TESTS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_GTK_DOC_TRUE}" && test -z "${ENABLE_GTK_DOC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GTK_DOC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_GTK_DOC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${GTK_DOC_USE_LIBTOOL_TRUE}" && test -z "${GTK_DOC_USE_LIBTOOL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"GTK_DOC_USE_LIBTOOL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"GTK_DOC_USE_LIBTOOL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CHECK_TRUE}" && test -z "${HAVE_CHECK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CHECK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CHECK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_CHECK_TRUE}" && test -z "${HAVE_CHECK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_CHECK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_CHECK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_VALGRIND_TRUE}" && test -z "${HAVE_VALGRIND_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_VALGRIND\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"HAVE_VALGRIND\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${GNET_GCOV_ENABLED_TRUE}" && test -z "${GNET_GCOV_ENABLED_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"GNET_GCOV_ENABLED\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"GNET_GCOV_ENABLED\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by gnet $as_me 2.0.8, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ gnet config.status 2.0.8 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "examples/xmlrpc/Makefile") CONFIG_FILES="$CONFIG_FILES examples/xmlrpc/Makefile" ;; "macros/Makefile") CONFIG_FILES="$CONFIG_FILES macros/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "tests/check/Makefile") CONFIG_FILES="$CONFIG_FILES tests/check/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "doc/version.xml") CONFIG_FILES="$CONFIG_FILES doc/version.xml" ;; "gnetconfig.h") CONFIG_FILES="$CONFIG_FILES gnetconfig.h" ;; "gnet.spec") CONFIG_FILES="$CONFIG_FILES gnet.spec" ;; "gnet-2.0.pc") CONFIG_FILES="$CONFIG_FILES gnet-2.0.pc" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "$CONFIG_FILES"; then _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim build!$build$ac_delim build_cpu!$build_cpu$ac_delim build_vendor!$build_vendor$ac_delim build_os!$build_os$ac_delim host!$host$ac_delim host_cpu!$host_cpu$ac_delim host_vendor!$host_vendor$ac_delim host_os!$host_os$ac_delim target!$target$ac_delim target_cpu!$target_cpu$ac_delim target_vendor!$target_vendor$ac_delim target_os!$target_os$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim CYGPATH_W!$CYGPATH_W$ac_delim PACKAGE!$PACKAGE$ac_delim VERSION!$VERSION$ac_delim ACLOCAL!$ACLOCAL$ac_delim AUTOCONF!$AUTOCONF$ac_delim AUTOMAKE!$AUTOMAKE$ac_delim AUTOHEADER!$AUTOHEADER$ac_delim MAKEINFO!$MAKEINFO$ac_delim install_sh!$install_sh$ac_delim STRIP!$STRIP$ac_delim INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim mkdir_p!$mkdir_p$ac_delim AWK!$AWK$ac_delim SET_MAKE!$SET_MAKE$ac_delim am__leading_dot!$am__leading_dot$ac_delim AMTAR!$AMTAR$ac_delim am__tar!$am__tar$ac_delim am__untar!$am__untar$ac_delim MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim MAINT!$MAINT$ac_delim GNET_MAJOR_VERSION!$GNET_MAJOR_VERSION$ac_delim GNET_MINOR_VERSION!$GNET_MINOR_VERSION$ac_delim GNET_MICRO_VERSION!$GNET_MICRO_VERSION$ac_delim GNET_VERSION!$GNET_VERSION$ac_delim GNET_INTERFACE_AGE!$GNET_INTERFACE_AGE$ac_delim GNET_BINARY_AGE!$GNET_BINARY_AGE$ac_delim LT_RELEASE!$LT_RELEASE$ac_delim LT_CURRENT!$LT_CURRENT$ac_delim LT_REVISION!$LT_REVISION$ac_delim LT_AGE!$LT_AGE$ac_delim LT_CURRENT_MINUS_AGE!$LT_CURRENT_MINUS_AGE$ac_delim OS_WIN32_TRUE!$OS_WIN32_TRUE$ac_delim OS_WIN32_FALSE!$OS_WIN32_FALSE$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim DEPDIR!$DEPDIR$ac_delim am__include!$am__include$ac_delim am__quote!$am__quote$ac_delim AMDEP_TRUE!$AMDEP_TRUE$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF CEOF$ac_eof _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF AMDEP_FALSE!$AMDEP_FALSE$ac_delim AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim CCDEPMODE!$CCDEPMODE$ac_delim am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim HAVE_CPU_I386_TRUE!$HAVE_CPU_I386_TRUE$ac_delim HAVE_CPU_I386_FALSE!$HAVE_CPU_I386_FALSE$ac_delim HAVE_CPU_PPC_TRUE!$HAVE_CPU_PPC_TRUE$ac_delim HAVE_CPU_PPC_FALSE!$HAVE_CPU_PPC_FALSE$ac_delim HAVE_CPU_PPC64_TRUE!$HAVE_CPU_PPC64_TRUE$ac_delim HAVE_CPU_PPC64_FALSE!$HAVE_CPU_PPC64_FALSE$ac_delim HAVE_CPU_ALPHA_TRUE!$HAVE_CPU_ALPHA_TRUE$ac_delim HAVE_CPU_ALPHA_FALSE!$HAVE_CPU_ALPHA_FALSE$ac_delim HAVE_CPU_ARM_TRUE!$HAVE_CPU_ARM_TRUE$ac_delim HAVE_CPU_ARM_FALSE!$HAVE_CPU_ARM_FALSE$ac_delim HAVE_CPU_SPARC_TRUE!$HAVE_CPU_SPARC_TRUE$ac_delim HAVE_CPU_SPARC_FALSE!$HAVE_CPU_SPARC_FALSE$ac_delim HAVE_CPU_HPPA_TRUE!$HAVE_CPU_HPPA_TRUE$ac_delim HAVE_CPU_HPPA_FALSE!$HAVE_CPU_HPPA_FALSE$ac_delim HAVE_CPU_MIPS_TRUE!$HAVE_CPU_MIPS_TRUE$ac_delim HAVE_CPU_MIPS_FALSE!$HAVE_CPU_MIPS_FALSE$ac_delim HAVE_CPU_S390_TRUE!$HAVE_CPU_S390_TRUE$ac_delim HAVE_CPU_S390_FALSE!$HAVE_CPU_S390_FALSE$ac_delim HAVE_CPU_IA64_TRUE!$HAVE_CPU_IA64_TRUE$ac_delim HAVE_CPU_IA64_FALSE!$HAVE_CPU_IA64_FALSE$ac_delim HAVE_CPU_M68K_TRUE!$HAVE_CPU_M68K_TRUE$ac_delim HAVE_CPU_M68K_FALSE!$HAVE_CPU_M68K_FALSE$ac_delim HAVE_CPU_X86_64_TRUE!$HAVE_CPU_X86_64_TRUE$ac_delim HAVE_CPU_X86_64_FALSE!$HAVE_CPU_X86_64_FALSE$ac_delim HAVE_CPU_CRIS_TRUE!$HAVE_CPU_CRIS_TRUE$ac_delim HAVE_CPU_CRIS_FALSE!$HAVE_CPU_CRIS_FALSE$ac_delim HAVE_CPU_CRISV32_TRUE!$HAVE_CPU_CRISV32_TRUE$ac_delim HAVE_CPU_CRISV32_FALSE!$HAVE_CPU_CRISV32_FALSE$ac_delim GNET_DEBUG_FLAGS!$GNET_DEBUG_FLAGS$ac_delim ENABLE_NETWORK_TESTS_TRUE!$ENABLE_NETWORK_TESTS_TRUE$ac_delim ENABLE_NETWORK_TESTS_FALSE!$ENABLE_NETWORK_TESTS_FALSE$ac_delim SED!$SED$ac_delim LN_S!$LN_S$ac_delim ECHO!$ECHO$ac_delim AR!$AR$ac_delim RANLIB!$RANLIB$ac_delim DLLTOOL!$DLLTOOL$ac_delim AS!$AS$ac_delim OBJDUMP!$OBJDUMP$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim CXXDEPMODE!$CXXDEPMODE$ac_delim am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim CXXCPP!$CXXCPP$ac_delim F77!$F77$ac_delim FFLAGS!$FFLAGS$ac_delim ac_ct_F77!$ac_ct_F77$ac_delim LIBTOOL!$LIBTOOL$ac_delim PKG_CONFIG!$PKG_CONFIG$ac_delim GLIB_CFLAGS!$GLIB_CFLAGS$ac_delim GLIB_LIBS!$GLIB_LIBS$ac_delim GTHREAD_CFLAGS!$GTHREAD_CFLAGS$ac_delim GTHREAD_LIBS!$GTHREAD_LIBS$ac_delim HTML_DIR!$HTML_DIR$ac_delim ENABLE_GTK_DOC_TRUE!$ENABLE_GTK_DOC_TRUE$ac_delim ENABLE_GTK_DOC_FALSE!$ENABLE_GTK_DOC_FALSE$ac_delim GTK_DOC_USE_LIBTOOL_TRUE!$GTK_DOC_USE_LIBTOOL_TRUE$ac_delim GTK_DOC_USE_LIBTOOL_FALSE!$GTK_DOC_USE_LIBTOOL_FALSE$ac_delim HAVE_CHECK_TRUE!$HAVE_CHECK_TRUE$ac_delim HAVE_CHECK_FALSE!$HAVE_CHECK_FALSE$ac_delim CHECK_CFLAGS!$CHECK_CFLAGS$ac_delim CHECK_LIBS!$CHECK_LIBS$ac_delim VALGRIND_PATH!$VALGRIND_PATH$ac_delim HAVE_VALGRIND_TRUE!$HAVE_VALGRIND_TRUE$ac_delim HAVE_VALGRIND_FALSE!$HAVE_VALGRIND_FALSE$ac_delim VALGRIND_CFLAGS!$VALGRIND_CFLAGS$ac_delim VALGRIND_LIBS!$VALGRIND_LIBS$ac_delim GNET_GCOV_ENABLED_TRUE!$GNET_GCOV_ENABLED_TRUE$ac_delim GNET_GCOV_ENABLED_FALSE!$GNET_GCOV_ENABLED_FALSE$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 81; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :H) # # CONFIG_HEADER # _ACEOF # Transform confdefs.h into a sed script `conftest.defines', that # substitutes the proper values into config.h.in to produce config.h. rm -f conftest.defines conftest.tail # First, append a space to every undef/define line, to ease matching. echo 's/$/ /' >conftest.defines # Then, protect against being on the right side of a sed subst, or in # an unquoted here document, in config.status. If some macros were # called several times there might be several #defines for the same # symbol, which is useless. But do not sort them, since the last # AC_DEFINE must be honored. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* # These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where # NAME is the cpp macro being defined, VALUE is the value it is being given. # PARAMS is the parameter list in the macro definition--in most cases, it's # just an empty string. ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' ac_dB='\\)[ (].*,\\1define\\2' ac_dC=' ' ac_dD=' ,' uniq confdefs.h | sed -n ' t rset :rset s/^[ ]*#[ ]*define[ ][ ]*// t ok d :ok s/[\\&,]/\\&/g s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p ' >>conftest.defines # Remove the space that was appended to ease matching. # Then replace #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. # (The regexp can be short, since the line contains either #define or #undef.) echo 's/ $// s,^[ #]*u.*,/* & */,' >>conftest.defines # Break up conftest.defines: ac_max_sed_lines=50 # First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" # Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" # Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" # et cetera. ac_in='$ac_file_inputs' ac_out='"$tmp/out1"' ac_nxt='"$tmp/out2"' while : do # Write a here document: cat >>$CONFIG_STATUS <<_ACEOF # First, check the format of the line: cat >"\$tmp/defines.sed" <<\\CEOF /^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def /^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def b :def _ACEOF sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines conftest.tail echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then echo "/* $configure_input */" >"$tmp/config.h" cat "$ac_result" >>"$tmp/config.h" if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else rm -f $ac_file mv "$tmp/config.h" $ac_file fi else echo "/* $configure_input */" cat "$ac_result" fi rm -f "$tmp/out12" # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`$as_dirname -- $ac_file || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| . 2>/dev/null || echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir=$dirpart/$fdir case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi gnet-2.0.8/aclocal.m40000644000175000017500000101460310751327166011254 00000000000000# generated automatically by aclocal 1.9.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # serial 51 Debian 1.5.24-1ubuntu1 AC_PROG_LIBTOOL # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) # ----------------------------------------------------------- # If this macro is not defined by Autoconf, define it here. m4_ifdef([AC_PROVIDE_IFELSE], [], [m4_define([AC_PROVIDE_IFELSE], [m4_ifdef([AC_PROVIDE_$1], [$2], [$3])])]) # AC_PROG_LIBTOOL # --------------- AC_DEFUN([AC_PROG_LIBTOOL], [AC_REQUIRE([_AC_PROG_LIBTOOL])dnl dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. AC_PROVIDE_IFELSE([AC_PROG_CXX], [AC_LIBTOOL_CXX], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX ])]) dnl And a similar setup for Fortran 77 support AC_PROVIDE_IFELSE([AC_PROG_F77], [AC_LIBTOOL_F77], [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 ])]) dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [AC_LIBTOOL_GCJ], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [AC_LIBTOOL_GCJ], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], [AC_LIBTOOL_GCJ], [ifdef([AC_PROG_GCJ], [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) ifdef([A][M_PROG_GCJ], [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) ifdef([LT_AC_PROG_GCJ], [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) ])])# AC_PROG_LIBTOOL # _AC_PROG_LIBTOOL # ---------------- AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl # Prevent multiple expansion define([AC_PROG_LIBTOOL], []) ])# _AC_PROG_LIBTOOL # AC_LIBTOOL_SETUP # ---------------- AC_DEFUN([AC_LIBTOOL_SETUP], [AC_PREREQ(2.50)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! AC_REQUIRE([AC_OBJEXT])dnl AC_REQUIRE([AC_EXEEXT])dnl dnl AC_LIBTOOL_SYS_MAX_CMD_LEN AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE AC_LIBTOOL_OBJDIR AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_PROG_ECHO_BACKSLASH case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. [double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Constants: rm="rm -f" # Global variables: default_ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" ofile="$default_ofile" with_gnu_ld="$lt_cv_prog_gnu_ld" AC_CHECK_TOOL(AR, ar, false) AC_CHECK_TOOL(RANLIB, ranlib, :) AC_CHECK_TOOL(STRIP, strip, :) old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then AC_PATH_MAGIC fi ;; esac AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) AC_ARG_ENABLE([libtool-lock], [AC_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes AC_ARG_WITH([pic], [AC_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=default # Use C for the default configuration in the libtool script tagname= AC_LIBTOOL_LANG_C_CONFIG _LT_AC_TAGCONFIG ])# AC_LIBTOOL_SETUP # _LT_AC_SYS_COMPILER # ------------------- AC_DEFUN([_LT_AC_SYS_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_AC_SYS_COMPILER # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. AC_DEFUN([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` ]) # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. AC_DEFUN([_LT_COMPILER_BOILERPLATE], [AC_REQUIRE([LT_AC_PROG_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. AC_DEFUN([_LT_LINKER_BOILERPLATE], [AC_REQUIRE([LT_AC_PROG_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* ])# _LT_LINKER_BOILERPLATE # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], [AC_REQUIRE([LT_AC_PROG_SED])dnl AC_LINK_IFELSE(AC_LANG_PROGRAM,[ lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ])# _LT_AC_SYS_LIBPATH_AIX # _LT_AC_SHELL_INIT(ARG) # ---------------------- AC_DEFUN([_LT_AC_SHELL_INIT], [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], [AC_DIVERT_PUSH(NOTICE)]) $1 AC_DIVERT_POP ])# _LT_AC_SHELL_INIT # _LT_AC_PROG_ECHO_BACKSLASH # -------------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], [_LT_AC_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` ;; esac echo=${ECHO-echo} if test "X[$]1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else # Restart under the correct shell. exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} fi if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if (echo_test_string=`eval $cmd`) 2>/dev/null && echo_test_string=`eval $cmd` && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break fi done fi if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} else # Try using printf. echo='printf %s\n' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL [$]0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL [$]0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "[$]0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. ECHO=$echo if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" fi AC_SUBST(ECHO) ])])# _LT_AC_PROG_ECHO_BACKSLASH # _LT_AC_LOCK # ----------- AC_DEFUN([_LT_AC_LOCK], [AC_ARG_ENABLE([libtool-lock], [AC_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) LD="${LD-ld} -64" ;; esac ;; esac fi rm -rf conftest* ;; AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw* | *-*-pw32*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; ]) esac need_locks="$enable_libtool_lock" ])# _LT_AC_LOCK # AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [AC_REQUIRE([LT_AC_PROG_SED]) AC_CACHE_CHECK([$1], [$2], [$2=no ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $rm conftest* ]) if test x"[$]$2" = xyes; then ifelse([$5], , :, [$5]) else ifelse([$6], , :, [$6]) fi ])# AC_LIBTOOL_COMPILER_OPTION # AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ------------------------------------------------------------ # Check whether the given compiler option works AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [AC_REQUIRE([LT_AC_PROG_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then ifelse([$4], , :, [$4]) else ifelse([$5], , :, [$5]) fi ])# AC_LIBTOOL_LINKER_OPTION # AC_LIBTOOL_SYS_MAX_CMD_LEN # -------------------------- AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [# find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done teststring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi ])# AC_LIBTOOL_SYS_MAX_CMD_LEN # _LT_AC_CHECK_DLFCN # ------------------ AC_DEFUN([_LT_AC_CHECK_DLFCN], [AC_CHECK_HEADERS(dlfcn.h)dnl ])# _LT_AC_CHECK_DLFCN # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # --------------------------------------------------------------------- AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); }] EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_AC_TRY_DLOPEN_SELF # AC_LIBTOOL_DLOPEN_SELF # ---------------------- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_AC_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_AC_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi ])# AC_LIBTOOL_DLOPEN_SELF # AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) # --------------------------------- # Check to see if options -c and -o are simultaneously supported by compiler AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], [AC_REQUIRE([LT_AC_PROG_SED])dnl AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* ]) ])# AC_LIBTOOL_PROG_CC_C_O # AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) # ----------------------------------------- # Check to see if we can do hard links to lock some files if needed AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_REQUIRE([_LT_AC_LOCK])dnl hard_links="nottested" if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi ])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS # AC_LIBTOOL_OBJDIR # ----------------- AC_DEFUN([AC_LIBTOOL_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir ])# AC_LIBTOOL_OBJDIR # AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) # ---------------------------------------------- # Check hardcoding attributes. AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_AC_TAGVAR(hardcode_action, $1)= if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existant directories. if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_AC_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_AC_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_AC_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi ])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH # AC_LIBTOOL_SYS_LIB_STRIP # ------------------------ AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], [striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi ])# AC_LIBTOOL_SYS_LIB_STRIP # AC_LIBTOOL_SYS_DYNAMIC_LINKER # ----------------------------- # PORTME Fill in your ld.so characteristics AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_REQUIRE([LT_AC_PROG_SED])dnl AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" m4_if($1,[],[ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'` else lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` sys_lib_search_path_spec=`echo $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi ])# AC_LIBTOOL_SYS_DYNAMIC_LINKER # _LT_AC_TAGCONFIG # ---------------- AC_DEFUN([_LT_AC_TAGCONFIG], [AC_REQUIRE([LT_AC_PROG_SED])dnl AC_ARG_WITH([tags], [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], [include additional configurations @<:@automatic@:>@])], [tagnames="$withval"]) if test -f "$ltmain" && test -n "$tagnames"; then if test ! -f "${ofile}"; then AC_MSG_WARN([output file `$ofile' does not exist]) fi if test -z "$LTCC"; then eval "`$SHELL ${ofile} --config | grep '^LTCC='`" if test -z "$LTCC"; then AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) else AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) fi fi if test -z "$LTCFLAGS"; then eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for tagname in $tagnames; do IFS="$lt_save_ifs" # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in "") ;; *) AC_MSG_ERROR([invalid tag name: $tagname]) ;; esac if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null then AC_MSG_ERROR([tag name \"$tagname\" already exists]) fi # Update the list of available tags. if test -n "$tagname"; then echo appending configuration tag \"$tagname\" to $ofile case $tagname in CXX) if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_LIBTOOL_LANG_CXX_CONFIG else tagname="" fi ;; F77) if test -n "$F77" && test "X$F77" != "Xno"; then AC_LIBTOOL_LANG_F77_CONFIG else tagname="" fi ;; GCJ) if test -n "$GCJ" && test "X$GCJ" != "Xno"; then AC_LIBTOOL_LANG_GCJ_CONFIG else tagname="" fi ;; RC) AC_LIBTOOL_LANG_RC_CONFIG ;; *) AC_MSG_ERROR([Unsupported tag name: $tagname]) ;; esac # Append the new tag name to the list of available tags. if test -n "$tagname" ; then available_tags="$available_tags $tagname" fi fi done IFS="$lt_save_ifs" # Now substitute the updated list of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then mv "${ofile}T" "$ofile" chmod +x "$ofile" else rm -f "${ofile}T" AC_MSG_ERROR([unable to update list of available tagged configurations.]) fi fi ])# _LT_AC_TAGCONFIG # AC_LIBTOOL_DLOPEN # ----------------- # enable checks for dlopen support AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) ])# AC_LIBTOOL_DLOPEN # AC_LIBTOOL_WIN32_DLL # -------------------- # declare package support for building win32 DLLs AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) ])# AC_LIBTOOL_WIN32_DLL # AC_ENABLE_SHARED([DEFAULT]) # --------------------------- # implement the --enable-shared flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_SHARED], [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([shared], [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]AC_ENABLE_SHARED_DEFAULT) ])# AC_ENABLE_SHARED # AC_DISABLE_SHARED # ----------------- # set the default shared flag to --disable-shared AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no) ])# AC_DISABLE_SHARED # AC_ENABLE_STATIC([DEFAULT]) # --------------------------- # implement the --enable-static flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_STATIC], [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([static], [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]AC_ENABLE_STATIC_DEFAULT) ])# AC_ENABLE_STATIC # AC_DISABLE_STATIC # ----------------- # set the default static flag to --disable-static AC_DEFUN([AC_DISABLE_STATIC], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_STATIC(no) ])# AC_DISABLE_STATIC # AC_ENABLE_FAST_INSTALL([DEFAULT]) # --------------------------------- # implement the --enable-fast-install flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_FAST_INSTALL], [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([fast-install], [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) ])# AC_ENABLE_FAST_INSTALL # AC_DISABLE_FAST_INSTALL # ----------------------- # set the default to --disable-fast-install AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_FAST_INSTALL(no) ])# AC_DISABLE_FAST_INSTALL # AC_LIBTOOL_PICMODE([MODE]) # -------------------------- # implement the --with-pic flag # MODE is either `yes' or `no'. If omitted, it defaults to `both'. AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl pic_mode=ifelse($#,1,$1,default) ])# AC_LIBTOOL_PICMODE # AC_PROG_EGREP # ------------- # This is predefined starting with Autoconf 2.54, so this conditional # definition can be removed once we require Autoconf 2.54 or later. m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi]) EGREP=$ac_cv_prog_egrep AC_SUBST([EGREP]) ])]) # AC_PATH_TOOL_PREFIX # ------------------- # find a file program which can recognize shared library AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="ifelse([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi ])# AC_PATH_TOOL_PREFIX # AC_PATH_MAGIC # ------------- # find a file program which can recognize a shared library AC_DEFUN([AC_PATH_MAGIC], [AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# AC_PATH_MAGIC # AC_PROG_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([AC_PROG_LD], [AC_ARG_WITH([gnu-ld], [AC_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no]) AC_REQUIRE([LT_AC_PROG_SED])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; nto-qnx*) lt_cv_deplibs_check_method=unknown ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown ])# AC_DEPLIBS_CHECK_METHOD # AC_PROG_NM # ---------- # find the pathname to a BSD-compatible name lister AC_DEFUN([AC_PROG_NM], [AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi]) NM="$lt_cv_path_NM" ])# AC_PROG_NM # AC_CHECK_LIBM # ------------- # check for math library AC_DEFUN([AC_CHECK_LIBM], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac ])# AC_CHECK_LIBM # AC_LIBLTDL_CONVENIENCE([DIRECTORY]) # ----------------------------------- # sets LIBLTDL to the link flags for the libltdl convenience library and # LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-convenience to the configure arguments. Note that # AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, # it is assumed to be `libltdl'. LIBLTDL will be prefixed with # '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/' # (note the single quotes!). If your package is not flat and you're not # using automake, define top_builddir and top_srcdir appropriately in # the Makefiles. AC_DEFUN([AC_LIBLTDL_CONVENIENCE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case $enable_ltdl_convenience in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" ])# AC_LIBLTDL_CONVENIENCE # AC_LIBLTDL_INSTALLABLE([DIRECTORY]) # ----------------------------------- # sets LIBLTDL to the link flags for the libltdl installable library and # LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-install to the configure arguments. Note that # AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, # and an installed libltdl is not found, it is assumed to be `libltdl'. # LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with # '${top_srcdir}/' (note the single quotes!). If your package is not # flat and you're not using automake, define top_builddir and top_srcdir # appropriately in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN([AC_LIBLTDL_INSTALLABLE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_CHECK_LIB(ltdl, lt_dlinit, [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) else enable_ltdl_install=yes fi ]) if test x"$enable_ltdl_install" = x"yes"; then ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" LTDLINCL= fi # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" ])# AC_LIBLTDL_INSTALLABLE # AC_LIBTOOL_CXX # -------------- # enable support for C++ libraries AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_LT_AC_LANG_CXX]) ])# AC_LIBTOOL_CXX # _LT_AC_LANG_CXX # --------------- AC_DEFUN([_LT_AC_LANG_CXX], [AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([_LT_AC_PROG_CXXCPP]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) ])# _LT_AC_LANG_CXX # _LT_AC_PROG_CXXCPP # ------------------ AC_DEFUN([_LT_AC_PROG_CXXCPP], [ AC_REQUIRE([AC_PROG_CXX]) if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP fi ])# _LT_AC_PROG_CXXCPP # AC_LIBTOOL_F77 # -------------- # enable support for Fortran 77 libraries AC_DEFUN([AC_LIBTOOL_F77], [AC_REQUIRE([_LT_AC_LANG_F77]) ])# AC_LIBTOOL_F77 # _LT_AC_LANG_F77 # --------------- AC_DEFUN([_LT_AC_LANG_F77], [AC_REQUIRE([AC_PROG_F77]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) ])# _LT_AC_LANG_F77 # AC_LIBTOOL_GCJ # -------------- # enable support for GCJ libraries AC_DEFUN([AC_LIBTOOL_GCJ], [AC_REQUIRE([_LT_AC_LANG_GCJ]) ])# AC_LIBTOOL_GCJ # _LT_AC_LANG_GCJ # --------------- AC_DEFUN([_LT_AC_LANG_GCJ], [AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) ])# _LT_AC_LANG_GCJ # AC_LIBTOOL_RC # ------------- # enable support for Windows resource files AC_DEFUN([AC_LIBTOOL_RC], [AC_REQUIRE([LT_AC_PROG_RC]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) ])# AC_LIBTOOL_RC # AC_LIBTOOL_LANG_C_CONFIG # ------------------------ # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) AC_DEFUN([_LT_AC_LANG_C_CONFIG], [lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_AC_SYS_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_SYS_LIB_STRIP AC_LIBTOOL_DLOPEN_SELF # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) AC_LIBTOOL_CONFIG($1) AC_LANG_POP CC="$lt_save_CC" ])# AC_LIBTOOL_LANG_C_CONFIG # AC_LIBTOOL_LANG_CXX_CONFIG # -------------------------- # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], [AC_LANG_PUSH(C++) AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([_LT_AC_PROG_CXXCPP]) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(allow_undefined_flag, $1)= _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(archive_expsym_cmds, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= _LT_AC_TAGVAR(hardcode_minus_L, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(hardcode_automatic, $1)=no _LT_AC_TAGVAR(module_cmds, $1)= _LT_AC_TAGVAR(module_expsym_cmds, $1)= _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown _LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_AC_TAGVAR(no_undefined_flag, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Dependencies to place before and after the object being linked: _LT_AC_TAGVAR(predep_objects, $1)= _LT_AC_TAGVAR(postdep_objects, $1)= _LT_AC_TAGVAR(predeps, $1)= _LT_AC_TAGVAR(postdeps, $1)= _LT_AC_TAGVAR(compiler_lib_search_path, $1)= # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration AC_PROG_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ grep 'no-whole-archive' > /dev/null; then _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_AC_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_AC_TAGVAR(archive_cmds, $1)='' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_AC_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GXX" = yes ; then lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds if test "X$lt_int_apple_cc_single_mod" = Xyes ; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before switch to ELF _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_AC_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; hpux9*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi fi _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC*) # Portland Group C++ compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; openbsd2*) # C++ shared libraries are fairly broken _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd='echo' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; osf3*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | grep -v '^2\.7' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. # So that behaviour is only enabled if SCOABSPATH is set to a # non-empty value in the environment. Most likely only useful for # creating official distributions of packages. # This is a hack until libtool officially supports absolute path # names for shared libraries. _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_AC_TAGVAR(GCC, $1)="$GXX" _LT_AC_TAGVAR(LD, $1)="$LD" AC_LIBTOOL_POSTDEP_PREDEP($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_CONFIG($1) AC_LANG_POP CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ldcxx=$with_gnu_ld with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld ])# AC_LIBTOOL_LANG_CXX_CONFIG # AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) # ------------------------------------ # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_AC_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac ])# AC_LIBTOOL_POSTDEP_PREDEP # AC_LIBTOOL_LANG_F77_CONFIG # -------------------------- # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)]) AC_DEFUN([_LT_AC_LANG_F77_CONFIG], [AC_REQUIRE([AC_PROG_F77]) AC_LANG_PUSH(Fortran 77) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(allow_undefined_flag, $1)= _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(archive_expsym_cmds, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= _LT_AC_TAGVAR(hardcode_minus_L, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=no _LT_AC_TAGVAR(module_cmds, $1)= _LT_AC_TAGVAR(module_expsym_cmds, $1)= _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown _LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_AC_TAGVAR(no_undefined_flag, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_AC_TAGVAR(GCC, $1)="$G77" _LT_AC_TAGVAR(LD, $1)="$LD" AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_CONFIG($1) AC_LANG_POP CC="$lt_save_CC" ])# AC_LIBTOOL_LANG_F77_CONFIG # AC_LIBTOOL_LANG_GCJ_CONFIG # -------------------------- # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], [AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_CONFIG($1) AC_LANG_RESTORE CC="$lt_save_CC" ])# AC_LIBTOOL_LANG_GCJ_CONFIG # AC_LIBTOOL_LANG_RC_CONFIG # ------------------------- # Ensure that the configuration vars for the Windows resource compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) AC_DEFUN([_LT_AC_LANG_RC_CONFIG], [AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes AC_LIBTOOL_CONFIG($1) AC_LANG_RESTORE CC="$lt_save_CC" ])# AC_LIBTOOL_LANG_RC_CONFIG # AC_LIBTOOL_CONFIG([TAGNAME]) # ---------------------------- # If TAGNAME is not passed, then create an initial libtool script # with a default configuration from the untagged config vars. Otherwise # add code to config.status for appending the configuration named by # TAGNAME from the matching tagged config vars. AC_DEFUN([AC_LIBTOOL_CONFIG], [# The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ _LT_AC_TAGVAR(compiler, $1) \ _LT_AC_TAGVAR(CC, $1) \ _LT_AC_TAGVAR(LD, $1) \ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ _LT_AC_TAGVAR(old_archive_cmds, $1) \ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ _LT_AC_TAGVAR(predep_objects, $1) \ _LT_AC_TAGVAR(postdep_objects, $1) \ _LT_AC_TAGVAR(predeps, $1) \ _LT_AC_TAGVAR(postdeps, $1) \ _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ _LT_AC_TAGVAR(archive_cmds, $1) \ _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ _LT_AC_TAGVAR(postinstall_cmds, $1) \ _LT_AC_TAGVAR(postuninstall_cmds, $1) \ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ _LT_AC_TAGVAR(allow_undefined_flag, $1) \ _LT_AC_TAGVAR(no_undefined_flag, $1) \ _LT_AC_TAGVAR(export_symbols_cmds, $1) \ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ _LT_AC_TAGVAR(hardcode_automatic, $1) \ _LT_AC_TAGVAR(module_cmds, $1) \ _LT_AC_TAGVAR(module_expsym_cmds, $1) \ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ _LT_AC_TAGVAR(fix_srcfile_path, $1) \ _LT_AC_TAGVAR(exclude_expsyms, $1) \ _LT_AC_TAGVAR(include_expsyms, $1); do case $var in _LT_AC_TAGVAR(old_archive_cmds, $1) | \ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ _LT_AC_TAGVAR(archive_cmds, $1) | \ _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ _LT_AC_TAGVAR(module_cmds, $1) | \ _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\[$]0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` ;; esac ifelse([$1], [], [cfgfile="${ofile}T" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 $rm -f "$cfgfile" AC_MSG_NOTICE([creating $ofile])], [cfgfile="$ofile"]) cat <<__EOF__ >> "$cfgfile" ifelse([$1], [], [#! $SHELL # `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= # ### BEGIN LIBTOOL CONFIG], [# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) # Is the compiler the GNU C compiler? with_gcc=$_LT_AC_TAGVAR(GCC, $1) # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_[]_LT_AC_TAGVAR(LD, $1) # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) # Commands used to build and install a shared archive. archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) # Flag that forces no undefined symbols. no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) # The commands to list exported symbols. export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) # Symbols that must always be exported. include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) ifelse([$1],[], [# ### END LIBTOOL CONFIG], [# ### END LIBTOOL TAG CONFIG: $tagname]) __EOF__ ifelse([$1],[], [ case $host_os in aix3*) cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || \ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ]) else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ])# AC_LIBTOOL_CONFIG # AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------------------- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi ])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE # --------------------------------- AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([LT_AC_PROG_SED]) AC_REQUIRE([AC_PROG_NM]) AC_REQUIRE([AC_OBJEXT]) # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32*) symcode='[[ABCDGISTW]]' ;; hpux*) # Its linker distinguishes data from code symbols if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; linux* | k*bsd*-gnu) if test "$host_cpu" = ia64; then symcode='[[ABCDGIRSTW]]' lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if grep ' nm_test_var$' "$nlist" >/dev/null; then if grep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[[]] = { EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -f conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi ]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE # AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) # --------------------------------------- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], [_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)= AC_MSG_CHECKING([for $compiler option to produce PIC]) ifelse([$1],[CXX],[ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix4* | aix5*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; esac ;; dgux*) case $cc_basename in ec++*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; icpc* | ecpc*) # Intel C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC*) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; vxworks*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; esac ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; newsos6) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='' ;; esac ;; esac ;; osf3* | osf4* | osf5*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" ;; esac # # Check to make sure the static flag actually works. # wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\" AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) ]) # AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) # ------------------------------------ # See if the linker supports building shared libraries. AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_REQUIRE([LT_AC_PROG_SED])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix4* | aix5*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' else _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw*) _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' ;; linux* | k*bsd*-gnu) _LT_AC_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ],[ runpath_var= _LT_AC_TAGVAR(allow_undefined_flag, $1)= _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_AC_TAGVAR(archive_cmds, $1)= _LT_AC_TAGVAR(archive_expsym_cmds, $1)= _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_minus_L, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown _LT_AC_TAGVAR(hardcode_automatic, $1)=no _LT_AC_TAGVAR(module_cmds, $1)= _LT_AC_TAGVAR(module_expsym_cmds, $1)= _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_AC_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. _LT_CC_BASENAME([$compiler]) case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac _LT_AC_TAGVAR(ld_shlibs, $1)=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; interix[[3-9]]*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; *) tmp_sharedflag='-shared' ;; esac _LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi _LT_AC_TAGVAR(link_all_deplibs, $1)=no else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=yes _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' else _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_AC_TAGVAR(archive_cmds, $1)='' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_AC_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # see comment about different semantics on the GNU ld section _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; bsdi[[45]]*) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac fi ;; dgux*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_AC_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_AC_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac fi ]) AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_AC_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_MSG_CHECKING([whether -lc should be explicitly linked in]) $rm conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) _LT_AC_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) then _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no else _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) ;; esac fi ;; esac ])# AC_LIBTOOL_PROG_LD_SHLIBS # _LT_AC_FILE_LTDLL_C # ------------------- # Be careful that the start marker always follows a newline. AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include # #undef WIN32_LEAN_AND_MEAN # #include # # #ifndef __CYGWIN__ # # ifdef __CYGWIN32__ # # define __CYGWIN__ __CYGWIN32__ # # endif # #endif # # #ifdef __cplusplus # extern "C" { # #endif # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); # #ifdef __cplusplus # } # #endif # # #ifdef __CYGWIN__ # #include # DECLARE_CYGWIN_DLL( DllMain ); # #endif # HINSTANCE __hDllInstance_base; # # BOOL APIENTRY # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) # { # __hDllInstance_base = hInst; # return TRUE; # } # /* ltdll.c ends here */ ])# _LT_AC_FILE_LTDLL_C # _LT_AC_TAGVAR(VARNAME, [TAGNAME]) # --------------------------------- AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) # old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) AC_DEFUN([LT_AC_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj, no) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS) ]) AC_DEFUN([LT_AC_PROG_RC], [AC_CHECK_TOOL(RC, windres, no) ]) # Cheap backport of AS_EXECUTABLE_P and required macros # from Autoconf 2.59; we should not use $as_executable_p directly. # _AS_TEST_PREPARE # ---------------- m4_ifndef([_AS_TEST_PREPARE], [m4_defun([_AS_TEST_PREPARE], [if test -x / >/dev/null 2>&1; then as_executable_p='test -x' else as_executable_p='test -f' fi ])])# _AS_TEST_PREPARE # AS_EXECUTABLE_P # --------------- # Check whether a file is executable. m4_ifndef([AS_EXECUTABLE_P], [m4_defun([AS_EXECUTABLE_P], [AS_REQUIRE([_AS_TEST_PREPARE])dnl $as_executable_p $1[]dnl ])])# AS_EXECUTABLE_P # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # # LT_AC_PROG_SED # -------------- # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. AC_DEFUN([LT_AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ]) # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.9.6])]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # This was merged into AC_PROG_CC in Autoconf. AU_DEFUN([AM_PROG_CC_STDC], [AC_PROG_CC AC_DIAGNOSE([obsolete], [$0: your code should no longer depend upon `am_cv_prog_cc_stdc', but upon `ac_cv_prog_cc_stdc'. Remove this warning and the assignment when you adjust the code. You can also remove the above call to AC_PROG_CC if you already called it elsewhere.]) am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc ]) AU_DEFUN([fp_PROG_CC_STDC]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 7 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.58])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, [ --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer], USE_MAINTAINER_MODE=$enableval, USE_MAINTAINER_MODE=no) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST(MAINT)dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. # # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). # This was a mistake. There are at least two reasons why we must not # use `-m 0755': # - it causes special bits like SGID to be ignored, # - it may be too restrictive (some setups expect 775 directories). # # Do not use -m 0755 and let people choose whatever they expect by # setting umask. # # We cannot accept any implementation of `mkdir' that recognizes `-p'. # Some implementations (such as Solaris 8's) are not thread-safe: if a # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' # concurrently, both version can detect that a/ is missing, but only # one can create it and the other will error out. Consequently we # restrict ourselves to GNU make (using the --version option ensures # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi AC_SUBST([mkdir_p])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([macros/gnet-arch.m4]) m4_include([acinclude.m4]) gnet-2.0.8/gnetconfig.h.in0000644000175000017500000000054410751326732012311 00000000000000/* This file generated from gnetconfig.h.in. */ #ifndef GNETCONFIG_H #define GNETCONFIG_H #define GNET_MAJOR_VERSION @GNET_MAJOR_VERSION@ #define GNET_MINOR_VERSION @GNET_MINOR_VERSION@ #define GNET_MICRO_VERSION @GNET_MICRO_VERSION@ #define GNET_INTERFACE_AGE @GNET_INTERFACE_AGE@ #define GNET_BINARY_AGE @GNET_BINARY_AGE@ #endif /* GNETCONFIG_H */ gnet-2.0.8/depcomp0000755000175000017500000003710010535563747010774 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2005-07-09.11 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mecanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: