1 # strdup.m4 serial 12
3 dnl Copyright (C) 2002-2010 Free Software Foundation, Inc.
5 dnl This file is free software; the Free Software Foundation
6 dnl gives unlimited permission to copy and/or distribute it,
7 dnl with or without modifications, as long as this notice is preserved.
9 AC_DEFUN([gl_FUNC_STRDUP],
10 [
11 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
12 AC_CHECK_FUNCS_ONCE([strdup])
13 if test $ac_cv_func_strdup != yes; then
14 AC_LIBOBJ([strdup])
15 gl_PREREQ_STRDUP
16 fi
17 AC_CHECK_DECLS_ONCE([strdup])
18 if test $ac_cv_have_decl_strdup = no; then
19 HAVE_DECL_STRDUP=0
20 fi
21 ])
23 AC_DEFUN([gl_FUNC_STRDUP_POSIX],
24 [
25 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
26 AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
27 AC_CHECK_FUNCS_ONCE([strdup])
28 if test $ac_cv_func_strdup = yes; then
29 if test $gl_cv_func_malloc_posix != yes; then
30 REPLACE_STRDUP=1
31 AC_LIBOBJ([strdup])
32 gl_PREREQ_STRDUP
33 fi
34 else
35 AC_LIBOBJ([strdup])
36 gl_PREREQ_STRDUP
37 fi
38 AC_CHECK_DECLS_ONCE([strdup])
39 if test $ac_cv_have_decl_strdup = no; then
40 HAVE_DECL_STRDUP=0
41 fi
42 ])
44 # Prerequisites of lib/strdup.c.
45 AC_DEFUN([gl_PREREQ_STRDUP], [:])