-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
137 lines (116 loc) · 3.32 KB
/
configure.ac
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/cd.c)
LIBCDLYTE_MAJOR_VERSION=1
LIBCDLYTE_MINOR_VERSION=0
LIBCDLYTE_PATCH_LEVEL=0
AC_SUBST(LIBCDLYTE_MAJOR_VERSION)
AC_SUBST(LIBCDLYTE_MINOR_VERSION)
AC_SUBST(LIBCDLYTE_PATCH_LEVEL)
LIBCDLYTE_VERSION=$LIBCDLYTE_MAJOR_VERSION.$LIBCDLYTE_MINOR_VERSION.$LIBCDLYTE_PATCH_LEVEL
AC_SUBST(LIBCDLYTE_VERSION)
dnl Calculate libtool versioning information
LT_CURRENT=1
LT_REVISION=0
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
LT_VERSION=$LT_CURRENT:$LT_REVISION:$LT_AGE
AC_SUBST(LT_VERSION)
dnl Automake support
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(libcdlyte, ${LIBCDLYTE_VERSION})
dnl Checks for programs.
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_GCC_TRADITIONAL
AC_CANONICAL_HOST
AM_PROG_CC_STDC
AM_PROG_LIBTOOL
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h linux/cdrom.h linux/ucdrom.h sys/cdio.h io/cam/cdrom.h stdarg.h mntent.h sys/mntent.h sys/ucred.h sys/mount.h)
dnl Checks for libraries
AC_CHECK_LIB(m,main)
CFLAGS=""
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(long)
dnl Checks for library functions
AC_FUNC_GETMNTENT
AC_CHECK_FUNCS(gethostbyname gethostbyname_r mkdir socket strerror strstr strtol snprintf getmntinfo)
dnl Check operating system
case "$host_os" in
irix*)
AC_DEFINE(IRIX_CDLYTE,1,[Enable IRIX support])
LIBRARY_LIBS="-lcdaudio -lmediad -lds $LIBS"
;;
*solaris*)
AC_DEFINE(SOLARIS_GETMNTENT,1,[Enable Solaris 'getmntent' support])
AC_DEFINE(BROKEN_SOLARIS_LEADOUT,1,[Enable fixes for Solaris leadout issues])
;;
esac
dnl Debugging turned on
dnl If using gcc, turn on special debugging mode suitable for gdb
AC_MSG_CHECKING(for debugging)
AC_ARG_ENABLE(debug,[ --enable-debug compile for debugging])
if test "x$enable_debug" = "xyes" ; then
AC_MSG_RESULT(yes)
if test "$GCC" != "" ; then
CFLAGS="-ggdb3 -DDEBUG"
else
CFLAGS="-g -DDEBUG"
fi
else
AC_MSG_RESULT(no)
fi
dnl Building for release
AC_MSG_CHECKING(for release build)
AC_ARG_ENABLE(release,[ --enable-release compile for release])
if test "x$enable_release" = "xyes" ; then
AC_MSG_RESULT(yes)
CFLAGS="-O2 -DNDEBUG"
if test "${GCC}" = "yes" ; then
CFLAGS="${CFLAGS} -Wuninitialized -ffast-math -finline-functions -fomit-frame-pointer -fexpensive-optimizations"
fi
else
AC_MSG_RESULT(no)
fi
dnl Add copious amounts of debugging with gcc, egcs, etc
if test "${GCC}" = "yes" ; then
CFLAGS="${CFLAGS} -Wall -W -Wmissing-prototypes -Wformat"
fi
dnl Check for threading support
threads=no
AC_ARG_ENABLE(threads,
[ --enable-threads build a thread-safe version of libcdlyte [default=guessed]],
[if test "$enableval" = "yes"; then
threads=yes
else
threads=no
fi])
dnl POSIX.4 threads
if test "$threads" = "yes"; then
AC_CHECK_LIB(pthread,pthread_create,threads=-lpthread,threads=no)
else
AC_CHECK_LIB(c_r,pthread_create,threads=-lc_r,threads=no)
fi
if test "$threads" != "no"; then
AC_DEFINE(HAVE_PTHREAD,1,[Enable support for POSIX threads])
CFLAGS="$CFLAGS -D_REENTRANT"
LIBRARY_LIB="$threads $LIBRARY_LIB"
REENTRANT="-D_REENTRANT"
fi
AC_SUBST(REENTRANT)
AC_SUBST(LIBS)
AC_SUBST(LIB_LDADD)
AC_OUTPUT([
Makefile
src/Makefile
src/cdver.h
tests/Makefile
])