aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2010-01-02 15:08:06 -0800
committerGuy Harris <guy@alum.mit.edu>2010-01-02 15:08:06 -0800
commit9662c405221881b7ea2c37b850c4d55feef0928a (patch)
tree4131ef7c95563d4713fa2e0208bae9fdecd748b8
parentcef4d17b1de4e5a99e45998e9af673d88db28085 (diff)
Split off the shared-library tests into a separate macro.
Split off the shared-library tests into a separate AC_LBL_SHLIBS_INIT macro, so the libpcap and tcpdump versions of AC_LBL_C_INIT can be the same. While we're at it, clean up some of the AC_PREREQ and AC_BEFORE stuff.
-rw-r--r--aclocal.m4195
-rwxr-xr-xconfigure252
-rw-r--r--configure.in1
3 files changed, 251 insertions, 197 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index a420506..07f5bf6 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -38,7 +38,11 @@ dnl AC_LBL_C_INIT. Now, we run AC_LBL_C_INIT_BEFORE_CC, AC_PROG_CC,
dnl and AC_LBL_C_INIT at the top level.
dnl
AC_DEFUN(AC_LBL_C_INIT_BEFORE_CC,
-[
+ [AC_PREREQ(2.50)
+ AC_BEFORE([$0], [AC_LBL_C_INIT])
+ AC_BEFORE([$0], [AC_PROG_CC])
+ AC_BEFORE([$0], [AC_LBL_FIXINCLUDES])
+ AC_BEFORE([$0], [AC_LBL_DEVEL])
AC_ARG_WITH(gcc, [ --without-gcc don't use gcc])
$1="-O"
$2=""
@@ -90,6 +94,7 @@ AC_DEFUN(AC_LBL_C_INIT,
[AC_PREREQ(2.50)
AC_BEFORE([$0], [AC_LBL_FIXINCLUDES])
AC_BEFORE([$0], [AC_LBL_DEVEL])
+ AC_BEFORE([$0], [AC_LBL_SHLIBS_INIT])
if test "$GCC" = yes ; then
if test "$SHLICC2" = yes ; then
ac_cv_lbl_gcc_vers=2
@@ -107,7 +112,114 @@ AC_DEFUN(AC_LBL_C_INIT,
$1="-O2"
fi
fi
+ else
+ AC_MSG_CHECKING(that $CC handles ansi prototypes)
+ AC_CACHE_VAL(ac_cv_lbl_cc_ansi_prototypes,
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>],
+ [int frob(int, char *)],
+ ac_cv_lbl_cc_ansi_prototypes=yes,
+ ac_cv_lbl_cc_ansi_prototypes=no))
+ AC_MSG_RESULT($ac_cv_lbl_cc_ansi_prototypes)
+ if test $ac_cv_lbl_cc_ansi_prototypes = no ; then
+ case "$host_os" in
+
+ hpux*)
+ AC_MSG_CHECKING(for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE))
+ savedcflags="$CFLAGS"
+ CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS"
+ AC_CACHE_VAL(ac_cv_lbl_cc_hpux_cc_aa,
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>],
+ [int frob(int, char *)],
+ ac_cv_lbl_cc_hpux_cc_aa=yes,
+ ac_cv_lbl_cc_hpux_cc_aa=no))
+ AC_MSG_RESULT($ac_cv_lbl_cc_hpux_cc_aa)
+ if test $ac_cv_lbl_cc_hpux_cc_aa = no ; then
+ AC_MSG_ERROR(see the INSTALL doc for more info)
+ fi
+ CFLAGS="$savedcflags"
+ $1="-Aa $$1"
+ AC_DEFINE(_HPUX_SOURCE,1,[needed on HP-UX])
+ ;;
+
+ osf*)
+ AC_MSG_CHECKING(for ansi mode in DEC compiler ($CC -std1))
+ savedcflags="$CFLAGS"
+ CFLAGS="-std1"
+ AC_CACHE_VAL(ac_cv_lbl_cc_osf1_cc_std1,
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>],
+ [int frob(int, char *)],
+ ac_cv_lbl_cc_osf1_cc_std1=yes,
+ ac_cv_lbl_cc_osf1_cc_std1=no))
+ AC_MSG_RESULT($ac_cv_lbl_cc_osf1_cc_std1)
+ if test $ac_cv_lbl_cc_osf1_cc_std1 = no ; then
+ AC_MSG_ERROR(see the INSTALL doc for more info)
+ fi
+ CFLAGS="$savedcflags"
+ $1="-std1 $$1"
+ ;;
+
+ *)
+ AC_MSG_ERROR(see the INSTALL doc for more info)
+ ;;
+ esac
+ fi
+ $2="$$2 -I/usr/local/include"
+ LDFLAGS="$LDFLAGS -L/usr/local/lib"
+
+ case "$host_os" in
+
+ irix*)
+ $1="$$1 -xansi -signed -g3"
+ ;;
+
+ osf*)
+ #
+ # Presumed to be DEC OSF/1, Digital UNIX, or
+ # Tru64 UNIX.
+ #
+ $1="$$1 -g3"
+ ;;
+
+ ultrix*)
+ AC_MSG_CHECKING(that Ultrix $CC hacks const in prototypes)
+ AC_CACHE_VAL(ac_cv_lbl_cc_const_proto,
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>],
+ [struct a { int b; };
+ void c(const struct a *)],
+ ac_cv_lbl_cc_const_proto=yes,
+ ac_cv_lbl_cc_const_proto=no))
+ AC_MSG_RESULT($ac_cv_lbl_cc_const_proto)
+ if test $ac_cv_lbl_cc_const_proto = no ; then
+ AC_DEFINE(const,[],
+ [to handle Ultrix compilers that don't support const in prototypes])
+ fi
+ ;;
+ esac
+ fi
+])
+dnl
+dnl Determine what options are needed to build a shared library
+dnl
+dnl usage:
+dnl
+dnl AC_LBL_SHLIBS_INIT
+dnl
+dnl results:
+dnl
+dnl V_CCOPT (modified to build position-independent code)
+dnl V_SHLIB_CMD
+dnl V_SHLIB_OPT
+dnl V_SONAME_OPT
+dnl V_RPATH_OPT
+dnl
+AC_DEFUN(AC_LBL_SHLIBS_INIT,
+ [AC_PREREQ(2.50)
+ if test "$GCC" = yes ; then
#
# On platforms where we build a shared library:
#
@@ -165,62 +277,6 @@ AC_DEFUN(AC_LBL_C_INIT,
;;
esac
else
- AC_MSG_CHECKING(that $CC handles ansi prototypes)
- AC_CACHE_VAL(ac_cv_lbl_cc_ansi_prototypes,
- AC_TRY_COMPILE(
- [#include <sys/types.h>],
- [int frob(int, char *)],
- ac_cv_lbl_cc_ansi_prototypes=yes,
- ac_cv_lbl_cc_ansi_prototypes=no))
- AC_MSG_RESULT($ac_cv_lbl_cc_ansi_prototypes)
- if test $ac_cv_lbl_cc_ansi_prototypes = no ; then
- case "$host_os" in
-
- hpux*)
- AC_MSG_CHECKING(for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE))
- savedcflags="$CFLAGS"
- CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS"
- AC_CACHE_VAL(ac_cv_lbl_cc_hpux_cc_aa,
- AC_TRY_COMPILE(
- [#include <sys/types.h>],
- [int frob(int, char *)],
- ac_cv_lbl_cc_hpux_cc_aa=yes,
- ac_cv_lbl_cc_hpux_cc_aa=no))
- AC_MSG_RESULT($ac_cv_lbl_cc_hpux_cc_aa)
- if test $ac_cv_lbl_cc_hpux_cc_aa = no ; then
- AC_MSG_ERROR(see the INSTALL doc for more info)
- fi
- CFLAGS="$savedcflags"
- $1="-Aa $$1"
- AC_DEFINE(_HPUX_SOURCE,1,[needed on HP-UX])
- ;;
-
- osf*)
- AC_MSG_CHECKING(for ansi mode in DEC compiler ($CC -std1))
- savedcflags="$CFLAGS"
- CFLAGS="-std1"
- AC_CACHE_VAL(ac_cv_lbl_cc_osf1_cc_std1,
- AC_TRY_COMPILE(
- [#include <sys/types.h>],
- [int frob(int, char *)],
- ac_cv_lbl_cc_osf1_cc_std1=yes,
- ac_cv_lbl_cc_osf1_cc_std1=no))
- AC_MSG_RESULT($ac_cv_lbl_cc_osf1_cc_std1)
- if test $ac_cv_lbl_cc_osf1_cc_std1 = no ; then
- AC_MSG_ERROR(see the INSTALL doc for more info)
- fi
- CFLAGS="$savedcflags"
- $1="-std1 $$1"
- ;;
-
- *)
- AC_MSG_ERROR(see the INSTALL doc for more info)
- ;;
- esac
- fi
- $2="$$2 -I/usr/local/include"
- LDFLAGS="$LDFLAGS -L/usr/local/lib"
-
#
# Set the appropriate compiler flags and, on platforms
# where we build a shared library:
@@ -252,7 +308,7 @@ AC_DEFUN(AC_LBL_C_INIT,
#
# "cc" is GCC.
#
- $1="$$1 -fpic"
+ V_CCOPT="$V_CCOPT -fpic"
V_SHLIB_CMD="\$(CC)"
V_SHLIB_OPT="-shared"
V_SONAME_OPT="-Wl,-soname,"
@@ -260,7 +316,7 @@ AC_DEFUN(AC_LBL_C_INIT,
;;
hpux*)
- $1="$$1 +z"
+ V_CCOPT="$V_CCOPT +z"
V_SHLIB_CMD="\$(LD)"
V_SHLIB_OPT="-b"
V_SONAME_OPT="+h "
@@ -271,16 +327,11 @@ AC_DEFUN(AC_LBL_C_INIT,
#
;;
- irix*)
- $1="$$1 -xansi -signed -g3"
- ;;
-
osf*)
#
# Presumed to be DEC OSF/1, Digital UNIX, or
# Tru64 UNIX.
#
- $1="$$1 -g3"
V_SHLIB_CMD="\$(CC)"
V_SHLIB_OPT="-shared"
V_SONAME_OPT="-soname "
@@ -294,22 +345,6 @@ AC_DEFUN(AC_LBL_C_INIT,
V_SONAME_OPT="-h "
V_RPATH_OPT="-R"
;;
-
- ultrix*)
- AC_MSG_CHECKING(that Ultrix $CC hacks const in prototypes)
- AC_CACHE_VAL(ac_cv_lbl_cc_const_proto,
- AC_TRY_COMPILE(
- [#include <sys/types.h>],
- [struct a { int b; };
- void c(const struct a *)],
- ac_cv_lbl_cc_const_proto=yes,
- ac_cv_lbl_cc_const_proto=no))
- AC_MSG_RESULT($ac_cv_lbl_cc_const_proto)
- if test $ac_cv_lbl_cc_const_proto = no ; then
- AC_DEFINE(const,[],
- [to handle Ultrix compilers that don't support const in prototypes])
- fi
- ;;
esac
fi
])
diff --git a/configure b/configure
index 592963e..67dfc14 100755
--- a/configure
+++ b/configure
@@ -1909,6 +1909,10 @@ test -n "$target_alias" &&
+
+
+
+
# Check whether --with-gcc was given.
if test "${with_gcc+set}" = set; then
withval=$with_gcc;
@@ -2898,6 +2902,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
if test "$GCC" = yes ; then
if test "$SHLICC2" = yes ; then
ac_cv_lbl_gcc_vers=2
@@ -2921,63 +2926,6 @@ echo "${ECHO_T}$ac_cv_lbl_gcc_vers" >&6; }
V_CCOPT="-O2"
fi
fi
-
- #
- # On platforms where we build a shared library:
- #
- # add options to generate position-independent code,
- # if necessary (it's the default in AIX and Darwin/OS X);
- #
- # define option to set the soname of the shared library,
- # if the OS supports that;
- #
- # add options to specify, at link time, a directory to
- # add to the run-time search path, if that's necessary.
- #
- V_SHLIB_CMD="\$(CC)"
- V_SHLIB_OPT="-shared"
- case "$host_os" in
-
- aix*)
- ;;
-
- freebsd*|netbsd*|openbsd*|dragonfly*|linux*|osf*)
- #
- # Platforms where the linker is the GNU linker
- # or accepts command-line arguments like
- # those the GNU linker accepts.
- #
- V_CCOPT="$V_CCOPT -fpic"
- V_SONAME_OPT="-Wl,-soname,"
- V_RPATH_OPT="-Wl,-rpath,"
- ;;
-
- hpux*)
- V_CCOPT="$V_CCOPT -fpic"
- #
- # XXX - this assumes GCC is using the HP linker,
- # rather than the GNU linker, and that the "+h"
- # option is used on all HP-UX platforms, both .sl
- # and .so.
- #
- V_SONAME_OPT="-Wl,+h,"
- #
- # By default, directories specifed with -L
- # are added to the run-time search path, so
- # we don't add them in pcap-config.
- #
- ;;
-
- solaris*)
- V_CCOPT="$V_CCOPT -fpic"
- #
- # XXX - this assumes GCC is using the Sun linker,
- # rather than the GNU linker.
- #
- V_SONAME_OPT="-Wl,-h,"
- V_RPATH_OPT="-Wl,-R,"
- ;;
- esac
else
{ echo "$as_me:$LINENO: checking that $CC handles ansi prototypes" >&5
echo $ECHO_N "checking that $CC handles ansi prototypes... $ECHO_C" >&6; }
@@ -3172,56 +3120,8 @@ echo "$as_me: error: see the INSTALL doc for more info" >&2;}
V_INCLS="$V_INCLS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
- #
- # Set the appropriate compiler flags and, on platforms
- # where we build a shared library:
- #
- # add options to generate position-independent code,
- # if necessary (it's the default in Darwin/OS X);
- #
- # if we generate ".so" shared libraries, define the
- # appropriate options for building the shared library;
- #
- # add options to specify, at link time, a directory to
- # add to the run-time search path, if that's necessary.
- #
- # Note: spaces after V_SONAME_OPT are significant; on
- # some platforms the soname is passed with a GCC-like
- # "-Wl,-soname,{soname}" option, with the soname part
- # of the option, while on other platforms the C compiler
- # driver takes it as a regular option with the soname
- # following the option. The same applies to V_RPATH_OPT.
- #
case "$host_os" in
- aix*)
- V_SHLIB_CMD="\$(CC)"
- V_SHLIB_OPT="-G -bnoentry -bexpall"
- ;;
-
- freebsd*|netbsd*|openbsd*|dragonfly*|linux*)
- #
- # "cc" is GCC.
- #
- V_CCOPT="$V_CCOPT -fpic"
- V_SHLIB_CMD="\$(CC)"
- V_SHLIB_OPT="-shared"
- V_SONAME_OPT="-Wl,-soname,"
- V_RPATH_OPT="-Wl,-rpath,"
- ;;
-
- hpux*)
- V_CCOPT="$V_CCOPT +z"
- V_SHLIB_CMD="\$(LD)"
- V_SHLIB_OPT="-b"
- V_SONAME_OPT="+h "
- #
- # By default, directories specifed with -L
- # are added to the run-time search path, so
- # we don't add them in pcap-config.
- #
- ;;
-
irix*)
V_CCOPT="$V_CCOPT -xansi -signed -g3"
;;
@@ -3232,18 +3132,6 @@ echo "$as_me: error: see the INSTALL doc for more info" >&2;}
# Tru64 UNIX.
#
V_CCOPT="$V_CCOPT -g3"
- V_SHLIB_CMD="\$(CC)"
- V_SHLIB_OPT="-shared"
- V_SONAME_OPT="-soname "
- V_RPATH_OPT="-rpath "
- ;;
-
- solaris*)
- V_CCOPT="$V_CCOPT -Kpic"
- V_SHLIB_CMD="\$(CC)"
- V_SHLIB_OPT="-G"
- V_SONAME_OPT="-h "
- V_RPATH_OPT="-R"
;;
ultrix*)
@@ -3309,6 +3197,136 @@ _ACEOF
esac
fi
+
+ if test "$GCC" = yes ; then
+ #
+ # On platforms where we build a shared library:
+ #
+ # add options to generate position-independent code,
+ # if necessary (it's the default in AIX and Darwin/OS X);
+ #
+ # define option to set the soname of the shared library,
+ # if the OS supports that;
+ #
+ # add options to specify, at link time, a directory to
+ # add to the run-time search path, if that's necessary.
+ #
+ V_SHLIB_CMD="\$(CC)"
+ V_SHLIB_OPT="-shared"
+ case "$host_os" in
+
+ aix*)
+ ;;
+
+ freebsd*|netbsd*|openbsd*|dragonfly*|linux*|osf*)
+ #
+ # Platforms where the linker is the GNU linker
+ # or accepts command-line arguments like
+ # those the GNU linker accepts.
+ #
+ V_CCOPT="$V_CCOPT -fpic"
+ V_SONAME_OPT="-Wl,-soname,"
+ V_RPATH_OPT="-Wl,-rpath,"
+ ;;
+
+ hpux*)
+ V_CCOPT="$V_CCOPT -fpic"
+ #
+ # XXX - this assumes GCC is using the HP linker,
+ # rather than the GNU linker, and that the "+h"
+ # option is used on all HP-UX platforms, both .sl
+ # and .so.
+ #
+ V_SONAME_OPT="-Wl,+h,"
+ #
+ # By default, directories specifed with -L
+ # are added to the run-time search path, so
+ # we don't add them in pcap-config.
+ #
+ ;;
+
+ solaris*)
+ V_CCOPT="$V_CCOPT -fpic"
+ #
+ # XXX - this assumes GCC is using the Sun linker,
+ # rather than the GNU linker.
+ #
+ V_SONAME_OPT="-Wl,-h,"
+ V_RPATH_OPT="-Wl,-R,"
+ ;;
+ esac
+ else
+ #
+ # Set the appropriate compiler flags and, on platforms
+ # where we build a shared library:
+ #
+ # add options to generate position-independent code,
+ # if necessary (it's the default in Darwin/OS X);
+ #
+ # if we generate ".so" shared libraries, define the
+ # appropriate options for building the shared library;
+ #
+ # add options to specify, at link time, a directory to
+ # add to the run-time search path, if that's necessary.
+ #
+ # Note: spaces after V_SONAME_OPT are significant; on
+ # some platforms the soname is passed with a GCC-like
+ # "-Wl,-soname,{soname}" option, with the soname part
+ # of the option, while on other platforms the C compiler
+ # driver takes it as a regular option with the soname
+ # following the option. The same applies to V_RPATH_OPT.
+ #
+ case "$host_os" in
+
+ aix*)
+ V_SHLIB_CMD="\$(CC)"
+ V_SHLIB_OPT="-G -bnoentry -bexpall"
+ ;;
+
+ freebsd*|netbsd*|openbsd*|dragonfly*|linux*)
+ #
+ # "cc" is GCC.
+ #
+ V_CCOPT="$V_CCOPT -fpic"
+ V_SHLIB_CMD="\$(CC)"
+ V_SHLIB_OPT="-shared"
+ V_SONAME_OPT="-Wl,-soname,"
+ V_RPATH_OPT="-Wl,-rpath,"
+ ;;
+
+ hpux*)
+ V_CCOPT="$V_CCOPT +z"
+ V_SHLIB_CMD="\$(LD)"
+ V_SHLIB_OPT="-b"
+ V_SONAME_OPT="+h "
+ #
+ # By default, directories specifed with -L
+ # are added to the run-time search path, so
+ # we don't add them in pcap-config.
+ #
+ ;;
+
+ osf*)
+ #
+ # Presumed to be DEC OSF/1, Digital UNIX, or
+ # Tru64 UNIX.
+ #
+ V_SHLIB_CMD="\$(CC)"
+ V_SHLIB_OPT="-shared"
+ V_SONAME_OPT="-soname "
+ V_RPATH_OPT="-rpath "
+ ;;
+
+ solaris*)
+ V_CCOPT="$V_CCOPT -Kpic"
+ V_SHLIB_CMD="\$(CC)"
+ V_SHLIB_OPT="-G"
+ V_SONAME_OPT="-h "
+ V_RPATH_OPT="-R"
+ ;;
+ esac
+ fi
+
{ echo "$as_me:$LINENO: checking for inline" >&5
echo $ECHO_N "checking for inline... $ECHO_C" >&6; }
save_CFLAGS="$CFLAGS"
diff --git a/configure.in b/configure.in
index c0a1df9..e3904f9 100644
--- a/configure.in
+++ b/configure.in
@@ -24,6 +24,7 @@ AC_CANONICAL_SYSTEM
AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
AC_PROG_CC
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
+AC_LBL_SHLIBS_INIT
AC_LBL_C_INLINE
AC_C___ATTRIBUTE__