From 1e27276feb946596b4dea1f1b7819cc53962f1b6 Mon Sep 17 00:00:00 2001 From: zodiac Date: Wed, 11 Feb 2009 23:25:15 +0000 Subject: [PATCH] Use a config.h file, instead of passing configuration options on the compiler's command line. Fix fatal compilation warning when building without SSL support. git-svn-id: https://shellinabox.googlecode.com/svn/trunk@59 0da03de8-d603-11dd-86c2-0f8696b7b6f9 --- ChangeLog | 17 +++ Makefile.am | 9 +- Makefile.in | 52 ++++++--- aclocal.m4 | 12 ++ configure | 232 ++++++++++++++++++++++++++++--------- configure.ac | 1 + libhttp/hashmap.c | 2 + libhttp/httpconnection.c | 2 + libhttp/server.c | 2 + libhttp/ssl.c | 9 +- libhttp/ssl.h | 2 + libhttp/trie.c | 2 + libhttp/url.c | 2 + logging/logging.c | 2 + shellinabox/externalfile.c | 1 + shellinabox/launcher.c | 1 + shellinabox/privileges.c | 1 + shellinabox/service.c | 2 + shellinabox/session.c | 2 + shellinabox/shellinaboxd.c | 1 + 20 files changed, 277 insertions(+), 77 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1168a98..9af58df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2009-02-11 Markus Gutschke + + * Fixed fatal compiler warning if compiling without SSL support. + + * Fixed cursor hiding and showing + + * Fixed various rendering glitches reported by Phil Endecott of + Anyterm (http://anyterm.org) fame. + + * Made code more portable. In particular, fixed sed scripts. + + * Added explicit config.h file, instead of passing configuration + options on the compiler's command line. + + * Fixed compilation issues on BSD systems. Code is still untested + and unsupport on non-Linux systems at this time. + 2009-01-21 Markus Gutschke * Released version 2.3 diff --git a/Makefile.am b/Makefile.am index 35d9951..1115cc1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,8 @@ EXTRA_DIST = shellinabox/shellinaboxd.man.in \ debian/shellinabox.install \ debian/shellinabox.postinst \ debian/shellinabox.postrm -LIBLOGGING_INCLUDES = logging/logging.h +LIBLOGGING_INCLUDES = logging/logging.h \ + config.h liblogging_la_SOURCES= logging/logging.c \ $(LIBLOGGING_INCLUDES) liblogging_la_LDFLAGS= -version 1:0:0 @@ -39,7 +40,8 @@ LIBHTTP_INCLUDES = libhttp/hashmap.h \ libhttp/httpconnection.h \ libhttp/server.h \ libhttp/ssl.h \ - libhttp/url.h + libhttp/url.h \ + config.h libhttp_la_SOURCES = libhttp/hashmap.c \ libhttp/trie.c \ libhttp/httpconnection.c \ @@ -68,7 +70,8 @@ shellinaboxd_SOURCES = shellinabox/shellinaboxd.c \ shellinabox/shell_in_a_box.js \ shellinabox/styles.css \ shellinabox/favicon.ico \ - shellinabox/beep.wav + shellinabox/beep.wav \ + config.h shellinaboxd_LDADD = liblogging.la \ libhttp.la shellinaboxd_LDFLAGS = -static diff --git a/Makefile.in b/Makefile.in index 5823fd5..f9d8bdc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -39,9 +39,9 @@ bin_PROGRAMS = shellinaboxd$(EXEEXT) subdir = . DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \ $(noinst_HEADERS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ - TODO config.guess config.sub depcomp install-sh ltmain.sh \ - missing + $(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS COPYING \ + ChangeLog INSTALL NEWS TODO config.guess config.sub depcomp \ + install-sh ltmain.sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -49,6 +49,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libhttp_la_LIBADD = @@ -265,7 +266,9 @@ EXTRA_DIST = shellinabox/shellinaboxd.man.in \ debian/shellinabox.postinst \ debian/shellinabox.postrm -LIBLOGGING_INCLUDES = logging/logging.h +LIBLOGGING_INCLUDES = logging/logging.h \ + config.h + liblogging_la_SOURCES = logging/logging.c \ $(LIBLOGGING_INCLUDES) @@ -275,7 +278,8 @@ LIBHTTP_INCLUDES = libhttp/hashmap.h \ libhttp/httpconnection.h \ libhttp/server.h \ libhttp/ssl.h \ - libhttp/url.h + libhttp/url.h \ + config.h libhttp_la_SOURCES = libhttp/hashmap.c \ libhttp/trie.c \ @@ -306,13 +310,15 @@ shellinaboxd_SOURCES = shellinabox/shellinaboxd.c \ shellinabox/shell_in_a_box.js \ shellinabox/styles.css \ shellinabox/favicon.ico \ - shellinabox/beep.wav + shellinabox/beep.wav \ + config.h shellinaboxd_LDADD = liblogging.la \ libhttp.la shellinaboxd_LDFLAGS = -static -all: all-am +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .css .html .ico .js .lo .o .obj .wav @@ -350,6 +356,23 @@ $(top_srcdir)/configure: $(am__configure_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) 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: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ @@ -676,11 +699,11 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) mkid -fID $$unique tags: TAGS -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + 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 | \ @@ -692,10 +715,10 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$tags $$unique; \ fi ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + 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 | \ @@ -846,7 +869,8 @@ distcleancheck: distclean exit 1; } >&2 check-am: all-am check: check-am -all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(DATA) $(HEADERS) +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(DATA) $(HEADERS) \ + config.h installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ @@ -887,7 +911,7 @@ distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-hdr distclean-libtool distclean-tags dvi: dvi-am @@ -948,7 +972,7 @@ uninstall-man: uninstall-man1 clean-binPROGRAMS clean-generic clean-libtool clean-local \ clean-noinstLTLIBRARIES ctags dist dist-all dist-bzip2 \ dist-gzip dist-lzma dist-shar dist-tarZ dist-zip distcheck \ - distclean distclean-compile distclean-generic \ + distclean distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ diff --git a/aclocal.m4 b/aclocal.m4 index fcd930d..c8d28b8 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -7022,6 +7022,18 @@ AC_DEFUN([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, diff --git a/configure b/configure index 2822d09..f8e612c 100755 --- a/configure +++ b/configure @@ -2415,6 +2415,8 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' +ac_config_headers="$ac_config_headers config.h" + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4392,7 +4394,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4395 "configure"' > conftest.$ac_ext + echo '#line 4397 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7449,11 +7451,11 @@ else -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:7452: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7454: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7456: \$? = $ac_status" >&5 + echo "$as_me:7458: \$? = $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. @@ -7739,11 +7741,11 @@ else -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:7742: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7744: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7746: \$? = $ac_status" >&5 + echo "$as_me:7748: \$? = $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. @@ -7843,11 +7845,11 @@ else -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:7846: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7848: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7850: \$? = $ac_status" >&5 + echo "$as_me:7852: \$? = $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 @@ -10220,7 +10222,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12726: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12728: \$? = $ac_status" >&5 + echo "$as_me:12730: \$? = $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. @@ -12825,11 +12827,11 @@ else -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:12828: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12830: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12832: \$? = $ac_status" >&5 + echo "$as_me:12834: \$? = $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 @@ -14423,11 +14425,11 @@ else -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:14426: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14428: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14430: \$? = $ac_status" >&5 + echo "$as_me:14432: \$? = $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. @@ -14527,11 +14529,11 @@ else -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:14530: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14532: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14534: \$? = $ac_status" >&5 + echo "$as_me:14536: \$? = $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 @@ -16747,11 +16749,11 @@ else -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:16750: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16752: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16754: \$? = $ac_status" >&5 + echo "$as_me:16756: \$? = $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. @@ -17037,11 +17039,11 @@ else -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:17040: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17042: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17044: \$? = $ac_status" >&5 + echo "$as_me:17046: \$? = $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. @@ -17141,11 +17143,11 @@ else -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:17144: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17146: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17148: \$? = $ac_status" >&5 + echo "$as_me:17150: \$? = $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 @@ -20435,37 +20437,7 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` - +DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= @@ -20821,6 +20793,7 @@ _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 @@ -20839,10 +20812,15 @@ Usage: $0 [OPTIONS] [FILE]... --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 @@ -20896,7 +20874,16 @@ do $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) + --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) @@ -20956,6 +20943,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; @@ -20972,6 +20960,7 @@ done # 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 @@ -21226,7 +21215,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" -for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; @@ -21472,7 +21461,138 @@ which seems to be undefined. Please make sure it is defined." >&2;} *) 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_arg=$ac_file +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +echo X"$_am_arg" | + 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;} diff --git a/configure.ac b/configure.ac index 4a2a6cf..4b38c58 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,7 @@ AC_PREREQ(2.57) AC_INIT(shellinabox, 2.3, markus@shellinabox.com) AM_INIT_AUTOMAKE +AM_CONFIG_HEADER(config.h) AC_PROG_CC AC_PROG_INSTALL AC_PROG_LIBTOOL diff --git a/libhttp/hashmap.c b/libhttp/hashmap.c index 13edc41..5ffa1e5 100644 --- a/libhttp/hashmap.c +++ b/libhttp/hashmap.c @@ -43,6 +43,8 @@ // The most up-to-date version of this program is always available from // http://shellinabox.com +#include "config.h" + #include #include diff --git a/libhttp/httpconnection.c b/libhttp/httpconnection.c index 3084720..7a6f619 100644 --- a/libhttp/httpconnection.c +++ b/libhttp/httpconnection.c @@ -43,6 +43,8 @@ // The most up-to-date version of this program is always available from // http://shellinabox.com +#include "config.h" + #include #include #include diff --git a/libhttp/server.c b/libhttp/server.c index 3b738f9..0ae92b2 100644 --- a/libhttp/server.c +++ b/libhttp/server.c @@ -43,6 +43,8 @@ // The most up-to-date version of this program is always available from // http://shellinabox.com +#include "config.h" + #include #include #include diff --git a/libhttp/ssl.c b/libhttp/ssl.c index 8b8a714..af01bff 100644 --- a/libhttp/ssl.c +++ b/libhttp/ssl.c @@ -44,6 +44,7 @@ // http://shellinabox.com #define _GNU_SOURCE +#include "config.h" #include #include @@ -57,8 +58,8 @@ #include "libhttp/httpconnection.h" #include "logging/logging.h" -#if !defined(OPENSSL_NO_TLSEXT) && defined(TLSEXT_NAMETYPE_host_name) && \ - defined(SSL_TLSEXT_ERR_OK) +#if defined(HAVE_OPENSSL) && !defined(OPENSSL_NO_TLSEXT) && \ + defined(TLSEXT_NAMETYPE_host_name) && defined(SSL_TLSEXT_ERR_OK) #define HAVE_TLSEXT #endif @@ -274,9 +275,9 @@ int serverSupportsSSL(void) { #endif } +#if defined(HAVE_OPENSSL) static void sslGenerateCertificate(const char *certificate, const char *serverName) { -#if defined(HAVE_OPENSSL) debug("Auto-generating missing certificate \"%s\" for \"%s\"", certificate, serverName); char *cmd = stringPrintf(NULL, @@ -291,8 +292,8 @@ static void sslGenerateCertificate(const char *certificate, warn("Failed to generate self-signed certificate \"%s\"", certificate); } free(cmd); -#endif } +#endif #ifdef HAVE_TLSEXT static int sslSNICallback(SSL *sslHndl, int *al, struct SSLSupport *ssl) { diff --git a/libhttp/ssl.h b/libhttp/ssl.h index 2ba43cf..89595d1 100644 --- a/libhttp/ssl.h +++ b/libhttp/ssl.h @@ -46,6 +46,8 @@ #ifndef SSL_H__ #define SSL_H__ +#include "config.h" + #include "libhttp/trie.h" #if defined(HAVE_OPENSSL_BIO_H) && \ diff --git a/libhttp/trie.c b/libhttp/trie.c index ef92a27..e0549e7 100644 --- a/libhttp/trie.c +++ b/libhttp/trie.c @@ -43,6 +43,8 @@ // The most up-to-date version of this program is always available from // http://shellinabox.com +#include "config.h" + #include #include diff --git a/libhttp/url.c b/libhttp/url.c index eee4c04..7dae646 100644 --- a/libhttp/url.c +++ b/libhttp/url.c @@ -43,6 +43,8 @@ // The most up-to-date version of this program is always available from // http://shellinabox.com +#include "config.h" + #include #include diff --git a/logging/logging.c b/logging/logging.c index 8810a51..a386fd0 100644 --- a/logging/logging.c +++ b/logging/logging.c @@ -43,6 +43,8 @@ // The most up-to-date version of this program is always available from // http://shellinabox.com +#include "config.h" + #include #include #include diff --git a/shellinabox/externalfile.c b/shellinabox/externalfile.c index 888e059..b7548c9 100644 --- a/shellinabox/externalfile.c +++ b/shellinabox/externalfile.c @@ -44,6 +44,7 @@ // http://shellinabox.com #define _GNU_SOURCE +#include "config.h" #include #include diff --git a/shellinabox/launcher.c b/shellinabox/launcher.c index 5d11c75..289c2c0 100644 --- a/shellinabox/launcher.c +++ b/shellinabox/launcher.c @@ -44,6 +44,7 @@ // http://shellinabox.com #define _GNU_SOURCE +#include "config.h" #include #include diff --git a/shellinabox/privileges.c b/shellinabox/privileges.c index b321f3b..f018163 100644 --- a/shellinabox/privileges.c +++ b/shellinabox/privileges.c @@ -44,6 +44,7 @@ // http://shellinabox.com #define _GNU_SOURCE +#include "config.h" #include #include diff --git a/shellinabox/service.c b/shellinabox/service.c index b9186f1..ae6b9ff 100644 --- a/shellinabox/service.c +++ b/shellinabox/service.c @@ -43,6 +43,8 @@ // The most up-to-date version of this program is always available from // http://shellinabox.com +#include "config.h" + #include #include #include diff --git a/shellinabox/session.c b/shellinabox/session.c index 24e2534..d9c749c 100644 --- a/shellinabox/session.c +++ b/shellinabox/session.c @@ -43,6 +43,8 @@ // The most up-to-date version of this program is always available from // http://shellinabox.com +#include "config.h" + #include #include #include diff --git a/shellinabox/shellinaboxd.c b/shellinabox/shellinaboxd.c index 0db9ff1..3186709 100644 --- a/shellinabox/shellinaboxd.c +++ b/shellinabox/shellinaboxd.c @@ -45,6 +45,7 @@ // http://shellinabox.com #define _GNU_SOURCE +#include "config.h" #include #include