File: libm.m4

package info (click to toggle)
mysql%2B%2B 3.2.1%2Bpristine-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,624 kB
  • ctags: 11,252
  • sloc: cpp: 35,659; sh: 3,034; makefile: 951; perl: 786
file content (37 lines) | stat: -rw-r--r-- 802 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
dnl @synopsis LIB_MATH
dnl 
dnl This macro figures out how whether programs using C's math routines
dnl need to link to libm or not.  This is common on SysV Unices.
dnl
dnl @category C
dnl @author Warren Young <warren@etr-usa.com>
dnl @version 1.2, 2006-03-06

AC_DEFUN([LIB_MATH],
[
	AC_MSG_CHECKING([whether -lm is needed to use C math functions])
	
	MYSQLPP_EXTRA_LIBS=
	TRY_LIBM=no
	AC_TRY_LINK(
		[ #include <math.h> ],
		[ floor(0); ], AC_MSG_RESULT(no), TRY_LIBM=yes)

	if test "x$TRY_LIBM" = "xyes"
	then
		save_LIBS=$LIBS
		LIBS="$LIBS -lm"
		AC_TRY_LINK(
			[ #include <math.h> ],
			[ floor(0); ],
			[ 
				MYSQLPP_EXTRA_LIBS=-lm 
				AC_MSG_RESULT(yes)
			],
			AC_MSG_ERROR([Failed to build program containing math functions!]))
		LIBS="$save_LIBS"
	fi

	AC_SUBST(MYSQLPP_EXTRA_LIBS)
])