~mohyt/drizzle/drizzle-drop

« back to all changes in this revision

Viewing changes to m4/lib-link.m4

  • Committer: Continuous Integration
  • Date: 2013-04-27 20:03:58 UTC
  • mfrom: (2633.1.11 drizzle-7.2)
  • Revision ID: ci@drizzle.org-20130427200358-77r6140iqb0orc1o
Merge lp:~brianaker/drizzle/update-bootstrap-april-20113/ Build: jenkins-Drizzle-Builder-192

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# lib-link.m4 serial 18 (gettext-0.18)
2
 
dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
 
1
# lib-link.m4 serial 21 (gettext-0.18)
 
2
dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
43
43
  popdef([Name])
44
44
])
45
45
 
46
 
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [system])
 
46
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
47
47
dnl searches for libname and the libraries corresponding to explicit and
48
48
dnl implicit dependencies, together with the specified include files and
49
 
dnl the ability to compile and link the specified testcode. If found, it
50
 
dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
51
 
dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
 
49
dnl the ability to compile and link the specified testcode. The missing-message
 
50
dnl defaults to 'no' and may contain additional hints for the user.
 
51
dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
 
52
dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
52
53
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
53
54
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
54
55
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
63
64
 
64
65
  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
65
66
  dnl accordingly.
66
 
  AC_LIB_LINKFLAGS_BODY([$1], [$2], [$5])
 
67
  AC_LIB_LINKFLAGS_BODY([$1], [$2])
67
68
 
68
69
  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
69
70
  dnl because if the user has installed lib[]Name and not disabled its use
73
74
 
74
75
  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
75
76
    ac_save_LIBS="$LIBS"
76
 
    LIBS="$LIBS $LIB[]NAME"
77
 
    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
 
77
    dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
 
78
    dnl because these -l options might require -L options that are present in
 
79
    dnl LIBS. -l options benefit only from the -L options listed before it.
 
80
    dnl Otherwise, add it to the front of LIBS, because it may be a static
 
81
    dnl library that depends on another static library that is present in LIBS.
 
82
    dnl Static libraries benefit only from the static libraries listed after
 
83
    dnl it.
 
84
    case " $LIB[]NAME" in
 
85
      *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
 
86
      *)       LIBS="$LIB[]NAME $LIBS" ;;
 
87
    esac
 
88
    AC_TRY_LINK([$3], [$4],
 
89
      [ac_cv_lib[]Name=yes],
 
90
      [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
78
91
    LIBS="$ac_save_LIBS"
79
92
  ])
80
93
  if test "$ac_cv_lib[]Name" = yes; then
81
94
    HAVE_LIB[]NAME=yes
82
 
    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
 
95
    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
83
96
    AC_MSG_CHECKING([how to link with lib[]$1])
84
97
    AC_MSG_RESULT([$LIB[]NAME])
85
98
  else
157
170
  popdef([PACK])
158
171
])
159
172
 
160
 
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies, system]) searches for
161
 
dnl libname and the libraries corresponding to explicit and implicit
162
 
dnl dependencies.
 
173
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
 
174
dnl the libraries corresponding to explicit and implicit dependencies.
163
175
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
164
176
dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
165
177
dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
166
 
dnl If system==system, -isystem is used instead of -I
167
178
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
168
179
[
169
180
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
177
188
  pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)])
178
189
  dnl By default, look in $includedir and $libdir.
179
190
  use_additional=yes
180
 
  if test "x$GCC" = "xyes" -a "x$3" = "xsystem"
181
 
  then
182
 
    i_system="-isystem "
183
 
  else
184
 
    i_system="-I"
185
 
  fi
186
 
 
187
191
  AC_LIB_WITH_FINAL_PREFIX([
188
192
    eval additional_includedir=\"$includedir\"
189
193
    eval additional_libdir=\"$libdir\"
216
220
  LTLIB[]NAME=
217
221
  INC[]NAME=
218
222
  LIB[]NAME[]_PREFIX=
 
223
  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
 
224
  dnl computed. So it has to be reset here.
 
225
  HAVE_LIB[]NAME=
219
226
  rpathdirs=
220
227
  ltrpathdirs=
221
228
  names_already_handled=
488
495
                if test -z "$haveit"; then
489
496
                  for x in $CPPFLAGS $INC[]NAME; do
490
497
                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
491
 
                    if test "X$x" = "X${i_system}$additional_includedir"; then
 
498
                    if test "X$x" = "X-I$additional_includedir"; then
492
499
                      haveit=yes
493
500
                      break
494
501
                    fi
496
503
                  if test -z "$haveit"; then
497
504
                    if test -d "$additional_includedir"; then
498
505
                      dnl Really add $additional_includedir to $INCNAME.
499
 
                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }${i_system}$additional_includedir"
 
506
                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
500
507
                    fi
501
508
                  fi
502
509
                fi