1AC_DEFUN([LIBBURNIA_SET_FLAGS],
2[
3case $target_os in
4freebsd* | netbsd*)
5        LDFLAGS="$LDFLAGS -L/usr/local/lib"
6        CPPFLAGS="$CPPFLAGS -I/usr/local/include"
7        ;;
8esac
9])
10
11
12AC_DEFUN([TARGET_SHIZZLE],
13[
14  ARCH=""
15  LIBBURNIA_PKGCONFDIR="$libdir"/pkgconfig
16
17  AC_MSG_CHECKING([target operating system])
18
19  LIBBURNIA_LDCONFIG_CMD="echo 'No ldconfig run performed. If needed, configure manually for:'"
20
21  case $target in
22    *-*-linux*)
23      ARCH=linux
24      LIBBURN_ARCH_LIBS=
25      LIBBURNIA_LDCONFIG_CMD=ldconfig
26      ;;
27    *-*-freebsd*)
28      ARCH=freebsd
29      LIBBURN_ARCH_LIBS=-lcam
30      LIBBURNIA_PKGCONFDIR=$(echo "$libdir" | sed 's/\/lib$/\/libdata/')/pkgconfig
31      ;;
32    *-kfreebsd*-gnu*)
33      ARCH=freebsd
34      LIBBURN_ARCH_LIBS=-lcam
35      ;;
36    *-solaris*)
37      ARCH=solaris
38      LIBBURN_ARCH_LIBS=-lvolmgt
39      ;;
40    *)
41      ARCH=
42      LIBBURN_ARCH_LIBS=
43#      AC_ERROR([You are attempting to compile for an unsupported platform])
44      ;;
45  esac
46
47  AC_MSG_RESULT([$ARCH])
48])
49
50
51dnl LIBBURN_ASSERT_VERS_LIBS is by Thomas Schmitt, libburnia project
52dnl It tests whether -Wl,--version-script=... works with the compiler
53AC_DEFUN([LIBBURN_ASSERT_VERS_LIBS],
54[
55    libburnia_save_LDFLAGS="$LDFLAGS"
56    LDFLAGS="$LDFLAGS -Wl,--version-script=$srcdir/libburn/libburn.ver"
57    AC_TRY_LINK([#include <stdio.h>], [printf("Hello\n");],
58                [vers_libs_test="yes"], [vers_libs_test="no"])
59    if test x$vers_libs_test = xyes
60    then
61        LIBLDFLAGS="-Wl,--version-script=$srcdir/libburn/libburn.ver"
62    fi
63    LDFLAGS="$libburnia_save_LDFLAGS"
64    AC_SUBST(LIBLDFLAGS)
65])
66
67
68dnl LIBBURNIA_SET_PKGCONFIG determines the install directory for the *.pc file.
69dnl Important: Must be performed _after_ TARGET_SHIZZLE
70dnl
71AC_DEFUN([LIBBURNIA_SET_PKGCONFIG],
72[
73### for testing --enable-libdir-pkgconfig on Linux
74### LIBBURNIA_PKGCONFDIR="$libdir"data/pkgconfig
75
76if test "x$LIBBURNIA_PKGCONFDIR" = "x$libdir"/pkgconfig
77then
78  dummy=dummy
79else
80  AC_ARG_ENABLE(libdir-pkgconfig,
81  [  --enable-libdir-pkgconfig  Install to $libdir/pkgconfig on any OS, default=no],
82   , enable_libdir_pkgconfig="no")
83  AC_MSG_CHECKING([for --enable-libdir-pkgconfig])
84  if test "x$enable_libdir_pkgconfig" = xyes
85  then
86    LIBBURNIA_PKGCONFDIR="$libdir"/pkgconfig
87  fi
88  AC_MSG_RESULT([$enable_libdir_pkgconfig])
89fi
90
91libburnia_pkgconfig_override="no"
92AC_ARG_ENABLE(pkgconfig-path,
93[  --enable-pkgconfig-path=DIR  Absolute path of directory for libisofs-*.pc],
94libburnia_pkgconfig_override="yes" , enable_pkgconfig_path="none")
95AC_MSG_CHECKING([for overridden pkgconfig directory path])
96if test "x$enable_pkgconfig_path" = xno
97then
98  libburnia_pkgconfig_override="no"
99fi
100if test "x$enable_pkgconfig_path" = x -o "x$enable_pkgconfig_path" = xyes
101then
102  libburnia_pkgconfig_override="invalid argument"
103fi
104if test "x$libburnia_pkgconfig_override" = xyes
105then
106  LIBBURNIA_PKGCONFDIR="$enable_pkgconfig_path"
107  AC_MSG_RESULT([$LIBBURNIA_PKGCONFDIR])
108else
109  AC_MSG_RESULT([$libburnia_pkgconfig_override])
110fi
111AC_SUBST(LIBBURNIA_PKGCONFDIR)
112
113dnl For debugging only
114### AC_MSG_RESULT([LIBBURNIA_PKGCONFDIR = $LIBBURNIA_PKGCONFDIR])
115
116])
117
118dnl LIBBURNIA_CHECK_ARCH_LIBS is by Thomas Schmitt, libburnia project
119dnl It tests whether the OS dependent libraries are available.
120dnl With libisoburn they are needed only for the case that indirect linking
121dnl does not work. So it is worth a try to omit them.
122dnl $1 = "mandatory" or "optional" define the action if test linking fails.
123AC_DEFUN([LIBBURNIA_CHECK_ARCH_LIBS],
124[
125    libburnia_save_LIBS="$LIBS"
126    if test "x$LIBBURN_ARCH_LIBS" = x
127    then
128      dummy=dummy
129    else
130      LIBS="$LIBS $LIBBURN_ARCH_LIBS"
131      AC_TRY_LINK([#include <stdio.h>], [printf("Hello\n");],
132                  [archlibs_test="yes"], [archlibs_test="no"])
133      LIBS="$libburnia_save_LIBS"
134      if test x$archlibs_test = xno
135      then
136        if test x"$1" = xmandatory
137        then
138          echo >&2
139          echo "FATAL: Test linking with mandatory library options failed: $LIBBURN_ARCH_LIBS" >&2
140          echo >&2
141          (exit 1); exit 1;
142        else
143          echo "disabled linking with $LIBBURN_ARCH_LIBS (because not found)"
144          LIBBURN_ARCH_LIBS=""
145        fi
146      else
147        echo "enabled  linking with $LIBBURN_ARCH_LIBS"
148      fi
149    fi
150])
151
152
153dnl LIBBURNIA_CHECK_LINUX_SCSI is by Thomas Schmitt, libburnia project
154dnl
155AC_DEFUN([LIBBURNIA_CHECK_LINUX_SCSI],
156[
157  dnl Check whether it is a Linux without scsi/scsi.h
158  AH_TEMPLATE([Libburn_use_sg_dummY],
159              [Define to compile without OS specific SCSI features])
160  AC_MSG_CHECKING([for missing scsi/scsi.h on Linux])
161  AC_TRY_COMPILE([
162#ifdef __linux
163#include <scsi/scsi.h>
164#endif
165     ],
166     [;],
167     [AC_MSG_RESULT([no])],
168     [AC_DEFINE([Libburn_use_sg_dummY], [yes])
169      AC_MSG_RESULT([yes])]
170  )
171])
172
173