acinclude.m4
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· M4 代码 · 共 2,494 行 · 第 1/5 页
M4
2,494 行
dnldnl $Id: acinclude.m4,v 1.332.2.14.2.26 2007/08/20 14:28:45 jani Exp $dnldnl This file contains local autoconf functions.dnldnl -------------------------------------------------------------------------dnl Output stylize macros for configure (help/runtime)dnl -------------------------------------------------------------------------dnldnl PHP_HELP_SEPARATOR(title)dnldnl Adds separator title into the configure --help display.dnl AC_DEFUN([PHP_HELP_SEPARATOR],[AC_ARG_ENABLE([],[$1],[])])dnldnl PHP_CONFIGURE_PART(title)dnldnl Adds separator title configure output (idea borrowed from mm)dnlAC_DEFUN([PHP_CONFIGURE_PART],[ AC_MSG_RESULT() AC_MSG_RESULT([${T_MD}$1${T_ME}])])dnl -------------------------------------------------------------------------dnl Build system helper macrosdnl -------------------------------------------------------------------------dnldnl PHP_DEF_HAVE(what)dnldnl Generates 'AC_DEFINE(HAVE_WHAT, 1, [ ])'dnlAC_DEFUN([PHP_DEF_HAVE],[AC_DEFINE([HAVE_]translit($1,a-z_.-,A-Z___), 1, [ ])])dnldnl PHP_RUN_ONCE(namespace, variable, code)dnldnl execute code, if variable is not set in namespacednlAC_DEFUN([PHP_RUN_ONCE],[ changequote({,}) unique=`echo $2|$SED 's/[^a-zA-Z0-9]/_/g'` changequote([,]) cmd="echo $ac_n \"\$$1$unique$ac_c\"" if test -n "$unique" && test "`eval $cmd`" = "" ; then eval "$1$unique=set" $3 fi])dnldnl PHP_EXPAND_PATH(path, variable)dnldnl expands path to an absolute path and assigns it to variablednlAC_DEFUN([PHP_EXPAND_PATH],[ if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then $2=$1 else changequote({,}) ep_dir="`echo $1|$SED 's%/*[^/][^/]*/*$%%'`" changequote([,]) ep_realdir="`(cd \"$ep_dir\" && pwd)`" $2="$ep_realdir/`basename \"$1\"`" fi])dnldnl PHP_DEFINE(WHAT [, value[, directory]])dnldnl Creates builddir/include/what.h and in there #define WHAT valuednlAC_DEFUN([PHP_DEFINE],[ [echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > ]ifelse([$3],,[include],[$3])[/php_]translit($1,A-Z,a-z)[.h]])dnldnl PHP_SUBST(varname)dnldnl Adds variable with it's value into Makefile, e.g.:dnl CC = gccdnlAC_DEFUN([PHP_SUBST],[ PHP_VAR_SUBST="$PHP_VAR_SUBST $1"])dnldnl PHP_SUBST_OLD(varname)dnldnl Same as PHP_SUBST() but also substitutes all @VARNAME@dnl instances in every file passed to AC_OUTPUT()dnlAC_DEFUN([PHP_SUBST_OLD],[ PHP_SUBST($1) AC_SUBST($1)])dnldnl PHP_OUTPUT(file)dnldnl Adds "file" to the list of files generated by AC_OUTPUTdnl This macro can be used several times.dnlAC_DEFUN([PHP_OUTPUT],[ PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1"])dnl -------------------------------------------------------------------------dnl Build system base macrosdnl -------------------------------------------------------------------------dnldnl PHP_CANONICAL_HOST_TARGETdnlAC_DEFUN([PHP_CANONICAL_HOST_TARGET],[ AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_TARGET])dnl dnl Make sure we do not continue if host_alias is empty. if test -z "$host_alias" && test -n "$host"; then host_alias=$host fi if test -z "$host_alias"; then AC_MSG_ERROR([host_alias is not set!]) fi])dnldnl PHP_INIT_BUILD_SYSTEMdnlAC_DEFUN([PHP_INIT_BUILD_SYSTEM],[AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnltest -d include || $php_shtool mkdir include> Makefile.objects> Makefile.fragmentsdnl We need to play tricks here to avoid matching the grep line itselfpattern=define$EGREP $pattern'.*include/php' $srcdir/configure|$SED 's/.*>//'|xargs touch 2>/dev/null])dnldnl PHP_GEN_GLOBAL_MAKEFILEdnl dnl Generates the global makefile.dnlAC_DEFUN([PHP_GEN_GLOBAL_MAKEFILE],[ cat >Makefile <<EOFsrcdir = $abs_srcdirbuilddir = $abs_builddirtop_srcdir = $abs_srcdirtop_builddir = $abs_builddirEOF for i in $PHP_VAR_SUBST; do eval echo "$i = \$$i" >> Makefile done cat $abs_srcdir/Makefile.global Makefile.fragments Makefile.objects >> Makefile])dnldnl PHP_ADD_MAKEFILE_FRAGMENT([srcfile [, ext_srcdir [, ext_builddir]]])dnldnl Processes a file called Makefile.frag in the source directorydnl of the most recently added extension. $(srcdir) and $(builddir)dnl are substituted with the proper paths. Can be used to supplydnl custom rules and/or additional targets.dnlAC_DEFUN([PHP_ADD_MAKEFILE_FRAGMENT],[ ifelse($1,,src=$ext_srcdir/Makefile.frag,src=$1) ifelse($2,,ac_srcdir=$ext_srcdir,ac_srcdir=$2) ifelse($3,,ac_builddir=$ext_builddir,ac_builddir=$3) test -f "$src" && $SED -e "s#\$(srcdir)#$ac_srcdir#g" -e "s#\$(builddir)#$ac_builddir#g" $src >> Makefile.fragments])dnldnl PHP_ADD_SOURCES(source-path, sources [, special-flags [, type]])dnldnl Adds sources which are located relative to source-path to the dnl array of type type. Sources are processed with optional dnl special-flags which are passed to the compiler. Sourcesdnl can be either written in C or C++ (filenames shall end in .c dnl or .cpp, respectively).dnldnl Note: If source-path begins with a "/", the "/" is removed anddnl the path is interpreted relative to the top build-directory.dnldnl which array to append to?AC_DEFUN([PHP_ADD_SOURCES],[ PHP_ADD_SOURCES_X($1, $2, $3, ifelse($4,cli,PHP_CLI_OBJS,ifelse($4,sapi,PHP_SAPI_OBJS,PHP_GLOBAL_OBJS)))])dnldnl _PHP_ASSIGN_BUILD_VARS(type)dnl internal, don't useAC_DEFUN([_PHP_ASSIGN_BUILD_VARS],[ifelse($1,shared,[ b_c_pre=$shared_c_pre b_cxx_pre=$shared_cxx_pre b_c_meta=$shared_c_meta b_cxx_meta=$shared_cxx_meta b_c_post=$shared_c_post b_cxx_post=$shared_cxx_post],[ b_c_pre=$php_c_pre b_cxx_pre=$php_cxx_pre b_c_meta=$php_c_meta b_cxx_meta=$php_cxx_meta b_c_post=$php_c_post b_cxx_post=$php_cxx_post])dnl b_lo=[$]$1_lo])dnldnl PHP_ADD_SOURCES_X(source-path, sources[, special-flags[, target-var[, shared[, special-post-flags]]]])dnldnl Additional to PHP_ADD_SOURCES (see above), this lets you set thednl name of the array target-var directly, as well as whetherdnl shared objects will be built from the sources.dnldnl Should not be used directly.dnl AC_DEFUN([PHP_ADD_SOURCES_X],[dnl relative to source- or build-directory?dnl ac_srcdir/ac_bdir include trailing slash case $1 in ""[)] ac_srcdir="$abs_srcdir/"; unset ac_bdir; ac_inc="-I. -I$abs_srcdir" ;; /*[)] ac_srcdir=`echo "$1"|cut -c 2-`"/"; ac_bdir=$ac_srcdir; ac_inc="-I$ac_bdir -I$abs_srcdir/$ac_bdir" ;; *[)] ac_srcdir="$abs_srcdir/$1/"; ac_bdir="$1/"; ac_inc="-I$ac_bdir -I$ac_srcdir" ;; esac dnl how to build .. shared or static? ifelse($5,yes,_PHP_ASSIGN_BUILD_VARS(shared),_PHP_ASSIGN_BUILD_VARS(php))dnl iterate over the sources old_IFS=[$]IFS for ac_src in $2; do dnl remove the suffix IFS=. set $ac_src ac_obj=[$]1 IFS=$old_IFS dnl append to the array which has been dynamically chosen at m4 time $4="[$]$4 [$]ac_bdir[$]ac_obj.lo"dnl choose the right compiler/flags/etc. for the source-file case $ac_src in *.c[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;; *.s[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;; *.S[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;; *.cpp|*.cc|*.cxx[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;; esacdnl create a rule for the object/source combo cat >>Makefile.objects<<EOF$ac_bdir[$]ac_obj.lo: $ac_srcdir[$]ac_src $ac_compEOF done])dnl -------------------------------------------------------------------------dnl Compiler characteristics checksdnl -------------------------------------------------------------------------dnldnl PHP_TARGET_RDYNAMICdnldnl Checks whether -rdynamic is supported by the compiler. Thisdnl is necessary for some targets to populate the global symboldnl table. Otherwise, dynamic modules would not be able to resolvednl PHP-related symbols.dnldnl If successful, adds -rdynamic to PHP_LDFLAGS.dnlAC_DEFUN([PHP_TARGET_RDYNAMIC],[ if test -n "$GCC"; then dnl we should use a PHP-specific macro here PHP_CHECK_GCC_ARG(-rdynamic, gcc_rdynamic=yes) if test "$gcc_rdynamic" = "yes"; then PHP_LDFLAGS="$PHP_LDFLAGS -rdynamic" fi fi])dnldnl PHP_RUNPATH_SWITCHdnldnl Checks for -R, etc. switchdnlAC_DEFUN([PHP_RUNPATH_SWITCH],[AC_MSG_CHECKING([if compiler supports -R])AC_CACHE_VAL(php_cv_cc_dashr,[ SAVE_LIBS=$LIBS LIBS="-R /usr/$PHP_LIBDIR $LIBS" AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no) LIBS=$SAVE_LIBS])AC_MSG_RESULT([$php_cv_cc_dashr])if test $php_cv_cc_dashr = "yes"; then ld_runpath_switch=-Relse AC_MSG_CHECKING([if compiler supports -Wl,-rpath,]) AC_CACHE_VAL(php_cv_cc_rpath,[ SAVE_LIBS=$LIBS LIBS="-Wl,-rpath,/usr/$PHP_LIBDIR $LIBS" AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no) LIBS=$SAVE_LIBS]) AC_MSG_RESULT([$php_cv_cc_rpath]) if test $php_cv_cc_rpath = "yes"; then ld_runpath_switch=-Wl,-rpath, else dnl something innocuous ld_runpath_switch=-L fifiif test "$PHP_RPATH" = "no"; then ld_runpath_switch=fi])dnldnl PHP_CHECK_GCC_ARG(arg, action-if-found, action-if-not-found)dnlAC_DEFUN([PHP_CHECK_GCC_ARG],[ gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_) AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [ echo 'void somefunc() { };' > conftest.c cmd='$CC $1 -c conftest.c' if eval $cmd 2>&1 | $EGREP -e $1 >/dev/null ; then ac_result=no else ac_result=yes fi eval $gcc_arg_name=$ac_result rm -f conftest.* ]) if eval test "\$$gcc_arg_name" = "yes"; then $2 else : $3 fi])dnldnl PHP_LIBGCC_LIBPATH(gcc)dnldnl Stores the location of libgcc in libgcc_libpathdnlAC_DEFUN([PHP_LIBGCC_LIBPATH],[ changequote({,}) libgcc_libpath=`$1 --print-libgcc-file-name|$SED 's%/*[^/][^/]*$%%'` changequote([,])])dnl -------------------------------------------------------------------------dnl Macros to modify LIBS, INCLUDES, etc. variables dnl -------------------------------------------------------------------------dnldnl PHP_REMOVE_USR_LIB(NAME)dnldnl Removes all -L/usr/$PHP_LIBDIR entries from variable NAMEdnlAC_DEFUN([PHP_REMOVE_USR_LIB],[ unset ac_new_flags for i in [$]$1; do case [$]i in -L/usr/$PHP_LIBDIR|-L/usr/$PHP_LIBDIR/[)] ;; *[)] ac_new_flags="[$]ac_new_flags [$]i" ;; esac done $1=[$]ac_new_flags])dnldnl PHP_EVAL_LIBLINE(libline, SHARED-LIBADD)dnldnl Use this macro, if you need to add libraries and or library searchdnl paths to the PHP build system which are only given in compilerdnl notation.dnlAC_DEFUN([PHP_EVAL_LIBLINE],[ for ac_i in $1; do case $ac_i in -pthread[)] if test "$ext_shared" = "yes"; then $2="[$]$2 -pthread" else PHP_RUN_ONCE(EXTRA_LDFLAGS, [$ac_i], [EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i"]) fi ;; -l*[)] ac_ii=`echo $ac_i|cut -c 3-` PHP_ADD_LIBRARY($ac_ii,1,$2) ;; -L*[)] ac_ii=`echo $ac_i|cut -c 3-` PHP_ADD_LIBPATH($ac_ii,$2) ;; esac done])dnldnl PHP_EVAL_INCLINE(headerline)dnldnl Use this macro, if you need to add header search paths to the PHPdnl build system which are only given in compiler notation.dnlAC_DEFUN([PHP_EVAL_INCLINE],[ for ac_i in $1; do case $ac_i in -I*[)] ac_ii=`echo $ac_i|cut -c 3-` PHP_ADD_INCLUDE($ac_ii) ;; esac done])dnl internal, don't useAC_DEFUN([_PHP_ADD_LIBPATH_GLOBAL],[ PHP_RUN_ONCE(LIBPATH, $1, [ test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$1" LDFLAGS="$LDFLAGS -L$1" PHP_RPATHS="$PHP_RPATHS $1" ])])dnldnldnldnl PHP_ADD_LIBPATH(path [, SHARED-LIBADD])dnldnl Adds a path to linkpath/runpath (LDFLAGS)dnlAC_DEFUN([PHP_ADD_LIBPATH],[ if test "$1" != "/usr/$PHP_LIBDIR" && test "$1" != "/usr/lib"; then PHP_EXPAND_PATH($1, ai_p) ifelse([$2],,[ _PHP_ADD_LIBPATH_GLOBAL([$ai_p]) ],[ if test "$ext_shared" = "yes"; then $2="-L$ai_p [$]$2" test -n "$ld_runpath_switch" && $2="$ld_runpath_switch$ai_p [$]$2" else _PHP_ADD_LIBPATH_GLOBAL([$ai_p]) fi ]) fi])dnldnl PHP_UTILIZE_RPATHS()dnldnl builds RPATHS/LDFLAGS from PHP_RPATHSdnlAC_DEFUN([PHP_UTILIZE_RPATHS],[ OLD_RPATHS=$PHP_RPATHS unset PHP_RPATHS for i in $OLD_RPATHS; dodnl Can be passed to native cc/libtool PHP_LDFLAGS="$PHP_LDFLAGS -L$i"dnl Libtool-specific PHP_RPATHS="$PHP_RPATHS -R $i"dnl cc-specific NATIVE_RPATHS="$NATIVE_RPATHS $ld_runpath_switch$i" done if test "$PHP_RPATH" = "no"; then unset PHP_RPATHS unset NATIVE_RPATHS fi])dnldnl PHP_ADD_INCLUDE(path [,before])dnldnl add an include path. dnl if before is 1, add in the beginning of INCLUDES.dnlAC_DEFUN([PHP_ADD_INCLUDE],[ if test "$1" != "/usr/include"; then PHP_EXPAND_PATH($1, ai_p) PHP_RUN_ONCE(INCLUDEPATH, $ai_p, [ if test "$2"; then INCLUDES="-I$ai_p $INCLUDES" else INCLUDES="$INCLUDES -I$ai_p"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?