Skip to content
reentrant.m4 28.2 KiB
Newer Older
#***************************************************************************
#                                  _   _ ____  _
#  Project                     ___| | | |  _ \| |
#                             / __| | | | |_) | |
#                            | (__| |_| |  _ <| |___
#                             \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# $Id$
###########################################################################


dnl CHECK_NEED_REENTRANT_STRERROR_R
dnl -------------------------------------------------
dnl Checks if the preprocessor _REENTRANT definition
dnl makes function strerror_r compiler visible.

AC_DEFUN([CHECK_NEED_REENTRANT_STRERROR_R], [
  #
  AC_MSG_NOTICE([DEBUG:])
  AC_MSG_NOTICE([DEBUG:])
  AC_LINK_IFELSE([
    AC_LANG_FUNC_LINK_TRY([strerror_r])
  ],[
    AC_MSG_NOTICE([DEBUG: strerror_r links... yes])
    tmp_strerror_r="yes"
  ],[
    AC_MSG_NOTICE([DEBUG: strerror_r links... no])
    tmp_strerror_r="no"
  ])
  #
  if test "$tmp_strerror_r" = "yes"; then
    AC_EGREP_CPP([strerror_r],[
#include <sys/types.h>
#include <string.h>
    ],[
      AC_MSG_NOTICE([DEBUG: strerror_r proto... without our definition])
      tmp_strerror_r="proto_wout_def"
    ],[
      AC_EGREP_CPP([strerror_r],[
#define _REENTRANT
#include <sys/types.h>
#include <string.h>
      ],[
        AC_MSG_NOTICE([DEBUG: strerror_r proto... with our _reentrant])
        tmp_strerror_r="proto_with_def"
      ],[
        AC_MSG_NOTICE([DEBUG: strerror_r proto... not found])
      ])
    ])
  fi
  #
  if test "$tmp_strerror_r" = "proto_wout_def"; then
    AC_COMPILE_IFELSE([
      AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <string.h>
      ]],[[
        strerror_r(0, 0, 0);
      ]])
    ],[
      AC_MSG_NOTICE([DEBUG: strerror_r proto wout finds... 3 args])
      tmp_strerror_r="done"
    ])
  fi
  #
  if test "$tmp_strerror_r" = "proto_with_def"; then
    AC_COMPILE_IFELSE([
      AC_LANG_PROGRAM([[
#define _REENTRANT
#include <sys/types.h>
#include <string.h>
      ]],[[
        strerror_r(0, 0, 0);
      ]])
    ],[
      AC_MSG_NOTICE([DEBUG: strerror_r proto with finds... 3 args])
      tmp_strerror_r="needs_reentrant"
    ])
  fi
  #
  if test "$tmp_strerror_r" = "needs_reentrant"; then
    ac_cv_need_reentrant="yes"
  fi
])


dnl CHECK_NEED_REENTRANT_STRTOK_R
dnl -------------------------------------------------
dnl Checks if the preprocessor _REENTRANT definition
dnl makes function strtok_r compiler visible.

AC_DEFUN([CHECK_NEED_REENTRANT_STRTOK_R], [
  #
  AC_MSG_NOTICE([DEBUG:])
  AC_LINK_IFELSE([
    AC_LANG_FUNC_LINK_TRY([strtok_r])
  ],[
    AC_MSG_NOTICE([DEBUG: strtok_r links... yes])
    tmp_strtok_r="yes"
  ],[
    AC_MSG_NOTICE([DEBUG: strtok_r links... no])
    tmp_strtok_r="no"
  ])
  #
  if test "$tmp_strtok_r" = "yes"; then
    AC_EGREP_CPP([strtok_r],[
#include <sys/types.h>
#include <string.h>
    ],[
      AC_MSG_NOTICE([DEBUG: strtok_r proto... without our definition])
      tmp_strtok_r="proto_wout_def"
    ],[
      AC_EGREP_CPP([strtok_r],[
#define _REENTRANT
#include <sys/types.h>
#include <string.h>
      ],[
        AC_MSG_NOTICE([DEBUG: strtok_r proto... with our _reentrant])
        tmp_strtok_r="proto_with_def"
      ],[
        AC_MSG_NOTICE([DEBUG: strtok_r proto... not found])
      ])
    ])
  fi
  #
  if test "$tmp_strtok_r" = "proto_wout_def"; then
    AC_COMPILE_IFELSE([
      AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <string.h>
      ]],[[
        strtok_r(0, 0, 0);
      ]])
    ],[
      AC_MSG_NOTICE([DEBUG: strtok_r proto wout finds... 3 args])
      tmp_strtok_r="done"
    ])
  fi
  #
  if test "$tmp_strtok_r" = "proto_with_def"; then
    AC_COMPILE_IFELSE([
      AC_LANG_PROGRAM([[
#define _REENTRANT
#include <sys/types.h>
#include <string.h>
      ]],[[
        strtok_r(0, 0, 0);
      ]])
    ],[
      AC_MSG_NOTICE([DEBUG: strtok_r proto with finds... 3 args])
      tmp_strtok_r="needs_reentrant"
    ])
  fi
  #
  if test "$tmp_strtok_r" = "needs_reentrant"; then
    ac_cv_need_reentrant="yes"
  fi
])


dnl CHECK_NEED_REENTRANT_LOCALTIME_R
dnl -------------------------------------------------
dnl Checks if the preprocessor _REENTRANT definition
dnl makes function localtime_r compiler visible.

AC_DEFUN([CHECK_NEED_REENTRANT_LOCALTIME_R], [
  #
  AC_MSG_NOTICE([DEBUG:])
  AC_LINK_IFELSE([
    AC_LANG_FUNC_LINK_TRY([localtime_r])
  ],[
    AC_MSG_NOTICE([DEBUG: localtime_r links... yes])
    tmp_localtime_r="yes"
  ],[
    AC_MSG_NOTICE([DEBUG: localtime_r links... no])
    tmp_localtime_r="no"
  ])
  #
  if test "$tmp_localtime_r" = "yes"; then
    AC_EGREP_CPP([localtime_r],[
#include <sys/types.h>
#include <time.h>
    ],[
      AC_MSG_NOTICE([DEBUG: localtime_r proto... without our definition])
      tmp_localtime_r="proto_wout_def"
    ],[
      AC_EGREP_CPP([localtime_r],[
Loading
Loading full blame…