Use autoheader

This commit adds a zncconfig.h to ZNC that is automatically generated by
configure. This is done because the -DPACKAGE_STRING=\"znc\ 0.097\" that
configure adds to CXXFLAGS breaks znc-buildmod.

This means that we have to include zncconfig.h as the very first header in every
C++ file that is compiled. This commit kinda cheats and instead adds this
include as the very first thing to all header files we have. This should
hopefully mean that modules don't have to include this.

Because Csocket includes defines.h too late, this commit causes znc to divert
from upstream Csocket once again. :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2250 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2011-01-07 15:01:08 +00:00
parent 40a1bbacdf
commit 3ecbf13390
27 changed files with 194 additions and 42 deletions

View File

@@ -9,6 +9,7 @@
#ifndef _BUFFER_H
#define _BUFFER_H
#include "zncconfig.h"
#include "ZNCString.h"
#include <deque>

1
Chan.h
View File

@@ -9,6 +9,7 @@
#ifndef _CHAN_H
#define _CHAN_H
#include "zncconfig.h"
#include "FileUtils.h"
#include "Nick.h"
#include "ZNCString.h"

View File

@@ -9,6 +9,7 @@
#ifndef _CLIENT_H
#define _CLIENT_H
#include "zncconfig.h"
#include "Socket.h"
#include "Utils.h"
#include "main.h"

View File

@@ -34,6 +34,9 @@
#ifndef _HAS_CSOCKET_
#define _HAS_CSOCKET_
#include "zncconfig.h"
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>

View File

@@ -9,6 +9,7 @@
#ifndef _DCCBOUNCE_H
#define _DCCBOUNCE_H
#include "zncconfig.h"
#include "Socket.h"
class CUser;

View File

@@ -9,6 +9,7 @@
#ifndef _DCCSOCK_H
#define _DCCSOCK_H
#include "zncconfig.h"
#include "FileUtils.h"
// Forward Declarations

View File

@@ -9,6 +9,7 @@
#ifndef _FILEUTILS_H
#define _FILEUTILS_H
#include "zncconfig.h"
#include "Socket.h"
#include "ZNCString.h"
#include <dirent.h>

View File

@@ -9,6 +9,7 @@
#ifndef _HTTPSOCK_H
#define _HTTPSOCK_H
#include "zncconfig.h"
#include "Socket.h"
class CModule;

View File

@@ -9,6 +9,7 @@
#ifndef _IRCSOCK_H
#define _IRCSOCK_H
#include "zncconfig.h"
#include "Socket.h"
#include "Nick.h"

View File

@@ -9,6 +9,7 @@
#ifndef _LISTENER_H
#define _LISTENER_H
#include "zncconfig.h"
#include "znc.h"
// Forward Declarations

1
MD5.h
View File

@@ -3,6 +3,7 @@
#ifndef _MD5_H
#define _MD5_H
#include "zncconfig.h"
#include <string>
using std::string;

View File

@@ -15,7 +15,7 @@ includedir := @includedir@
sbindir := @sbindir@
localstatedir := @localstatedir@
CXX := @CXX@
CXXFLAGS := @DEFS@ @CPPFLAGS@ @CXXFLAGS@
CXXFLAGS := @DEFS@ @CPPFLAGS@ @CXXFLAGS@ -I.
LDFLAGS := @LDFLAGS@
LIBS := @LIBS@
LIBZNC := @LIBZNC@

View File

@@ -9,6 +9,7 @@
#ifndef _MODULES_H
#define _MODULES_H
#include "zncconfig.h"
#include "WebModules.h"
#include "FileUtils.h"
#include "Utils.h"

1
Nick.h
View File

@@ -9,6 +9,7 @@
#ifndef _NICK_H
#define _NICK_H
#include "zncconfig.h"
#include "ZNCString.h"
#include <set>
#include <vector>

View File

@@ -37,6 +37,8 @@
#define SHA256_DIGEST_SIZE ( 256 / 8)
#define SHA256_BLOCK_SIZE ( 512 / 8)
#include "zncconfig.h"
// C99 defines stdint.h which defines a uint32_t and uint8_t type.
// But the other kids didn't want to play with poor little Solaris 9 and so he
// just defines these in inttypes.h which is also part of C99 and is supposed to

View File

@@ -9,6 +9,7 @@
#ifndef _SERVER_H
#define _SERVER_H
#include "zncconfig.h"
#include "ZNCString.h"
class CServer {

View File

@@ -9,6 +9,7 @@
#ifndef SOCKET_H
#define SOCKET_H
#include "zncconfig.h"
#include "Csocket.h"
class CModule;

View File

@@ -9,6 +9,7 @@
#ifndef _TEMPLATE_H
#define _TEMPLATE_H
#include "zncconfig.h"
#include "Utils.h"
#include <iostream>

1
User.h
View File

@@ -9,6 +9,7 @@
#ifndef _USER_H
#define _USER_H
#include "zncconfig.h"
#include "Buffer.h"
#include "FileUtils.h"
#include "Modules.h"

View File

@@ -9,6 +9,7 @@
#ifndef _UTILS_H
#define _UTILS_H
#include "zncconfig.h"
#include "ZNCString.h"
#include <assert.h>
#include <cstdio>

View File

@@ -9,6 +9,7 @@
#ifndef _WEBMODULES_H
#define _WEBMODULES_H
#include "zncconfig.h"
#include "Client.h"
#include "Template.h"
#include "HTTPSock.h"

View File

@@ -9,6 +9,7 @@
#ifndef ZNCSTRING_H
#define ZNCSTRING_H
#include "zncconfig.h"
#include <map>
#include <set>
#include <string>

201
configure vendored
View File

@@ -1936,6 +1936,10 @@ 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
ac_config_headers="$ac_config_headers zncconfig.h"
@@ -4347,43 +4351,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='
:mline
/\\$/{
N
s,\\\n,,
b mline
}
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=
@@ -4828,11 +4796,15 @@ case $ac_config_files in *"
"*) set x $ac_config_files; shift; ac_config_files=$*;;
esac
case $ac_config_headers in *"
"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
_ACEOF
@@ -4853,10 +4825,15 @@ Usage: $0 [OPTION]... [TAG]...
--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
Report bugs to the package provider."
_ACEOF
@@ -4918,7 +4895,18 @@ do
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h | --help | --hel | -h )
--header | --heade | --head | --hea )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
as_fn_append CONFIG_HEADERS " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
--help | --hel | -h )
$as_echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
@@ -4974,6 +4962,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"zncconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS zncconfig.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"znc-config") CONFIG_FILES="$CONFIG_FILES znc-config" ;;
"znc-buildmod") CONFIG_FILES="$CONFIG_FILES znc-buildmod" ;;
@@ -4993,6 +4982,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
fi
# Have a temporary directory for convenience. Make it in the build tree
@@ -5178,8 +5168,116 @@ fi
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"
# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
cat >"$tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF
eval set X " :F $CONFIG_FILES "
# Transform confdefs.h into an awk script `defines.awk', embedded as
# here-document in config.status, that substitutes the proper values into
# config.h.in to produce config.h.
# Create a delimiter string that does not exist in confdefs.h, to ease
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
ac_t=`sed -n "/$ac_delim/p" confdefs.h`
if test -z "$ac_t"; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
# For the awk script, D is an array of macro values keyed by name,
# likewise P contains macro parameters if any. Preserve backslash
# newline sequences.
ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
sed -n '
s/.\{148\}/&'"$ac_delim"'/g
t rset
:rset
s/^[ ]*#[ ]*define[ ][ ]*/ /
t def
d
:def
s/\\$//
t bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3"/p
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
d
:bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3\\\\\\n"\\/p
t cont
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
t cont
d
:cont
n
s/.\{148\}/&'"$ac_delim"'/g
t clear
:clear
s/\\$//
t bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/"/p
d
:bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
b cont
' <confdefs.h | sed '
s/'"$ac_delim"'/"\\\
"/g' >>$CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
for (key in D) D_is_set[key] = 1
FS = ""
}
/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
line = \$ 0
split(line, arg, " ")
if (arg[1] == "#") {
defundef = arg[2]
mac1 = arg[3]
} else {
defundef = substr(arg[1], 2)
mac1 = arg[2]
}
split(mac1, mac2, "(") #)
macro = mac2[1]
prefix = substr(line, 1, index(line, defundef) - 1)
if (D_is_set[macro]) {
# Preserve the white space surrounding the "#".
print prefix "define", macro P[macro] D[macro]
next
} else {
# 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.
if (defundef == "undef") {
print "/*", prefix defundef, macro, "*/"
next
}
}
}
{ print }
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
fi # test -n "$CONFIG_HEADERS"
eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS "
shift
for ac_tag
do
@@ -5391,7 +5489,30 @@ which seems to be undefined. Please make sure it is defined" >&2;}
esac \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
:H)
#
# CONFIG_HEADER
#
if test x"$ac_file" != x-; then
{
$as_echo "/* $configure_input */" \
&& eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
} >"$tmp/config.h" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
$as_echo "$as_me: $ac_file is unchanged" >&6;}
else
rm -f "$ac_file"
mv "$tmp/config.h" "$ac_file" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
$as_echo "/* $configure_input */" \
&& eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
|| as_fn_error $? "could not create -" "$LINENO" 5
fi
;;
esac

View File

@@ -2,6 +2,10 @@ dnl Keep the version number in sync with main.h!
AC_INIT([znc], [0.097])
AC_CONFIG_SRCDIR([znc.cpp])
AC_LANG([C++])
AC_CONFIG_HEADERS([zncconfig.h])
AH_TOP([#ifndef ZNCCONFIG_H
#define ZNCCONFIG_H])
AH_BOTTOM([#endif /* ZNCCONFIG_H */])
AC_DEFUN([ZNC_AUTO_FAIL], [
# This looks better in the summary at the end

2
main.h
View File

@@ -9,6 +9,8 @@
#ifndef _MAIN_H
#define _MAIN_H
#include "zncconfig.h"
// The following defines are for #if comparison (preprocessor only likes ints)
#define VERSION_MAJOR 0
#define VERSION_MINOR 97

View File

@@ -17,7 +17,7 @@ sbindir := @sbindir@
localstatedir := @localstatedir@
CXX := @CXX@
# CXXFLAGS are for the main binary, so don't use them here, use MODFLAGS instead
MODFLAGS := @DEFS@ @CPPFLAGS@ @MODFLAGS@ -I$(srcdir)/..
MODFLAGS := @DEFS@ @CPPFLAGS@ @MODFLAGS@ -I$(srcdir)/.. -I..
MODLINK := @MODLINK@
LDFLAGS := @LDFLAGS@
# LIBS are not and should not be used in here.

1
znc.h
View File

@@ -9,6 +9,7 @@
#ifndef _ZNC_H
#define _ZNC_H
#include "zncconfig.h"
#include "Client.h"
#include "FileUtils.h"
#include "Modules.h"