Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitde1a697

Browse files
committed
Improve getopt_long search, per Peter:
AC_SEARCH_LIBS(getopt_long, [getopt])
1 parent5af19e4 commitde1a697

File tree

2 files changed

+69
-20
lines changed

2 files changed

+69
-20
lines changed

‎configure

Lines changed: 67 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6045,19 +6045,70 @@ _ACEOF
60456045
60466046
fi
60476047
6048-
6049-
echo"$as_me:$LINENO: checking for main in -lgetopt">&5
6050-
echo$ECHO_N"checking for main in -lgetopt...$ECHO_C">&6
6051-
iftest"${ac_cv_lib_getopt_main+set}" =set;then
6048+
echo"$as_me:$LINENO: checking for library containing getopt_long">&5
6049+
echo$ECHO_N"checking for library containing getopt_long...$ECHO_C">&6
6050+
iftest"${ac_cv_search_getopt_long+set}" =set;then
60526051
echo$ECHO_N"(cached)$ECHO_C">&6
60536052
else
6054-
ac_check_lib_save_LIBS=$LIBS
6055-
LIBS="-lgetopt$LIBS"
6053+
ac_func_search_save_LIBS=$LIBS
6054+
ac_cv_search_getopt_long=no
60566055
cat>conftest.$ac_ext<<_ACEOF
60576056
#line$LINENO "configure"
60586057
#include "confdefs.h"
60596058
6059+
/* Override any gcc2 internal prototype to avoid an error. */
6060+
#ifdef __cplusplus
6061+
extern "C"
6062+
#endif
6063+
/* We use char because int might match the return type of a gcc2
6064+
builtin and then its argument prototype would still apply. */
6065+
char getopt_long ();
6066+
#ifdef F77_DUMMY_MAIN
6067+
# ifdef __cplusplus
6068+
extern "C"
6069+
# endif
6070+
int F77_DUMMY_MAIN() { return 1; }
6071+
#endif
6072+
int
6073+
main ()
6074+
{
6075+
getopt_long ();
6076+
;
6077+
return 0;
6078+
}
6079+
_ACEOF
6080+
rm -f conftest.$ac_objext conftest$ac_exeext
6081+
if { (evalecho"$as_me:$LINENO:\"$ac_link\"")>&5
6082+
(eval$ac_link)2>&5
6083+
ac_status=$?
6084+
echo"$as_me:$LINENO:\$? =$ac_status">&5
6085+
(exit$ac_status); }&&
6086+
{ ac_try='test -s conftest$ac_exeext'
6087+
{ (evalecho"$as_me:$LINENO:\"$ac_try\"")>&5
6088+
(eval$ac_try)2>&5
6089+
ac_status=$?
6090+
echo"$as_me:$LINENO:\$? =$ac_status">&5
6091+
(exit$ac_status); }; };then
6092+
ac_cv_search_getopt_long="none required"
6093+
else
6094+
echo"$as_me: failed program was:">&5
6095+
cat conftest.$ac_ext>&5
6096+
fi
6097+
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
6098+
iftest"$ac_cv_search_getopt_long" = no;then
6099+
forac_libin getopt;do
6100+
LIBS="-l$ac_lib$ac_func_search_save_LIBS"
6101+
cat>conftest.$ac_ext<<_ACEOF
6102+
#line$LINENO "configure"
6103+
#include "confdefs.h"
60606104
6105+
/* Override any gcc2 internal prototype to avoid an error. */
6106+
#ifdef __cplusplus
6107+
extern "C"
6108+
#endif
6109+
/* We use char because int might match the return type of a gcc2
6110+
builtin and then its argument prototype would still apply. */
6111+
char getopt_long ();
60616112
#ifdef F77_DUMMY_MAIN
60626113
# ifdef __cplusplus
60636114
extern "C"
@@ -6067,7 +6118,7 @@ cat >conftest.$ac_ext <<_ACEOF
60676118
int
60686119
main ()
60696120
{
6070-
main ();
6121+
getopt_long ();
60716122
;
60726123
return 0;
60736124
}
@@ -6084,23 +6135,21 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
60846135
ac_status=$?
60856136
echo"$as_me:$LINENO:\$? =$ac_status">&5
60866137
(exit$ac_status); }; };then
6087-
ac_cv_lib_getopt_main=yes
6138+
ac_cv_search_getopt_long="-l$ac_lib"
6139+
break
60886140
else
60896141
echo"$as_me: failed program was:">&5
60906142
cat conftest.$ac_ext>&5
6091-
ac_cv_lib_getopt_main=no
60926143
fi
60936144
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
6094-
LIBS=$ac_check_lib_save_LIBS
6145+
done
60956146
fi
6096-
echo"$as_me:$LINENO: result:$ac_cv_lib_getopt_main">&5
6097-
echo"${ECHO_T}$ac_cv_lib_getopt_main">&6
6098-
iftest$ac_cv_lib_getopt_main = yes;then
6099-
cat>>confdefs.h<<_ACEOF
6100-
#define HAVE_LIBGETOPT 1
6101-
_ACEOF
6102-
6103-
LIBS="-lgetopt$LIBS"
6147+
LIBS=$ac_func_search_save_LIBS
6148+
fi
6149+
echo"$as_me:$LINENO: result:$ac_cv_search_getopt_long">&5
6150+
echo"${ECHO_T}$ac_cv_search_getopt_long">&6
6151+
iftest"$ac_cv_search_getopt_long"!= no;then
6152+
test"$ac_cv_search_getopt_long" ="none required"|| LIBS="$ac_cv_search_getopt_long$LIBS"
61046153
61056154
fi
61066155

‎configure.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $Header: /cvsroot/pgsql/configure.in,v 1.190 2002/07/16 05:46:35 momjian Exp $
2+
dnl $Header: /cvsroot/pgsql/configure.in,v 1.191 2002/07/17 02:54:01 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -696,7 +696,7 @@ AC_CHECK_LIB(BSD, main)
696696
AC_CHECK_LIB(gen, main)
697697
AC_CHECK_LIB(PW, main)
698698
AC_CHECK_LIB(resolv, main)
699-
AC_CHECK_LIB(getopt, main)
699+
AC_SEARCH_LIBS(getopt_long, [getopt])
700700
# QNX:
701701
AC_CHECK_LIB([[unix]], main)
702702
AC_SEARCH_LIBS(crypt, crypt)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp