"Fossies" - the Fresh Open Source Software Archive

Member "scalasca-2.6/vendor/cubew/build-config/m4/ac_cube_libz_selection.m4" (19 Apr 2021, 11370 Bytes) of package /linux/misc/scalasca-2.6.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.


    1 ##*************************************************************************##
    2 ##  CUBE        http://www.scalasca.org/                                   ##
    3 ##*************************************************************************##
    4 ##  Copyright (c) 1998-2018                                                ##
    5 ##  Forschungszentrum Juelich GmbH, Juelich Supercomputing Centre          ##
    6 ##                                                                         ##
    7 ##  Copyright (c) 2009-2015                                                ##
    8 ##  German Research School for Simulation Sciences GmbH,                   ##
    9 ##  Laboratory for Parallel Programming                                    ##
   10 ##                                                                         ##
   11 ##  This software may be modified and distributed under the terms of       ##
   12 ##  a BSD-style license.  See the COPYING file in the package base         ##
   13 ##  directory for details.                                                 ##
   14 ##*************************************************************************##
   15 
   16 
   17 #
   18 # This macro invalidates the headers cache variables created by previous AC_CHECK_HEADER/AC_CHECK_HEADERS checks.
   19 #
   20 AC_DEFUN([AC_CUBE_RESET_LIB_CACHE], [
   21     AS_FOR([AX_var], [ax_var], [$1], [
   22         dnl You can replace "ac_cv_lib_" with any prefix from http://www.gnu.org/software/autoconf/manual/html_node/Cache-Variable-Index.html
   23         AS_VAR_PUSHDEF([ax_Var], [ac_cv_lib_${ax_var}_$2])
   24         AS_UNSET([ax_Var])
   25         AS_VAR_POPDEF([ax_Var])
   26     ])
   27 ]) # AX_RESET_LIB_CACHE
   28 
   29 AC_DEFUN([AC_CUBE_RESET_HEADERS_CACHE], [
   30     AS_FOR([AX_var], [ax_var], [$1], [
   31         dnl You can replace "ac_cv_lib_" with any prefix from http://www.gnu.org/software/autoconf/manual/html_node/Cache-Variable-Index.html
   32         AS_VAR_PUSHDEF([ax_Var], [ac_cv_header_${ax_var}])
   33         AS_UNSET([ax_Var])
   34         AS_VAR_POPDEF([ax_Var])
   35     ])
   36 ]) # AX_RESET_LIB_CACHE
   37 
   38 
   39 AC_DEFUN([AC_CUBE_LIBZ_DETECTION],
   40 [
   41     dnl If after run of this macro is still empty - lib wasn't found
   42     LIB_RETURN="__NOT_FOUND__"
   43     AS_IF([ test "x$1" == "x" ],[
   44     AC_MSG_NOTICE([Try pkg-config zlib for library...])
   45         PKG_CONFIG_AVAILABLE=`which pkg-config`
   46         #here we try tu use pkg-config
   47         AS_IF([ test "x$PKG_CONFIG_AVAILABLE" != "x" ],[
   48             ZLIBCHECK=`pkg-config --libs-only-L zlib 2>&1| grep "No package "`
   49             AS_IF([ test "x$ZLIBCHECK" = "x" ],[
   50     	    LIB_RETURN=$ZLIBCHECK
   51     	    AC_MSG_NOTICE([Found zlib. Library linked  via ${LIB_RETURN} -lz])
   52     	    ])
   53 	])
   54     ], [
   55     AS_IF([ test -e $1 ],[
   56       AS_IF([ test -f $1 ],[
   57 	 ZLIB_PATH=`dirname $1`
   58          ZLIB_PATH=`dirname $ZLIB_PATH`
   59 	],[
   60         ZLIB_PATH=$1
   61 	])
   62 
   63         PATH_CANDIDATES=`find $ZLIB_PATH/ -type d `
   64         
   65 
   66       for zlib_path in $PATH_CANDIDATES; do
   67 
   68 	  dnl Save the current state
   69 	  ax_probe_library_save_LDFLAGS=${LDFLAGS}
   70 
   71 	  LDFLAGS="-L$zlib_path"
   72 	  dnl $LDFLAGS 
   73 	  AC_MSG_CHECKING([zlib in $zlib_path])
   74 	  AS_ECHO()
   75 	  _AS_ECHO_LOG([LDFLAGS="${LDFLAGS}"])
   76 
   77 	  AC_CHECK_LIB(z, zlibVersion, [ZLIB_FOUND="yes"], [ZLIB_FOUND="no"])
   78 
   79 	  dnl Restore the state to original in case of unsuccessful attempt
   80 	  LDFLAGS=${ax_probe_library_save_LDFLAGS}
   81 	  AC_CUBE_RESET_LIB_CACHE([z], [zlibVersion])
   82 
   83 	  dnl We have found the location, leave the loop:
   84 	  AS_IF([ test "x$ZLIB_FOUND" == "xyes" ],[
   85 		  AC_MSG_NOTICE([FOUND zlib at $1])
   86 		  LIB_RETURN="-L$zlib_path"
   87 		  break;
   88 	  ])
   89       done
   90     ],[
   91       AC_MSG_ERROR(["Error: $1 doesn't exist"])
   92     ])
   93     ])
   94 ])
   95 
   96 
   97 AC_DEFUN([AC_CUBE_LIBZ_HEADERS_DETECTION],
   98 [
   99     dnl If after run of this macro is still empty - lib wasn't found
  100     HEADER_RETURN="__NOT_FOUND__"
  101 
  102     AS_IF([ test "x$1" == "x" ],[
  103 	AC_MSG_NOTICE([Try pkg-config zlib for headers...])
  104         PKG_CONFIG_AVAILABLE=`which pkg-config`
  105         #here we try tu use pkg-config
  106         AS_IF([ test "x$PKG_CONFIG_AVAILABLE" != "x" ],[
  107             ZLIBCHECK=`pkg-config --cflags zlib 2>&1| grep "No package "`
  108             AS_IF([ test "x$ZLIBCHECK" = "x" ],[
  109         	HEADER_RETURN=$ZLIBCHECK
  110                 AC_MSG_NOTICE([Found zlib. Headers are included via $HEADER_RETURN])
  111         	])
  112 	    ])
  113     ], [
  114     AS_IF([ test -e $1 ],[ 
  115      AS_IF([ test -f $1 ],[
  116        ZLIB_PATH=`dirname $1`
  117        ZLIB_PATH=`dirname $ZLIB_PATH`
  118       ],[
  119         ZLIB_PATH=$1
  120        ])
  121  
  122       PATH_CANDIDATES=`find $ZLIB_PATH/ -type d `
  123 
  124       for zlib_path in $PATH_CANDIDATES; do
  125 
  126 	  dnl Save the current state
  127 	  ax_probe_header_save_CXXFLAGS=${CXXFLAGS}
  128 	  ax_probe_header_save_CFLAGS=${CFLAGS}
  129 
  130 	  CXXFLAGS="-I$zlib_path"
  131 	  CFLAGS="-I$zlib_path"
  132 	  dnl $LDFLAGS 
  133 	  AC_MSG_CHECKING([zlib.h in $zlib_path])
  134 	  AS_ECHO()
  135 	  _AS_ECHO_LOG([CXXFLAGS="${CXXFLAGS}"])
  136 	  _AS_ECHO_LOG([CFLAGS="${CFLAGS}"])
  137 
  138 	  AC_CHECK_HEADER(zlib.h, [ZLIB_HEADER_FOUND="yes"], [ZLIB_HEADER_FOUND="no"])
  139 
  140 	  dnl Restore the state to original in case of unsuccessful attempt
  141 	  CXXFLAGS=${ax_probe_header_save_CXXFLAGS}
  142 	  CFLAGS=${ax_probe_header_save_CFLAGS}
  143 	  AC_CUBE_RESET_HEADERS_CACHE([zlib.h])
  144 
  145 	  dnl We have found the location, leave the loop:
  146 	  AS_IF([ test "x$ZLIB_HEADER_FOUND" == "xyes" ],[
  147 		  AC_MSG_NOTICE([FOUND zlib.h at $1])
  148 		  HEADER_RETURN="-I$zlib_path"
  149 		  break;
  150 	  ])
  151       done
  152     ],[
  153     # here is not $1 given or test is failed 
  154     AC_MSG_ERROR(["Error: $1 doesn't exist"])
  155     ])
  156     ])
  157 ])
  158 
  159 
  160 
  161 AC_DEFUN([AC_CUBE_LIBZ_FRONTEND_SEARCH], [
  162     dnl if variable is empty, we do not change FRONTEND_LIBZ_LD
  163     AC_CUBE_RESET_LIB_CACHE([z], [zlibVersion])
  164     AC_CUBE_RESET_HEADERS_CACHE([zlib.h])
  165     AC_CUBE_LIBZ_DETECTION([$FRONTEND_PATH])
  166     AC_CUBE_LIBZ_HEADERS_DETECTION([$FRONTEND_PATH])
  167     AS_IF([ test "x$HEADER_RETURN"  != "x__NOT_FOUND__" && test "x$LIB_RETURN"  != "x__NOT_FOUND__" ],[
  168 	    FRONTEND_LIBZ_LDFLAGS="$LIB_RETURN "
  169 	    FRONTEND_LIBZ_LIBS="-lz"
  170 	    FRONTEND_LIBZ_HEADERS="$HEADER_RETURN"
  171 	    COMPRESSION="$COMPRESSION -DFRONTEND_CUBE_COMPRESSED=yes "
  172 	    AC_DEFINE(COMPRESSION, 1, [Compression is enabled])
  173 	    MSG_FRONTEND_COMPRESSION=yes
  174 	],[
  175 	    AC_MSG_WARN([ Cannot find zlib under $FRONTEND_PATH. CUBE uses zlib compression and this library is needed, if you create a frontend application.])
  176 	    FRONTEND_LIBZ_LDFLAGS=""
  177 	    FRONTEND_LIBZ_LIBS=""
  178 	    FRONTEND_LIBZ_HEADERS=""
  179 	    MSG_FRONTEND_COMPRESSION=no
  180 	    COMPRESSION="$COMPRESSION"
  181     ])
  182     AC_CUBE_RESET_LIB_CACHE([z], [zlibVersion])
  183     AC_CUBE_RESET_HEADERS_CACHE([zlib.h])
  184     
  185     
  186    
  187 ])
  188 
  189 
  190 AC_DEFUN([AC_CUBE_LIBZ_BACKEND_SEARCH], [
  191     dnl if variable is empty, we do not change BACKEND_LIBZ_LD
  192     AC_CUBE_RESET_LIB_CACHE([z], [zlibVersion])
  193     AC_CUBE_RESET_HEADERS_CACHE([zlib.h])
  194     AS_IF([test "x${ac_scorep_platform}" = "xbgq" && test "x$BACKEND_PATH" = "x" ],
  195                  [
  196                    BACKEND_PATH="/bgsys/local/zlib"
  197                  ])
  198     AC_CUBE_LIBZ_DETECTION([$BACKEND_PATH])
  199     AC_CUBE_LIBZ_HEADERS_DETECTION([$BACKEND_PATH])
  200     AS_IF([ test "x$HEADER_RETURN"  != "x__NOT_FOUND__" && test "x$LIB_RETURN"  != "x__NOT_FOUND__" ],[
  201 	    BACKEND_LIBZ_LDFLAGS="$LIB_RETURN "
  202 	    BACKEND_LIBZ_LIBS="-lz"
  203 	    BACKEND_LIBZ_HEADERS="$HEADER_RETURN"
  204 	    MSG_BACKEND_COMPRESSION=yes; 
  205 	    COMPRESSION="$COMPRESSION -DBACKEND_CUBE_COMPRESSED=yes "
  206 	    AC_DEFINE(COMPRESSION, 1, [Compression is enabled])
  207 	],[
  208 	    AC_MSG_WARN([ Cannot find zlib under $BACKEND_PATH. CUBE uses zlib compression and this library is needed, if you create a backend application.])
  209 	    BACKEND_LIBZ_LDFLAGS=""
  210 	    BACKEND_LIBZ_LIBS=""
  211 	    BACKEND_LIBZ_LD=""
  212 	    BACKEND_LIBZ_HEADERS=""
  213 	    MSG_BACKEND_COMPRESSION=no
  214 	    COMPRESSION="$COMPRESSION"
  215     ])
  216     AC_CUBE_RESET_LIB_CACHE([z], [zlibVersion])
  217     AC_CUBE_RESET_HEADERS_CACHE([zlib.h])
  218     
  219 ])
  220 
  221 
  222 
  223 AC_DEFUN([AC_CUBE_LIBZ_SELECTION], [
  224 
  225 AC_ARG_WITH(compression, [AS_HELP_STRING([--with-compression | --without-compression ] ,[ Enables (default) or disables support for zlib compression  ])],[compression_on=$with_compression],[ compression_on="yes"])
  226 ])
  227 
  228 
  229 
  230 
  231 AC_MSG_NOTICE([ Compression support in tools and GUI : $MSG_FRONTEND_COMPRESSION])
  232 AS_IF([ test "x$MSG_FRONTEND_COMPRESSION" != "xno" ],[ 
  233 AC_MSG_NOTICE([ Frontend zlib get linked  as: $FRONTEND_LIBZ_LD])
  234 AC_MSG_NOTICE([ Frontend zlib headers included as: $FRONTEND_LIBZ_HEADERS])
  235 ])
  236 AC_SUBST([FRONTEND_LIBZ_LDFLAGS])
  237 AC_SUBST([FRONTEND_LIBZ_LIBS])
  238 AC_SUBST([FRONTEND_LIBZ_HEADERS])
  239 AC_SUBST([COMPRESSION])
  240 AC_SUBST([MSG_FRONTEND_COMPRESSION])
  241 
  242 ])
  243 
  244 
  245 
  246 
  247 AC_DEFUN([AC_CUBE_LIBZ_FRONTEND_SELECTION], [
  248 AC_ARG_WITH(frontend-zlib, [AS_HELP_STRING([--with-frontend-zlib="path to frontrend zlib"], [Defines the zlib library, used by frontend c-writer library])],[FRONTEND_PATH=$withval ; FRONTEND_LIBZ_LDFLAGS="-L$withval/lib"; FRONTEND_LIBZ_LIBS="-lz" ; FRONTEND_LIBZ_HEADERS="-I$withval/include"],[FRONTEND_PATH= ; FRONTEND_LIBZ_LDFLAGS=""; FRONTEND_LIBZ_LIBS="-lz" ; FRONTEND_LIBZ_HEADERS=""])
  249 #AC_ARG_WITH(frontend-compression, [AS_HELP_STRING([--with-frontend-compression], [Enables reading and writing of compressed cube files by C++ library(tools, GUI) and c-writer on frontend.)])],[FRONTEND_COMPRESSION_ON=$withval ],[])
  250 
  251 dnl "looks for libz.a or libz.so in pathes, wich are under the $BACKEND_PATH or $FRONTEND_PATH"
  252 AS_IF([ test "x$compression_on" = "xyes"],[
  253 AC_CUBE_LIBZ_FRONTEND_SEARCH
  254 ],[
  255 COMPRESSION=""
  256 FRONTEND_LIBZ_HEADERS=""
  257 FRONTEND_LIBZ_LDFLAGS=""
  258 FRONTEND_LIBZ_LIBS=""
  259 MSG_FRONTEND_COMPRESSION="no"
  260 ])
  261 
  262 
  263 
  264 
  265 AS_IF([ test "x$MSG_FRONTEND_COMPRESSION" != "xno" ],[ 
  266 AC_MSG_NOTICE([ Frontend zlib get linked  as: $FRONTEND_LIBZ_LDFLAGS $FRONTEND_LIBZ_LIBS])
  267 AC_MSG_NOTICE([ Frontend zlib headers included as: $FRONTEND_LIBZ_HEADERS])
  268 ])
  269 
  270 AM_CONDITIONAL([CUBEW_COMPRESSION_FRONTEND], [test "x$MSG_FRONTEND_COMPRESSION" = "xyes"])
  271 
  272 AC_SUBST([FRONTEND_LIBZ_LDFLAGS])
  273 AC_SUBST([FRONTEND_LIBZ_LIBS])
  274 AC_SUBST([FRONTEND_LIBZ_HEADERS])
  275 AC_SUBST([COMPRESSION])
  276 AC_SUBST([MSG_FRONTEND_COMPRESSION])
  277 
  278 ])
  279 
  280 
  281 
  282 AC_DEFUN([AC_CUBE_LIBZ_BACKEND_SELECTION], [
  283 AC_ARG_WITH(compression, [AS_HELP_STRING([--with-compression | --without-compression], [ Enables (default) or disables support for zlib compression    ])],[ WITH_COMPRESSION=$withvalue; WITHOUT_COMPRESSION=$withoutvalue],[BACKEND_COMPRESSION_ON="yes"])
  284 
  285 
  286 AC_ARG_WITH(backend-zlib, [AS_HELP_STRING([--with-backend-zlib="path to backend zlib"], [Defines the zlib library, used by cube c-writer])],[BACKEND_PATH=$withval ; BACKEND_LIBZ_LDFLAGS="-L$withval/lib";  BACKEND_LIBZ_LIBS="-lz" ; BACKEND_LIBZ_HEADERS="-I$withval/include"],[BACKEND_PATH= ; BACKEND_LIBZ_LDFLAGS=""  BACKEND_LIBZ_LIBS="-lz" ;  BACKEND_LIBZ_HEADERS=""])
  287 
  288 
  289 dnl "looks for libz.a or libz.so in pathes, wich are under the $BACKEND_PATH or $FRONTEND_PATH"
  290 AS_IF([ test "x$compression_on" = "xyes" ],[
  291 AC_CUBE_LIBZ_BACKEND_SEARCH
  292 ],[
  293 COMPRESSION=""
  294 BACKEND_LIBZ_HEADERS=""
  295 BACKEND_LIBZ_LDFLAGS=""
  296 BACKEND_LIBZ_LIBS=""
  297 MSG_BACKEND_COMPRESSION="no"
  298 ])
  299 
  300 
  301 
  302 AS_IF([ test "x$MSG_BACKEND_COMPRESSION" = "xyes" ],[ 
  303 AC_MSG_NOTICE([ Back-end zlib get linked  as: $BACKEND_LIBZ_LDFLAGS $BACKEND_LIBZ_LIBS ])
  304 AC_MSG_NOTICE([ Back-end zlib headers included  as: $BACKEND_LIBZ_HEADERS])
  305 ])
  306 
  307 AM_CONDITIONAL([CUBEW_COMPRESSION_BACKEND], [test "x$MSG_BACKEND_COMPRESSION" = "xyes"])
  308 
  309 AC_SUBST([BACKEND_LIBZ_LDFLAGS])
  310 AC_SUBST([BACKEND_LIBZ_LIBS])
  311 AC_SUBST([BACKEND_LIBZ_HEADERS])
  312 AC_SUBST([COMPRESSION])
  313 AC_SUBST([MSG_BACKEND_COMPRESSION])
  314 ])
  315