From 7a3bf155580627c511d75dd923a2a1a9f37f01fd Mon Sep 17 00:00:00 2001 From: binki Date: Tue, 20 Jul 2010 16:09:10 +0000 Subject: [PATCH] - Now define _SOLARIS, USE_LIBCURL, and ZIP_LINKS in setup.h instead of the Makefiles. This means better automatic rebuilds if the latter settings change. --- Changes | 3 +++ autoconf/m4/unreal.m4 | 10 +++---- configure | 61 +++++++++++++++++++++++++++++-------------- configure.ac | 14 +++++----- include/setup.h.in | 10 +++++++ 5 files changed, 65 insertions(+), 33 deletions(-) diff --git a/Changes b/Changes index 46f557a00..f592d2cdb 100644 --- a/Changes +++ b/Changes @@ -2045,3 +2045,6 @@ - Initialize ARG parameter properly in ./Config, otherwise everything fails. - Fixed similar bug like nospoof with ./Config, but now with prefixaq. - Same for IPv6 +- Now define _SOLARIS, USE_LIBCURL, and ZIP_LINKS in setup.h instead + of the Makefiles. This means better automatic rebuilds if the latter + settings change. diff --git a/autoconf/m4/unreal.m4 b/autoconf/m4/unreal.m4 index 39eb036da..e887f09c8 100644 --- a/autoconf/m4/unreal.m4 +++ b/autoconf/m4/unreal.m4 @@ -125,7 +125,8 @@ AC_DEFUN([CHECK_LIBCURL], dnl Make sure that linking against cURL works rather than letting the user dnl find out after compiling most of his program. ~ohnobinki IRCDLIBS="$IRCDLIBS $CURLLIBS" - CFLAGS="$CFLAGS $CURLCFLAG -DUSE_LIBCURL" + CFLAGS="$CFLAGS $CURLCFLAG" + AC_DEFINE([USE_LIBCURL], [], [Define if you have libcurl installed to get remote includes and MOTD support]) AC_MSG_CHECKING([curl_easy_init() in $CURLLIBS]) LIBS_SAVEDA="$LIBS" @@ -218,11 +219,10 @@ AS_IF([test $enable_ziplinks != "no"], if test -f "$dir/include/zlib.h"; then AC_MSG_RESULT(found in $zlibdir) found_zlib="yes"; - if test "$zlibdir" = "/usr" ; then - CFLAGS="$CFLAGS -DZIP_LINKS"; - else - CFLAGS="$CFLAGS -I$zlibdir/include -DZIP_LINKS"; + if test "$zlibdir" != "/usr" ; then + CFLAGS="$CFLAGS -I$zlibdir/include"; fi + AC_DEFINE([ZIP_LINKS], [], [Define if you have zlib and want zip links support.]) break fi done diff --git a/configure b/configure index 85b867524..ea0cec8b0 100755 --- a/configure +++ b/configure @@ -599,6 +599,8 @@ LIBOBJS URL CARES_LIBS CARES_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH PKG_CONFIG TRE_LIBS TRE_CFLAGS @@ -707,6 +709,8 @@ LIBS CPPFLAGS CPP PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR TRE_CFLAGS TRE_LIBS CARES_CFLAGS @@ -1377,6 +1381,10 @@ Some influential environment variables: you have headers in a nonstandard directory CPP C preprocessor PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path TRE_CFLAGS C compiler flags for TRE, overriding pkg-config TRE_LIBS linker flags for TRE, overriding pkg-config CARES_CFLAGS @@ -6170,11 +6178,12 @@ $as_echo_n "checking for zlib... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $zlibdir" >&5 $as_echo "found in $zlibdir" >&6; } found_zlib="yes"; - if test "$zlibdir" = "/usr" ; then - CFLAGS="$CFLAGS -DZIP_LINKS"; - else - CFLAGS="$CFLAGS -I$zlibdir/include -DZIP_LINKS"; + if test "$zlibdir" != "/usr" ; then + CFLAGS="$CFLAGS -I$zlibdir/include"; fi + +$as_echo "#define ZIP_LINKS /**/" >>confdefs.h + break fi done @@ -6469,6 +6478,7 @@ if ac_fn_c_try_compile "$LINENO"; then : $as_echo "yes" >&6; } else +# must be passed on the commandline to avoid a ``warning, you redefined something'' FD_SETSIZE="-DFD_SETSIZE=$ac_fd" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -6476,21 +6486,24 @@ $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + case `uname -s` in -*SunOS*) -CFLAGS="$CFLAGS -D_SOLARIS" -IRCDLIBS="$IRCDLIBS -lresolv " -;; -*solaris*) -CFLAGS="$CFLAGS -D_SOLARIS" -IRCDLIBS="$IRCDLIBS -lresolv " -;; + *SunOS*|*solaris*) + +$as_echo "#define _SOLARIS /**/" >>confdefs.h + + IRCDLIBS="$IRCDLIBS -lresolv " + ;; esac export PATH_SEPARATOR + + + + 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. @@ -6603,7 +6616,6 @@ $as_echo "yes" >&6; } $as_echo "no" >&6; } PKG_CONFIG="" fi - fi if test "x$with_system_tre" = "xno"; then : @@ -6684,6 +6696,8 @@ fi if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -6707,9 +6721,10 @@ installed software in a non-standard prefix. Alternatively, you may set the environment variables TRE_CFLAGS and TRE_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. -" "$LINENO" 5 +See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "The pkg-config script could not be found or is too old. Make sure it @@ -6727,7 +6742,7 @@ else TRE_LIBS=$pkg_cv_TRE_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - : + fi fi @@ -6830,6 +6845,8 @@ fi if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -6853,9 +6870,10 @@ installed software in a non-standard prefix. Alternatively, you may set the environment variables CARES_CFLAGS and CARES_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. -" "$LINENO" 5 +See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "The pkg-config script could not be found or is too old. Make sure it @@ -6873,7 +6891,7 @@ else CARES_LIBS=$pkg_cv_CARES_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - : + fi fi @@ -6963,7 +6981,10 @@ fi fi IRCDLIBS="$IRCDLIBS $CURLLIBS" - CFLAGS="$CFLAGS $CURLCFLAG -DUSE_LIBCURL" + CFLAGS="$CFLAGS $CURLCFLAG" + +$as_echo "#define USE_LIBCURL /**/" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: checking curl_easy_init() in $CURLLIBS" >&5 $as_echo_n "checking curl_easy_init() in $CURLLIBS... " >&6; } diff --git a/configure.ac b/configure.ac index 5a5e1a8fa..15e02ac50 100644 --- a/configure.ac +++ b/configure.ac @@ -516,19 +516,17 @@ int main() { exit(0); } ], AC_MSG_RESULT([yes]), [ +# must be passed on the commandline to avoid a ``warning, you redefined something'' FD_SETSIZE="-DFD_SETSIZE=$ac_fd" AC_MSG_RESULT(no) ]) AC_SUBST([FD_SETSIZE]) + case `uname -s` in -*SunOS*) -CFLAGS="$CFLAGS -D_SOLARIS" -IRCDLIBS="$IRCDLIBS -lresolv " -;; -*solaris*) -CFLAGS="$CFLAGS -D_SOLARIS" -IRCDLIBS="$IRCDLIBS -lresolv " -;; + *SunOS*|*solaris*) + AC_DEFINE([_SOLARIS], [], [Define if you are compiling unrealircd on Sun's (or Oracle's?) Solaris]) + IRCDLIBS="$IRCDLIBS -lresolv " + ;; esac dnl c-ares needs PATH_SEPARATOR set or it will diff --git a/include/setup.h.in b/include/setup.h.in index e2a251bb8..906465ec6 100644 --- a/include/setup.h.in +++ b/include/setup.h.in @@ -352,9 +352,19 @@ /* Define if you have the header file. */ #undef UNISTDH +/* Define if you have libcurl installed to get remote includes and MOTD + support */ +#undef USE_LIBCURL + /* Define if you want to allow SSL connections */ #undef USE_SSL +/* Define if you have zlib and want zip links support. */ +#undef ZIP_LINKS + +/* Define if you are compiling unrealircd on Sun's (or Oracle's?) Solaris */ +#undef _SOLARIS + /* Define to empty if `const' does not conform to ANSI C. */ #undef const