dect
/
libpcap
Archived
13
0
Fork 0

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.
This commit is contained in:
Guy Harris 2010-01-02 15:08:06 -08:00
parent cef4d17b1d
commit 9662c40522
3 changed files with 252 additions and 198 deletions

197
aclocal.m4 vendored
View File

@ -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,63 +112,6 @@ AC_DEFUN(AC_LBL_C_INIT,
$1="-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
AC_MSG_CHECKING(that $CC handles ansi prototypes)
AC_CACHE_VAL(ac_cv_lbl_cc_ansi_prototypes,
@ -221,6 +169,114 @@ AC_DEFUN(AC_LBL_C_INIT,
$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:
#
# 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:
@ -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
])

252
configure vendored
View File

@ -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"

View File

@ -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__