File: configure.ac

package info (click to toggle)
libcddb 1.3.2-6
  • links: PTS
  • area: main
  • in suites: buster
  • size: 2,276 kB
  • sloc: sh: 10,946; ansic: 4,721; makefile: 44
file content (209 lines) | stat: -rw-r--r-- 6,975 bytes parent folder | download | duplicates (4)
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.55)
AC_INIT(libcddb, 1.3.2)
AC_CONFIG_SRCDIR(configure.ac)
AM_CONFIG_HEADER(config.h)
AC_CONFIG_FILES([Makefile              \
                 libcddb.pc            \
                 include/Makefile      \
                 include/cddb/Makefile \
                 include/cddb/cddb_config.h \
                 include/cddb/version.h \
                 lib/Makefile          \
                 examples/Makefile     \
                 tests/Makefile        \
                 tests/settings.sh])
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE

LIBCDDB_VERSION_NUM=131
AC_SUBST(LIBCDDB_VERSION_NUM)

dnl iconv uses gettext macros (dependency on config.rpath)
AM_GNU_GETTEXT_VERSION(0.14.4)

dnl Process custom command-line options
AC_ARG_ENABLE([loglevel],
              AC_HELP_STRING([--enable-loglevel=LVL],
                             [set default log level to one of debug, info, warn, ]
                             [error, critical or none (default=warn)]),
              default_loglevel=$enableval, default_loglevel=$enableval)
if test x$default_loglevel = xdebug; then
    default_loglevel="CDDB_LOG_DEBUG"
elif test x$default_loglevel = xinfo; then
    default_loglevel="CDDB_LOG_INFO"
elif test x$default_loglevel = xwarn -o x$default_loglevel = xyes; then
    default_loglevel="CDDB_LOG_WARN"
elif test x$default_loglevel = xerror; then
    default_loglevel="CDDB_LOG_ERROR"
elif test x$default_loglevel = xcritical; then
    default_loglevel="CDDB_LOG_CRITICAL"
elif test x$default_loglevel = xnone -o x$default_loglevel = xno; then
    default_loglevel="CDDB_LOG_NONE"
elif test x$default_loglevel != x; then
    AC_MSG_WARN([invalid loglevel, using default])
fi

if test x$default_loglevel != x; then
    AC_DEFINE_UNQUOTED([LOGLEVEL],$default_loglevel,[Set to default log level])
fi

AC_ARG_WITH([cdio],
            AC_HELP_STRING([--without-cdio],
                           [do not use libcdio functionality when building the ]
                           [example program (default = use if found)]))
AC_ARG_WITH([iconv],
            AC_HELP_STRING([--without-iconv],
                           [do not include character set conversion support using ]
                           [the iconv library (default = enabled if found)]))

dnl Check for target
AC_CANONICAL_HOST
case $host in
    *beos*)
        AC_DEFINE([BEOS],1,[Define if compiling on BeOS system.])
        ;;
    *darwin*)
        AC_DEFINE([CDDB_NEED_UNISTD_H],1,
        [Define if you have <unistd.h> and need it included. 
         On MacOS, <regex.h> needs this but that header doesn't
         include it.])
        AC_DEFINE([CDDB_NEED_SYS_SOCKET_H],1,
        [Define if you have <sys/socket.h> and need it included. 
         On MacOS, <cddb_net.h> needs this but that header doesn't
         include it.])
        ;;
    *haiku*)
        AC_DEFINE([HAIKU],1,[Define if compiling on Haiku system.])
        AC_DEFINE([CDDB_NEED_UNISTD_H],1,
        [Define if you have <unistd.h> and need it included.])
        AC_DEFINE([CDDB_NEED_SYS_SOCKET_H],1,
        [Define if you have <sys/socket.h> and need it included.])
        ;;
esac

dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

dnl Checks for libraries.
AC_CHECK_LIB([socket], [connect])
AC_CHECK_LIB([network], [connect])

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h regex.h stdlib.h string.h sys/socket.h])
AC_CHECK_HEADERS([unistd.h errno.h time.h sys/time.h fcntl.h windows.h winsock2.h])

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T

dnl Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([mkdir regcomp socket strdup strtol strchr memset alarm select realloc])
AC_CHECK_FUNC([gethostbyname], , AC_CHECK_LIB([nsl], [gethostbyname]))

dnl Check for libcdio
if test x$with_cdio != xno; then
    PKG_CHECK_MODULES(LIBCDIO, libcdio >= 0.76, [
        HAVE_LIBCDIO=yes 
        AC_DEFINE(HAVE_LIBCDIO, [], [Define this if you have libcdio installed])
        ],
        [AC_MSG_WARN(new enough libcdio not found. CD reading in CDDB test program disabled. Get libcdio from http://www.gnu.org/software/libcdio/) 
        HAVE_LIBCDIO=no])
    AC_SUBST(LIBCDIO_LIBS)
    AC_SUBST(LIBCDIO_CFLAGS)
else
    HAVE_LIBCDIO=no
fi

dnl Check for iconv
if test x$with_iconv != xno; then
    AC_CHECK_HEADERS([iconv.h], [with_iconv=1], [with_iconv=0])
    AM_ICONV
else
    with_iconv=0
fi
AC_SUBST(with_iconv)

dnl Check and add some GCC specific warning flags
dnl - we do this as the last thing so that a possible -Werror flag
dnl - does not cause a failure in one of the other tests above
if test "x$GCC" != "xyes" 
then
    echo "*** non GNU CC compiler detected."
    echo "*** This package has not been tested very well with non GNU compilers"
    echo "*** you should try to use 'gcc' for compiling this package."
else
    WARN_CFLAGS="-Wall -Wchar-subscripts -Wmissing-prototypes -Wmissing-declarations"
    WARN_CFLAGS="$WARN_CFLAGS -Wunused -Wpointer-arith -Wwrite-strings -Wnested-externs"
    WARN_CFLAGS="$WARN_CFLAGS -Wno-sign-compare"
dnl MAINTAINER_CFLAGS="-std=c99 -pedantic -Werror -O0"
dnl MAINTAINER_CFLAGS="-Werror -O0"
    MAINTAINER_CFLAGS="-Werror"

    if test "x$enable_maintainer_mode" = "xyes"; then
        maintainer_flags=""
        for MOPT in $MAINTAINER_CFLAGS; do
            SAVE_CFLAGS="$CFLAGS"
            CFLAGS="$CFLAGS $MOPT"
            AC_MSG_CHECKING([whether $CC accepts $MOPT])
            AC_TRY_COMPILE([], [], has_option=yes, has_option=no)
            CFLAGS="$SAVE_CFLAGS"
            AC_MSG_RESULT($has_option)
            if test "x$has_option" = "xyes"; then
                maintainer_flags="$maintainer_flags $MOPT"
            fi
            unset has_option
            unset SAVE_CFLAGS
        done
        unset MOPT
        MAINTAINER_CFLAGS="$maintainer_flags"
        unset maintainer_flags
    else
        MAINTAINER_CFLAGS=""
    fi

    warning_flags=""
    for WOPT in $WARN_CFLAGS; do
        SAVE_CFLAGS="$CFLAGS"
        CFLAGS="$CFLAGS $WOPT"
        AC_MSG_CHECKING([whether $CC accepts $WOPT])
        AC_TRY_COMPILE([], [], has_option=yes, has_option=no)
        CFLAGS="$SAVE_CFLAGS"
        AC_MSG_RESULT($has_option)
        if test "x$has_option" = "xyes"; then
            warning_flags="$warning_flags $WOPT"
        fi
        unset has_option
        unset SAVE_CFLAGS
    done
    unset WOPT
    WARN_CFLAGS="$warning_flags"
    unset warning_flags
fi
CFLAGS="$CFLAGS $WARN_CFLAGS $MAINTAINER_CFLAGS"

dnl Additional configuration (platform dependant)
case $host in
    *mingw*)
        LIBS="$LIBS -lws2_32 -lregex"
        ;;
    *)
        ;;
esac

dnl Create makefiles
AC_OUTPUT