File: configure.ac

package info (click to toggle)
libnss-mysql 1.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 440 kB
  • sloc: ansic: 1,666; sql: 295; makefile: 45; sh: 30
file content (102 lines) | stat: -rw-r--r-- 2,902 bytes parent folder | download
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
dnl Copyright 2002 Ben Goodwin
dnl Copyright 2024 Bob Proulx <bob@proulx.com>
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License
dnl as published by the Free Software Foundation; either version 2
dnl of the License, or (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, see <https://www.gnu.org/licenses/>.

AC_PREREQ([2.59])
AC_INIT([libnss-mysql],[1.6.1],[bob@proulx.com])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([-Wall])

AC_PROG_CC
AM_PROG_AR

case "$target_os" in
linux*)
    CPPFLAGS="$CPPFLAGS -D_REENTRANT"
    LIBVER=2
    OS=linux
    RENAME=false
    test "$prefix" = "NONE" && prefix=
    ;;
solaris*)
    CPPFLAGS="$CPPFLAGS -D_REENTRANT"
    LIBVER=1
    OS=solaris
    RENAME=true
    test "$prefix" = "NONE" && prefix= && libdir=/usr/lib
    ;;
freebsd*)
    CPPFLAGS="$CPPFLAGS -DPIC -D_REENTRANT"
    LIBVER=1
    OS=freebsd
    RENAME=true
    test "$prefix" = "NONE" && prefix= && libdir=/usr/lib
    ;;
*)  OS=unknown
    ;;
esac

AM_CONDITIONAL(RENAME, test "$RENAME" = "true")

AC_CACHE_CHECK([whether the linker accepts -znodelete],
               [nss_mysql_cv_cc_znodelete], [
    SAVELIBS=$LIBS
    LIBS="-Wl,-znodelete $SAVELIBS"
    AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[nss_mysql_cv_cc_znodelete=yes],[nss_mysql_cv_cc_znodelete=no])
    LIBS=$SAVELIBS])
if test $nss_mysql_cv_cc_znodelete = "yes"; then
    LIBS="-Wl,-znodelete $SAVELIBS"
fi

AC_SUBST(LIBVER)
AC_SUBST(OS)

AC_CHECK_LIB(socket, getsockname)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(m, floor)
AC_CHECK_LIB(dl, dlsym)
AC_CHECK_LIB(z, compress)

AC_CHECK_LIB(mysqlclient, main, ,
             [AC_MSG_ERROR([Unable find a functioning MySQL library])])

CFLAGS="$CFLAGS $(mysql_config --cflags)"
LDFLAGS="$LDFLAGS $(mysql_config --libs)"

AC_CHECK_HEADER([mysql.h], , [AC_MSG_ERROR([Unable to find mysql.h])])
AC_CHECK_HEADERS([syslog.h stdint.h nss.h nss_common.h shadow.h])

AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_CHECK_TYPES([socklen_t], , , [
#include <unistd.h>
#include <sys/socket.h>
])

EXPANDED_SYSCONFDIR=`eval echo $sysconfdir`
AC_DEFINE_UNQUOTED([MAINCFG], "$EXPANDED_SYSCONFDIR/libnss-mysql.cfg",
                   [Main config file])
AC_DEFINE_UNQUOTED([ROOTCFG],"$EXPANDED_SYSCONFDIR/libnss-mysql-root.cfg",
                   [Root config file])

LT_INIT([disable-static])

AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT