Fix autoconf to have a new WINE_TRY_SHLIB_FLAGS function that tests if
the provided flags can be used to link a shared library.
Added test for building shared libs on HP-UX with gcc.
diff --git a/aclocal.m4 b/aclocal.m4
index 76813bd..76b33bd 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -68,6 +68,16 @@
AC_TRY_LINK([],[],[$2],[$3])
CFLAGS=$ac_wine_try_cflags_saved])
+dnl **** Check if we can link an empty shared lib (no main) with special CFLAGS ****
+dnl
+dnl Usage: WINE_TRY_SHLIB_FLAGS(flags,[action-if-yes,[action-if-no]])
+dnl
+AC_DEFUN([WINE_TRY_SHLIB_FLAGS],
+[ac_wine_try_cflags_saved=$CFLAGS
+CFLAGS="$CFLAGS $1"
+AC_LINK_IFELSE([void myfunc() {}],[$2],[$3])
+CFLAGS=$ac_wine_try_cflags_saved])
+
dnl **** Check whether we need to define a symbol on the compiler command line ****
dnl
dnl Usage: WINE_CHECK_DEFINE(name),[action-if-yes,[action-if-no]])
diff --git a/configure b/configure
index 9ee57ea..f2ea42e 100755
--- a/configure
+++ b/configure
@@ -13777,19 +13777,7 @@
ac_wine_try_cflags_saved=$CFLAGS
CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0,-Bsymbolic"
cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
+void myfunc() {}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
@@ -14150,19 +14138,7 @@
ac_wine_try_cflags_saved=$CFLAGS
CFLAGS="$CFLAGS -fPIC -Wl,-G,-h,conftest.so.1.0,-B,symbolic"
cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
+void myfunc() {}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
@@ -14212,19 +14188,7 @@
ac_wine_try_cflags_saved=$CFLAGS
CFLAGS="$CFLAGS -bundle"
cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
+void myfunc() {}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
@@ -14276,6 +14240,57 @@
IOKITLIB="-framework IOKit"
IOKITLIB = "$IOKITLIB $COREFOUNDATIONLIB"
+ else
+ echo "$as_me:$LINENO: checking whether we can build an HP-UX dll" >&5
+echo $ECHO_N "checking whether we can build an HP-UX dll... $ECHO_C" >&6
+if test "${ac_cv_c_dll_hpux+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_wine_try_cflags_saved=$CFLAGS
+CFLAGS="$CFLAGS -shared"
+cat >conftest.$ac_ext <<_ACEOF
+void myfunc() {}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_dll_hpux="yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_dll_hpux="no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+CFLAGS=$ac_wine_try_cflags_saved
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_dll_hpux" >&5
+echo "${ECHO_T}$ac_cv_c_dll_hpux" >&6
+ if test "$ac_cv_c_dll_hpux" = "yes"
+ then
+ LIBEXT="sl"
+ LDDLLFLAGS="-shared"
+ LDSHARED="\$(CC) -shared"
+ fi
fi
fi
fi
diff --git a/configure.ac b/configure.ac
index b4bb3a2..aba1816 100644
--- a/configure.ac
+++ b/configure.ac
@@ -878,8 +878,8 @@
DLLFLAGS="$DLLFLAGS -fPIC"
DLLEXT=".so"
AC_CACHE_CHECK([whether we can build a GNU style ELF dll], ac_cv_c_dll_gnuelf,
- [WINE_TRY_CFLAGS([-fPIC -shared -Wl,-soname,conftest.so.1.0,-Bsymbolic],
- ac_cv_c_dll_gnuelf="yes",ac_cv_c_dll_gnuelf="no")])
+ [WINE_TRY_SHLIB_FLAGS([-fPIC -shared -Wl,-soname,conftest.so.1.0,-Bsymbolic],
+ ac_cv_c_dll_gnuelf="yes",ac_cv_c_dll_gnuelf="no")])
if test "$ac_cv_c_dll_gnuelf" = "yes"
then
LDSHARED="\$(CC) -shared \$(SONAME:%=-Wl,-soname,%)"
@@ -932,8 +932,8 @@
else
AC_CACHE_CHECK(whether we can build a UnixWare (Solaris) dll, ac_cv_c_dll_unixware,
- [WINE_TRY_CFLAGS([-fPIC -Wl,-G,-h,conftest.so.1.0,-B,symbolic],
- ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")])
+ [WINE_TRY_SHLIB_FLAGS([-fPIC -Wl,-G,-h,conftest.so.1.0,-B,symbolic],
+ ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")])
if test "$ac_cv_c_dll_unixware" = "yes"
then
LDSHARED="\$(CC) -Wl,-G \$(SONAME:%=-Wl,-h,%)"
@@ -941,7 +941,7 @@
else
AC_CACHE_CHECK(whether we can build a Mach-O (Mac OS X/Darwin) dll, ac_cv_c_dll_macho,
- [WINE_TRY_CFLAGS([-bundle], ac_cv_c_dll_macho="yes", ac_cv_c_dll_macho="no")])
+ [WINE_TRY_SHLIB_FLAGS([-bundle], ac_cv_c_dll_macho="yes", ac_cv_c_dll_macho="no")])
if test "$ac_cv_c_dll_macho" = "yes"
then
LIBEXT="dylib"
@@ -958,6 +958,15 @@
AC_SUBST(IOKITLIB,"-framework IOKit")
dnl using IOKit imply we use CoreFoundation too
IOKITLIB = "$IOKITLIB $COREFOUNDATIONLIB"
+ else
+ AC_CACHE_CHECK(whether we can build an HP-UX dll, ac_cv_c_dll_hpux,
+ [WINE_TRY_SHLIB_FLAGS([-shared], ac_cv_c_dll_hpux="yes", ac_cv_c_dll_hpux="no")])
+ if test "$ac_cv_c_dll_hpux" = "yes"
+ then
+ LIBEXT="sl"
+ LDDLLFLAGS="-shared"
+ LDSHARED="\$(CC) -shared"
+ fi
fi
fi
fi