[Opalvoip-svn] SF.net SVN: opalvoip:[20714] ptlib/trunk
Brought to you by:
csoutheren,
rjongbloed
From: <ms3...@us...> - 2008-08-21 17:53:15
|
Revision: 20714 http://opalvoip.svn.sourceforge.net/opalvoip/?rev=20714&view=rev Author: ms30002000 Date: 2008-08-21 17:53:25 +0000 (Thu, 21 Aug 2008) Log Message: ----------- Move ptlib configure functions to a separate m4 file. Modified Paths: -------------- ptlib/trunk/configure ptlib/trunk/configure.ac Added Paths: ----------- ptlib/trunk/ptlib.m4 Modified: ptlib/trunk/configure =================================================================== --- ptlib/trunk/configure 2008-08-21 17:48:11 UTC (rev 20713) +++ ptlib/trunk/configure 2008-08-21 17:53:25 UTC (rev 20714) @@ -3316,6 +3316,8 @@ + + PTLIBDIR=`pwd` @@ -5656,40 +5658,6 @@ STDCXXFLAGS="$STDCCFLAGS -frtti" fi -GCSECTIONS=0 - - -if test 0 = 1 ; then - { { echo "$as_me:$LINENO: error: error" >&5 -echo "$as_me: error: error" >&2;} - { (exit 1); exit 1; }; } - - { echo "$as_me:$LINENO: checking if compiler accepts -ffunction-sections" >&5 -echo $ECHO_N "checking if compiler accepts -ffunction-sections... $ECHO_C" >&6; } - cat >conftest.$ac_ext <<_ACEOF -int main(int ac,char **av) { return 0; } -_ACEOF - $CXX $CFLAGS -ffunction-sections -c conftest.$ac_ext > /dev/null 2>&1 - if test $? = 0 ; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - STDCCFLAGS="$STDCCFLAGS -ffunction-sections" - GCSECTIONS=1 - else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - fi - - - - if test $GCSECTIONS = 1; then - if test "${OSTYPE}" != "Darwin" ; then - P_STATIC_LDFLAGS="$P_STATIC_LDFLAGS -Wl,--gc-sections" - fi - fi -fi - - ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' Modified: ptlib/trunk/configure.ac =================================================================== --- ptlib/trunk/configure.ac 2008-08-21 17:48:11 UTC (rev 20713) +++ ptlib/trunk/configure.ac 2008-08-21 17:53:25 UTC (rev 20714) @@ -11,296 +11,9 @@ AC_LANG(C++) -dnl PTLIB_SIMPLE -dnl Change a given variable according to arguments and subst and define it -dnl Arguments: $1 name of configure option -dnl $2 the variable to change, subst and define -dnl $3 the configure argument description -dnl $4 dependency variable #1 -dnl $5 dependency variable #2 -dnl Return: ${HAS_$2} The (possibly) changed variable -AC_DEFUN([PTLIB_SIMPLE_OPTION], - [ -dnl if test "x${HAS_$2}" = "x"; then -dnl AC_MSG_ERROR([No default specified for HAS_$2, please correct configure.ac]) -dnl fi - AC_MSG_CHECKING([$3]) - AC_ARG_ENABLE([$1], - [AC_HELP_STRING([--enable-$1],[$3])], - [ - if test "x$enableval" = "xyes"; then - HAS_$2=1 - else - HAS_$2= - fi - ]) +m4_include(ptlib.m4) - if test "x$4" != "x"; then - if test "x$$4" != "x1"; then - AC_MSG_NOTICE([$1 support disabled due to disabled dependency $4]) - HAS_$2= - fi - fi - - if test "x$5" != "x"; then - if test "x$$5" != "x1"; then - AC_MSG_NOTICE([$1 support disabled due to disabled dependency $5]) - HAS_$2= - fi - fi - - - if test "x${HAS_$2}" = "x1"; then - AC_DEFINE([P_$2], [1], [$3]) - HAS_$2=1 - AC_MSG_RESULT([yes]) - else - HAS_$2= - AC_MSG_RESULT([no]) - fi - AC_SUBST(HAS_$2) - - - ]) - -dnl PTLIB_FIND_DIRECTX -dnl Check for directX -dnl Arguments: -dnl Return: $1 action if-found -dnl $2 action if-not-found -dnl $DIRECTX_INCLUDES -dnl $DIRECTX_LIBS -AC_DEFUN([PTLIB_FIND_DIRECTX], - [ - ptlib_has_directx=yes - DIRECTX_INCLUDES= - DIRECTX_LIBS= - - AC_ARG_WITH([directx-includedir], - AS_HELP_STRING([--with-directx-includedir=DIR],[Location of DirectX include files]), - [with_directx_dir="$withval"], - [with_directx_dir="include"] - ) - - AC_MSG_CHECKING(for DirectX includes in ${with_directx_dir}) - AC_MSG_RESULT() - - old_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I${with_directx_dir}" - AC_LANG(C++) - - AC_CHECK_HEADERS([mingw_dshow_port.h], [], [ptlib_has_directx=no]) - AC_CHECK_HEADERS([control.h], [], [ptlib_has_directx=no]) - AC_CHECK_HEADERS([ddraw.h], [], [ptlib_has_directx=no]) - AC_CHECK_HEADERS([dshow.h], [], [ptlib_has_directx=no]) - AC_CHECK_HEADERS([dsound.h], [], [ptlib_has_directx=no]) - AC_CHECK_HEADERS([dxerr9.h], [], [ptlib_has_directx=no]) - AC_CHECK_HEADERS([ksuuids.h], [], [ptlib_has_directx=no]) - AC_CHECK_HEADERS([strmif.h], [], [ptlib_has_directx=no]) - AC_CHECK_HEADERS([uuids.h], [], [ptlib_has_directx=no]) - CPPFLAGS="$old_CPPFLAGS" - - - if test "x${ptlib_has_directx}" = "xyes" ; then - AC_MSG_CHECKING([for DirectX libraries]) - AC_MSG_RESULT() - fi - - if test "x${ptlib_has_directx}" = "xyes" ; then - DIRECTX_INCLUDES="-I${with_directx_dir}" - DIRECTX_LIBS="-ldsound -ldxerr9 -ldxguid -lstrmiids -lole32 -luuid -loleaut32 -lquartz" - fi - - AS_IF([test AS_VAR_GET([ptlib_has_directx]) = yes], [$1], [$2])[] - ]) - -dnl PTLIB_FIND_RESOLVER -dnl Check for dns resolver -dnl Arguments: -dnl Return: $1 action if-found -dnl $2 action if-not-found -dnl $RESOLVER_LIBS -dnl $$HAS_RES_INIT -AC_DEFUN([PTLIB_FIND_RESOLVER], - [ - ptlib_has_resolver=no - HAS_RES_NINIT= - - AC_CHECK_FUNC([res_ninit], - [ - HAS_RES_NINIT=1 - ptlib_has_resolver=yes - ]) - - if test "x${ptlib_has_resolver}" = "xno" ; then - AC_MSG_CHECKING([for res_ninit in -lresolv]) - old_LIBS="$LIBS" - LIBS="$LIBS -lresolv" - AC_LINK_IFELSE([[ - #include <netinet/in.h> - #include <resolv.h> - int main(int argc,char **argv) { - res_state p; res_ninit(p); - } - ]], - [ - HAS_RES_NINIT=1 - ptlib_has_resolver=yes - RESOLVER_LIBS="-lresolv" - ]) - LIBS="${old_LIBS}" - AC_MSG_RESULT(${ptlib_has_resolver}) - fi - - if test "x${ptlib_has_resolver}" = "xno" ; then - AC_CHECK_FUNC([res_search], [ptlib_has_resolver=yes]) - fi - - if test "x${ptlib_has_resolver}" = "xno" ; then - AC_MSG_CHECKING([for res_search in -lresolv]) - old_LIBS="$LIBS" - LIBS="$LIBS -lresolv" - AC_LINK_IFELSE([[ - #include <netinet/in.h> - #include <resolv.h> - int main(int argc,char **argv){ - res_search (NULL, 0, 0, NULL, 0); - } - ]], - [ - ptlib_has_resolver=yes - RESOLVER_LIBS="-lresolv" - ]) - LIBS="${old_LIBS}" - AC_MSG_RESULT(${ptlib_has_resolver}) - fi - - if test "x${ptlib_has_resolver}" = "xno" ; then - AC_SEARCH_LIBS([__res_search], [resolv], [ptlib_has_resolver=yes]) - fi - - if test "x${ptlib_has_resolver}" = "xno" ; then - AC_SEARCH_LIBS([__res_search], [resolv], [ptlib_has_resolver=yes]) - fi - - if test "x${ptlib_has_resolver}" = "xno" ; then - AC_CHECK_HEADERS([windns.h], - [ - ptlib_has_resolver=yes - RESOLVER_LIBS="-ldnsapi" - ]) - fi - AS_IF([test AS_VAR_GET([ptlib_has_resolver]) = yes], [$1], [$2])[] - ]) - -dnl PTLIB_OPENSSL_CONST -dnl Check for directX -dnl Arguments: -dnl Return: $1 action if-found -dnl $2 action if-not-found -AC_DEFUN([PTLIB_OPENSSL_CONST], - [ - ptlib_openssl_const=no - old_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $OPENSSL_CFLAGS" - AC_LANG(C) - AC_MSG_CHECKING(for const arg to d2i_AutoPrivateKey) - AC_TRY_COMPILE([#include <openssl/evp.h>], - [ - EVP_PKEY **a; const unsigned char **p; long l; - d2i_AutoPrivateKey(a, p, l); - ], - [ptlib_openssl_const=yes] - ) - AC_MSG_RESULT(${ptlib_openssl_const}) - AC_LANG(C++) - CFLAGS="${old_CFLAGS}" - - AS_IF([test AS_VAR_GET([ptlib_openssl_const]) = yes], [$1], [$2])[] - ]) - -dnl PTLIB_CHECK_UPAD128 -dnl Check for upad128_t (solaris only) -dnl Arguments: -dnl Return: $1 action if-found -dnl $2 action if-not-found -AC_DEFUN([PTLIB_CHECK_UPAD128], - [ - ptlib_upad128=no - - AC_MSG_CHECKING(for upad128_t) - AC_TRY_COMPILE([#include <sys/types.h>], - [upad128_t upad; upad._q = 0.0;], - [ptlib_upad128=yes]) - AC_MSG_RESULT(${ptlib_upad128}) - - AS_IF([test AS_VAR_GET([ptlib_upad128]) = yes], [$1], [$2])[] - ]) - -dnl PTLIB_OPENSSL_AES -dnl Check for directX -dnl Arguments: -dnl Return: $1 action if-found -dnl $2 action if-not-found -AC_DEFUN([PTLIB_OPENSSL_AES], - [ - ptlib_openssl_aes=no - old_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $OPENSSL_CFLAGS" - AC_LANG(C) - AC_CHECK_HEADERS([openssl/aes.h], [ptlib_openssl_aes=yes]) - AC_LANG(C++) - CFLAGS="${old_CFLAGS}" - AS_IF([test AS_VAR_GET([ptlib_openssl_aes]) = yes], [$1], [$2])[] - ]) - dnl ######################################################################## -dnl libdl -dnl ######################################################################## - -dnl PTLIB_FIND_LBDL -dnl Try to find a library containing dlopen() -dnl Arguments: $1 action if-found -dnl $2 action if-not-found -dnl Return: $DL_LIBS The libs for dlopen() -AC_DEFUN([PTLIB_FIND_LIBDL], - [ - ptlib_libdl=no - AC_CHECK_HEADERS([dlfcn.h], [ptlib_dlfcn=yes], [ptlib_dlfcn=no]) - if test "$ptlib_dlfcn" = yes ; then - AC_MSG_CHECKING(if dlopen is available) - AC_LANG(C) - AC_TRY_COMPILE([#include <dlfcn.h>], - [void * p = dlopen("lib", 0);], [ptlib_dlopen=yes], [ptlib_dlopen=no]) - if test "$ptlib_dlopen" = no ; then - AC_MSG_RESULT(no) - else - AC_MSG_RESULT(yes) - case "$target_os" in - freebsd*|openbsd*|netbsd*|darwin*|beos*) - AC_CHECK_LIB([c],[dlopen], - [ - ptlib_libdl=yes - DL_LIBS="-lc" - ], - [ptlib_libdl=no]) - ;; - *) - AC_CHECK_LIB([dl],[dlopen], - [ - ptlib_libdl=yes - DL_LIBS="-ldl" - ], - [ptlib_libdl=no]) - ;; - esac - fi - fi - AS_IF([test AS_VAR_GET([ptlib_libdl]) = yes], [$1], [$2])[] - ]) - - -dnl ######################################################################## dnl set the PTLIB directory to the current directory PTLIBDIR=`pwd` Added: ptlib/trunk/ptlib.m4 =================================================================== --- ptlib/trunk/ptlib.m4 (rev 0) +++ ptlib/trunk/ptlib.m4 2008-08-21 17:53:25 UTC (rev 20714) @@ -0,0 +1,289 @@ +dnl PTLIB_SIMPLE +dnl Change a given variable according to arguments and subst and define it +dnl Arguments: $1 name of configure option +dnl $2 the variable to change, subst and define +dnl $3 the configure argument description +dnl $4 dependency variable #1 +dnl $5 dependency variable #2 +dnl Return: ${HAS_$2} The (possibly) changed variable +AC_DEFUN([PTLIB_SIMPLE_OPTION], + [ +dnl if test "x${HAS_$2}" = "x"; then +dnl AC_MSG_ERROR([No default specified for HAS_$2, please correct configure.ac]) +dnl fi + AC_MSG_CHECKING([$3]) + AC_ARG_ENABLE([$1], + [AC_HELP_STRING([--enable-$1],[$3])], + [ + if test "x$enableval" = "xyes"; then + HAS_$2=1 + else + HAS_$2= + fi + ]) + + if test "x$4" != "x"; then + if test "x$$4" != "x1"; then + AC_MSG_NOTICE([$1 support disabled due to disabled dependency $4]) + HAS_$2= + fi + fi + + if test "x$5" != "x"; then + if test "x$$5" != "x1"; then + AC_MSG_NOTICE([$1 support disabled due to disabled dependency $5]) + HAS_$2= + fi + fi + + + if test "x${HAS_$2}" = "x1"; then + AC_DEFINE([P_$2], [1], [$3]) + HAS_$2=1 + AC_MSG_RESULT([yes]) + else + HAS_$2= + AC_MSG_RESULT([no]) + fi + AC_SUBST(HAS_$2) + + + ]) + +dnl PTLIB_FIND_DIRECTX +dnl Check for directX +dnl Arguments: +dnl Return: $1 action if-found +dnl $2 action if-not-found +dnl $DIRECTX_INCLUDES +dnl $DIRECTX_LIBS +AC_DEFUN([PTLIB_FIND_DIRECTX], + [ + ptlib_has_directx=yes + DIRECTX_INCLUDES= + DIRECTX_LIBS= + + AC_ARG_WITH([directx-includedir], + AS_HELP_STRING([--with-directx-includedir=DIR],[Location of DirectX include files]), + [with_directx_dir="$withval"], + [with_directx_dir="include"] + ) + + AC_MSG_CHECKING(for DirectX includes in ${with_directx_dir}) + AC_MSG_RESULT() + + old_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I${with_directx_dir}" + AC_LANG(C++) + + AC_CHECK_HEADERS([mingw_dshow_port.h], [], [ptlib_has_directx=no]) + AC_CHECK_HEADERS([control.h], [], [ptlib_has_directx=no]) + AC_CHECK_HEADERS([ddraw.h], [], [ptlib_has_directx=no]) + AC_CHECK_HEADERS([dshow.h], [], [ptlib_has_directx=no]) + AC_CHECK_HEADERS([dsound.h], [], [ptlib_has_directx=no]) + AC_CHECK_HEADERS([dxerr9.h], [], [ptlib_has_directx=no]) + AC_CHECK_HEADERS([ksuuids.h], [], [ptlib_has_directx=no]) + AC_CHECK_HEADERS([strmif.h], [], [ptlib_has_directx=no]) + AC_CHECK_HEADERS([uuids.h], [], [ptlib_has_directx=no]) + CPPFLAGS="$old_CPPFLAGS" + + + if test "x${ptlib_has_directx}" = "xyes" ; then + AC_MSG_CHECKING([for DirectX libraries]) + AC_MSG_RESULT() + fi + + if test "x${ptlib_has_directx}" = "xyes" ; then + DIRECTX_INCLUDES="-I${with_directx_dir}" + DIRECTX_LIBS="-ldsound -ldxerr9 -ldxguid -lstrmiids -lole32 -luuid -loleaut32 -lquartz" + fi + + AS_IF([test AS_VAR_GET([ptlib_has_directx]) = yes], [$1], [$2])[] + ]) + +dnl PTLIB_FIND_RESOLVER +dnl Check for dns resolver +dnl Arguments: +dnl Return: $1 action if-found +dnl $2 action if-not-found +dnl $RESOLVER_LIBS +dnl $$HAS_RES_INIT +AC_DEFUN([PTLIB_FIND_RESOLVER], + [ + ptlib_has_resolver=no + HAS_RES_NINIT= + + AC_CHECK_FUNC([res_ninit], + [ + HAS_RES_NINIT=1 + ptlib_has_resolver=yes + ]) + + if test "x${ptlib_has_resolver}" = "xno" ; then + AC_MSG_CHECKING([for res_ninit in -lresolv]) + old_LIBS="$LIBS" + LIBS="$LIBS -lresolv" + AC_LINK_IFELSE([[ + #include <netinet/in.h> + #include <resolv.h> + int main(int argc,char **argv) { + res_state p; res_ninit(p); + } + ]], + [ + HAS_RES_NINIT=1 + ptlib_has_resolver=yes + RESOLVER_LIBS="-lresolv" + ]) + LIBS="${old_LIBS}" + AC_MSG_RESULT(${ptlib_has_resolver}) + fi + + if test "x${ptlib_has_resolver}" = "xno" ; then + AC_CHECK_FUNC([res_search], [ptlib_has_resolver=yes]) + fi + + if test "x${ptlib_has_resolver}" = "xno" ; then + AC_MSG_CHECKING([for res_search in -lresolv]) + old_LIBS="$LIBS" + LIBS="$LIBS -lresolv" + AC_LINK_IFELSE([[ + #include <netinet/in.h> + #include <resolv.h> + int main(int argc,char **argv){ + res_search (NULL, 0, 0, NULL, 0); + } + ]], + [ + ptlib_has_resolver=yes + RESOLVER_LIBS="-lresolv" + ]) + LIBS="${old_LIBS}" + AC_MSG_RESULT(${ptlib_has_resolver}) + fi + + if test "x${ptlib_has_resolver}" = "xno" ; then + AC_SEARCH_LIBS([__res_search], [resolv], [ptlib_has_resolver=yes]) + fi + + if test "x${ptlib_has_resolver}" = "xno" ; then + AC_SEARCH_LIBS([__res_search], [resolv], [ptlib_has_resolver=yes]) + fi + + if test "x${ptlib_has_resolver}" = "xno" ; then + AC_CHECK_HEADERS([windns.h], + [ + ptlib_has_resolver=yes + RESOLVER_LIBS="-ldnsapi" + ]) + fi + AS_IF([test AS_VAR_GET([ptlib_has_resolver]) = yes], [$1], [$2])[] + ]) + +dnl PTLIB_OPENSSL_CONST +dnl Check for directX +dnl Arguments: +dnl Return: $1 action if-found +dnl $2 action if-not-found +AC_DEFUN([PTLIB_OPENSSL_CONST], + [ + ptlib_openssl_const=no + old_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $OPENSSL_CFLAGS" + AC_LANG(C) + AC_MSG_CHECKING(for const arg to d2i_AutoPrivateKey) + AC_TRY_COMPILE([#include <openssl/evp.h>], + [ + EVP_PKEY **a; const unsigned char **p; long l; + d2i_AutoPrivateKey(a, p, l); + ], + [ptlib_openssl_const=yes] + ) + AC_MSG_RESULT(${ptlib_openssl_const}) + AC_LANG(C++) + CFLAGS="${old_CFLAGS}" + + AS_IF([test AS_VAR_GET([ptlib_openssl_const]) = yes], [$1], [$2])[] + ]) + +dnl PTLIB_CHECK_UPAD128 +dnl Check for upad128_t (solaris only) +dnl Arguments: +dnl Return: $1 action if-found +dnl $2 action if-not-found +AC_DEFUN([PTLIB_CHECK_UPAD128], + [ + ptlib_upad128=no + + AC_MSG_CHECKING(for upad128_t) + AC_TRY_COMPILE([#include <sys/types.h>], + [upad128_t upad; upad._q = 0.0;], + [ptlib_upad128=yes]) + AC_MSG_RESULT(${ptlib_upad128}) + + AS_IF([test AS_VAR_GET([ptlib_upad128]) = yes], [$1], [$2])[] + ]) + +dnl PTLIB_OPENSSL_AES +dnl Check for directX +dnl Arguments: +dnl Return: $1 action if-found +dnl $2 action if-not-found +AC_DEFUN([PTLIB_OPENSSL_AES], + [ + ptlib_openssl_aes=no + old_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $OPENSSL_CFLAGS" + AC_LANG(C) + AC_CHECK_HEADERS([openssl/aes.h], [ptlib_openssl_aes=yes]) + AC_LANG(C++) + CFLAGS="${old_CFLAGS}" + AS_IF([test AS_VAR_GET([ptlib_openssl_aes]) = yes], [$1], [$2])[] + ]) + +dnl ######################################################################## +dnl libdl +dnl ######################################################################## + +dnl PTLIB_FIND_LBDL +dnl Try to find a library containing dlopen() +dnl Arguments: $1 action if-found +dnl $2 action if-not-found +dnl Return: $DL_LIBS The libs for dlopen() +AC_DEFUN([PTLIB_FIND_LIBDL], + [ + ptlib_libdl=no + AC_CHECK_HEADERS([dlfcn.h], [ptlib_dlfcn=yes], [ptlib_dlfcn=no]) + if test "$ptlib_dlfcn" = yes ; then + AC_MSG_CHECKING(if dlopen is available) + AC_LANG(C) + AC_TRY_COMPILE([#include <dlfcn.h>], + [void * p = dlopen("lib", 0);], [ptlib_dlopen=yes], [ptlib_dlopen=no]) + if test "$ptlib_dlopen" = no ; then + AC_MSG_RESULT(no) + else + AC_MSG_RESULT(yes) + case "$target_os" in + freebsd*|openbsd*|netbsd*|darwin*|beos*) + AC_CHECK_LIB([c],[dlopen], + [ + ptlib_libdl=yes + DL_LIBS="-lc" + ], + [ptlib_libdl=no]) + ;; + *) + AC_CHECK_LIB([dl],[dlopen], + [ + ptlib_libdl=yes + DL_LIBS="-ldl" + ], + [ptlib_libdl=no]) + ;; + esac + fi + fi + AS_IF([test AS_VAR_GET([ptlib_libdl]) = yes], [$1], [$2])[] + ]) + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |